Class: EmployeePhoneStatus::QueueStatusPuller

Inherits:
Object
  • Object
show all
Includes:
Service
Defined in:
app/services/employee_phone_status/queue_status_puller.rb

Overview

Merges periodic Switchvox queue snapshots into the webhook-backed state for
each employee without losing newer callbacks or queues omitted by a partial
PBX response.

Instance Method Summary collapse

Methods included from Service

#attributes_used, #build_result, call, #logger

Methods included from Service::Initializer

#initialize

Instance Method Details

#callArray

Returns retained for the legacy +pull_queue_status+ contract.

Returns:

  • (Array)

    retained for the legacy +pull_queue_status+ contract



13
14
15
16
17
18
19
20
21
22
# File 'app/services/employee_phone_status/queue_status_puller.rb', line 13

def call
  self.observed_at ||= Time.current

  .each do |, queue_statuses|
    phone_status = EmployeePhoneStatus.find_by(switchvox_account_id:)
    merge_snapshot(phone_status, queue_statuses) if phone_status
  end

  []
end