Class: SmilyCli::OAuth::Token

Inherits:
Struct
  • Object
show all
Defined in:
lib/smily_cli/oauth.rb

Overview

Structured token response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token

Returns:

  • (Object)

    the current value of access_token



18
19
20
# File 'lib/smily_cli/oauth.rb', line 18

def access_token
  @access_token
end

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



18
19
20
# File 'lib/smily_cli/oauth.rb', line 18

def created_at
  @created_at
end

#expires_inObject

Returns the value of attribute expires_in

Returns:

  • (Object)

    the current value of expires_in



18
19
20
# File 'lib/smily_cli/oauth.rb', line 18

def expires_in
  @expires_in
end

#rawObject

Returns the value of attribute raw

Returns:

  • (Object)

    the current value of raw



18
19
20
# File 'lib/smily_cli/oauth.rb', line 18

def raw
  @raw
end

#refresh_tokenObject

Returns the value of attribute refresh_token

Returns:

  • (Object)

    the current value of refresh_token



18
19
20
# File 'lib/smily_cli/oauth.rb', line 18

def refresh_token
  @refresh_token
end

#scopeObject

Returns the value of attribute scope

Returns:

  • (Object)

    the current value of scope



18
19
20
# File 'lib/smily_cli/oauth.rb', line 18

def scope
  @scope
end

#token_typeObject

Returns the value of attribute token_type

Returns:

  • (Object)

    the current value of token_type



18
19
20
# File 'lib/smily_cli/oauth.rb', line 18

def token_type
  @token_type
end

Instance Method Details

#expires_atTime?

Returns absolute expiry, when derivable.

Returns:

  • (Time, nil)

    absolute expiry, when derivable



23
24
25
26
27
# File 'lib/smily_cli/oauth.rb', line 23

def expires_at
  return nil unless created_at && expires_in

  Time.at(created_at.to_i + expires_in.to_i)
end