Class: Onfleet::Tasks

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

Instance Method Details

#auto_assign(config, body) ⇒ Object

ACTION: still needs to be tested



88
89
90
91
92
93
# File 'lib/resources/tasks.rb', line 88

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

ACTION: still needs to be tested



19
20
21
22
23
24
# File 'lib/resources/tasks.rb', line 19

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

ACTION: still needs to be tested



27
28
29
30
31
32
# File 'lib/resources/tasks.rb', line 27

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



73
74
75
76
77
78
# File 'lib/resources/tasks.rb', line 73

def clone(config, id)
  method = 'post'
  path = "tasks/#{id}/clone"

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

#complete(config, id, body) ⇒ Object

ACTION: still needs to be tested



66
67
68
69
70
71
# File 'lib/resources/tasks.rb', line 66

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



80
81
82
83
84
85
# File 'lib/resources/tasks.rb', line 80

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

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

#get(config, id) ⇒ Object



44
45
46
47
48
49
# File 'lib/resources/tasks.rb', line 44

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



51
52
53
54
55
56
# File 'lib/resources/tasks.rb', line 51

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



34
35
36
37
38
39
40
41
42
# File 'lib/resources/tasks.rb', line 34

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

ACTION: still needs to be tested



96
97
98
99
100
101
# File 'lib/resources/tasks.rb', line 96

def (config, body)
  method = 'post'
  path = 'tasks/metadata'

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

#update(config, id, body) ⇒ Object



58
59
60
61
62
63
# File 'lib/resources/tasks.rb', line 58

def update(config, id, body)
  method = 'put'
  path = "tasks/#{id}"

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