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.
104 105 106 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 104 def initialize(http_response) @http_response = http_response end |
Instance Attribute Details
#http_response ⇒ Object (readonly)
Returns the value of attribute http_response.
102 103 104 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 102 def http_response @http_response end |
Instance Method Details
#client_error? ⇒ Boolean
138 139 140 141 142 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 138 def client_error? return super if http_response.nil? code.between?(400, 499) end |
#code ⇒ Object
114 115 116 117 118 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 114 def code return super if http_response.nil? http_response.code.to_i end |
#inspect ⇒ Object
150 151 152 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 150 def inspect "#{super}, http_response:#{http_response}" end |
#not_found? ⇒ Boolean
132 133 134 135 136 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 132 def not_found? return super if http_response.nil? code == 404 end |
#ok? ⇒ Boolean
120 121 122 123 124 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 120 def ok? return super if http_response.nil? code.between?(200, 299) end |
#payload ⇒ Object
108 109 110 111 112 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 108 def payload return super if http_response.nil? http_response.body end |
#server_error? ⇒ Boolean
144 145 146 147 148 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 144 def server_error? return super if http_response.nil? code.between?(500, 599) end |
#unsupported? ⇒ Boolean
126 127 128 129 130 |
# File 'lib/datadog/core/transport/http/adapters/net.rb', line 126 def unsupported? return super if http_response.nil? code == 415 end |