Class: Datadog::CI::Transport::HTTP::Response
- Inherits:
-
Object
- Object
- Datadog::CI::Transport::HTTP::Response
- Defined in:
- lib/datadog/ci/transport/http.rb
Overview
Data structure for an HTTP Response
Direct Known Subclasses
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
- #internal_error? ⇒ Boolean
- #not_found? ⇒ Boolean
- #ok? ⇒ Boolean
- #payload ⇒ Object
- #server_error? ⇒ Boolean
- #trace_count ⇒ Object
- #unsupported? ⇒ Boolean
Constructor Details
#initialize(http_response) ⇒ Response
Returns a new instance of Response.
75 76 77 |
# File 'lib/datadog/ci/transport/http.rb', line 75 def initialize(http_response) @http_response = http_response end |
Instance Attribute Details
#http_response ⇒ Object (readonly)
Returns the value of attribute http_response.
73 74 75 |
# File 'lib/datadog/ci/transport/http.rb', line 73 def http_response @http_response end |
Instance Method Details
#client_error? ⇒ Boolean
99 100 101 |
# File 'lib/datadog/ci/transport/http.rb', line 99 def client_error? code.between?(400, 499) end |
#code ⇒ Object
83 84 85 |
# File 'lib/datadog/ci/transport/http.rb', line 83 def code http_response.code.to_i end |
#inspect ⇒ Object
115 116 117 118 119 120 |
# File 'lib/datadog/ci/transport/http.rb', line 115 def inspect "#{self.class} ok?:#{ok?} unsupported?:#{unsupported?}, " \ "not_found?:#{not_found?}, client_error?:#{client_error?}, " \ "server_error?:#{server_error?}, internal_error?:#{internal_error?}, " \ "payload:#{payload}" end |
#internal_error? ⇒ Boolean
107 108 109 |
# File 'lib/datadog/ci/transport/http.rb', line 107 def internal_error? false end |
#not_found? ⇒ Boolean
95 96 97 |
# File 'lib/datadog/ci/transport/http.rb', line 95 def not_found? code == 404 end |
#ok? ⇒ Boolean
87 88 89 |
# File 'lib/datadog/ci/transport/http.rb', line 87 def ok? code.between?(200, 299) end |
#payload ⇒ Object
79 80 81 |
# File 'lib/datadog/ci/transport/http.rb', line 79 def payload http_response.body end |
#server_error? ⇒ Boolean
103 104 105 |
# File 'lib/datadog/ci/transport/http.rb', line 103 def server_error? code.between?(500, 599) end |
#trace_count ⇒ Object
111 112 113 |
# File 'lib/datadog/ci/transport/http.rb', line 111 def trace_count 0 end |
#unsupported? ⇒ Boolean
91 92 93 |
# File 'lib/datadog/ci/transport/http.rb', line 91 def unsupported? code == 415 end |