Class: Onfleet::Containers

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

Overview

Containers are an abstraction which describes task assignment. A container is an ordered list of tasks. Tasks belong to exactly one container once created and when reassigned. When a task is started by a worker, it is no longer part of that container’s tasks. Organizations, teams and workers all correspond to containers as they can all be assigned tasks.

Instance Method Summary collapse

Instance Method Details

#get(config, entity, id) ⇒ Object



9
10
11
12
13
14
# File 'lib/resources/containers.rb', line 9

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

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

#update_tasks(config, worker_id, body) ⇒ Object

This replacement method is only supported on the worker container type.



17
18
19
20
21
22
# File 'lib/resources/containers.rb', line 17

def update_tasks(config, worker_id, body)
  method = 'put'
  path = "containers/workers/#{worker_id}"

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