Class: Nonnative::HTTPClient
- Inherits:
-
Object
- Object
- Nonnative::HTTPClient
- Defined in:
- lib/nonnative/http_client.rb
Overview
Minimal RestClient-based HTTP client with consistent exception handling.
This class is intended to be subclassed by higher-level clients (for example Observability). It provides protected helpers for common HTTP verbs and a retry wrapper.
Error handling behavior:
-
Timeouts and broken connections (see #initialize) are re-raised so callers can handle them explicitly.
-
Other
RestClient::Exceptionerrors return the underlyingresponseobject.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(host) ⇒ HTTPClient
constructor
A new instance of HTTPClient.
Constructor Details
#initialize(host) ⇒ HTTPClient
Returns a new instance of HTTPClient.
17 18 19 20 21 22 23 |
# File 'lib/nonnative/http_client.rb', line 17 def initialize(host) @host = host @exceptions = [ RestClient::Exceptions::Timeout, RestClient::ServerBrokeConnection ] end |