Class: PDNS::Metadata
Overview
Metadata for a zone.
Instance Attribute Summary collapse
-
#kind ⇒ Object
The kind of metadata.
-
#value(value = nil) ⇒ Object
Gets or sets the
valueattribute.
Attributes inherited from API
Instance Method Summary collapse
-
#change(value = nil) ⇒ Object
Updates the object on the server.
-
#get ⇒ Object
Gets the current information.
-
#initialize(http, parent, kind, value = []) ⇒ Metadata
constructor
Creates a configuration option object.
Methods inherited from API
#create, #delete, #ensure_array, #info
Constructor Details
#initialize(http, parent, kind, value = []) ⇒ Metadata
Creates a configuration option object.
-
http: An HTTP object for interaction with the PowerDNS server. -
parent: This object’s parent. -
kind: Name of the metadata. -
value: Optional value of the metadata.
39 40 41 42 43 44 45 46 47 |
# File 'lib/pdns_api/metadata.rb', line 39 def initialize(http, parent, kind, value = []) @class = :metadata @http = http @parent = parent @kind = kind @url = "#{parent.url}/#{@class}/#{kind}" @value = value.get if value.empty? value(@value) end |
Instance Attribute Details
#kind ⇒ Object
The kind of metadata.
26 27 28 |
# File 'lib/pdns_api/metadata.rb', line 26 def kind @kind end |
#value(value = nil) ⇒ Object
Gets or sets the value attribute.
If value is not set the current value is returned. If value is set the object’s value is updated and info is set and returned.
30 31 32 |
# File 'lib/pdns_api/metadata.rb', line 30 def value @value end |
Instance Method Details
#change(value = nil) ⇒ Object
Updates the object on the server.
If value is set, the current value is used. If value is not set, value is updated and then used.
79 80 81 82 |
# File 'lib/pdns_api/metadata.rb', line 79 def change(value = nil) value(value) @http.put(@url, @info) end |
#get ⇒ Object
Gets the current information. This also updates value.
68 69 70 71 72 |
# File 'lib/pdns_api/metadata.rb', line 68 def get res = @http.get @url value(res[:value]) if res.key? :value res end |