Exception: ApiRecipes::ResponseCodeNotAsExpected
- Inherits:
-
Exception
- Object
- Exception
- ApiRecipes::ResponseCodeNotAsExpected
- Defined in:
- lib/api_recipes/exceptions.rb
Instance Attribute Summary collapse
-
#expected_code ⇒ Object
readonly
Returns the value of attribute expected_code.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(path, expected_code = nil, response = nil, message: nil) ⇒ ResponseCodeNotAsExpected
constructor
A new instance of ResponseCodeNotAsExpected.
Constructor Details
#initialize(path, expected_code = nil, response = nil, message: nil) ⇒ ResponseCodeNotAsExpected
Returns a new instance of ResponseCodeNotAsExpected.
46 47 48 49 50 51 52 53 54 |
# File 'lib/api_recipes/exceptions.rb', line 46 def initialize(path, expected_code = nil, response = nil, message: nil) @path = path @expected_code = expected_code @response = response unless = "response code for request on route '#{@path}' has returned '#{@response.code}', but '#{@expected_code}' was expected\n\nResponse body:\n #{@response.body}" end super() end |
Instance Attribute Details
#expected_code ⇒ Object (readonly)
Returns the value of attribute expected_code.
44 45 46 |
# File 'lib/api_recipes/exceptions.rb', line 44 def expected_code @expected_code end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
44 45 46 |
# File 'lib/api_recipes/exceptions.rb', line 44 def path @path end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
44 45 46 |
# File 'lib/api_recipes/exceptions.rb', line 44 def response @response end |