Class: DispatchRider::Publisher::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/dispatch-rider/publisher/configuration.rb

Defined Under Namespace

Classes: Destination, NotificationService

Instance Method Summary collapse

Constructor Details

#initialize(configuration_hash = {}) ⇒ Configuration

Returns a new instance of Configuration.



4
5
6
7
8
# File 'lib/dispatch-rider/publisher/configuration.rb', line 4

def initialize(configuration_hash = {})
  @notification_services = []
  @destinations = []
  parse(configuration_hash)
end

Instance Method Details

#clearObject



26
27
28
29
# File 'lib/dispatch-rider/publisher/configuration.rb', line 26

def clear
  @notification_services.clear
  @destinations.clear
end

#destinationsObject



14
15
16
# File 'lib/dispatch-rider/publisher/configuration.rb', line 14

def destinations
  @destinations
end

#notification_servicesObject



10
11
12
# File 'lib/dispatch-rider/publisher/configuration.rb', line 10

def notification_services
  @notification_services
end

#parse(configuration_hash) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/dispatch-rider/publisher/configuration.rb', line 18

def parse(configuration_hash)
  clear

  configuration_hash = configuration_hash.with_indifferent_access
  configure_notification_services(configuration_hash[:notification_services] || {})
  configure_destinations(configuration_hash[:destinations] || {})
end