Class: PDNS::Client

Inherits:
API
  • Object
show all
Defined in:
lib/pdns_api/client.rb

Overview

Client

Instance Attribute Summary collapse

Attributes inherited from API

#class, #url

Instance Method Summary collapse

Methods inherited from API

#create, #delete, #ensure_array, #get, hash_string_to_sym, hash_sym_to_string, #info, #initialize

Constructor Details

This class inherits a constructor from PDNS::API

Instance Attribute Details

#versionObject (readonly)

Returns the value of attribute version.



9
10
11
# File 'lib/pdns_api/client.rb', line 9

def version
  @version
end

Instance Method Details

#servers(id = nil) ⇒ Object Also known as: server

Main methods



12
13
14
15
16
17
18
# File 'lib/pdns_api/client.rb', line 12

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