Sha256: 18c07ff9dea431bd269c1c3baecde7fc9ffdbc3c54b5cad1eb67be416c2f1427
Contents?: true
Size: 1.08 KB
Versions: 23
Compression:
Stored size: 1.08 KB
Contents
module ProxyAPI module ForemanDynflow class DynflowProxy PREFIX = 'dynflow' class Task < ProxyAPI::Resource def initialize(args) @url = "#{args[:url]}/#{PREFIX}/tasks" super args @connect_params[:headers] ||= {} @connect_params[:headers]['content-type'] = 'application/json' end end def initialize(args) @args = args end # Initiate the command def trigger_task(action_name, action_input) payload = MultiJson.dump(:action_name => action_name, :action_input => action_input) MultiJson.load(Task.new(@args).send(:post, payload)) end # Cancel the command def cancel_task(proxy_task_id) MultiJson.load(Task.new(@args).send(:post, "", "#{ proxy_task_id }/cancel")) end def status_of_task(proxy_task_id) MultiJson.load(Task.new(@args).send(:get, "#{ proxy_task_id }/status")) end def tasks_count(state) MultiJson.load(Task.new(@args).send(:get, "count?state=#{state}"))['count'].to_i end end end end
Version data entries
23 entries across 23 versions & 1 rubygems