Class: SimpleConnect::Request
- Inherits:
-
Object
- Object
- SimpleConnect::Request
- Defined in:
- lib/simple_connect/request.rb
Overview
Transport layer. Holds the Headers + retry policy + timeout/logger, and exposes #get / #post which return an immutable Result. Retries are delegated to the injected Retryable; per-retry sleep / delay policy lives there (see SimpleConnect::Retryable).
Instance Method Summary collapse
- #get(uri, body: "") ⇒ Object
-
#initialize(headers:, timeout:, retryable:, logger: nil, debug: false) ⇒ Request
constructor
A new instance of Request.
- #post(uri, body:) ⇒ Object
Constructor Details
#initialize(headers:, timeout:, retryable:, logger: nil, debug: false) ⇒ Request
Returns a new instance of Request.
9 10 11 12 13 14 15 |
# File 'lib/simple_connect/request.rb', line 9 def initialize(headers:, timeout:, retryable:, logger: nil, debug: false) @headers = headers @timeout = timeout @logger = logger @retryable = retryable @debug = debug end |
Instance Method Details
#get(uri, body: "") ⇒ Object
17 18 19 |
# File 'lib/simple_connect/request.rb', line 17 def get(uri, body: "") request_with_retry(http_method: :get, body: body, uri: uri) end |
#post(uri, body:) ⇒ Object
21 22 23 |
# File 'lib/simple_connect/request.rb', line 21 def post(uri, body:) request_with_retry(http_method: :post, body: body, uri: uri) end |