Class: Snapshot::Token
- Inherits:
-
Object
- Object
- Snapshot::Token
- Includes:
- ActiveModel::Serialization
- Defined in:
- lib/snapshot/token.rb
Instance Attribute Summary collapse
-
#expires_in ⇒ Object
Returns the value of attribute expires_in.
-
#token ⇒ Object
Returns the value of attribute token.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#expires_in ⇒ Object
Returns the value of attribute expires_in.
3 4 5 |
# File 'lib/snapshot/token.rb', line 3 def expires_in @expires_in end |
#token ⇒ Object
Returns the value of attribute token.
3 4 5 |
# File 'lib/snapshot/token.rb', line 3 def token @token end |
Class Method Details
.create ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/snapshot/token.rb', line 5 def self.create result = Snapshot.connection.post('/token') info = JSON.parse(result) self.new.tap do |t| t.expires_in = info['expires_in'] t.token = info['token'] end end |
Instance Method Details
#attributes ⇒ Object
23 24 25 |
# File 'lib/snapshot/token.rb', line 23 def attributes { expires_in: expires_in, token: token } end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/snapshot/token.rb', line 15 def to_s token end |