lib/tropo-webapi-ruby/tropo-webapi-ruby-helpers.rb
def has_params?(params, action, names)
        if names.kind_of? Array
          names.each { |name| raise ArgumentError, "A '#{name}' must be provided to a '#{action}' action" if params[name.to_sym].nil? }
        else
          raise ArgumentError, "A '#{names}' must be provided to a '#{action}' action" if params[names.to_sym].nil?
        end
      end
##
# Checks to see if certain parameters are present, and if not raises an error
#
# @overload has_params?(params, action, names)
#   @param [Hash] the parameter hash to be checked for the presence of a parameter
#   @param [String] the action being checked
#   @param [String] the name of the key in the params that must be present
# @overload has_params?(params, action, names)
#   @param [Hash] the parameter hash to be checked for the presence of a parameter
#   @param [String] the action being checked
#   @param [Array] a list of names of the keys in the params that must be present
Checks to see if certain parameters are present, and if not raises an error
Checks to see if certain parameters are present and if not raises an error
def has_params?(params, action, names)
        if names.kind_of? Array
          names.each { |name| raise ArgumentError, "A '#{name}' must be provided to a '#{action}' action" if params[name.to_sym].nil? }
        else
          raise ArgumentError, "A '#{names}' must be provided to a '#{action}' action" if params[names.to_sym].nil?
        end
      end
def has_params? ( params , action , names ) if names . kind_of? Array names . each { | name | raise ArgumentError , "A '#{name}' must be provided to a '#{action}' action" if params [ name . to_sym ] . nil? } else raise ArgumentError , "A '#{names}' must be provided to a '#{action}' action" if params [ names . to_sym ] . nil? end end
Checks to see if certain parameters are present, and if not raises an error
Checks to see if certain parameters are present and if not raises an error
params
action
names
overload
has_params?(params, action, names) @param [Hash] the parameter hash to be checked for the presence of a parameter @param [String] the action being checked @param [String] the name of the key in the params that must be present
has_params? ( params action names ) @param [ Hash ] the parameter hash to be checked for the presence of a parameter @param [ String ] the action being checked @param [ String ] the name of the key in the params that must be present
overload
has_params?(params, action, names) @param [Hash] the parameter hash to be checked for the presence of a parameter @param [String] the action being checked @param [Array] a list of names of the keys in the params that must be present
has_params? ( params action names ) @param [ Hash ] the parameter hash to be checked for the presence of a parameter @param [ String ] the action being checked @param [ Array ] a list of names of the keys in the params that must be present