Class: Aspera::Keychain::Base

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

Direct Known Subclasses

EncryptedHash, HashicorpVault, MacosSystem

Constant Summary collapse

CONTENT_KEYS =
i[label username password url description].freeze

Instance Method Summary collapse

Instance Method Details

#validate_set(options) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/aspera/keychain/base.rb', line 7

def validate_set(options)
  Aspera.assert_type(options, Hash){'options'}
  unsupported = options.keys - CONTENT_KEYS
  Aspera.assert(unsupported.empty?){"unsupported options: #{unsupported}, use #{CONTENT_KEYS.join(', ')}"}
  options.each_pair do |k, v|
    Aspera.assert_type(v, String){k.to_s}
  end
  Aspera.assert(options.key?(:label)){'label is required'}
end