Class: Hatchet::Features::Workers
- Inherits:
-
Object
- Object
- Hatchet::Features::Workers
- Defined in:
- lib/hatchet/features/workers.rb
Overview
Workers client for managing workers programmatically within Hatchet
This class provides a high-level interface for retrieving, listing, and updating workers in the Hatchet system.
Instance Method Summary collapse
-
#get(worker_id) ⇒ Object
Get a worker by its ID.
-
#initialize(rest_client, config) ⇒ void
constructor
Initializes a new Workers client instance.
-
#list ⇒ Object
List all workers in the tenant.
-
#update(worker_id, opts) ⇒ Object
Update a worker by its ID.
Constructor Details
#initialize(rest_client, config) ⇒ void
Initializes a new Workers client instance
24 25 26 27 28 |
# File 'lib/hatchet/features/workers.rb', line 24 def initialize(rest_client, config) @rest_client = rest_client @config = config @worker_api = HatchetSdkRest::WorkerApi.new(rest_client) end |
Instance Method Details
#get(worker_id) ⇒ Object
Get a worker by its ID
37 38 39 |
# File 'lib/hatchet/features/workers.rb', line 37 def get(worker_id) @worker_api.worker_get(worker_id) end |
#list ⇒ Object
List all workers in the tenant
47 48 49 |
# File 'lib/hatchet/features/workers.rb', line 47 def list @worker_api.worker_list(@config.tenant_id) end |
#update(worker_id, opts) ⇒ Object
Update a worker by its ID
59 60 61 62 |
# File 'lib/hatchet/features/workers.rb', line 59 def update(worker_id, opts) update_request = HatchetSdkRest::UpdateWorkerRequest.new(opts) @worker_api.worker_update(worker_id, update_request) end |