Class: LucidShopify::Response
- Inherits:
-
Object
- Object
- LucidShopify::Response
- Extended by:
- Dry::Initializer
- Defined in:
- lib/lucid_shopify/response.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
Instance Method Summary collapse
- #assert! ⇒ self
- #data ⇒ String
-
#data_hash ⇒ Hash
The parsed response body.
- #failure? ⇒ Boolean
- #headers ⇒ Hash
-
#request ⇒ Request
The original request.
- #status_code ⇒ Integer
- #success? ⇒ Boolean
Instance Method Details
#assert! ⇒ self
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/lucid_shopify/response.rb', line 71 def assert! case status_code when 400..499 raise ClientError.new(request, self) when 500..599 raise ServerError.new(request, self) end self end |
#data ⇒ String
40 |
# File 'lib/lucid_shopify/response.rb', line 40 param :data |
#data_hash ⇒ Hash
Returns the parsed response body.
42 |
# File 'lib/lucid_shopify/response.rb', line 42 param :data_hash, default: -> { parse_data } |
#failure? ⇒ Boolean
92 93 94 |
# File 'lib/lucid_shopify/response.rb', line 92 def failure? !success? end |
#headers ⇒ Hash
38 |
# File 'lib/lucid_shopify/response.rb', line 38 param :headers |
#request ⇒ Request
Returns the original request.
34 |
# File 'lib/lucid_shopify/response.rb', line 34 param :request |
#status_code ⇒ Integer
36 |
# File 'lib/lucid_shopify/response.rb', line 36 param :status_code |
#success? ⇒ Boolean
85 86 87 |
# File 'lib/lucid_shopify/response.rb', line 85 def success? status_code.between?(200, 299) end |