-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement transparent client pattern and middleware error handling #147
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
7b66dd6
Add response middleware
andrii-balitskyi 5142519
Remove base client
andrii-balitskyi 0d8bce6
Remove request_seam methods in favour of using faraday client directly
andrii-balitskyi 4e71113
Support [] syntax on DeepHashAccessor instances
andrii-balitskyi 95e3604
Adjust action attempt polling to the new logic
andrii-balitskyi 68a4c94
Bump the generator to 1.14.10 to adjust routes
andrii-balitskyi df3d364
Fix tests
andrii-balitskyi 9fdc02b
ci: Generate code
seambot d2918a6
Merge branch 'main' of github.com:seamapi/ruby-next into transparent-…
andrii-balitskyi e5cec05
Remove outdated test
andrii-balitskyi 50b3e35
Remove unnecessary default value
andrii-balitskyi b35a6b1
Use default Faraday::Response::RaiseError when response error is not …
andrii-balitskyi fdde700
Update lib/seam/helpers/action_attempt.rb
andrii-balitskyi 1578c5c
Fix action attempt polling test
andrii-balitskyi 5f777cd
Test that faraday errors are thrown if error response is not seam api…
andrii-balitskyi bbcf4e5
Remove retry logic from ResponseMiddleware, use retry middleware last…
andrii-balitskyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do? Why is it defined as a private function but called here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initialize_routes
is an internal method to set up route clients by making available@client
and@defaults
for them.SingleWorkspace
can access privateinitialize_routes
becauseRoutes
module getsinclude
d in the class. While the method will exist on instances, being private it can only be called internally (inside the class/module methods) and not from outside code, unlike public methods like 'devices', 'access_codes' etc. which can be called by anyone using the instance.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this method needed though vs just putting the code inline? I think I must be missing something obvious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By including it inline, you mean to include the code bellow in the
SingleWorkspace
class?We could have done that, but we decided to generate route-related stuff, so I placed the clients under the Routes module (which is generated) so that we won't need to manually update the SDK when new namespaces are introduced in the Seam API. Let me know if you have a better approach in mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering why not to just do
But now I understand what this is doing. Basically this module only works if mixed into classes that define
@client
and@defaults
. And this method is helping clarify that requirement.I wonder if there is a more standard pattern to handle this.
I think it may be what this question is asking about https://stackoverflow.com/questions/12586051/initializing-instance-variables-in-mixins