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.
- #inspect ⇒ Object
- #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.
49 50 51 52 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 49 def initialize(code, body = nil) @code = code @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
45 46 47 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 45 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
45 46 47 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 45 def code @code end |
Instance Method Details
#client_error? ⇒ Boolean
70 71 72 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 70 def client_error? code.between?(400, 499) end |
#inspect ⇒ Object
78 79 80 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 78 def inspect "#{super}, code:#{code}" end |
#not_found? ⇒ Boolean
66 67 68 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 66 def not_found? code == 404 end |
#ok? ⇒ Boolean
58 59 60 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 58 def ok? code.between?(200, 299) end |
#payload ⇒ Object
54 55 56 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 54 def payload @body end |
#server_error? ⇒ Boolean
74 75 76 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 74 def server_error? code.between?(500, 599) end |
#unsupported? ⇒ Boolean
62 63 64 |
# File 'lib/ddtrace/transport/http/adapters/test.rb', line 62 def unsupported? code == 415 end |