class UqamGradeNotification::Notifier

Attributes

phone[R]

Public Class Methods

new(args) click to toggle source
# File lib/uqam_grade_notification/notifier.rb, line 7
def initialize args
  args = HashWithIndifferentAccess.new(args)
  @phone = args.fetch("phone")
  @twilio_account_id = args.fetch("twilio_account_id")
  @twilio_token = args.fetch("twilio_token")
  @twilio_phone = args.fetch("twilio_phone")
end

Public Instance Methods

sms(message) click to toggle source
# File lib/uqam_grade_notification/notifier.rb, line 15
def sms(message)
  client = Twilio::REST::Client.new @twilio_account_id, @twilio_token

  client.account.messages.create({
    from: @twilio_phone,
    to: @phone,
    body: message
  })
end