Exception: Alchemrest::ResponseError
- Defined in:
- lib/alchemrest/error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #deconstruct ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
-
#initialize(response) ⇒ ResponseError
constructor
A new instance of ResponseError.
- #to_s ⇒ Object
Constructor Details
#initialize(response) ⇒ ResponseError
Returns a new instance of ResponseError.
17 18 19 20 |
# File 'lib/alchemrest/error.rb', line 17 def initialize(response) super @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
15 16 17 |
# File 'lib/alchemrest/error.rb', line 15 def response @response end |
Instance Method Details
#deconstruct ⇒ Object
31 32 33 |
# File 'lib/alchemrest/error.rb', line 31 def deconstruct [response.status, response.error_details] end |
#deconstruct_keys(_keys) ⇒ Object
35 36 37 |
# File 'lib/alchemrest/error.rb', line 35 def deconstruct_keys(_keys) { status: response.status, error: response.error_details } end |
#to_s ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/alchemrest/error.rb', line 22 def to_s method = response.env.method url = response.env.url [ "HTTP #{response.status} for #{method.upcase} #{url}", response.error_details.to_s, ].compact.join(" - ") end |