Class: UqamGradeNotification::Notifier
- Inherits:
-
Object
- Object
- UqamGradeNotification::Notifier
- Defined in:
- lib/uqam_grade_notification/notifier.rb
Instance Attribute Summary collapse
-
#phone ⇒ Object
readonly
Returns the value of attribute phone.
Instance Method Summary collapse
-
#initialize(args) ⇒ Notifier
constructor
A new instance of Notifier.
- #sms(message) ⇒ Object
Constructor Details
#initialize(args) ⇒ Notifier
Returns a new instance of Notifier.
7 8 9 10 11 12 13 |
# 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 |
Instance Attribute Details
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
5 6 7 |
# File 'lib/uqam_grade_notification/notifier.rb', line 5 def phone @phone end |
Instance Method Details
#sms(message) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/uqam_grade_notification/notifier.rb', line 15 def sms() client = Twilio::REST::Client.new @twilio_account_id, @twilio_token client.account..create({ from: @twilio_phone, to: @phone, body: }) end |