Class: Consul::Async::VaultResult
- Inherits:
-
Object
- Object
- Consul::Async::VaultResult
- Defined in:
- lib/consul/async/vault_endpoint.rb
Overview
Keep information about Vault result of a query
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#http ⇒ Object
readonly
Returns the value of attribute http.
-
#retry_in ⇒ Object
readonly
Returns the value of attribute retry_in.
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
- #[](path) ⇒ Object
-
#initialize(result, modified, stats, retry_in) ⇒ VaultResult
constructor
A new instance of VaultResult.
- #json ⇒ Object
- #modified? ⇒ Boolean
- #mutate(new_data) ⇒ Object
Constructor Details
#initialize(result, modified, stats, retry_in) ⇒ VaultResult
Returns a new instance of VaultResult.
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/consul/async/vault_endpoint.rb', line 80 def initialize(result, modified, stats, retry_in) @data = result.response @modified = modified @http = result @data_json = result.json @last_update = Time.now.utc @next_update = Time.now.utc + retry_in @stats = stats @retry_in = retry_in end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
78 79 80 |
# File 'lib/consul/async/vault_endpoint.rb', line 78 def data @data end |
#http ⇒ Object (readonly)
Returns the value of attribute http.
78 79 80 |
# File 'lib/consul/async/vault_endpoint.rb', line 78 def http @http end |
#retry_in ⇒ Object (readonly)
Returns the value of attribute retry_in.
78 79 80 |
# File 'lib/consul/async/vault_endpoint.rb', line 78 def retry_in @retry_in end |
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
78 79 80 |
# File 'lib/consul/async/vault_endpoint.rb', line 78 def stats @stats end |
Instance Method Details
#[](path) ⇒ Object
100 101 102 |
# File 'lib/consul/async/vault_endpoint.rb', line 100 def [](path) json[path] end |
#json ⇒ Object
104 105 106 107 |
# File 'lib/consul/async/vault_endpoint.rb', line 104 def json @data_json = JSON.parse(data) if @data_json.nil? @data_json end |
#modified? ⇒ Boolean
91 92 93 |
# File 'lib/consul/async/vault_endpoint.rb', line 91 def modified? @modified end |
#mutate(new_data) ⇒ Object
95 96 97 98 |
# File 'lib/consul/async/vault_endpoint.rb', line 95 def mutate(new_data) @data = new_data.dup @data_json = nil end |