Class: PDNS::Config
Overview
Server config
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#value(value = nil) ⇒ Object
Simple interfaces to metadata Get/set config value.
Attributes inherited from API
Instance Method Summary collapse
-
#change(value = nil) ⇒ Object
Change configuration.
-
#get ⇒ Object
Get configuration value.
-
#initialize(http, parent, name, value = nil) ⇒ Config
constructor
A new instance of Config.
Methods inherited from API
#create, #delete, #ensure_array, hash_string_to_sym, hash_sym_to_string, #info
Constructor Details
#initialize(http, parent, name, value = nil) ⇒ Config
Returns a new instance of Config.
7 8 9 10 11 12 13 14 15 |
# File 'lib/pdns_api/config.rb', line 7 def initialize(http, parent, name, value = nil) @class = :config @http = http @parent = parent @name = name @url = "#{parent.url}/#{@class}/#{name}" @value = value.get if value.nil? value(@value) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/pdns_api/config.rb', line 5 def name @name end |
#value(value = nil) ⇒ Object
Simple interfaces to metadata Get/set config value
19 20 21 |
# File 'lib/pdns_api/config.rb', line 19 def value @value end |
Instance Method Details
#change(value = nil) ⇒ Object
Change configuration
32 33 34 35 |
# File 'lib/pdns_api/config.rb', line 32 def change(value = nil) value(value) @http.put(@url, @info) end |
#get ⇒ Object
Get configuration value
26 27 28 29 |
# File 'lib/pdns_api/config.rb', line 26 def get res = @http.get(@url) return value if res.key? :value end |