Class: Matterhorn::Endpoint::Workflow
- Inherits:
-
Matterhorn::Endpoint
- Object
- Matterhorn::Endpoint
- Matterhorn::Endpoint::Workflow
- Defined in:
- lib/matterhorn/endpoint/workflow.rb
Overview
Matterhorn::Endpoint::Workflow ===
Instance Attribute Summary
Attributes inherited from Matterhorn::Endpoint
#response_body, #response_code
Instance Method Summary collapse
-
#instance(wi_id) ⇒ Object
————————————————————————————— read —.
-
#remove(wi_id) ⇒ Object
————————————————————————————- delete —.
-
#resume(wi_id) ⇒ Object
————————————————————————————- update —.
- #statistics ⇒ Object
- #stop(wi_id) ⇒ Object
Methods inherited from Matterhorn::Endpoint
#close, create, #error_code, #error_msg, #error_occurred?, #initialize, open
Constructor Details
This class inherits a constructor from Matterhorn::Endpoint
Instance Method Details
#instance(wi_id) ⇒ Object
————————————————————————————— read —
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/matterhorn/endpoint/workflow.rb', line 12 def instance(wi_id) wi = nil begin split_response http_endpoint_client.get( "workflow/instance/#{wi_id}.xml" ) wi = response_body rescue => ex exception_handler('instance', ex, { 404 => "WorkflowInstance[#{wi_id}]: No workflow instance with that identifier exists." } ) end wi ? Matterhorn::WorkflowInstance.new(wi) : nil end |
#remove(wi_id) ⇒ Object
————————————————————————————- delete —
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/matterhorn/endpoint/workflow.rb', line 85 def remove(wi_id) wi_removed = false begin split_response http_endpoint_client.delete( "workflow/remove/#{wi_id}" ) wi_removed = true rescue => ex exception_handler('remove', ex, { 404 => "WorkflowInstance[#{wi_id}]: No workflow instance with that identifier exists." } ) end wi_removed end |
#resume(wi_id) ⇒ Object
————————————————————————————- update —
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/matterhorn/endpoint/workflow.rb', line 45 def resume(wi_id) wi = nil begin split_response http_endpoint_client.post( "workflow/resume", { 'id' => wi_id } ) wi = response_body rescue => ex exception_handler('resume', ex, { 404 => "WorkflowInstance[#{wi_id}]: No suspended workflow instance " + "with that identifier exists." } ) end wi ? Matterhorn::WorkflowInstance.new(wi) : nil end |
#statistics ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/matterhorn/endpoint/workflow.rb', line 29 def statistics stati = nil begin split_response http_endpoint_client.get( "workflow/statistics.json" ) stati = JSON.parse(response_body) rescue => ex exception_handler('statistics', ex, {}) end stati ? Matterhorn::WorkflowStatistics.new(stati) : nil end |
#stop(wi_id) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/matterhorn/endpoint/workflow.rb', line 64 def stop(wi_id) wi = nil begin split_response http_endpoint_client.post( "workflow/stop", { 'id' => wi_id } ) wi = response_body rescue => ex exception_handler('stop', ex, { 404 => "WorkflowInstance[#{wi_id}]: No running workflow instance " + "with that identifier exists." } ) end wi ? Matterhorn::WorkflowInstance.new(wi) : nil end |