Sha256: d2a8ab42e880b3998cf3e8b90339851c39dd4b73271092f14aa67b6c71b1c49d
Contents?: true
Size: 1016 Bytes
Versions: 14
Compression:
Stored size: 1016 Bytes
Contents
# SMS notification service for Messages and Notifications sent to Participants. class MessageSmsNotification attr_reader :body, :phone_number def initialize(body:, phone_number:) @body = body @phone_number = phone_number end def deliver if environment.staging? || environment.production? sms_client.account.messages.create message else message end end private def config Rails.application.config end def environment Rails.env end def status_callback_url config.try(:status_callback_url) end def from_telephone_number config.try(:twilio_account_telephone_number) end def message params = { to: "+1#{ phone_number }", from: from_telephone_number, body: body } if status_callback_url params[:status_callback] = status_callback_url end params end def sms_client @sms_client ||= Twilio::REST::Client.new( config.twilio_account_sid, config.twilio_auth_token) end end
Version data entries
14 entries across 14 versions & 1 rubygems