Exception: Zephyr::FailedRequest
- Inherits:
-
StandardError
- Object
- StandardError
- Zephyr::FailedRequest
- Defined in:
- lib/zephyr/failed_request.rb
Overview
Raised when a request fails due to either a timeout or when the expected response code does not match the actual response code.
Instance Attribute Summary collapse
-
#expected_code ⇒ Object
readonly
Returns the value of attribute expected_code.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(options) ⇒ FailedRequest
constructor
The following options are required:.
-
#timed_out? ⇒ Boolean
Returns whether the request timed out.
Constructor Details
#initialize(options) ⇒ FailedRequest
The following options are required:
method - The HTTP method used for the request. uri - The uri of the request. expected_code - The expected response code for the request. timeout - The timeout (in milliseconds) for the request. response - The response.
14 15 16 17 18 19 20 21 22 |
# File 'lib/zephyr/failed_request.rb', line 14 def initialize() @method = [:method].to_s.upcase @uri = [:uri] @expected_code = [:expected_code] @timeout = [:timeout] @response = [:response] super "#{@method} #{@uri} - #{}" end |
Instance Attribute Details
#expected_code ⇒ Object (readonly)
Returns the value of attribute expected_code.
5 6 7 |
# File 'lib/zephyr/failed_request.rb', line 5 def expected_code @expected_code end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
5 6 7 |
# File 'lib/zephyr/failed_request.rb', line 5 def method @method end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/zephyr/failed_request.rb', line 5 def response @response end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/zephyr/failed_request.rb', line 5 def timeout @timeout end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
5 6 7 |
# File 'lib/zephyr/failed_request.rb', line 5 def uri @uri end |
Instance Method Details
#timed_out? ⇒ Boolean
Returns whether the request timed out.
25 26 27 |
# File 'lib/zephyr/failed_request.rb', line 25 def timed_out? @response.timed_out? || @response.code == 0 end |