Class: Fog::Compute::ProfitBricks::IpBlock

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

Instance Method Summary collapse

Methods included from Helpers::ProfitBricks::DataHelper

#flatten

Methods inherited from Models::ProfitBricks::Base

#request_status, #wait_for

Constructor Details

#initialize(attributes = {}) ⇒ IpBlock

Returns a new instance of IpBlock.


27
28
29
# File 'lib/fog/profitbricks/models/compute/ip_block.rb', line 27

def initialize(attributes = {})
  super
end

Instance Method Details

#deleteObject


44
45
46
47
48
# File 'lib/fog/profitbricks/models/compute/ip_block.rb', line 44

def delete
  requires :id
  service.delete_ip_block(id)
  true
end

#failed?Boolean

Returns:

  • (Boolean)

54
55
56
# File 'lib/fog/profitbricks/models/compute/ip_block.rb', line 54

def failed?
  state == 'ERROR'
end

#ready?Boolean

Returns:

  • (Boolean)

50
51
52
# File 'lib/fog/profitbricks/models/compute/ip_block.rb', line 50

def ready?
  state == 'AVAILABLE'
end

#saveObject


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

def save
  requires :location, :size

  properties = {}
  properties[:location] = location if location
  properties[:size]     = size if size
  properties[:name]     = name if name

  data = service.create_ip_block(properties)
  merge_attributes(flatten(data.body))
  true
end