Class: Fog::Compute::ProfitBricks::Datacenter

Inherits:
Models::ProfitBricks::Base show all
Includes:
Helpers::ProfitBricks::DataHelper
Defined in:
lib/fog/profitbricks/models/compute/datacenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::ProfitBricks::DataHelper

#flatten

Methods inherited from Models::ProfitBricks::Base

#failed?, #ready?, #request_status, #wait_for

Constructor Details

#initialize(attributes = {}) ⇒ Datacenter

Returns a new instance of Datacenter.



28
29
30
# File 'lib/fog/profitbricks/models/compute/datacenter.rb', line 28

def initialize(attributes = {})
  super
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#deleteObject



56
57
58
59
60
# File 'lib/fog/profitbricks/models/compute/datacenter.rb', line 56

def delete
  requires :id
  data = service.delete_datacenter(id)
  true
end

#saveObject



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fog/profitbricks/models/compute/datacenter.rb', line 32

def save
  requires :name, :location

  options = {}
  options[:name]        = name
  options[:location]    = location
  options[:description] = description if description

  data = service.create_datacenter(options)
  merge_attributes(flatten(data.body))
  true
end

#updateObject



45
46
47
48
49
50
51
52
53
54
# File 'lib/fog/profitbricks/models/compute/datacenter.rb', line 45

def update
  requires :id

  options = {}
  options[:name] = name if name
  options[:description] = description if description
  data = service.update_datacenter(id, options)
  merge_attributes(flatten(data.body))
  true
end