Class: Versafleet::JobsResource
Instance Attribute Summary
Attributes inherited from Resource
#client
Instance Method Summary
collapse
Methods inherited from Resource
#initialize
Instance Method Details
#cancel(job_id:) ⇒ Object
20
21
22
|
# File 'lib/versafleet/resources/jobs.rb', line 20
def cancel(job_id:)
Job.new put_request("v2/jobs/#{job_id}/cancel", body: {}).body
end
|
#create(**attributes) ⇒ Object
8
9
10
|
# File 'lib/versafleet/resources/jobs.rb', line 8
def create(**attributes)
Job.new post_request("v2/jobs", body: attributes).body.dig("job")
end
|
#list(**params) ⇒ Object
3
4
5
6
|
# File 'lib/versafleet/resources/jobs.rb', line 3
def list(**params)
response = get_request("v2/jobs", params: params)
Collection.from_response(response, key: "jobs", type: Job)
end
|
#list_tasks(job_id:) ⇒ Object
24
25
26
27
|
# File 'lib/versafleet/resources/jobs.rb', line 24
def list_tasks(job_id:)
response = get_request("v2/jobs/#{job_id}/tasks")
Collection.from_response(response, key: "tasks", type: Task)
end
|
#retrieve(job_id:) ⇒ Object
16
17
18
|
# File 'lib/versafleet/resources/jobs.rb', line 16
def retrieve(job_id:)
Job.new get_request("v2/jobs/#{job_id}").body.dig("job")
end
|
#update(job_id:, **attributes) ⇒ Object
12
13
14
|
# File 'lib/versafleet/resources/jobs.rb', line 12
def update(job_id:, **attributes)
Job.new put_request("v2/jobs/#{job_id}", body: attributes).body.dig("job")
end
|