Class: OpenstackBridge::Authentication
- Inherits:
-
Struct
- Object
- Struct
- OpenstackBridge::Authentication
- Defined in:
- lib/openstack_bridge/authentication.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#password ⇒ Object
Returns the value of attribute password.
-
#response ⇒ Object
Returns the value of attribute response.
-
#tenant ⇒ Object
Returns the value of attribute tenant.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize ⇒ Authentication
constructor
A new instance of Authentication.
- #token ⇒ Object
Constructor Details
#initialize ⇒ Authentication
Returns a new instance of Authentication.
5 6 7 8 9 10 11 12 |
# File 'lib/openstack_bridge/authentication.rb', line 5 def initialize(*) super request = HTTPI::Request.new request.url = host request.body = auth_hash.to_json request.headers['Content-Type'] = 'application/json' self.response = JSON.parse(HTTPI.post(request, :curb).body) end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host
2 3 4 |
# File 'lib/openstack_bridge/authentication.rb', line 2 def host @host end |
#password ⇒ Object
Returns the value of attribute password
2 3 4 |
# File 'lib/openstack_bridge/authentication.rb', line 2 def password @password end |
#response ⇒ Object
Returns the value of attribute response.
3 4 5 |
# File 'lib/openstack_bridge/authentication.rb', line 3 def response @response end |
#tenant ⇒ Object
Returns the value of attribute tenant
2 3 4 |
# File 'lib/openstack_bridge/authentication.rb', line 2 def tenant @tenant end |
#username ⇒ Object
Returns the value of attribute username
2 3 4 |
# File 'lib/openstack_bridge/authentication.rb', line 2 def username @username end |
Instance Method Details
#token ⇒ Object
14 15 16 |
# File 'lib/openstack_bridge/authentication.rb', line 14 def token self.response['access']['token']['id'] end |