Class: MonoVM::Whois::Transport::Base
- Inherits:
-
Object
- Object
- MonoVM::Whois::Transport::Base
- Defined in:
- lib/monovm/whois/transport/base.rb
Overview
The one interface every transport and every middleware implements.
fetch(query:, endpoint:) -> Response
Two implementations exist for two protocols (WhoisSocket, RdapHttp), and the middlewares in Middleware implement the same method so they can wrap either one. Because the whole surface is a single method, the specs inject a lambda-backed fake and the entire suite runs without a network.
A transport decides nothing about availability. It returns what the server said, or raises: ConnectionError when the server was unreachable, MonoVM::Whois::TimeoutError when it was too slow, ServerRefusedError when it answered but declined to give a verdict, EmptyResponseError when it said nothing. That separation is what stops a network failure from being mistaken for an unregistered domain.
Direct Known Subclasses
Instance Method Summary collapse
- #fetch(query:, endpoint:) ⇒ Response
-
#supports?(endpoint) ⇒ Boolean
True when this transport can serve
endpoint.
Instance Method Details
#fetch(query:, endpoint:) ⇒ Response
28 29 30 |
# File 'lib/monovm/whois/transport/base.rb', line 28 def fetch(query:, endpoint:) raise NotImplementedError, "#{self.class} must implement #fetch" end |
#supports?(endpoint) ⇒ Boolean
True when this transport can serve endpoint.
35 36 37 |
# File 'lib/monovm/whois/transport/base.rb', line 35 def supports?(endpoint) raise NotImplementedError, "#{self.class} must implement #supports?" end |