Class: Honeybadger::Backend::Response
- Inherits:
-
Object
- Object
- Honeybadger::Backend::Response
- Defined in:
- lib/honeybadger/backend/base.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Response
constructor
Public: Initializes the Response instance.
- #success? ⇒ Boolean
Constructor Details
#initialize(*args) ⇒ Response
Public: Initializes the Response instance.
response - With 1 argument Net::HTTPResponse, the code, body, and
will be determined automatically. (optional)
code - The Integer status code. May also be :error for requests which
failed to reach the server.
body - The String body of the response. message - The String message returned by the server (or set by the
backend in the case of an :error code).
Returns nothing
22 23 24 25 26 27 28 29 30 |
# File 'lib/honeybadger/backend/base.rb', line 22 def initialize(*args) if (response = args.first).kind_of?(Net::HTTPResponse) @code, @body, @message = response.code.to_i, response.body.to_s, response. else @code, @body, @message = args end @success = (200..299).cover?(@code) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
9 10 11 |
# File 'lib/honeybadger/backend/base.rb', line 9 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
9 10 11 |
# File 'lib/honeybadger/backend/base.rb', line 9 def code @code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
9 10 11 |
# File 'lib/honeybadger/backend/base.rb', line 9 def @message end |
Instance Method Details
#success? ⇒ Boolean
32 33 34 |
# File 'lib/honeybadger/backend/base.rb', line 32 def success? @success end |