Class: DNSDB::Clients::Lookup

Inherits:
Client
  • Object
show all
Defined in:
lib/dnsdb/clients/lookup.rb

Constant Summary

Constants inherited from Client

Client::BASE_URL, Client::HOST

Instance Method Summary collapse

Methods inherited from Client

#initialize

Constructor Details

This class inherits a constructor from DNSDB::Clients::Client

Instance Method Details

#rdata(type:, value:, rrtype: nil, **params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/dnsdb/clients/lookup.rb', line 6

def rdata(type:, value:, rrtype: nil, **params)
  path = if type == "ip"
           "/lookup/rdata/ip/#{value}"
         elsif rrtype
           "/lookup/rdata/name/#{value}/#{rrtype}"
         else
           "/lookup/rdata/name/#{value}"
         end

  _get(path, params) { |json| json }
end

#rrset(owner_name:, rrtype: nil, bailiwick: nil, **params) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dnsdb/clients/lookup.rb', line 18

def rrset(owner_name:, rrtype: nil, bailiwick: nil, **params)
  path = if bailiwick
           rrtype ||= "ANY"
           "/lookup/rrset/name/#{owner_name}/#{rrtype}/#{bailiwick}"
         elsif rrtype
           "/lookup/rrset/name/#{owner_name}/#{rrtype}"
         else
           "/lookup/rrset/name/#{owner_name}"
         end

  _get(path, params) { |json| json }
end