Class: Onfleet::Teams

Inherits:
Object
  • Object
show all
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

Instance Method Details

#auto_dispatch(config, id, body) ⇒ Object

ACTION: still needs to be tested



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

ACTION: still needs to be tested



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/resources/teams.rb', line 53

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) ⇒ Object

ACTION: still needs to be tested



67
68
69
70
71
72
# File 'lib/resources/teams.rb', line 67

def get_unassigned_tasks(config, id)
  method = 'get'
  path = "teams/#{id}/tasks"

  Onfleet.request(config, method.to_sym, path)
end

#insert_task(config, team_id, body) ⇒ Object

ACTION: still needs to be tested



75
76
77
78
79
80
# File 'lib/resources/teams.rb', line 75

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