Class: Dialogue::ConversationOptionsValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/dialogue/conversation_options_validator.rb

Defined Under Namespace

Classes: ValidationResult

Constant Summary collapse

VALID_OPTIONS =
[:access_token, :author_id, :data].freeze

Instance Method Summary collapse

Instance Method Details

#validate(options) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/dialogue/conversation_options_validator.rb', line 5

def validate(options)
  errors = []
  options.keys.each do |key|
    errors << "#{key} is not a valid option" unless VALID_OPTIONS.include?(key)
  end

  ValidationResult.new errors
end