-
-
Notifications
You must be signed in to change notification settings - Fork 621
Allow new access token class inheriting from AccessToken class to get access token instance of the its own class when refreshed #305
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
Conversation
46e67f5 to
96daaf5
Compare
|
@styd If you get a chance please rebase this on master. We've improved many things in the codebase, and the CI build is now functional, and passing. |
…s token instance of the its own class when refreshed
d21ab69 to
9f08416
Compare
|
@pboling I've rebased it on master. Please review. Thanks. |
meganemura
left a comment
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.
Great update. I will close #425.
This branch needs to update some points.
lib/oauth2/access_token.rb
Outdated
| # @return [AccessToken] a new AccessToken | ||
| # @note options should be carried over to the new AccessToken | ||
| def refresh(params = {}) | ||
| def refresh!(params = {}, access_token_opts = {}, access_token_class = self.class) |
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 must be refresh, not refresh! since it was renamed.
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.
Got it!
spec/oauth2/access_token_spec.rb
Outdated
| :param_name => 'o_param') | ||
| end | ||
| let(:new_access) do | ||
| NewAccessToken = Class.new(AccessToken) |
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 will be notified by RuboCop.
Use described_class instead of AccessToken.
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.
meganemura
left a comment
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.
🎉
pboling
left a comment
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
When a new class inherits from the AccessToken class, its refresh! method should return an instance of its own class, not of AccessToken's.