Sha256: 3df8f5404d51133bd384a8ddc146a89ffe77b86f8a6613828f77a50eaf12a8e2

Contents?: true

Size: 708 Bytes

Versions: 9

Compression:

Stored size: 708 Bytes

Contents

require 'interactor'

module DiscoApp
  module Flow
    class CreateTrigger

      include Interactor

      delegate :shop, :title, :resource_name, :resource_url, :properties, to: :context
      delegate :trigger, to: :context

      def call
        create_trigger
        enqueue_process_trigger_job
      end

      private

        def create_trigger
          context.trigger = shop.flow_triggers.create!(
            title: title,
            resource_name: resource_name,
            resource_url: resource_url,
            properties: properties
          )
        end

        def enqueue_process_trigger_job
          ProcessTriggerJob.perform_later(shop, trigger)
        end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
disco_app-0.16.1.pre.sidekiq.pre.6.pre.release app/services/disco_app/flow/create_trigger.rb
disco_app-0.17.0 app/services/disco_app/flow/create_trigger.rb
disco_app-0.18.0 app/services/disco_app/flow/create_trigger.rb
disco_app-0.18.2 app/services/disco_app/flow/create_trigger.rb
disco_app-0.18.3 app/services/disco_app/flow/create_trigger.rb
disco_app-0.18.6 app/services/disco_app/flow/create_trigger.rb
disco_app-0.16.1 app/services/disco_app/flow/create_trigger.rb
disco_app-0.18.4 app/services/disco_app/flow/create_trigger.rb
disco_app-0.18.1 app/services/disco_app/flow/create_trigger.rb