class Zara4::API::Communication::AccessToken::ReissuableAccessToken

Attributes

scopes[RW]

Public Class Methods

new(client_id, client_secret, access_token, expires_at, scopes) click to toggle source

Constructor

# File lib/zara4/api/communication/access_token/reissuable_access_token.rb, line 10
def initialize(client_id, client_secret, access_token, expires_at, scopes)
  super(client_id, client_secret, access_token, expires_at)
  @scopes = scopes
end

Public Instance Methods

refresh() click to toggle source

Refresh this ReissuableAccessToken

# File lib/zara4/api/communication/access_token/reissuable_access_token.rb, line 19
def refresh
  grant = ClientCredentialsGrantRequest.new(@client_id, @client_secret, @scopes)
  tokens = grant.get_tokens()
  
  @access_token = tokens['access_token']
  @expires_at   = tokens['expires_in']
end