Class: LucidShopify::SendRequest
- Inherits:
-
Object
- Object
- LucidShopify::SendRequest
- Defined in:
- lib/lucid_shopify/send_request.rb
Direct Known Subclasses
Defined Under Namespace
Classes: NetworkError
Instance Method Summary collapse
-
#call(request, attempts: default_attempts) ⇒ Hash
The parsed response body.
Instance Method Details
#call(request, attempts: default_attempts) ⇒ Hash
Returns the parsed response body.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/lucid_shopify/send_request.rb', line 26 def call(request, attempts: default_attempts) res = send(request) res = Response.new(request, res.code, res.headers.to_h, res.to_s) res.assert!.data_hash rescue HTTP::ConnectionError, HTTP::ResponseError, HTTP::TimeoutError => e raise NetworkError.new(e), e. if attempts.zero? call(request, attempts: attempts - 1) end |