Class: Consul::Async::HttpResponse
- Inherits:
-
Object
- Object
- Consul::Async::HttpResponse
- Defined in:
- lib/consul/async/json_endpoint.rb,
lib/consul/async/consul_endpoint.rb
Overview
Basic Encapsulation of HTTP response from Consul It supports empty responses to handle first call is an easy way
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#response_header ⇒ Object
readonly
Returns the value of attribute response_header.
Instance Method Summary collapse
-
#initialize(http, override_nil_response = nil) ⇒ HttpResponse
constructor
A new instance of HttpResponse.
Constructor Details
#initialize(http, override_nil_response = nil) ⇒ HttpResponse
Returns a new instance of HttpResponse.
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/consul/async/json_endpoint.rb', line 81 def initialize(http, override_nil_response = nil) if http.nil? @response_header = nil @response = override_nil_response @error = 'Not initialized yet' else @response_header = http.response_header.nil? ? nil : http.response_header.dup.freeze @response = http.response.nil? || http.response.empty? ? override_nil_response : http.response.dup.freeze @error = http.error.nil? ? nil : http.error.dup.freeze end end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
80 81 82 |
# File 'lib/consul/async/json_endpoint.rb', line 80 def error @error end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
80 81 82 |
# File 'lib/consul/async/json_endpoint.rb', line 80 def response @response end |
#response_header ⇒ Object (readonly)
Returns the value of attribute response_header.
80 81 82 |
# File 'lib/consul/async/json_endpoint.rb', line 80 def response_header @response_header end |