Class: Datadog::Transport::HTTP::Adapters::Test::Response
- Inherits:
-
Object
- Object
- Datadog::Transport::HTTP::Adapters::Test::Response
- Includes:
- Response
- Defined in:
- lib/ddtrace/transport/http/adapters/test.rb
Overview
Response for test adapter
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Instance Method Summary collapse
- #client_error? ⇒ Boolean
-
#initialize(code, body = nil) ⇒ Response
constructor
A new instance of Response.
- #not_found? ⇒ Boolean
- #ok? ⇒ Boolean
- #payload ⇒ Object
- #server_error? ⇒ Boolean
- #unsupported? ⇒ Boolean
Methods included from Response
Constructor Details
#initialize(code, body = nil) ⇒ Response
Returns a new instance of Response.
44 45 46 47 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 44 def initialize(code, body = nil) @code = code @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
40 41 42 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 40 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
40 41 42 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 40 def code @code end |
Instance Method Details
#client_error? ⇒ Boolean
65 66 67 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 65 def client_error? code.between?(400, 499) end |
#not_found? ⇒ Boolean
61 62 63 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 61 def not_found? code == 404 end |
#ok? ⇒ Boolean
53 54 55 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 53 def ok? code.between?(200, 299) end |
#payload ⇒ Object
49 50 51 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 49 def payload @body end |
#server_error? ⇒ Boolean
69 70 71 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 69 def server_error? code.between?(500, 599) end |
#unsupported? ⇒ Boolean
57 58 59 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 57 def unsupported? code == 415 end |