Class: MonoVM::Whois::Availability::Rules::RegistrationFields
- Inherits:
-
MonoVM::Whois::Availability::Rule
- Object
- MonoVM::Whois::Availability::Rule
- MonoVM::Whois::Availability::Rules::RegistrationFields
- Defined in:
- lib/monovm/whois/availability/rules/registration_fields.rb
Overview
The response is a record: it carries the fields only a registration has.
Useful for the many registries that never say "registered" in so many words — they simply return the record, and the record's existence is the answer. Counting fields rather than looking for one is deliberate: a registrar name might appear in a preamble, but a registrar and a creation date and nameservers together are a registration.
Constant Summary collapse
- THRESHOLD =
Three independent fields. Two is reachable by a chatty error notice; four loses the GDPR-redacted records that only keep domain, registrar and status.
3
Instance Method Summary collapse
Methods inherited from MonoVM::Whois::Availability::Rule
Instance Method Details
#call(context) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/monovm/whois/availability/rules/registration_fields.rb', line 22 def call(context) return nil if context.empty? found = context.count(Patterns::REGISTRATION_INDICATORS, source: :significant) return nil if found < THRESHOLD registered( reason: "the response contains #{found} registration fields", evidence: context.find(Patterns::REGISTRATION_INDICATORS, source: :significant) ) end |