Class: Fog::Compute::Packet::Ip
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Packet::Ip
- Defined in:
- lib/fog/compute/packet/models/ip.rb
Overview
Ip Model
Instance Method Summary collapse
- #assign(device_id) ⇒ Object
-
#initialize(attributes = {}) ⇒ Ip
constructor
A new instance of Ip.
- #save ⇒ Object
- #unassign ⇒ Object
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 = {} [:address] = address [:manageable] = manageable response = service.assign_ip(device_id, ) true if response.status == 201 end |
#save ⇒ Object
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 = {} [:quantity] = quantity [:type] = type [:facility] = facility response = service.reserve_ip(project_id, ) merge_attributes(response.body) end |
#unassign ⇒ Object
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 |