Class: Onfleet::Tasks
- Inherits:
-
Object
- Object
- Onfleet::Tasks
- Defined in:
- lib/resources/tasks.rb
Overview
Tasks represent units of work, defined by one destination and one recipient, that administrators create and assign to workers for completion. Task assignment, state and dependencies are important concepts that you should understand well prior to using the task endpoints.
Instance Method Summary collapse
- #auto_assign(config, body) ⇒ Object
- #batch_create(config, body) ⇒ Object
- #batch_create_async(config, body) ⇒ Object
- #clone(config, id) ⇒ Object
- #complete(config, id, body) ⇒ Object
- #create(config, body) ⇒ Object
- #delete(config, id) ⇒ Object
- #get(config, id) ⇒ Object
- #get_by_short_id(config, short_id) ⇒ Object
- #list(config, query_parameters_hash) ⇒ Object
- #match_metadata(config, body) ⇒ Object
- #update(config, id, body) ⇒ Object
Instance Method Details
#auto_assign(config, body) ⇒ Object
84 85 86 87 88 89 |
# File 'lib/resources/tasks.rb', line 84 def auto_assign(config, body) method = 'post' path = 'tasks/autoAssign' Onfleet.request(config, method.to_sym, path, body.to_json) end |
#batch_create(config, body) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/resources/tasks.rb', line 18 def batch_create(config, body) method = 'post' path = 'tasks/batch' Onfleet.request(config, method.to_sym, path, body.to_json) end |
#batch_create_async(config, body) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/resources/tasks.rb', line 25 def batch_create_async(config, body) method = 'post' path = 'tasks/batch-async' Onfleet.request(config, method.to_sym, path, body.to_json) end |
#clone(config, id) ⇒ Object
70 71 72 73 74 75 |
# File 'lib/resources/tasks.rb', line 70 def clone(config, id) method = 'post' path = "tasks/#{id}/clone" Onfleet.request(config, method.to_sym, path) end |
#complete(config, id, body) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/resources/tasks.rb', line 63 def complete(config, id, body) method = 'post' path = "tasks/#{id}/complete" Onfleet.request(config, method.to_sym, path, body.to_json) end |
#create(config, body) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/resources/tasks.rb', line 11 def create(config, body) method = 'post' path = 'tasks' Onfleet.request(config, method.to_sym, path, body.to_json) end |
#delete(config, id) ⇒ Object
77 78 79 80 81 82 |
# File 'lib/resources/tasks.rb', line 77 def delete(config, id) method = 'delete' path = "tasks/#{id}" Onfleet.request(config, method.to_sym, path) end |
#get(config, id) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/resources/tasks.rb', line 42 def get(config, id) method = 'get' path = "tasks/#{id}" Onfleet.request(config, method.to_sym, path) end |
#get_by_short_id(config, short_id) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/resources/tasks.rb', line 49 def get_by_short_id(config, short_id) method = 'get' path = "tasks/shortId/#{short_id}" Onfleet.request(config, method.to_sym, path) end |
#list(config, query_parameters_hash) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/resources/tasks.rb', line 32 def list(config, query_parameters_hash) method = 'get' # NOTE: parameters included here must be a hash object that is translated to URL query parameters # The from parameter is the only required query parameter for this API call - must be formatted in Unix time. query_parameters = URI.encode_www_form(query_parameters_hash) path = "tasks/all?#{query_parameters}" Onfleet.request(config, method.to_sym, path) end |
#match_metadata(config, body) ⇒ Object
91 92 93 94 95 96 |
# File 'lib/resources/tasks.rb', line 91 def (config, body) method = 'post' path = 'tasks/metadata' Onfleet.request(config, method.to_sym, path, body.to_json) end |
#update(config, id, body) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/resources/tasks.rb', line 56 def update(config, id, body) method = 'put' path = "tasks/#{id}" Onfleet.request(config, method.to_sym, path, body.to_json) end |