Class: Datadog::Transport::HTTP::Adapters::Net::Response
- Inherits:
-
Object
- Object
- Datadog::Transport::HTTP::Adapters::Net::Response
- Includes:
- Response
- Defined in:
- lib/ddtrace/transport/http/adapters/net.rb
Overview
A wrapped Net::HTTP response that implements the Transport::Response interface
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.
- #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.
69 70 71 |
# File 'lib/ddtrace/transport/http/adapters/net.rb', line 69 def initialize(http_response) @http_response = http_response end |
Instance Attribute Details
#http_response ⇒ Object (readonly)
Returns the value of attribute http_response.
67 68 69 |
# File 'lib/ddtrace/transport/http/adapters/net.rb', line 67 def http_response @http_response end |
Instance Method Details
#client_error? ⇒ Boolean
98 99 100 101 |
# File 'lib/ddtrace/transport/http/adapters/net.rb', line 98 def client_error? return super if http_response.nil? code.between?(400, 499) end |
#code ⇒ Object
78 79 80 81 |
# File 'lib/ddtrace/transport/http/adapters/net.rb', line 78 def code return super if http_response.nil? http_response.code.to_i end |
#not_found? ⇒ Boolean
93 94 95 96 |
# File 'lib/ddtrace/transport/http/adapters/net.rb', line 93 def not_found? return super if http_response.nil? code == 404 end |
#ok? ⇒ Boolean
83 84 85 86 |
# File 'lib/ddtrace/transport/http/adapters/net.rb', line 83 def ok? return super if http_response.nil? code.between?(200, 299) end |
#payload ⇒ Object
73 74 75 76 |
# File 'lib/ddtrace/transport/http/adapters/net.rb', line 73 def payload return super if http_response.nil? http_response.body end |
#server_error? ⇒ Boolean
103 104 105 106 |
# File 'lib/ddtrace/transport/http/adapters/net.rb', line 103 def server_error? return super if http_response.nil? code.between?(500, 599) end |
#unsupported? ⇒ Boolean
88 89 90 91 |
# File 'lib/ddtrace/transport/http/adapters/net.rb', line 88 def unsupported? return super if http_response.nil? code == 415 end |