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.



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

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

Instance Method Details

#clearObject



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

def clear
  @notification_services.clear
  @destinations.clear
end

#destinationsObject



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

def destinations
  @destinations
end

#notification_servicesObject



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

def notification_services
  @notification_services
end

#parse(configuration_hash) ⇒ Object



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

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