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.



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

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

Instance Method Details

#clearObject



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

def clear
  @notification_services.clear
  @destinations.clear
end

#destinationsObject



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

def destinations
  @destinations
end

#notification_servicesObject



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

def notification_services
  @notification_services
end

#parse(configuration_hash) ⇒ Object



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

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