Class: Stacktor::Identity::V2::Token
Instance Attribute Summary
#client, #data
Instance Method Summary
collapse
#[], #[]=, #handle_data, #headers, #initialize, #method_missing
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Stacktor::Core::Resource
Instance Method Details
#endpoint_url_for_service_type(type, level = :public) ⇒ Object
24
25
26
27
28
|
# File 'lib/stacktor/identity/v2/token.rb', line 24
def endpoint_url_for_service_type(type, level=:public)
svc = self.data['access']['serviceCatalog'].select{|s| s['type'] == type}.first
return nil if svc.nil?
return svc['endpoints'][0]["#{level.to_s}URL"]
end
|
#expired? ⇒ Boolean
16
17
18
|
# File 'lib/stacktor/identity/v2/token.rb', line 16
def expired?
self.expires_at < Time.now
end
|
#expires_at ⇒ Object
12
13
14
15
|
# File 'lib/stacktor/identity/v2/token.rb', line 12
def expires_at
str = self.data["access"]["token"]["expires"]
Time.parse(str)
end
|
#id ⇒ Object
9
10
11
|
# File 'lib/stacktor/identity/v2/token.rb', line 9
def id
self.data["access"]["token"]["id"]
end
|
#valid? ⇒ Boolean
20
21
22
|
# File 'lib/stacktor/identity/v2/token.rb', line 20
def valid?
!self.expired?
end
|