Class: FriendlyShipping::Services::TForceFreight::AccessToken

Inherits:
AccessToken
  • Object
show all
Defined in:
lib/friendly_shipping/services/tforce_freight/access_token.rb

Overview

Represents an access token returned by TForce Freight. The access token can be used to make API requests. Once it expires, a new token must be created.

Instance Attribute Summary collapse

Attributes inherited from AccessToken

#expires_in, #raw_token

Instance Method Summary collapse

Methods inherited from AccessToken

#decoded_token

Constructor Details

#initialize(token_type:, ext_expires_in:, **other_kwargs) ⇒ AccessToken

Returns a new instance of AccessToken.

Parameters:

  • token_type (String)

    the token's type (typically "Bearer")

  • ext_expires_in (Integer)

    the token's extended expiration (only applicable during a service outage)

See Also:



20
21
22
23
24
# File 'lib/friendly_shipping/services/tforce_freight/access_token.rb', line 20

def initialize(token_type:, ext_expires_in:, **other_kwargs)
  @token_type = token_type
  @ext_expires_in = ext_expires_in
  super(**other_kwargs)
end

Instance Attribute Details

#ext_expires_inInteger (readonly)

Returns the token's extended expiration.

Returns:

  • (Integer)

    the token's extended expiration



15
16
17
# File 'lib/friendly_shipping/services/tforce_freight/access_token.rb', line 15

def ext_expires_in
  @ext_expires_in
end

#token_typeString (readonly)

Returns the token's type.

Returns:

  • (String)

    the token's type



12
13
14
# File 'lib/friendly_shipping/services/tforce_freight/access_token.rb', line 12

def token_type
  @token_type
end