Class: Runcible::Resources::Task
- Defined in:
- lib/runcible/resources/task.rb
Overview
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, #format_payload_json, #generate_log_message, #generate_payload, #get_response, #initialize, #lazy_config=, #log_debug, #log_exception, #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
34 35 36 |
# File 'lib/runcible/resources/task.rb', line 34 def self.path(id=nil) (id == nil) ? "tasks/" : "tasks/#{id}/" end |
Instance Method Details
#cancel(id) ⇒ RestClient::Response
Cancels a task
50 51 52 53 54 |
# File 'lib/runcible/resources/task.rb', line 50 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
60 61 62 |
# File 'lib/runcible/resources/task.rb', line 60 def list(=[]) call(:get, path, :params=>{:tag=>}) end |
#poll(id) ⇒ RestClient::Response
Polls for the status of a task
42 43 44 |
# File 'lib/runcible/resources/task.rb', line 42 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
69 70 71 |
# File 'lib/runcible/resources/task.rb', line 69 def poll_all(ids) return ids.collect{|id| poll(id)} end |