Class: Doorkeeper::OAuth::RefreshTokenRequest

Inherits:
Object
  • Object
show all
Includes:
Validations
Defined in:
lib/doorkeeper/oauth/refresh_token_request.rb

Instance Attribute Summary collapse

Attributes included from Validations

#error

Instance Method Summary collapse

Methods included from Validations

#validate

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_tokenObject

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

#clientObject

Returns the value of attribute client.



9
10
11
# File 'lib/doorkeeper/oauth/refresh_token_request.rb', line 9

def client
  @client
end

#refresh_tokenObject

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

#serverObject

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

#authorizeObject



18
19
20
21
22
23
24
25
26
# File 'lib/doorkeeper/oauth/refresh_token_request.rb', line 18

def authorize
  validate
  @response = if valid?
    revoke_and_create_access_token
    OAuth::TokenResponse.new access_token
  else
    OAuth::ErrorResponse.from_request(self)
  end
end

#valid?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/doorkeeper/oauth/refresh_token_request.rb', line 28

def valid?
  self.error.nil?
end