Class: Nuntius::TwilioSmsProvider

Inherits:
BaseProvider show all
Defined in:
app/providers/nuntius/twilio_sms_provider.rb

Overview

Send SMS messages using twilio.com

Instance Attribute Summary

Attributes inherited from BaseProvider

#message

Instance Method Summary collapse

Methods inherited from BaseProvider

all_settings, #callback, class_from_name, #initialize, #name, setting_reader, states, transport

Constructor Details

This class inherits a constructor from Nuntius::BaseProvider

Instance Method Details

#deliverObject



17
18
19
20
21
22
# File 'app/providers/nuntius/twilio_sms_provider.rb', line 17

def deliver
  response = client.messages.create(from: message.from.present? ? message.from : from, to: message.to, body: message.text)
  message.provider_id = response.sid
  message.status = translated_status(response.status)
  message
end

#refreshObject



24
25
26
27
28
29
# File 'app/providers/nuntius/twilio_sms_provider.rb', line 24

def refresh
  response = client.messages(message.provider_id).fetch
  message.provider_id = response.sid
  message.status = translated_status(response.status)
  message
end