Class: OpenStack::Keystone::Public::Auth::Token
- Inherits:
-
Base
- Object
- ActiveResource::Base
- Base
- OpenStack::Keystone::Public::Auth::Token
- Defined in:
- lib/open_stack/keystone/public/auth.rb
Overview
Authentication Token
Instance Method Summary collapse
-
#expired? ⇒ Boolean
True if the token is expired.
-
#expires_at ⇒ Object
Expiration date and time for this token.
-
#initialize(attributes = {}, persisted = false) ⇒ Token
constructor
:notnew:.
Methods inherited from Base
Methods inherited from ActiveResource::Base
Constructor Details
#initialize(attributes = {}, persisted = false) ⇒ Token
:notnew:
136 137 138 139 140 141 142 143 144 |
# File 'lib/open_stack/keystone/public/auth.rb', line 136 def initialize(attributes = {}, persisted = false) # :notnew: attributes = attributes.with_indifferent_access new_attributes = { :id => attributes[:id], :expires => attributes[:expires] } super(new_attributes, persisted) end |
Instance Method Details
#expired? ⇒ Boolean
True if the token is expired
152 153 154 |
# File 'lib/open_stack/keystone/public/auth.rb', line 152 def expired? DateTime.strptime(attributes[:expires], OpenStack::DATETIME_FORMAT) < DateTime.now.utc end |
#expires_at ⇒ Object
Expiration date and time for this token
147 148 149 |
# File 'lib/open_stack/keystone/public/auth.rb', line 147 def expires_at DateTime.strptime(attributes[:expires], OpenStack::DATETIME_FORMAT) end |