Class: OAuthToken
- Inherits:
-
Struct
- Object
- Struct
- OAuthToken
- Defined in:
- lib/vhx/oauth_token.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#expires ⇒ Object
Returns the value of attribute expires.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#expires_in ⇒ Object
Returns the value of attribute expires_in.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
-
#refreshed ⇒ Object
Returns the value of attribute refreshed.
Instance Method Summary collapse
-
#initialize(params = {}, refreshed = false) ⇒ OAuthToken
constructor
A new instance of OAuthToken.
Constructor Details
#initialize(params = {}, refreshed = false) ⇒ OAuthToken
Returns a new instance of OAuthToken.
2 3 4 5 6 7 8 9 10 |
# File 'lib/vhx/oauth_token.rb', line 2 def initialize(params = {}, refreshed = false) params = Hash[params.map{ |k, v| [k.to_sym, v] }] self.access_token = params[:access_token] self.refresh_token = params[:refresh_token] self.expires_at = params[:expires_at] || Time.now.to_i + params[:expires_in].to_i self.expires_in = params[:expires_in] self.expires = (params[:expires_at] || params[:expires_in]) ? true : false self.refreshed = refreshed end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token
1 2 3 |
# File 'lib/vhx/oauth_token.rb', line 1 def access_token @access_token end |
#expires ⇒ Object
Returns the value of attribute expires
1 2 3 |
# File 'lib/vhx/oauth_token.rb', line 1 def expires @expires end |
#expires_at ⇒ Object
Returns the value of attribute expires_at
1 2 3 |
# File 'lib/vhx/oauth_token.rb', line 1 def expires_at @expires_at end |
#expires_in ⇒ Object
Returns the value of attribute expires_in
1 2 3 |
# File 'lib/vhx/oauth_token.rb', line 1 def expires_in @expires_in end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token
1 2 3 |
# File 'lib/vhx/oauth_token.rb', line 1 def refresh_token @refresh_token end |
#refreshed ⇒ Object
Returns the value of attribute refreshed
1 2 3 |
# File 'lib/vhx/oauth_token.rb', line 1 def refreshed @refreshed end |