Class: SchedulerBookingLeadProcessor
- Inherits:
-
Object
- Object
- SchedulerBookingLeadProcessor
- Defined in:
- app/services/scheduler_booking_lead_processor.rb
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.
15 16 17 |
# File 'app/services/scheduler_booking_lead_processor.rb', line 15 def initialize(booking) @booking = booking end |
Instance Attribute Details
#booking ⇒ Object (readonly)
Returns the value of attribute booking.
4 5 6 |
# File 'app/services/scheduler_booking_lead_processor.rb', line 4 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.
8 9 10 11 12 13 |
# File 'app/services/scheduler_booking_lead_processor.rb', line 8 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
19 20 21 22 23 24 25 26 |
# File 'app/services/scheduler_booking_lead_processor.rb', line 19 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 |