Module: Hcp::Statused

Included in:
Estimate, Job
Defined in:
lib/hcp/concerns/statused.rb

Overview

Extends a record Housecall Pro moves through a workflow.

Constant Summary collapse

STATUSES =

Housecall Pro narrows a list by one set of words and answers with another, so a caller who filters by :in_progress reads :in_progress back rather than 'in progress'.

{
  'needs scheduling' => :unscheduled,
  'scheduled' => :scheduled,
  'in progress' => :in_progress,
  'complete rated' => :completed,
  'complete unrated' => :completed,
  'user canceled' => :canceled,
  'pro canceled' => :canceled,
}

Instance Method Summary collapse

Instance Method Details

#rated?Boolean

A rating is not a status, so it reads beside one rather than inside it.

Returns:

  • (Boolean)

    whether the customer rated the work.



21
# File 'lib/hcp/concerns/statused.rb', line 21

def rated? = @node['work_status'] == 'complete rated'

#work_statusSymbol?

Returns where Housecall Pro files the record in its own workflow.

Returns:

  • (Symbol, nil)

    where Housecall Pro files the record in its own workflow.



17
# File 'lib/hcp/concerns/statused.rb', line 17

def work_status = STATUSES[@node['work_status']]