Class: OpenStack::Identity::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/openstack/identity/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Connection

Returns a new instance of Connection.



9
10
11
12
13
# File 'lib/openstack/identity/connection.rb', line 9

def initialize(connection)
  @connection = connection
  OpenStack::Authentication.init(@connection)
  extend @connection.auth_path.match(/v3/) ? OpenStack::Identity::ConnectionV3 : OpenStack::Identity::ConnectionV2
end

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



7
8
9
# File 'lib/openstack/identity/connection.rb', line 7

def connection
  @connection
end

Instance Method Details

#delete_user(id) ⇒ Object



22
23
24
25
# File 'lib/openstack/identity/connection.rb', line 22

def delete_user(id)
  @connection.req('DELETE', "/users/#{id}")
  true
end

#list_usersObject Also known as: users



15
16
17
18
19
# File 'lib/openstack/identity/connection.rb', line 15

def list_users
  response = @connection.req('GET', '/users')
  users_hash = JSON.parse(response.body)['users']
  users_hash.map { |res| OpenStack::Identity::User.new(res) }
end