Class: Onfleet::Teams
- Inherits:
-
Object
- Object
- Onfleet::Teams
- Defined in:
- lib/resources/teams.rb
Overview
Teams are named entities that bring together administrators and workers belonging to the same organization. Teams have hubs from where its workers may start and end their shifts.
Instance Method Summary collapse
- #auto_dispatch(config, id, body) ⇒ Object
- #create(config, body) ⇒ Object
- #delete(config, id) ⇒ Object
- #driver_time_estimate(config, worker_id, query_parameters_hash = nil) ⇒ Object
- #get(config, id) ⇒ Object
-
#get_unassigned_tasks(config, id, query_parameters_hash = nil) ⇒ Object
ACTION: still needs to be tested - need to include query_parameters.
- #insert_task(config, team_id, body) ⇒ Object
- #list(config) ⇒ Object
- #update(config, id, body) ⇒ Object
Instance Method Details
#auto_dispatch(config, id, body) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/resources/teams.rb', line 45 def auto_dispatch(config, id, body) method = 'post' path = "teams/#{id}/dispatch" Onfleet.request(config, method.to_sym, path, body.to_json) end |
#create(config, body) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/resources/teams.rb', line 9 def create(config, body) method = 'post' path = 'teams' Onfleet.request(config, method.to_sym, path, body.to_json) end |
#delete(config, id) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/resources/teams.rb', line 37 def delete(config, id) method = 'delete' path = "teams/#{id}" Onfleet.request(config, method.to_sym, path) end |
#driver_time_estimate(config, worker_id, query_parameters_hash = nil) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/resources/teams.rb', line 52 def driver_time_estimate(config, worker_id, query_parameters_hash = nil) method = 'get' # NOTE: parameters included here must be a hash object that is translated to URL query parameters query_parameters = nil if query_parameters_hash query_parameters = URI.encode_www_form(query_parameters_hash) end path = "teams/#{worker_id}/estimate?#{query_parameters}" Onfleet.request(config, method.to_sym, path) end |
#get(config, id) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/resources/teams.rb', line 23 def get(config, id) method = 'get' path = "teams/#{id}" Onfleet.request(config, method.to_sym, path) end |
#get_unassigned_tasks(config, id, query_parameters_hash = nil) ⇒ Object
ACTION: still needs to be tested - need to include query_parameters
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/resources/teams.rb', line 66 def get_unassigned_tasks(config, id, query_parameters_hash = nil) method = 'get' # NOTE: parameters included here must be a hash object that is translated to URL query parameters query_parameters = nil if query_parameters_hash query_parameters = URI.encode_www_form(query_parameters_hash) end path = "teams/#{id}/tasks?#{query_parameters}" Onfleet.request(config, method.to_sym, path) end |
#insert_task(config, team_id, body) ⇒ Object
79 80 81 82 83 84 |
# File 'lib/resources/teams.rb', line 79 def insert_task(config, team_id, body) method = 'put' path = "containers/teams/#{team_id}" Onfleet.request(config, method.to_sym, path, body.to_json) end |
#list(config) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/resources/teams.rb', line 16 def list(config) method = 'get' path = 'teams' Onfleet.request(config, method.to_sym, path) end |
#update(config, id, body) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/resources/teams.rb', line 30 def update(config, id, body) method = 'put' path = "teams/#{id}" Onfleet.request(config, method.to_sym, path, body.to_json) end |