Class: SolidusBolt::Users::RefreshAccessTokenService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/solidus_bolt/users/refresh_access_token_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseService

call

Constructor Details

#initialize(session:) ⇒ RefreshAccessTokenService

Returns a new instance of RefreshAccessTokenService.



8
9
10
11
# File 'app/services/solidus_bolt/users/refresh_access_token_service.rb', line 8

def initialize(session:)
  @session = session
  super
end

Instance Attribute Details

#sessionObject (readonly)

Returns the value of attribute session.



6
7
8
# File 'app/services/solidus_bolt/users/refresh_access_token_service.rb', line 6

def session
  @session
end

Instance Method Details

#callObject



13
14
15
16
17
18
# File 'app/services/solidus_bolt/users/refresh_access_token_service.rb', line 13

def call
  return if session[:bolt_access_token].nil?
  return session[:bolt_access_token] if session[:bolt_expiration_time] >= Time.now.utc

  refresh_access_token
end