Class: PDNS::Client
Overview
Class for interaction with the top level API.
Instance Attribute Summary collapse
-
#version ⇒ Integer
readonly
The PowerDNS API version in use.
Attributes inherited from API
Instance Method Summary collapse
-
#change ⇒ Object
Disabled common methods.
-
#initialize(args) ⇒ Client
constructor
Creates a
Client
object. -
#servers(id = nil) ⇒ Hash, Server
(also: #server)
Returns existing or creates a
Server
object.
Methods inherited from API
#create, #delete, #ensure_array, #get, #info
Constructor Details
Instance Attribute Details
#version ⇒ Integer (readonly)
Returns the PowerDNS API version in use.
30 31 32 |
# File 'lib/pdns_api/client.rb', line 30 def version @version end |
Instance Method Details
#change ⇒ Object
Disabled common methods
34 |
# File 'lib/pdns_api/client.rb', line 34 undef_method :change, :create, :delete |
#servers(id = nil) ⇒ Hash, Server Also known as: server
Returns existing or creates a Server
object.
61 62 63 64 65 66 67 |
# File 'lib/pdns_api/client.rb', line 61 def servers(id = nil) return Server.new(@http, self, id) unless id.nil? # Return a hash of server objects servers = @http.get "#{@url}/servers" servers.map! { |s| [s[:id], Server.new(@http, self, s[:id], s)] }.to_h end |