Module: Playapi::Validation::Instagrabber
- Defined in:
- lib/playapi/validation/instagrabber.rb
Class Method Summary collapse
Class Method Details
.pkeys ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/playapi/validation/instagrabber.rb', line 7 def pkeys @pkeys ||= [ :name, :description, :type, :client_id, :client_secret ] end |
.validate(opts) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/playapi/validation/instagrabber.rb', line 17 def validate(opts) pkeys.each do |p| unless opts.include?(p) raise "#{p} must not be nil" end end opts.each do |field, value| raise "Type should not be specified in options!" if field.to_s == "type" #next if value.nil? unless value.is_a?(String) || value.is_a?(Integer) || value.is_a?(Float) raise("Invalid #{value} specified: #{field} must be a string or a number") unless value == points end end end |