Class: Pheromone::Validators::OptionsValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/pheromone/validators/options_validator.rb

Constant Summary collapse

ACCEPTED_EVENT_TYPES =
%i(create update).freeze
ALLOWED_DISPATCH_METHODS =
%i(sync async)

Instance Method Summary collapse

Constructor Details

#initialize(message_options) ⇒ OptionsValidator

Returns a new instance of OptionsValidator.



9
10
11
12
# File 'lib/pheromone/validators/options_validator.rb', line 9

def initialize(message_options)
  @errors = {}
  @message_options = message_options
end

Instance Method Details

#validateObject



14
15
16
17
18
19
20
21
22
# File 'lib/pheromone/validators/options_validator.rb', line 14

def validate
  validate_message_options
  return @errors if @errors.present?
  validate_topic
  validate_event_types
  validate_message_attributes
  validate_dispatch_method
  @errors
end