Class: Direct7::SMS
- Inherits:
-
Object
- Object
- Direct7::SMS
- Defined in:
- lib/direct7/sms.rb
Instance Method Summary collapse
- #get_status(request_id) ⇒ Object
-
#initialize(client) ⇒ SMS
constructor
A new instance of SMS.
- #send_message(recipients, content, originator, report_url = nil, unicode = false) ⇒ Object
Constructor Details
#initialize(client) ⇒ SMS
Returns a new instance of SMS.
7 8 9 |
# File 'lib/direct7/sms.rb', line 7 def initialize(client) @client = client end |
Instance Method Details
#get_status(request_id) ⇒ Object
31 32 33 34 35 |
# File 'lib/direct7/sms.rb', line 31 def get_status(request_id) response = @client.get(@client.host, "/report/v1/message-log/#{request_id}") puts'Message status retrieved successfully.' response end |
#send_message(recipients, content, originator, report_url = nil, unicode = false) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/direct7/sms.rb', line 11 def (recipients, content, originator, report_url = nil, unicode = false) = { 'channel' => 'sms', 'content' => content, 'msg_type' => 'text', 'data_coding' => unicode ? 'unicode' : 'text', 'recipients' => recipients }; = { 'originator' => originator, 'report_url' => report_url, }; response = @client.post(@client.host, '/messages/v1/send', true, params= { 'messages' => [], 'message_globals' => }) # puts "Message sent successfully." response end |