Simsen
Add SMS sending capability to your application.
A simple wrapper provides basic functionally needed to create a SMS.
Also a DSL to setup the gateway and deliver the SMS is applied.
Because every provider has a different API this has to be implemented for each gateway that inherit from this wraper.
Read the Wiki for more details.
Installation
Add this line to your application's Gemfile:
gem 'simsen', :git => 'git@github.com:SalesLentz/simsen.git'
And then execute:
$ bundle
Usage
Implement your own wrapper for your required third-party SMS gateway provider or choose one of the existing implementations.
If you're going to implement a new wrapper please refer to our example
Selecting and configuring the wrapper is done within the setup block.
The following setup options are provided. Please note that a wrapper could use only a subset of them according to the provider API functionality. Please consult the wrapper test or documentation for more information.
Simsen.setup do |config|
config.gateway = :example_gateway
config.password = 'secret'
config.sender = 'Sales-Lentz'
config.testmode = :off
config.testmode_strategy = :succeed
config.username = 'username'
end
After setup is done just create a new SMS and deliver it. This method takes two parameters. First the message you want to send and second the recipients phone number.
sms = Simsen.new_sms('A short message', 352000000000)
Now you can deliver the SMS by calling deliver
on the returned object.
sms.deliver
You can find an example implementation as a ruby script using bundler here: https://gist.github.com/3750204
Available gateway wrapper
Testing
All tests are written in RSpec, so if you checkout this gem from Github https://github.com/SalesLentz/simsen you can run the tests with
$ bundle exec rake
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request