Sha256: 7b25bf500475cce59ddd7abd794bcf4055d14891feaf6501463c28a04a375529
Contents?: true
Size: 1.17 KB
Versions: 5
Compression:
Stored size: 1.17 KB
Contents
require 'json' require 'net/http' require 'uri' module Direct7 class SMS def initialize(client) @client = client end def send_message(originator, report_url, schedule_time, *args) messages = [] args.each do |message| messages << { 'channel' => 'sms', 'recipients' => message[:recipients] || [], 'content' => message[:content] || '', 'msg_type' => 'text', 'data_coding' => message[:unicode] ? 'unicode' : 'text' } end message_globals = { 'originator' => originator, 'report_url' => report_url, 'schedule_time' => schedule_time }; payload = { 'messages' => messages, 'message_globals' => message_globals } response = @client.post(@client.host, '/messages/v1/send', true, params=payload) puts "Message sent successfully." response end def get_status(request_id) response = @client.get(@client.host, "/report/v1/message-log/#{request_id}") puts'Message status retrieved successfully.' response end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
direct7-0.0.18 | lib/direct7/sms.rb |
direct7-0.0.17 | lib/direct7/sms.rb |
direct7-0.0.16 | lib/direct7/sms.rb |
direct7-0.0.13 | lib/direct7/sms.rb |
direct7-0.0.12 | lib/direct7/sms.rb |