Class: Fog::Compute::ProfitBricks::Volumes

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

Instance Method Summary collapse

Methods included from Helpers::ProfitBricks::DataHelper

#flatten

Instance Method Details

#all(datacenter_id) ⇒ Object


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

def all(datacenter_id)
  result = service.get_all_volumes(datacenter_id)

  volumes = result.body['items'].each { |volume| volume['datacenter_id'] = datacenter_id }
  result.body['items'] = volumes

  load(result.body['items'].each { |volume| flatten(volume) })
end

#get(datacenter_id, volume_id) ⇒ Object


20
21
22
23
24
25
26
# File 'lib/fog/profitbricks/models/compute/volumes.rb', line 20

def get(datacenter_id, volume_id)
  response = service.get_volume(datacenter_id, volume_id)
  volume = response.body

  volume['datacenter_id'] = datacenter_id
  new(flatten(volume))
end