Class: Datadog::Core::Transport::HTTP::Adapters::Test::Response
- Inherits:
-
Object
- Object
- Datadog::Core::Transport::HTTP::Adapters::Test::Response
- Includes:
- Response
- Defined in:
- lib/datadog/core/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.
51 52 53 54 |
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 51 def initialize(code, body = nil) @code = code @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
47 48 49 |
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 47 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
47 48 49 |
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 47 def code @code end |
Instance Method Details
#client_error? ⇒ Boolean
72 73 74 |
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 72 def client_error? code.between?(400, 499) end |
#inspect ⇒ Object
80 81 82 |
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 80 def inspect "#{super}, code:#{code}" end |
#not_found? ⇒ Boolean
68 69 70 |
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 68 def not_found? code == 404 end |
#ok? ⇒ Boolean
60 61 62 |
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 60 def ok? code.between?(200, 299) end |
#payload ⇒ Object
56 57 58 |
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 56 def payload @body end |
#server_error? ⇒ Boolean
76 77 78 |
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 76 def server_error? code.between?(500, 599) end |
#unsupported? ⇒ Boolean
64 65 66 |
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 64 def unsupported? code == 415 end |