Class: ProxyAPI::ForemanDynflow::DynflowProxy
- Inherits:
-
Object
- Object
- ProxyAPI::ForemanDynflow::DynflowProxy
- Defined in:
- app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb
Defined Under Namespace
Classes: Task
Constant Summary collapse
- PREFIX =
'dynflow'
Instance Method Summary collapse
-
#cancel_task(proxy_task_id) ⇒ Object
Cancel the command.
-
#initialize(args) ⇒ DynflowProxy
constructor
A new instance of DynflowProxy.
- #status_of_task(proxy_task_id) ⇒ Object
- #tasks_count(state) ⇒ Object
-
#trigger_task(action_name, action_input) ⇒ Object
Initiate the command.
Constructor Details
#initialize(args) ⇒ DynflowProxy
Returns a new instance of DynflowProxy.
15 16 17 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 15 def initialize(args) @args = args end |
Instance Method Details
#cancel_task(proxy_task_id) ⇒ Object
Cancel the command
26 27 28 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 26 def cancel_task(proxy_task_id) MultiJson.load(Task.new(@args).send(:post, "", "#{ proxy_task_id }/cancel")) end |
#status_of_task(proxy_task_id) ⇒ Object
30 31 32 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 30 def status_of_task(proxy_task_id) MultiJson.load(Task.new(@args).send(:get, "#{ proxy_task_id }/status")) end |
#tasks_count(state) ⇒ Object
34 35 36 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 34 def tasks_count(state) MultiJson.load(Task.new(@args).send(:get, "count?state=#{state}"))['count'].to_i end |
#trigger_task(action_name, action_input) ⇒ Object
Initiate the command
20 21 22 23 |
# File 'app/lib/proxy_api/foreman_dynflow/dynflow_proxy.rb', line 20 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 |