Class: Fog::Compute::ProfitBricks::Resources

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

Instance Method Summary collapse

Methods included from Helpers::ProfitBricks::DataHelper

#flatten

Instance Method Details

#allObject


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

def all
  response = service.get_all_resources

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

#get_by_type(resource_type) ⇒ Object


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

def get_by_type(resource_type)
  response = service.get_resources_by_type(resource_type)

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

#get_resource_by_type(resource_type, resource_id) ⇒ Object


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

def get_resource_by_type(resource_type, resource_id)
  response = service.get_resource_by_type(resource_type, resource_id)
  share = response.body

  new(flatten(share))
end