Class: GetToWork::Keychain

Inherits:
Object
  • Object
show all
Defined in:
lib/get_to_work/keychain.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.absolute_service_name(relative_name) ⇒ Object



19
20
21
# File 'lib/get_to_work/keychain.rb', line 19

def self.absolute_service_name(relative_name)
  "#{KEYCHAIN_PREFIX}::#{relative_name}"
end

.find(service:) ⇒ Object



13
14
15
16
17
# File 'lib/get_to_work/keychain.rb', line 13

def self.find(service:)
  ::Keychain.generic_passwords.where(
    service: absolute_service_name(service)
  ).all
end

Instance Method Details

#update(opts = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/get_to_work/keychain.rb', line 5

def update(opts = {})
  relative_service_name = opts[:service]
  @absolute_service_name =
    self.class.absolute_service_name(relative_service_name)

  update_or_create_keychain_item(opts)
end