Module: Micropayment

Defined in:
lib/micropayment.rb,
lib/services/api.rb,
lib/services/debit.rb,
lib/services/config.rb

Defined Under Namespace

Modules: API Classes: Config, Debit

Class Method Summary collapse

Class Method Details

.assert_keys_exists(opts, *keys) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/micropayment.rb', line 18

def self.assert_keys_exists(opts, *keys)
  keys.flatten!
  opt_keys = opts.keys
  keys.each do |k|
    raise(ArgumentError, "Mandatory key missing: #{k}") unless opt_keys.include?(k)
  end
end

.assert_valid_keys(opts, *valid_keys) ⇒ Object



11
12
13
14
15
16
# File 'lib/micropayment.rb', line 11

def self.assert_valid_keys(opts, *valid_keys)
  valid_keys.flatten!
  opts.each_key do |k|
    raise(ArgumentError, "Unknown key: #{k}") unless valid_keys.include?(k)
  end
end