Class: GandiV5::Domain::AutoRenew
- Inherits:
-
Object
- Object
- GandiV5::Domain::AutoRenew
- Includes:
- GandiV5::Data
- Defined in:
- lib/gandi_v5/domain/auto_renew.rb
Overview
Automatic renewal information for a domain.
Instance Attribute Summary collapse
- #dates ⇒ nil, Array<Time> readonly
-
#domain ⇒ Object
Returns the value of attribute domain.
- #duration ⇒ nil, Integer readonly
- #enabled ⇒ nil, Boolean readonly
- #org_id ⇒ nil, String readonly
Instance Method Summary collapse
-
#disable ⇒ String
Disable auto renewal for the associated domain.
-
#enable(duration: self.duration || 1, org_id: self.org_id) ⇒ String
Disable auto renewal for the associated domain.
Methods included from GandiV5::Data
#from_gandi, included, #initialize, #to_gandi, #to_h, #values_at
Instance Attribute Details
#dates ⇒ nil, Array<Time> (readonly)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/gandi_v5/domain/auto_renew.rb', line 14 class AutoRenew include GandiV5::Data attr_accessor :domain members :duration, :enabled, :org_id member :dates, converter: GandiV5::Data::Converter::Time, array: true # Disable auto renewal for the associated domain. # @return [String] The confirmation message from Gandi. # @raise [GandiV5::Error::GandiError] if Gandi returns an error. def disable body = { enabled: false }.to_json _response, data = GandiV5.patch url, body self.enabled = false data['message'] end # Disable auto renewal for the associated domain. # @param duration [Integer, #to_s] how long to renew for. # @param org_id [String, #to_s] UUID of the organisation that should pay. # @return [String] The confirmation message from Gandi. # @raise [ArgumentError] if duration is invalid (not 1 to 9 (inclusive)). # @raise [ArgumentError] if org_id is not passed and not set for this domain. # @raise [GandiV5::Error::GandiError] if Gandi returns an error. def enable(duration: self.duration || 1, org_id: self.org_id) fail ArgumentError, 'duration can not be less than 1' if duration < 1 fail ArgumentError, 'duration can not be more than 9' if duration > 9 fail ArgumentError, 'org_id is required' if org_id.nil? body = { enabled: true, duration: duration, org_id: org_id }.to_json _response, data = GandiV5.patch url, body self.enabled = true self.duration = duration self.org_id = org_id data['message'] end private def url "#{BASE}domain/domains/#{CGI.escape domain.fqdn}/autorenew" end end |
#domain ⇒ Object
Returns the value of attribute domain.
17 18 19 |
# File 'lib/gandi_v5/domain/auto_renew.rb', line 17 def domain @domain end |
#duration ⇒ nil, Integer (readonly)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/gandi_v5/domain/auto_renew.rb', line 14 class AutoRenew include GandiV5::Data attr_accessor :domain members :duration, :enabled, :org_id member :dates, converter: GandiV5::Data::Converter::Time, array: true # Disable auto renewal for the associated domain. # @return [String] The confirmation message from Gandi. # @raise [GandiV5::Error::GandiError] if Gandi returns an error. def disable body = { enabled: false }.to_json _response, data = GandiV5.patch url, body self.enabled = false data['message'] end # Disable auto renewal for the associated domain. # @param duration [Integer, #to_s] how long to renew for. # @param org_id [String, #to_s] UUID of the organisation that should pay. # @return [String] The confirmation message from Gandi. # @raise [ArgumentError] if duration is invalid (not 1 to 9 (inclusive)). # @raise [ArgumentError] if org_id is not passed and not set for this domain. # @raise [GandiV5::Error::GandiError] if Gandi returns an error. def enable(duration: self.duration || 1, org_id: self.org_id) fail ArgumentError, 'duration can not be less than 1' if duration < 1 fail ArgumentError, 'duration can not be more than 9' if duration > 9 fail ArgumentError, 'org_id is required' if org_id.nil? body = { enabled: true, duration: duration, org_id: org_id }.to_json _response, data = GandiV5.patch url, body self.enabled = true self.duration = duration self.org_id = org_id data['message'] end private def url "#{BASE}domain/domains/#{CGI.escape domain.fqdn}/autorenew" end end |
#enabled ⇒ nil, Boolean (readonly)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/gandi_v5/domain/auto_renew.rb', line 14 class AutoRenew include GandiV5::Data attr_accessor :domain members :duration, :enabled, :org_id member :dates, converter: GandiV5::Data::Converter::Time, array: true # Disable auto renewal for the associated domain. # @return [String] The confirmation message from Gandi. # @raise [GandiV5::Error::GandiError] if Gandi returns an error. def disable body = { enabled: false }.to_json _response, data = GandiV5.patch url, body self.enabled = false data['message'] end # Disable auto renewal for the associated domain. # @param duration [Integer, #to_s] how long to renew for. # @param org_id [String, #to_s] UUID of the organisation that should pay. # @return [String] The confirmation message from Gandi. # @raise [ArgumentError] if duration is invalid (not 1 to 9 (inclusive)). # @raise [ArgumentError] if org_id is not passed and not set for this domain. # @raise [GandiV5::Error::GandiError] if Gandi returns an error. def enable(duration: self.duration || 1, org_id: self.org_id) fail ArgumentError, 'duration can not be less than 1' if duration < 1 fail ArgumentError, 'duration can not be more than 9' if duration > 9 fail ArgumentError, 'org_id is required' if org_id.nil? body = { enabled: true, duration: duration, org_id: org_id }.to_json _response, data = GandiV5.patch url, body self.enabled = true self.duration = duration self.org_id = org_id data['message'] end private def url "#{BASE}domain/domains/#{CGI.escape domain.fqdn}/autorenew" end end |
#org_id ⇒ nil, String (readonly)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/gandi_v5/domain/auto_renew.rb', line 14 class AutoRenew include GandiV5::Data attr_accessor :domain members :duration, :enabled, :org_id member :dates, converter: GandiV5::Data::Converter::Time, array: true # Disable auto renewal for the associated domain. # @return [String] The confirmation message from Gandi. # @raise [GandiV5::Error::GandiError] if Gandi returns an error. def disable body = { enabled: false }.to_json _response, data = GandiV5.patch url, body self.enabled = false data['message'] end # Disable auto renewal for the associated domain. # @param duration [Integer, #to_s] how long to renew for. # @param org_id [String, #to_s] UUID of the organisation that should pay. # @return [String] The confirmation message from Gandi. # @raise [ArgumentError] if duration is invalid (not 1 to 9 (inclusive)). # @raise [ArgumentError] if org_id is not passed and not set for this domain. # @raise [GandiV5::Error::GandiError] if Gandi returns an error. def enable(duration: self.duration || 1, org_id: self.org_id) fail ArgumentError, 'duration can not be less than 1' if duration < 1 fail ArgumentError, 'duration can not be more than 9' if duration > 9 fail ArgumentError, 'org_id is required' if org_id.nil? body = { enabled: true, duration: duration, org_id: org_id }.to_json _response, data = GandiV5.patch url, body self.enabled = true self.duration = duration self.org_id = org_id data['message'] end private def url "#{BASE}domain/domains/#{CGI.escape domain.fqdn}/autorenew" end end |
Instance Method Details
#disable ⇒ String
Disable auto renewal for the associated domain.
25 26 27 28 29 30 |
# File 'lib/gandi_v5/domain/auto_renew.rb', line 25 def disable body = { enabled: false }.to_json _response, data = GandiV5.patch url, body self.enabled = false data['message'] end |
#enable(duration: self.duration || 1, org_id: self.org_id) ⇒ String
Disable auto renewal for the associated domain.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/gandi_v5/domain/auto_renew.rb', line 39 def enable(duration: self.duration || 1, org_id: self.org_id) fail ArgumentError, 'duration can not be less than 1' if duration < 1 fail ArgumentError, 'duration can not be more than 9' if duration > 9 fail ArgumentError, 'org_id is required' if org_id.nil? body = { enabled: true, duration: duration, org_id: org_id }.to_json _response, data = GandiV5.patch url, body self.enabled = true self.duration = duration self.org_id = org_id data['message'] end |