Class: Fog::Compute::ProfitBricks::Users

Inherits:
Fog::Collection
  • Object
show all
Includes:
Helpers::ProfitBricks::DataHelper
Defined in:
lib/fog/profitbricks/models/compute/users.rb

Instance Method Summary collapse

Methods included from Helpers::ProfitBricks::DataHelper

#flatten

Instance Method Details

#add_group_user(group_id, user_id) ⇒ Object


30
31
32
33
34
35
# File 'lib/fog/profitbricks/models/compute/users.rb', line 30

def add_group_user(group_id, user_id)
  response = service.add_user_to_group(group_id, user_id)
  user = response.body

  new(flatten(user))
end

#allObject


11
12
13
14
15
# File 'lib/fog/profitbricks/models/compute/users.rb', line 11

def all
  response = service.get_all_users

  load(response.body['items'].each { |user| flatten(user) })
end

#get(user_id) ⇒ Object


17
18
19
20
21
22
# File 'lib/fog/profitbricks/models/compute/users.rb', line 17

def get(user_id)
  response = service.get_user(user_id)
  share = response.body

  new(flatten(share))
end

#list_group_users(group_id) ⇒ Object


24
25
26
27
28
# File 'lib/fog/profitbricks/models/compute/users.rb', line 24

def list_group_users(group_id)
  response = service.get_group_users(group_id)

  load(response.body['items'].each { |user| flatten(user) })
end

#remove_group_user(group_id, user_id) ⇒ Object


37
38
39
40
41
# File 'lib/fog/profitbricks/models/compute/users.rb', line 37

def remove_group_user(group_id, user_id)
  service.remove_user_from_group(group_id, user_id)

  true
end