Class: SchedulerBookingLeadProcessor
- Inherits:
-
Object
- Object
- SchedulerBookingLeadProcessor
- Defined in:
- app/services/scheduler_booking_lead_processor.rb
Overview
Service object: scheduler booking lead processor.
Instance Attribute Summary collapse
-
#booking ⇒ Object
readonly
Returns the value of attribute booking.
Class Method Summary collapse
-
.customer_for_sales_rep_invite(booking) ⇒ Object
Existing customer matched by guest email/phone (same rules as #process), or nil.
Instance Method Summary collapse
-
#initialize(booking) ⇒ SchedulerBookingLeadProcessor
constructor
A new instance of SchedulerBookingLeadProcessor.
- #process ⇒ Object
Constructor Details
#initialize(booking) ⇒ SchedulerBookingLeadProcessor
Returns a new instance of SchedulerBookingLeadProcessor.
16 17 18 |
# File 'app/services/scheduler_booking_lead_processor.rb', line 16 def initialize(booking) @booking = booking end |
Instance Attribute Details
#booking ⇒ Object (readonly)
Returns the value of attribute booking.
5 6 7 |
# File 'app/services/scheduler_booking_lead_processor.rb', line 5 def booking @booking end |
Class Method Details
.customer_for_sales_rep_invite(booking) ⇒ Object
Existing customer matched by guest email/phone (same rules as #process), or nil.
Used to invite the customer's primary sales rep on calendar events before party_id is set.
9 10 11 12 13 14 |
# File 'app/services/scheduler_booking_lead_processor.rb', line 9 def self.customer_for_sales_rep_invite(booking) party = new(booking).send(:find_existing_party) return unless party party.is_a?(Customer) ? party : party.try(:customer) end |
Instance Method Details
#process ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/services/scheduler_booking_lead_processor.rb', line 20 def process party = find_existing_party || create_lead_qualify_customer return unless party activity = create_booking_activity(party) booking.update_columns(party_id: party.customer_id || party.id) if activity&.persisted? activity end |