Class: OpenstackBridge::Authentication

Inherits:
Struct
  • Object
show all
Defined in:
lib/openstack_bridge/authentication.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAuthentication

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

#hostObject

Returns the value of attribute host

Returns:

  • (Object)

    the current value of host



2
3
4
# File 'lib/openstack_bridge/authentication.rb', line 2

def host
  @host
end

#passwordObject

Returns the value of attribute password

Returns:

  • (Object)

    the current value of password



2
3
4
# File 'lib/openstack_bridge/authentication.rb', line 2

def password
  @password
end

#responseObject

Returns the value of attribute response.



3
4
5
# File 'lib/openstack_bridge/authentication.rb', line 3

def response
  @response
end

#tenantObject

Returns the value of attribute tenant

Returns:

  • (Object)

    the current value of tenant



2
3
4
# File 'lib/openstack_bridge/authentication.rb', line 2

def tenant
  @tenant
end

#usernameObject

Returns the value of attribute username

Returns:

  • (Object)

    the current value of username



2
3
4
# File 'lib/openstack_bridge/authentication.rb', line 2

def username
  @username
end

Instance Method Details

#tokenObject



14
15
16
# File 'lib/openstack_bridge/authentication.rb', line 14

def token
  self.response['access']['token']['id']
end