Class: MessageSmsNotification
- Inherits:
-
Object
- Object
- MessageSmsNotification
- Defined in:
- app/models/message_sms_notification.rb
Overview
SMS notification service for Messages and Notifications sent to Participants.
Constant Summary collapse
- BLACKLIST_MESSAGE =
"The message From/To pair violates a blacklist rule."
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#phone_number ⇒ Object
readonly
Returns the value of attribute phone_number.
Instance Method Summary collapse
- #deliver ⇒ Object
-
#initialize(body:, phone_number:) ⇒ MessageSmsNotification
constructor
A new instance of MessageSmsNotification.
Constructor Details
#initialize(body:, phone_number:) ⇒ MessageSmsNotification
Returns a new instance of MessageSmsNotification.
8 9 10 11 |
# File 'app/models/message_sms_notification.rb', line 8 def initialize(body:, phone_number:) @body = body @phone_number = phone_number end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
4 5 6 |
# File 'app/models/message_sms_notification.rb', line 4 def body @body end |
#phone_number ⇒ Object (readonly)
Returns the value of attribute phone_number.
4 5 6 |
# File 'app/models/message_sms_notification.rb', line 4 def phone_number @phone_number end |
Instance Method Details
#deliver ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/models/message_sms_notification.rb', line 13 def deliver if environment.staging? || environment.production? sms_client.account..create else end rescue Twilio::REST::RequestError => e if e. == BLACKLIST_MESSAGE record_delivery_error!(e.) else (e.) end end |