Class: Jbr::Jobs

Inherits:
Resource show all
Includes:
Includable, Listable
Defined in:
lib/jbr/jobs.rb

Overview

The jobs on a Jobber account, oldest first, walked a page at a time.

Direct Known Subclasses

Mock::Jobs

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 } }'

Constants included from Listable

Listable::IDS_PAGE, Listable::PAGE

Instance Attribute Summary

Attributes inherited from Resource

#id

Instance Method Summary collapse

Methods included from Includable

#includes

Methods included from Listable

#each, #ids, #past, #upcoming

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Jbr::Resource

Instance Method Details

#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.

Parameters:

  • id (String)

    the Jobber ID of the job.

Returns:

  • (Job, nil)

    nil when Jobber has no job under that ID.



15
16
17
18
# File 'lib/jbr/jobs.rb', line 15

def find(id)
  node = @oauth.query(one, variables: { id: id })['job']
  Job.new node: node if node
end