Class: Omnivault::PWS
- Inherits:
-
AbstractVault
- Object
- AbstractVault
- Omnivault::PWS
- Defined in:
- lib/omnivault/pws.rb
Instance Attribute Summary collapse
-
#cli ⇒ Object
Returns the value of attribute cli.
-
#raw_data ⇒ Object
Returns the value of attribute raw_data.
Instance Method Summary collapse
- #entries ⇒ Object
-
#initialize(name = 'default') ⇒ PWS
constructor
A new instance of PWS.
- #remove(key) ⇒ Object
- #store(key, value) ⇒ Object
Methods inherited from AbstractVault
#configure_aws!, #fetch, for_platform, from_env
Constructor Details
#initialize(name = 'default') ⇒ PWS
Returns a new instance of PWS.
5 6 7 8 9 10 |
# File 'lib/omnivault/pws.rb', line 5 def initialize(name = 'default') require 'pws' @cli ||= ::PWS.new(namespace: name) @raw_data = @cli.instance_variable_get(:@data) end |
Instance Attribute Details
#cli ⇒ Object
Returns the value of attribute cli.
3 4 5 |
# File 'lib/omnivault/pws.rb', line 3 def cli @cli end |
#raw_data ⇒ Object
Returns the value of attribute raw_data.
3 4 5 |
# File 'lib/omnivault/pws.rb', line 3 def raw_data @raw_data end |
Instance Method Details
#entries ⇒ Object
12 13 14 |
# File 'lib/omnivault/pws.rb', line 12 def entries Hash[raw_data.map { |k, v| [k, v[:password]] }] end |
#remove(key) ⇒ Object
20 21 22 |
# File 'lib/omnivault/pws.rb', line 20 def remove(key) cli.remove(key) end |
#store(key, value) ⇒ Object
16 17 18 |
# File 'lib/omnivault/pws.rb', line 16 def store(key, value) cli.add(key, value) end |