Class: HP::Cloud::AddressHelper
- Inherits:
-
BaseHelper
- Object
- BaseHelper
- HP::Cloud::AddressHelper
- Defined in:
- lib/hpcloud/address_helper.rb
Instance Attribute Summary collapse
-
#fixed_ip ⇒ Object
Returns the value of attribute fixed_ip.
-
#id ⇒ Object
Returns the value of attribute id.
-
#instance_id ⇒ Object
Returns the value of attribute instance_id.
-
#ip ⇒ Object
Returns the value of attribute ip.
Attributes inherited from BaseHelper
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(connection, foggy = nil) ⇒ AddressHelper
constructor
A new instance of AddressHelper.
- #name=(value) ⇒ Object
- #save ⇒ Object
Methods inherited from BaseHelper
#destroy, #is_valid?, #set_error, #to_hash
Constructor Details
#initialize(connection, foggy = nil) ⇒ AddressHelper
Returns a new instance of AddressHelper.
31 32 33 34 35 36 37 38 |
# File 'lib/hpcloud/address_helper.rb', line 31 def initialize(connection, foggy = nil) super(connection, foggy) return if foggy.nil? @id = foggy.id @ip = foggy.ip @fixed_ip = foggy.fixed_ip @instance_id = foggy.instance_id end |
Instance Attribute Details
#fixed_ip ⇒ Object
Returns the value of attribute fixed_ip.
25 26 27 |
# File 'lib/hpcloud/address_helper.rb', line 25 def fixed_ip @fixed_ip end |
#id ⇒ Object
Returns the value of attribute id.
25 26 27 |
# File 'lib/hpcloud/address_helper.rb', line 25 def id @id end |
#instance_id ⇒ Object
Returns the value of attribute instance_id.
25 26 27 |
# File 'lib/hpcloud/address_helper.rb', line 25 def instance_id @instance_id end |
#ip ⇒ Object
Returns the value of attribute ip.
25 26 27 |
# File 'lib/hpcloud/address_helper.rb', line 25 def ip @ip end |
Class Method Details
.get_keys ⇒ Object
27 28 29 |
# File 'lib/hpcloud/address_helper.rb', line 27 def self.get_keys() return [ "id", "ip", "fixed_ip", "instance_id" ] end |
Instance Method Details
#name=(value) ⇒ Object
58 59 60 |
# File 'lib/hpcloud/address_helper.rb', line 58 def name=(value) ip = value end |
#save ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/hpcloud/address_helper.rb', line 40 def save return false if is_valid? == false if @fog.nil? address = @connection.compute.addresses.create if address.nil? set_error("Error creating ip address") return false end @id = address.id @ip = address.ip @fixed_ip = address.fixed_ip @fog = address return true else raise "Update not implemented" end end |