Class: Doorkeeper::OAuth::RefreshTokenRequest
- Inherits:
-
Object
- Object
- Doorkeeper::OAuth::RefreshTokenRequest
- Includes:
- Validations
- Defined in:
- lib/doorkeeper/oauth/refresh_token_request.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#client ⇒ Object
Returns the value of attribute client.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
-
#server ⇒ Object
Returns the value of attribute server.
Attributes included from Validations
Instance Method Summary collapse
- #authorize ⇒ Object
-
#initialize(server, refresh_token, client) ⇒ RefreshTokenRequest
constructor
TODO: refresh token can receive scope as parameters.
- #valid? ⇒ Boolean
Methods included from Validations
Constructor Details
#initialize(server, refresh_token, client) ⇒ RefreshTokenRequest
TODO: refresh token can receive scope as parameters
12 13 14 15 16 |
# File 'lib/doorkeeper/oauth/refresh_token_request.rb', line 12 def initialize(server, refresh_token, client) @server = server @refresh_token = refresh_token @client = client end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
9 10 11 |
# File 'lib/doorkeeper/oauth/refresh_token_request.rb', line 9 def access_token @access_token end |
#client ⇒ Object
Returns the value of attribute client.
9 10 11 |
# File 'lib/doorkeeper/oauth/refresh_token_request.rb', line 9 def client @client end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
9 10 11 |
# File 'lib/doorkeeper/oauth/refresh_token_request.rb', line 9 def refresh_token @refresh_token end |
#server ⇒ Object
Returns the value of attribute server.
9 10 11 |
# File 'lib/doorkeeper/oauth/refresh_token_request.rb', line 9 def server @server end |
Instance Method Details
#authorize ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/doorkeeper/oauth/refresh_token_request.rb', line 18 def validate @response = if valid? revoke_and_create_access_token OAuth::TokenResponse.new access_token else OAuth::ErrorResponse.from_request(self) end end |
#valid? ⇒ Boolean
28 29 30 |
# File 'lib/doorkeeper/oauth/refresh_token_request.rb', line 28 def valid? self.error.nil? end |