Class: Fog::Compute::ProfitBricks::Shares

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

Instance Method Summary collapse

Methods included from Helpers::ProfitBricks::DataHelper

#flatten

Instance Method Details

#all(group_id) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/fog/profitbricks/models/compute/shares.rb', line 11

def all(group_id)
  result = service.get_all_shares(group_id)

  load(result.body['items'].each do |share|
    share['group_id'] = group_id
    share['resource_id'] = share['id']
    flatten(share)
  end)
end

#get(group_id, resource_id) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/fog/profitbricks/models/compute/shares.rb', line 21

def get(group_id, resource_id)
  response = service.get_share(group_id, resource_id)
  share = response.body

  share['group_id'] = group_id
  share['resource_id'] = resource_id

  new(flatten(share))
end