Class: Onfleet::Routeplans

Inherits:
Object
  • Object
show all
Defined in:
lib/resources/routeplans.rb

Instance Method Summary collapse

Instance Method Details

#add_tasks_to_routeplan(config, id, body) ⇒ Object



38
39
40
41
42
43
# File 'lib/resources/routeplans.rb', line 38

def add_tasks_to_routeplan(config, id, body)
    method = 'put'
    path = "routePlans/#{id}/tasks"
   
    Onfleet.request(config, method.to_sym, path, body.to_json)
end

#create(config, body) ⇒ Object



7
8
9
10
11
12
# File 'lib/resources/routeplans.rb', line 7

def create(config, body)
  method = 'post'
  path = 'routePlans'

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

#delete_one(config, id) ⇒ Object



45
46
47
48
49
50
# File 'lib/resources/routeplans.rb', line 45

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

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

#get(config, query_parameters_hash) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/resources/routeplans.rb', line 14

def get(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 = "routePlans?#{query_parameters}"

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

#get_by_id(config, id) ⇒ Object



24
25
26
27
28
29
# File 'lib/resources/routeplans.rb', line 24

def get_by_id(config, id)
  method = 'get'
  path = "routePlans/#{id}"

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

#update(config, id, body) ⇒ Object



31
32
33
34
35
36
# File 'lib/resources/routeplans.rb', line 31

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

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