class PDNS::API
The superclass for all PDNS
objects.
Attributes
@return the class of the resource object.
@return the url of the resource object.
Public Instance Methods
Changes this object's information on the server.
@param rrsets [Array] is used as changeset for the change. @return [Hash] result of the change.
# File lib/pdns_api/api.rb, line 40 def change(rrsets) @http.put(@url, rrsets) end
Creates this object on the server
If info
is set this method updates the current information. The current information is used to create the object.
@param info [Hash, nil] Information to set when creating the object. @return [Hash] result of the creation.
@example
zone.create( name: zone.id, kind: 'Native', dnssec: true, nameservers: %w( ns0.example.com. ns1.example.com. ) )
# File lib/pdns_api/api.rb, line 61 def create(info = nil) info(info) @http.post("#{@parent.url}/#{@class}", @info) end
Deletes this object.
@return [Hash] result of the deletion.
# File lib/pdns_api/api.rb, line 71 def delete @http.delete @url end
Ensures the object is an array. If it is not, an array containing the item is returned.
@param item anything that might or might not be an Array
. @return [Array] item
as an array.
# File lib/pdns_api/api.rb, line 105 def ensure_array(item) return item if item.is_a? Array [item] end
Gets and sets the object information. This does not cause an API
request.
@param info [Hash, nil] Information to change. @return [Hash] this object's information.
# File lib/pdns_api/api.rb, line 92 def info(info = nil) return @info if info.nil? @info.merge!(info) end