Class: SparkApi::Authentication::OAuth2Impl::GrantTypeRefresh

Inherits:
GrantTypeBase
  • Object
show all
Defined in:
lib/spark_api/authentication/oauth2_impl/grant_type_refresh.rb

Constant Summary

Constants inherited from GrantTypeBase

SparkApi::Authentication::OAuth2Impl::GrantTypeBase::GRANT_TYPES

Instance Attribute Summary collapse

Attributes inherited from GrantTypeBase

#client, #provider, #session

Instance Method Summary collapse

Methods inherited from GrantTypeBase

create, #refresh

Constructor Details

#initialize(client, provider, session) ⇒ GrantTypeRefresh

Returns a new instance of GrantTypeRefresh.



7
8
9
10
# File 'lib/spark_api/authentication/oauth2_impl/grant_type_refresh.rb', line 7

def initialize(client, provider, session)
  super(client, provider, session)
  @params = {}
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



6
7
8
# File 'lib/spark_api/authentication/oauth2_impl/grant_type_refresh.rb', line 6

def params
  @params
end

Instance Method Details

#authenticateObject



12
13
14
15
16
17
18
19
# File 'lib/spark_api/authentication/oauth2_impl/grant_type_refresh.rb', line 12

def authenticate
  new_session = nil
  unless @session.refresh_token.nil?
    SparkApi.logger.debug { "[oauth2] Refreshing authentication to #{provider.access_uri} using [#{session.refresh_token}]" }
    new_session = create_session(token_params)
  end
  new_session 
end