Class: Recurly::HTTP::Adapter
- Inherits:
-
Object
- Object
- Recurly::HTTP::Adapter
- Defined in:
- lib/recurly/http/adapter.rb
Overview
Base class documenting the HTTP adapter contract. Custom adapters should
subclass this (or simply respond to #call) and implement #call.
Contract:
#call(method, url, headers, body, open_timeout: nil, read_timeout: nil)performs the HTTP request.methodis a HttpMethod string,urlis an ABSOLUTE url (scheme+host+path+query),headersis a plain Hash of app-level headers, andbodyis a serialized String or nil.- On success (including HTTP 4xx and 5xx) it MUST return a AdapterResponse. 4xx/5xx are RETURNED, never raised.
- On a transport-level failure (timeout, connection refused, SSL error,
etc.) it MUST raise Errors::TransportError, ideally carrying a
kindso the client can reproduce its typed-error mapping.
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#call(method, url, headers, body, open_timeout: nil, read_timeout: nil) ⇒ Object
17 18 19 |
# File 'lib/recurly/http/adapter.rb', line 17 def call(method, url, headers, body, open_timeout: nil, read_timeout: nil) raise NotImplementedError, "#{self.class} must implement #call" end |