Class: Jbr::Jobs
- Includes:
- Enumerable, Includable
- Defined in:
- lib/jbr/jobs.rb
Overview
The jobs on a Jobber account, oldest first, walked a page at a time.
Direct Known Subclasses
Constant Summary collapse
- FIELDS =
What a job answers with wherever one is read, before anything it was asked to bring back with it.
'id title instructions jobStatus total createdAt startAt completedAt ' \ 'quote { id amounts { total } }'
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#each ⇒ Object
Every job on the account, past and future alike.
-
#find(id) ⇒ Job?
Shadows Enumerable#find on purpose, the way Active Record does: a job is reached by the ID Jobber files it under, not by asking every job on the account whether it is the one.
-
#past ⇒ Enumerator<Job>
The jobs that started before now.
-
#upcoming ⇒ Enumerator<Job>
The jobs scheduled from now on.
Methods included from Includable
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Jbr::Resource
Instance Method Details
#each ⇒ Object
Every job on the account, past and future alike. Nothing is read until the walk starts, and a page is read only once the one before it runs out.
13 |
# File 'lib/jbr/jobs.rb', line 13 def each(&) = walk.each(&) |
#find(id) ⇒ Job?
Shadows Enumerable#find on purpose, the way Active Record does: a job is reached by the ID Jobber files it under, not by asking every job on the account whether it is the one.
25 26 27 28 |
# File 'lib/jbr/jobs.rb', line 25 def find(id) node = @oauth.query(one, variables: { id: id })['job'] Job.new node: node if node end |
#past ⇒ Enumerator<Job>
Returns the jobs that started before now.
19 |
# File 'lib/jbr/jobs.rb', line 19 def past = walk until_now |
#upcoming ⇒ Enumerator<Job>
Returns the jobs scheduled from now on.
16 |
# File 'lib/jbr/jobs.rb', line 16 def upcoming = walk from_now |