Class: Company::Visit

Inherits:
Resource show all
Defined in:
lib/company/resources/visit.rb

Overview

Booked time: somebody is somewhere for an hour. Where it is, who is going and when are what a visit is for; the job or the lead it was booked against says why, and either may be absent.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#id, #initialize, keys, node_keys

Constructor Details

This class inherits a constructor from Company::Resource

Class Method Details

.attributes ⇒ Object

What every visit reads, by the vocabulary's names.



6
# File 'lib/company/resources/visit.rb', line 6

def self.attributes = %i[id description starts_at ends_at anytime]

Instance Method Details

#anytime? ⇒ Boolean?

Returns whether the visit may happen any time that day rather than at an hour.

Returns:

  • (Boolean, nil) —

    whether the visit may happen any time that day rather than at an hour.



18
# File 'lib/company/resources/visit.rb', line 18

def anytime? = attribute :anytime

#description ⇒ String?

Returns what the stop is, in the words of whoever booked it.

Returns:

  • (String, nil) —

    what the stop is, in the words of whoever booked it.



9
# File 'lib/company/resources/visit.rb', line 9

def description = attribute :description

#ends_at ⇒ Time?

Returns moment the visit is booked to end.

Returns:

  • (Time, nil) —

    moment the visit is booked to end.



15
# File 'lib/company/resources/visit.rb', line 15

def ends_at = time :ends_at

#job ⇒ Job?

Returns job the stop belongs to, nil where no job was booked for it.

Returns:

  • (Job, nil) —

    job the stop belongs to, nil where no job was booked for it.



26
# File 'lib/company/resources/visit.rb', line 26

def job = record Job, :job

#lead ⇒ Lead?

Returns lead the stop belongs to, nil where no lead was booked for it.

Returns:

  • (Lead, nil) —

    lead the stop belongs to, nil where no lead was booked for it.



29
# File 'lib/company/resources/visit.rb', line 29

def lead = record Lead, :lead

#location ⇒ Location?

A stop says where it is without being asked what it was booked for, so a caller reading a schedule never has to reach through a job to find an address.

Returns:

  • (Location, nil) —

    where the work happens, nil where the stop is booked nowhere.



23
# File 'lib/company/resources/visit.rb', line 23

def location = record Location, :location

#starts_at ⇒ Time?

Returns moment the visit is booked to start.

Returns:

  • (Time, nil) —

    moment the visit is booked to start.



12
# File 'lib/company/resources/visit.rb', line 12

def starts_at = time :starts_at

#technicians ⇒ Array<Technician>

Returns whoever the stop is booked for, where the platform names them.

Returns:

  • (Array<Technician>) —

    whoever the stop is booked for, where the platform names them.



32
# File 'lib/company/resources/visit.rb', line 32

def technicians = records Technician, :technicians