Class: Consul::Async::VaultHttpResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/consul/async/vault_endpoint.rb

Overview

VaultHttpResponse supports empty results (when no data has been received yet)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http, override_nil_response = nil) ⇒ VaultHttpResponse

Returns a new instance of VaultHttpResponse.



114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/consul/async/vault_endpoint.rb', line 114

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
  @json = JSON[response]
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



112
113
114
# File 'lib/consul/async/vault_endpoint.rb', line 112

def error
  @error
end

#jsonObject (readonly)

Returns the value of attribute json.



112
113
114
# File 'lib/consul/async/vault_endpoint.rb', line 112

def json
  @json
end

#responseObject (readonly)

Returns the value of attribute response.



112
113
114
# File 'lib/consul/async/vault_endpoint.rb', line 112

def response
  @response
end

#response_headerObject (readonly)

Returns the value of attribute response_header.



112
113
114
# File 'lib/consul/async/vault_endpoint.rb', line 112

def response_header
  @response_header
end