Class: Fog::Compute::Packet::Ip

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/packet/models/ip.rb

Overview

Ip Model

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Ip

Returns a new instance of Ip.



26
27
28
# File 'lib/fog/compute/packet/models/ip.rb', line 26

def initialize(attributes = {})
  super
end

Instance Method Details

#assign(device_id) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/fog/compute/packet/models/ip.rb', line 42

def assign(device_id)
  requires :address, :manageable

  options = {}
  options[:address] = address
  options[:manageable] = manageable

  response = service.assign_ip(device_id, options)
  true if response.status == 201
end

#saveObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fog/compute/packet/models/ip.rb', line 30

def save
  requires :project_id, :facility, :type, :quantity

  options = {}
  options[:quantity] = quantity
  options[:type] = type
  options[:facility] = facility
  response = service.reserve_ip(project_id, options)

  merge_attributes(response.body)
end

#unassignObject



53
54
55
56
# File 'lib/fog/compute/packet/models/ip.rb', line 53

def unassign
  response = service.unassign_ip(id)
  true if response.status == 204
end