Exception: MyTargetApi::RequestError
- Inherits:
-
StandardError
- Object
- StandardError
- MyTargetApi::RequestError
- Defined in:
- lib/my_target_api/request_error.rb
Overview
Error for request
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#original_exception ⇒ Object
readonly
Returns the value of attribute original_exception.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(method:, url:, params:, original_exception: nil, response: nil) ⇒ RequestError
constructor
A new instance of RequestError.
Constructor Details
#initialize(method:, url:, params:, original_exception: nil, response: nil) ⇒ RequestError
Returns a new instance of RequestError.
9 10 11 12 13 14 15 16 17 |
# File 'lib/my_target_api/request_error.rb', line 9 def initialize(method:, url:, params:, original_exception: nil, response: nil) @method = method @url = url @params = params @response = response @original_exception = original_exception super(response ? "#{response.code}: #{response.body}" : 'No response') end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
7 8 9 |
# File 'lib/my_target_api/request_error.rb', line 7 def method @method end |
#original_exception ⇒ Object (readonly)
Returns the value of attribute original_exception.
7 8 9 |
# File 'lib/my_target_api/request_error.rb', line 7 def original_exception @original_exception end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
7 8 9 |
# File 'lib/my_target_api/request_error.rb', line 7 def params @params end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/my_target_api/request_error.rb', line 7 def response @response end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/my_target_api/request_error.rb', line 7 def url @url end |