Class: Datadog::Core::Transport::HTTP::Adapters::Net::Response
- Inherits:
-
Object
- Object
- Datadog::Core::Transport::HTTP::Adapters::Net::Response
- Includes:
- Response
- Defined in:
- lib/datadog/core/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.
- #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.
113 114 115 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 113 def initialize(http_response) @http_response = http_response end |
Instance Attribute Details
#http_response ⇒ Object (readonly)
Returns the value of attribute http_response.
111 112 113 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 111 def http_response @http_response end |
Instance Method Details
#client_error? ⇒ Boolean
147 148 149 150 151 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 147 def client_error? return super if http_response.nil? code.between?(400, 499) end |
#code ⇒ Object
123 124 125 126 127 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 123 def code return super if http_response.nil? http_response.code.to_i end |
#inspect ⇒ Object
159 160 161 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 159 def inspect "#{super}, http_response:#{http_response}" end |
#not_found? ⇒ Boolean
141 142 143 144 145 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 141 def not_found? return super if http_response.nil? code == 404 end |
#ok? ⇒ Boolean
129 130 131 132 133 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 129 def ok? return super if http_response.nil? code.between?(200, 299) end |
#payload ⇒ Object
117 118 119 120 121 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 117 def payload return super if http_response.nil? http_response.body end |
#server_error? ⇒ Boolean
153 154 155 156 157 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 153 def server_error? return super if http_response.nil? code.between?(500, 599) end |
#unsupported? ⇒ Boolean
135 136 137 138 139 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 135 def unsupported? return super if http_response.nil? code == 415 end |