Class: Proxy::Dynflow::Action::BatchCallback

Inherits:
Dynflow::Action
  • Object
show all
Defined in:
lib/smart_proxy_dynflow/action/batch_callback.rb

Instance Method Summary collapse

Instance Method Details

#plan(input_hash, results) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/smart_proxy_dynflow/action/batch_callback.rb', line 5

def plan(input_hash, results)
  # In input_hash there are complete inputs for all the actions for which this is reporting
  # Trim it down to only the bare minimum we actually need
  callbacks = input_hash.reduce({}) do |acc, (key, value)|
    acc.merge(key => value['action_input']['callback'])
  end
  plan_self :targets => callbacks, :results => results
end

#runObject



14
15
16
17
18
19
# File 'lib/smart_proxy_dynflow/action/batch_callback.rb', line 14

def run
  payload = format_payload(input['targets'], input['results'])
  Proxy::Dynflow::Callback::Request.new.callback({ :callbacks => payload }.to_json)
ensure
  input.delete(:results)
end