Class: Luma::ResponseData
- Inherits:
-
Object
- Object
- Luma::ResponseData
- Defined in:
- lib/luma/response_data.rb
Constant Summary collapse
- BAD_GATEWAY_CODE =
502.freeze
- RETRYABLE_CODES =
[BAD_GATEWAY_CODE].freeze
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response: nil) ⇒ ResponseData
constructor
A new instance of ResponseData.
- #recommend_retry? ⇒ Boolean
Constructor Details
#initialize(response: nil) ⇒ ResponseData
Returns a new instance of ResponseData.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/luma/response_data.rb', line 8 def initialize(response: nil) @response = response begin @raw ||= response&.parsed_response rescue JSON::ParserError end @raw ||= {} end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
3 4 5 |
# File 'lib/luma/response_data.rb', line 3 def raw @raw end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/luma/response_data.rb', line 3 def response @response end |
Instance Method Details
#recommend_retry? ⇒ Boolean
19 20 21 |
# File 'lib/luma/response_data.rb', line 19 def recommend_retry? return true if RETRYABLE_CODES.include? response.code end |