Class: Datadog::Core::Telemetry::Http::Adapters::Net::Response
- Inherits:
-
Object
- Object
- Datadog::Core::Telemetry::Http::Adapters::Net::Response
- Includes:
- Response
- Defined in:
- lib/datadog/core/telemetry/http/adapters/net.rb
Overview
Data structure for an HTTP Response
Instance Attribute Summary collapse
-
#http_response ⇒ Object
readonly
Returns the value of attribute http_response.
Instance Method Summary collapse
- #client_error? ⇒ Boolean
- #code ⇒ Object
-
#initialize(http_response) ⇒ 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(http_response) ⇒ Response
Returns a new instance of Response.
56 57 58 |
# File 'lib/datadog/core/telemetry/http/adapters/net.rb', line 56 def initialize(http_response) @http_response = http_response end |
Instance Attribute Details
#http_response ⇒ Object (readonly)
Returns the value of attribute http_response.
54 55 56 |
# File 'lib/datadog/core/telemetry/http/adapters/net.rb', line 54 def http_response @http_response end |
Instance Method Details
#client_error? ⇒ Boolean
90 91 92 93 94 |
# File 'lib/datadog/core/telemetry/http/adapters/net.rb', line 90 def client_error? return super if http_response.nil? code.between?(400, 499) end |
#code ⇒ Object
66 67 68 69 70 |
# File 'lib/datadog/core/telemetry/http/adapters/net.rb', line 66 def code return super if http_response.nil? http_response.code.to_i end |
#inspect ⇒ Object
102 103 104 |
# File 'lib/datadog/core/telemetry/http/adapters/net.rb', line 102 def inspect "#{super}, http_response:#{http_response}" end |
#not_found? ⇒ Boolean
84 85 86 87 88 |
# File 'lib/datadog/core/telemetry/http/adapters/net.rb', line 84 def not_found? return super if http_response.nil? code == 404 end |
#ok? ⇒ Boolean
72 73 74 75 76 |
# File 'lib/datadog/core/telemetry/http/adapters/net.rb', line 72 def ok? return super if http_response.nil? code.between?(200, 299) end |
#payload ⇒ Object
60 61 62 63 64 |
# File 'lib/datadog/core/telemetry/http/adapters/net.rb', line 60 def payload return super if http_response.nil? http_response.body end |
#server_error? ⇒ Boolean
96 97 98 99 100 |
# File 'lib/datadog/core/telemetry/http/adapters/net.rb', line 96 def server_error? return super if http_response.nil? code.between?(500, 599) end |
#unsupported? ⇒ Boolean
78 79 80 81 82 |
# File 'lib/datadog/core/telemetry/http/adapters/net.rb', line 78 def unsupported? return super if http_response.nil? code == 415 end |