Sha256: d363bd7b4ed49da16618f213a6d88844b91d015fb3ac30a999380acf1f6af8c2
Contents?: true
Size: 779 Bytes
Versions: 5
Compression:
Stored size: 779 Bytes
Contents
# frozen_string_literal: true require "rubygems" require "twilio-ruby" # A set of utility methods used in relation to SMS notifications module Sms def send_sms(recipient, message_body) return unless Rails.env.staging? || Rails.env.production? return if recipient.phone_number.blank? client = Twilio::REST::Client.new( Rails.application.config.twilio_account_sid, Rails.application.config.twilio_auth_token ) account = client.account account.messages.create(message_attributes(recipient, message_body)) end private def message_attributes(recipient, body) { from: Rails.application.config.twilio_account_telephone_number.to_s, to: "+#{recipient.phone_number}", body: body } end end
Version data entries
5 entries across 5 versions & 1 rubygems