Class: LinkedIn::AccessToken
- Inherits:
-
Object
- Object
- LinkedIn::AccessToken
- Defined in:
- lib/linked_in/access_token.rb
Overview
A simple data object to contain the token string and expiration data.
Instance Attribute Summary collapse
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#expires_in ⇒ Object
Returns the value of attribute expires_in.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(token = nil, expires_in = nil, expires_at = nil) ⇒ AccessToken
constructor
Creates a simple data wrapper for an access token.
Constructor Details
#initialize(token = nil, expires_in = nil, expires_at = nil) ⇒ AccessToken
Creates a simple data wrapper for an access token.
LinkedIn returns only an ‘expires_in` value. This calculates and sets and `expires_at` field for convenience.
14 15 16 17 18 19 20 21 22 |
# File 'lib/linked_in/access_token.rb', line 14 def initialize(token=nil, expires_in=nil, expires_at=nil) self.token = token self.expires_in = expires_in if expires_at.nil? and not self.expires_in.nil? self.expires_at = Time.now + expires_in else self.expires_at = expires_at end end |
Instance Attribute Details
#expires_at ⇒ Object
Returns the value of attribute expires_at.
4 5 6 |
# File 'lib/linked_in/access_token.rb', line 4 def expires_at @expires_at end |
#expires_in ⇒ Object
Returns the value of attribute expires_in.
4 5 6 |
# File 'lib/linked_in/access_token.rb', line 4 def expires_in @expires_in end |
#token ⇒ Object
Returns the value of attribute token.
4 5 6 |
# File 'lib/linked_in/access_token.rb', line 4 def token @token end |