Sha256: 19052c474edf0f18d873b6a30f778cca639a310804b7d539d20b3ae675456ee4

Contents?: true

Size: 428 Bytes

Versions: 9

Compression:

Stored size: 428 Bytes

Contents

module WebhookSystem

  # Main code that handles dispatching of events out to subscribers
  class Dispatcher
    class << self

      # @param [WebhookSystem::BaseEvent] event The Event Object
      def dispatch(event)
        WebhookSystem::Subscription.interested_in_topic(event.event_name).each do |subscription|
          WebhookSystem::Job.perform_later subscription, event.as_json
        end
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
webhook_system-2.0.0 lib/webhook_system/dispatcher.rb
webhook_system-1.0.4 lib/webhook_system/dispatcher.rb
webhook_system-1.0.3 lib/webhook_system/dispatcher.rb
webhook_system-1.0.2 lib/webhook_system/dispatcher.rb
webhook_system-1.0.1 lib/webhook_system/dispatcher.rb
webhook_system-1.0.0 lib/webhook_system/dispatcher.rb
webhook_system-0.1.1 lib/webhook_system/dispatcher.rb
webhook_system-0.1.0 lib/webhook_system/dispatcher.rb
webhook_system-0.0.1 lib/webhook_system/dispatcher.rb