Sha256: da0f5b5c63555031c83348e23d8ee9d7f2a74e8279a85382fff73cf1947710bc

Contents?: true

Size: 696 Bytes

Versions: 1

Compression:

Stored size: 696 Bytes

Contents

module Workarea
  module FlowIo
    class Webhook
      class Error < RuntimeError; end
      class Error::NotFound < RuntimeError; end
      class Error::UnhandledWebhook < RuntimeError; end

      # @param ::Io::Flow::V0::Models::Event
      def self.process(event)
        begin
          klass = "Workarea::FlowIo::Webhook::#{event.discriminator.classify}".constantize
        rescue NameError => _error
          raise Error::UnhandledWebhook, "no class defined to handle #{event.discriminator.classify}"
        end

        klass.new(event).process
      end

      attr_reader :event

      def initialize(event)
        @event = event
      end

      def process; end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-flow_io-1.2.1 app/services/workarea/flow_io/webhook.rb