Class: Runcible::Resources::Task
- Defined in:
- lib/runcible/resources/task.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.path(id = nil) ⇒ String
Generates the API path for Tasks.
Instance Method Summary collapse
-
#cancel(id) ⇒ RestClient::Response
Cancels a task.
-
#list(tags = []) ⇒ RestClient::Response
List all tasks based on a set of tags.
-
#poll(id) ⇒ RestClient::Response
Polls for the status of a task.
-
#poll_all(ids) ⇒ Array
Polls all tasks based on array of IDs temporary solution until bugzilla.redhat.com/show_bug.cgi?id=860089.
Methods inherited from Base
#add_http_auth_header, #add_oauth_header, #call, #combine_get_params, #config, #exception_to_log, #format_payload_json, #generate_payload, #get_response, #initialize, #lazy_config=, #log_debug, #log_exception, #log_info, #logger, #path, #process_response, #required_params
Constructor Details
This class inherits a constructor from Runcible::Base
Class Method Details
.path(id = nil) ⇒ String
Generates the API path for Tasks
9 10 11 |
# File 'lib/runcible/resources/task.rb', line 9 def self.path(id = nil) id.nil? ? 'tasks/' : "tasks/#{id}/" end |
Instance Method Details
#cancel(id) ⇒ RestClient::Response
Cancels a task
25 26 27 28 29 |
# File 'lib/runcible/resources/task.rb', line 25 def cancel(id) #cancelling a task may require cancelling some higher level # task, so query the tasks _href field to make sure call(:delete, poll(id)['_href']) end |
#list(tags = []) ⇒ RestClient::Response
List all tasks based on a set of tags
35 36 37 |
# File 'lib/runcible/resources/task.rb', line 35 def list( = []) call(:get, path, :params => {:tag => }) end |
#poll(id) ⇒ RestClient::Response
Polls for the status of a task
17 18 19 |
# File 'lib/runcible/resources/task.rb', line 17 def poll(id) call(:get, path(id)) end |
#poll_all(ids) ⇒ Array
Polls all tasks based on array of IDs temporary solution until bugzilla.redhat.com/show_bug.cgi?id=860089
44 45 46 |
# File 'lib/runcible/resources/task.rb', line 44 def poll_all(ids) return ids.map { |id| poll(id) } end |