Sha256: bfe2100a8ea2fb286fdd30ad341e115df074256997b4a81fb4ce36ab2cf411bf

Contents?: true

Size: 901 Bytes

Versions: 2

Compression:

Stored size: 901 Bytes

Contents

# frozen_string_literal: true

module DNSDB
  module Clients
    class Lookup < Client
      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

      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dnsdb-0.1.2 lib/dnsdb/clients/lookup.rb
dnsdb-0.1.0 lib/dnsdb/clients/lookup.rb