Class: MonoVM::Whois::Availability::Rules::RdapObject
- Inherits:
-
MonoVM::Whois::Availability::Rule
- Object
- MonoVM::Whois::Availability::Rule
- MonoVM::Whois::Availability::Rules::RdapObject
- Defined in:
- lib/monovm/whois/availability/rules/rdap_object.rb
Overview
Reads an RDAP response, which says outright whether the object exists.
This is why the library prefers RDAP. Every other rule in the chain infers
a verdict from prose that varies by registry, by year and sometimes by
query. RDAP does not need inference: a registered domain is a JSON object
with an objectClassName of "domain", and an unregistered one is an
error document with errorCode 404 (RFC 7480 §5.3, RFC 9083 §6). Both
answers are definitive, so this rule sits above all the pattern matching.
Instance Method Summary collapse
Methods inherited from MonoVM::Whois::Availability::Rule
Instance Method Details
#call(context) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/monovm/whois/availability/rules/rdap_object.rb', line 18 def call(context) return nil unless context.rdap? document = context.json # An HTTP 404 is RDAP's "no such domain", whether or not it carried a body. if document.nil? return nil unless Patterns::RDAP_NOT_FOUND_CODES.include?(context.http_status) return available( reason: "RDAP answered HTTP 404: no such domain", evidence: "HTTP #{context.http_status}" ) end verdict_for_error(document, context) || verdict_for_object(document) end |