Class: OVH::Provisioner::APIObject::IP
- Inherits:
-
OVH::Provisioner::APIObject
- Object
- OVH::Provisioner::APIObject
- OVH::Provisioner::APIObject::IP
- Defined in:
- lib/ovh/provisioner/api_object/ip.rb
Overview
Represent an OVH IP
Instance Attribute Summary collapse
-
#can_be_terminated ⇒ Object
readonly
Returns the value of attribute can_be_terminated.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#organisation_id ⇒ Object
readonly
Returns the value of attribute organisation_id.
-
#reverse ⇒ Object
readonly
Returns the value of attribute reverse.
-
#routed_to ⇒ Object
readonly
Returns the value of attribute routed_to.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#can_be_terminated ⇒ Object (readonly)
Returns the value of attribute can_be_terminated.
25 26 27 |
# File 'lib/ovh/provisioner/api_object/ip.rb', line 25 def can_be_terminated @can_be_terminated end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
24 25 26 |
# File 'lib/ovh/provisioner/api_object/ip.rb', line 24 def country @country end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
26 27 28 |
# File 'lib/ovh/provisioner/api_object/ip.rb', line 26 def description @description end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
28 29 30 |
# File 'lib/ovh/provisioner/api_object/ip.rb', line 28 def kind @kind end |
#organisation_id ⇒ Object (readonly)
Returns the value of attribute organisation_id.
24 25 26 |
# File 'lib/ovh/provisioner/api_object/ip.rb', line 24 def organisation_id @organisation_id end |
#reverse ⇒ Object (readonly)
Returns the value of attribute reverse.
27 28 29 |
# File 'lib/ovh/provisioner/api_object/ip.rb', line 27 def reverse @reverse end |
#routed_to ⇒ Object (readonly)
Returns the value of attribute routed_to.
25 26 27 |
# File 'lib/ovh/provisioner/api_object/ip.rb', line 25 def routed_to @routed_to end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
25 26 27 |
# File 'lib/ovh/provisioner/api_object/ip.rb', line 25 def type @type end |
Instance Method Details
#add_reverse(reverse) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ovh/provisioner/api_object/ip.rb', line 30 def add_reverse(reverse) body = { 'ipReverse' => id.split('/').first, 'reverse' => reverse } response = post('reverse', body) unless response['reverse'].nil? response = "#{id} - reverse #{reverse} has been added" @reverse = reverse['reverse'] end response end |
#rm_reverse ⇒ Object
43 44 45 46 47 |
# File 'lib/ovh/provisioner/api_object/ip.rb', line 43 def rm_reverse response = delete("reverse/#{id.split('/').first}") response ||= "#{id} - reverse #{reverse} has been removed" response end |
#to_s ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/ovh/provisioner/api_object/ip.rb', line 49 def to_s base = "#{id} - #{routed_to}(#{type}) - #{endable}" %i[organisation_id country reverse description].each do |key| value = send(key) base += "\n #{key}: #{value}" unless value.nil? end base end |