Mediaburst Gem
Agency: Codebeef
In order to make it stupidly simple to integrate with the Mediaburst API, I was asked to develop a Ruby Gem that could provide an easy to use interface for Ruby developers.
Installation
Install the gem as normal:
sudo gem install mediaburst
The Mediaburst gem also relies on Nokogiri for XML parsing.
Usage
Create an instance of the Mediaburst client:
client = Mediaburst::API.new('username', 'password')
Send an SMS:
response = client.send_message('441234567890', 'My test message')
Send a message to several numbers:
response = client.send_message(['441234567890', '441234567891', '441234567892'], 'My test message')
Send a long message to several numbers using the concat option:
options = {
:concat => 3
}
response = client.send_message(['441234567890', '441234567891', '441234567892', '44'], SOME_LONG_MESSAGE, options)
Check the response for errors:
y response
=> ---
"441234567890": true
"441234567891": true
"441234567892": true
"44": 10
On error, the value of the key referenced by the number will equal the error code returned from Mediaburst.
Development
The source for the gem is hosted on GitHub for you to peruse, fork and contribute to.
To enable us to easily manage your contributions, please submit your pull requests as single commits that include tests to show your changes working as normal. Please do not change the version number - we’ll take care of that as we merge your changes.
License
Copyright © 2011 Matthew Hall, released under the ISC license. All trademarks and IP remain the property of their respective owners.