-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- letters instead of numbers for time slot selection in sms - filter available slots by user and person reservations - resend available slots if person selects reserved slot - change how a person declines over sms - sends url of calendar for person in every offer sms specs passing! Oof. So, callbacks to create things suck. more callback futzing. let vs let! when you need a new thing every time around. potentially a fix for our callback heisenbugs more attempts to prevent heisenbugs.
- Loading branch information
Showing
16 changed files
with
213 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# TODO: needs a spec. The spec for SmsReservationsController covers it, | ||
# but a unit test would make coverage more robust | ||
class TimeSlotNotAvailableSms < ApplicationSms | ||
attr_reader :to, :event | ||
|
||
def initialize(to:, event:) | ||
super | ||
@to = to | ||
@event = event | ||
end | ||
|
||
def send | ||
client.messages.create( | ||
from: application_number, | ||
to: to.phone_number, | ||
body: body | ||
) | ||
end | ||
|
||
def body | ||
body = "Sorry, that time is not longer available for: \n" | ||
body << "#{event.description}\n" | ||
available_slots = event.available_time_slots(to) | ||
body << generate_slot_messages(available_slots) | ||
body << "\nThanks!\n\n" | ||
body << 'Best, Kimball team' # TODO: signature should be configurable | ||
end | ||
|
||
# rubocop:disable Metrics/MethodLength, | ||
def generate_slot_messages(available_slots) | ||
msg = '' | ||
if available_slots.length >= 1 | ||
msg << "If you'd like to still attend," | ||
msg << ' would you so kind to select one of the possible times below,' | ||
msg << " by texting back its respective number?\n\n" | ||
available_slots.each_with_index do |slot, i| | ||
msg << "'#{event.id}#{slot_id_to_char(i)}' for #{slot.to_time_and_weekday}\n" | ||
end | ||
msg << "Or visit https://#{ENV['PRODUCTION_SERVER']}/calendar/?token=#{to.token} to pick a time.\n" | ||
msg << "If none of these times work, please respond with: '#{event.id}-Decline' to decline\n" | ||
else | ||
msg << "There are no more available times for this event.\n" | ||
end | ||
msg | ||
end | ||
# rubocop:enable Metrics/MethodLength, | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.