What is it?
A Ruby interface to the MobilePronto SMS gateway API. Please note: this gem is a proxy to MobiePronto SMS gateway, to use it you should get your credentials with the service of MobilePronto, not responsible at any time by the service offered by MobilePronto.
Installation
Download the latest version of gem or install using RubyGems.
$ sudo gem install mobilepronto
MobilePronto on GitHub
$ git clone git://github.com/nuxlli/mobilepronto.git
Basic Usage
To use this gem, you will need sign up for an account at the MobilePronto website. Once you are registered and logged into your account centre, you should add an HTTP API connection to your account. This will give you your CREDENCIAL.
Demonstration
EnviaSMS
require 'mobilepronto'
# Configure default values
MobilePronto.configure do |config|
# Default api url
# config.url_api = "http://www.mpgateway.com/v_2_00/smspush/enviasms.aspx"
config.credencial = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
config.project_name = "MYPROJECT"
config.send_project = true
end
sms = {
:mobile => 552199999999,
:user_name => "MYUSER",
:message => "Mensagem de test"
}
# Using blocks to analyze the result
MobilePronto.send_sms(sms) do |result|
result.on(:ok) { puts "Mensagem sendend..." }
result.on(1..999) { puts "Ops: #{result.error.}"}
end
# Or begin/rescue
begin
MobilePronto.send_sms(sms)
rescue MobilePronto::SendError => e
puts "Ops: #{e.}"
end
References
http://www.mobilepronto.info/samples/en-US/1205-httpget-php-v_2_00.pdf
License
MobilePronto is licensed under the BSD License.
See LICENSE file for details.