Module: DropboxApi::OptionsValidator

Instance Method Summary collapse

Instance Method Details

#validate_options(valid_option_keys, options) ⇒ Object

Takes in a list of valid option keys and a hash of options. If one of the keys in the hash is invalid an ArgumentError will be raised.

Parameters:

  • valid_option_keys

    List of valid keys for the options hash.

  • options (Hash)

    Options hash.


8
9
10
11
12
13
14
# File 'lib/dropbox_api/options_validator.rb', line 8

def validate_options(valid_option_keys, options)
  options.keys.each do |key|
    unless valid_option_keys.include? key.to_sym
      raise ArgumentError, "Invalid option `#{key}`"
    end
  end
end