Skip to content

Delayed Actions

Serafim Nenarokov edited this page Sep 28, 2016 · 1 revision

Simple DelayedActions

In simple case the class looks like the example below

module ExternalServices
  module DelayedActions
    module Fox
      class UpdateClient < DelayedAction

        define_step do
          # some simple code here
        end

      end
     end
  end
end

Nestable delayed actions

define_step type: :delayd_action do
  virtual_delayed_action :create_client, arguments: Client.last(3)
end

Dynamic steps

module ExternalServices
  module DelayedActions
    module Fox
      class CreateClient < DelayedAction

        has_dynamic_steps

        define_dynamic_step do |object|
          # some awesome code with every object from attributes
        end

      end
    end
  end
end

Clone this wiki locally