lib/soapy_cake/helper.rb in soapy_cake-1.21.0 vs lib/soapy_cake/helper.rb in soapy_cake-1.22.0

- old
+ new

@@ -13,24 +13,24 @@ yield(obj, key) end end def validate_id(opts, key) - fail Error, "Parameter '#{key}' must be > 0!" if opts[key].to_i < 1 + raise Error, "Parameter '#{key}' must be > 0!" if opts[key].to_i < 1 end def require_params(opts, params) params.each do |param| - fail Error, "Parameter '#{param}' missing!" unless opts.key?(param) + raise Error, "Parameter '#{param}' missing!" unless opts.key?(param) end end def translate_booleans(opts) opts.transform_values do |v| case v - when true then 'on'.freeze - when false then 'off'.freeze + when true then 'on' + when false then 'off' else v end end end @@ -43,10 +43,10 @@ end.to_h end def const_lookup(type, key) Const::CONSTS[type].fetch(key) do - fail ArgumentError, "#{key} is not a valid value for #{type}" + raise ArgumentError, "#{key} is not a valid value for #{type}" end end # Some API calls require expiration dates. # The default is to not expire campaigns/offers/etc., so we set this to far in the future.