Class: Raes::Dispatch
- Inherits:
-
Object
- Object
- Raes::Dispatch
- Includes:
- UseCaller
- Defined in:
- lib/raes/dispatch.rb
Instance Method Summary collapse
- #call ⇒ Object
- #create_payload ⇒ Object
-
#initialize(name, payload = {}) ⇒ Dispatch
constructor
A new instance of Dispatch.
Constructor Details
Instance Method Details
#call ⇒ Object
12 13 14 15 16 |
# File 'lib/raes/dispatch.rb', line 12 def call @action.payload = create_payload.to_json SubscribeJob.perform_later(@action) if @action.save @action end |
#create_payload ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/raes/dispatch.rb', line 18 def create_payload if @payload[:raes_storage].present? storage = @action.storages.create(name: @action.name, content: @payload[:raes_storage]) @payload.delete(:raes_storage) @payload[:raes_storage_id] = storage.id end @payload end |