Class: Fog::Compute::ProfitBricks::Lans

Inherits:
Fog::Collection
  • Object
show all
Includes:
Helpers::ProfitBricks::DataHelper
Defined in:
lib/fog/profitbricks/models/compute/lans.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
19
20
21
# File 'lib/fog/profitbricks/models/compute/lans.rb', line 11

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

  lans = result.body['items'].each do |lan|
    lan['datacenter_id'] = datacenter_id
  end

  result.body['items'] = lans

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

#get(datacenter_id, lan_id) ⇒ Object



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

def get(datacenter_id, lan_id)
  lan = service.get_lan(datacenter_id, lan_id).body

  lan['datacenter_id'] = datacenter_id

  new(flatten(lan))
end