Class: Zizq::Resources::JobPage
- Defined in:
- lib/zizq/resources/job_page.rb,
sig/generated/zizq/resources/job_page.rbs
Overview
Paginated list of jobs.
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#delete_all ⇒ Integer
Delete all jobs on this page.
-
#items ⇒ Object
(also: #jobs)
: () -> Array.
-
#update_all(queue: Zizq::UNCHANGED, priority: Zizq::UNCHANGED, ready_at: Zizq::UNCHANGED, retry_limit: Zizq::UNCHANGED, backoff: Zizq::UNCHANGED, retention: Zizq::UNCHANGED) ⇒ Integer
Update all jobs on this page with the given field values.
Methods inherited from Page
#each, #has_next?, #has_prev?, #next_page, #prev_page, #to_h, #wrap_page
Methods inherited from Resource
#initialize, #inspect, #ms_to_seconds, #to_h
Constructor Details
This class inherits a constructor from Zizq::Resources::Resource
Instance Method Details
#delete_all ⇒ Integer
Delete all jobs on this page.
Returns the number of deleted jobs.
23 24 25 26 27 28 |
# File 'lib/zizq/resources/job_page.rb', line 23 def delete_all ids = jobs.map(&:id) return 0 if ids.empty? client.delete_all_jobs(where: { id: ids }) end |
#items ⇒ Object Also known as: jobs
: () -> Array
12 13 14 |
# File 'lib/zizq/resources/job_page.rb', line 12 def items #: () -> Array[Job] @items ||= (@data["jobs"] || []).map { |j| Job.new(client, j) } end |
#update_all(queue: Zizq::UNCHANGED, priority: Zizq::UNCHANGED, ready_at: Zizq::UNCHANGED, retry_limit: Zizq::UNCHANGED, backoff: Zizq::UNCHANGED, retention: Zizq::UNCHANGED) ⇒ Integer
Update all jobs on this page with the given field values.
Returns the number of updated jobs.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/zizq/resources/job_page.rb', line 41 def update_all(queue: Zizq::UNCHANGED, priority: Zizq::UNCHANGED, ready_at: Zizq::UNCHANGED, retry_limit: Zizq::UNCHANGED, backoff: Zizq::UNCHANGED, retention: Zizq::UNCHANGED) ids = jobs.map(&:id) return 0 if ids.empty? client.update_all_jobs( where: { id: ids }, apply: { queue:, priority:, ready_at:, retry_limit:, backoff:, retention: }, ) end |