Class: Omnivault::PWS

Inherits:
AbstractVault show all
Defined in:
lib/omnivault/pws.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#cliObject

Returns the value of attribute cli.



3
4
5
# File 'lib/omnivault/pws.rb', line 3

def cli
  @cli
end

#raw_dataObject

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

#entriesObject



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