lib/dispatch-rider/publisher.rb in dispatch-rider-0.1.2 vs lib/dispatch-rider/publisher.rb in dispatch-rider-0.2.0

- old
+ new

@@ -1,20 +1,21 @@ require "active_support/core_ext/hash/indifferent_access" +require_relative "publisher/configuration_support" # This class takes care of the publishing side of the messaging system. module DispatchRider class Publisher + extend ConfigurationSupport + attr_reader :service_channel_mapper, :notification_service_registrar, :publishing_destination_registrar, :sns_channel_registrar - def configure(configuration_hash = {}) - ConfigurationReader.parse(configuration_hash.with_indifferent_access, self) - end - - def initialize + def initialize(configuration = self.class.configuration) @notification_service_registrar = DispatchRider::Registrars::NotificationService.new @publishing_destination_registrar = DispatchRider::Registrars::PublishingDestination.new @service_channel_mapper = ServiceChannelMapper.new(publishing_destination_registrar) + + ConfigurationReader.load_config(configuration, self) end def register_notification_service(name, options = {}) notification_service_registrar.register(name, options) self @@ -68,6 +69,8 @@ end end end end +require_relative "publisher/configuration" require_relative "publisher/configuration_reader" +require_relative "publisher/base"