-
Notifications
You must be signed in to change notification settings - Fork 474
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
Add access_scopes attribute to session object #843
Conversation
45cfb83
to
1da3feb
Compare
|
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.
🎩 LGTM 👍🏼
test/session_test.rb
Outdated
end | ||
|
||
test "session instantiation raises error if bad access scopes are provided" do | ||
assert_raises do |
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 it raise?
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.
Currently it's NoMethodError
because the strip
method doesn't exist on the object passed in object passed in. I can specify NoMethodError
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.
Should we have a custom error for ApiAccess
to throw when an invalid input is passed in?
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 think that because specifying api_access
is opt-in, it's up to the user to specify good input. In this case, building a new session will either:
- parse access_scopes correctly or
- throw some error (automatically an invalid session)
For this test, we know that it's NoMethodError
because strip
doesn't exist on the hash, but really the bad input could throw anything.
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.
Thanks for addressing comments @rezaansyed!
4aab6ef
to
63108ed
Compare
63108ed
to
2b12bf1
Compare
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.
👍🏻
This PR introduces an
access_scopes
attribute to the Session object.Things to focus on
ShopifyAPI::ApiAccess
object? Will a string suffice?Is this level of error handling needed?