Class: PDNS::Config
Overview
Configuration option for a DNS Server.
Instance Attribute Summary collapse
-
#name ⇒ String
The name of the configuration option.
Attributes inherited from API
Instance Method Summary collapse
-
#change(value = nil) ⇒ Hash
Changes this object’s information on the server.
-
#delete ⇒ Object
Disabled common methods.
-
#get ⇒ Hash
Gets the current information.
-
#initialize(http, parent, name, value = nil) ⇒ Config
constructor
Creates a configuration option object.
-
#value(value = nil) ⇒ String
Gets or sets the
value
attribute.
Methods inherited from API
Constructor Details
#initialize(http, parent, name, value = nil) ⇒ Config
Creates a configuration option object.
40 41 42 43 44 45 46 47 48 |
# File 'lib/pdns_api/config.rb', line 40 def initialize(http, parent, name, value = nil) @class = :config @http = http @parent = parent @name = name @url = "#{parent.url}/#{@class}/#{name}" @value = get if value.nil? value(@value) end |
Instance Attribute Details
#name ⇒ String
Returns the name of the configuration option.
26 27 28 |
# File 'lib/pdns_api/config.rb', line 26 def name @name end |
Instance Method Details
#change(value = nil) ⇒ Hash
Changes this object’s information on the server.
88 89 90 91 |
# File 'lib/pdns_api/config.rb', line 88 def change(value = nil) value(value) @http.put(@url, @info) end |
#delete ⇒ Object
Disabled common methods
30 |
# File 'lib/pdns_api/config.rb', line 30 undef_method :delete |
#get ⇒ Hash
Gets the current information. This also updates value
.
69 70 71 72 73 |
# File 'lib/pdns_api/config.rb', line 69 def get res = @http.get @url value(res[:value]) if res.key? :value res end |
#value(value = nil) ⇒ String
Gets or sets the value
attribute.
57 58 59 60 61 |
# File 'lib/pdns_api/config.rb', line 57 def value(value = nil) return @value if value.nil? @info = { type: 'ConfigSetting', name: @name, value: value } @value = value end |