Class: FlexmlsApi::Authentication::OAuth2Impl::GrantTypeRefresh

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

Constant Summary

Constants inherited from GrantTypeBase

FlexmlsApi::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.



8
9
10
11
# File 'lib/flexmls_api/authentication/oauth2_impl/grant_type_refresh.rb', line 8

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

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



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

def params
  @params
end

Instance Method Details

#authenticateObject



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

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