Module: Playapi::Validation::Custom
- Defined in:
- lib/playapi/validation/custom.rb
Class Method Summary collapse
Class Method Details
.pkeys ⇒ Object
7 8 9 10 11 |
# File 'lib/playapi/validation/custom.rb', line 7 def pkeys @pkeys ||= [ :name ] end |
.validate(opts) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/playapi/validation/custom.rb', line 13 def validate(opts) pkeys.each do |p| unless opts.include?(p) raise "#{p} must not be nil" end end opts.each do |interaction_field, value| #next if value.nil? unless value.is_a?(String) || value.is_a?(Integer) || value.is_a?(Float) raise("Invalid #{interaction_field} specified: #{value} must be a string or a number") unless value == points end end end |