class PassiveDNS::PassiveDB
abstract class that all PassiveDNS::Provider should subclass
Attributes
all of the classes that subclass PassiveDB
:debug enables verbose logging to standard output :timeout is the number of seconds to wait for a lookup
:debug enables verbose logging to standard output :timeout is the number of seconds to wait for a lookup
Public Class Methods
Source
# File lib/passivedns/client/passivedb.rb, line 34 def self.config_section_name name end
raises an exception that this should be implemented by the subclass
Source
# File lib/passivedns/client/passivedb.rb, line 18 def inherited(subclass) super PassiveDB.providers << subclass end
registers each subclass as a provider
Source
# File lib/passivedns/client/passivedb.rb, line 29 def self.name raise 'You should implement your own version of .name' end
raises an exception that this should be implemented by the subclass
Source
# File lib/passivedns/client/passivedb.rb, line 39 def self.option_letter raise 'You should pick a unique letter to serve as your database option letter for the command line option -d' end
raises an exception that this should be implemented by the subclass
Public Instance Methods
Source
# File lib/passivedns/client/passivedb.rb, line 44 def lookup(_label, _limit = nil) raise 'You must implement the lookup function' end
raises an exception that this should be implemented by the subclass
Private Instance Methods
Source
# File lib/passivedns/client/passivedb.rb, line 52 def check_response(response) return response if response.is_a? Net::HTTPSuccess detail = response.body.to_s.strip.lines.first.to_s.strip[0, 200] raise ProviderError, "#{self.class.name}: HTTP #{response.code}#{": #{detail}" unless detail.empty?}" end
returns the response when it is a success, otherwise raises a ProviderError that names the provider, the HTTP status and the first line of the body (providers report errors as plain text, HTML or JSON)