class AfricasTalking::Message
Public Instance Methods
deliver(recipients, message, username)
click to toggle source
POST /version1/messaging
# File lib/africas_talking/message.rb, line 10 def deliver(recipients, message, username) post('/version1/messaging', {username: username, message: message, to: prepare_recipients(recipients)}) end
deliver_with_shortcode(recipients, message, from, username)
click to toggle source
POST /version1/messaging
# File lib/africas_talking/message.rb, line 20 def deliver_with_shortcode(recipients, message, from, username) post('/version1/messaging', {username: username, message: message, to: recipients, from: from}) end
enqueue_messages(opts)
click to toggle source
POST /version1/messaging
# File lib/africas_talking/message.rb, line 35 def enqueue_messages(opts) post('/version1/messaging', { to: opts.fetch(:recipients), message: opts.fetch(:message, ""), sender: opts.fetch(:sender, nil), enqueue: opts.fetch(:enqueue,1), bulkSMSMode: opts.fetch(:bulkSMSMode, 1), username: opts.fetch(:username)}) end
fetch_messages(username, last_received_id=0)
click to toggle source
GET /?username=#{ENV}&lastReceivedId=#{last_received_id}
The gateway will return 10 messages at a time back to you, starting with what you currently believe is the lastReceivedId. Specify 0 for the first time you access the gateway, and the ID of the last message we sent you on subsequent results
# File lib/africas_talking/message.rb, line 71 def fetch_messages(username, last_received_id=0) get("/version1/messaging?username=#{username}&lastReceivedId=#{last_received_id}") end