class Proxy::Dynflow::Action::BatchCallback

Public Instance Methods

plan(input_hash, results) click to toggle source
# 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
run() click to toggle source
# 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

Private Instance Methods

format_payload(input_hash, results) click to toggle source
# File lib/smart_proxy_dynflow/action/batch_callback.rb, line 23
def format_payload(input_hash, results)
  input_hash.map do |task_id, callback|
    { :callback => callback, :data => results[task_id] }
  end
end