Class: Jbr::Visits

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

Overview

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

Direct Known Subclasses

Mock::Visits

Constant Summary collapse

FIELDS =

What a visit answers with, before anything it was asked to bring back with it.

'id title startAt endAt allDay clientConfirmed job { id }'

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) ⇒ Visit?

Shadows Enumerable#find on purpose, the way jobs do: a visit is reached by the ID Jobber files it under, not by asking every visit on the account whether it is the one.

Parameters:

  • id (String)

    the Jobber ID of the visit.

Returns:

  • (Visit, nil)

    nil when Jobber has no visit under that ID.



13
14
15
16
# File 'lib/jbr/visits.rb', line 13

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