Sha256: 4dfc5a2c78e2e97bd2e2de2eb406bd585ed57af7ad120dff154897d48d17536e

Contents?: true

Size: 870 Bytes

Versions: 5

Compression:

Stored size: 870 Bytes

Contents

require_relative '../onfleet'

module Onfleet
  # 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.
  class Containers
    def get(config, entity, id)
      method = 'get'
      path = "containers/#{entity}/#{id}"

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

    # This replacement method is only supported on the worker container type.
    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
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-onfleet-1.0.5 lib/resources/containers.rb
ruby-onfleet-1.0.4 lib/resources/containers.rb
ruby-onfleet-1.0.3 lib/resources/containers.rb
ruby-onfleet-1.0.2 lib/resources/containers.rb
ruby-onfleet-1.0.1 lib/resources/containers.rb