A Ruby client that allows you to send SMS messages via {www.mollie.nl/sms-diensten/sms-gateway Mollie.nl}.
See {Mollie::SMS} for the API documentation. Or, if you are reading this as plain text, on {rdoc.info/projects/Fingertips/Mollie-SMS rdoc.info}.
See the Mollie.nl API {www.mollie.nl/support/documentatie/sms-diensten/sms/http/en documentation} for more info.
Note that it currently only does what we need, for our app, at this point in time. Which means that it connects to the webservice via SSL, and only sends a message to one recipient at a time. Finally, it assumes ActiveSupport is available for XML parsing. (A patch that adds a fallback, to REXML, is much appreciated.)
$ gem install mollie-sms
Or if you have a checkout of the source and have installed Jeweler:
$ rake install
The minimum required settings are:
-
{Mollie::SMS.username username}
-
{Mollie::SMS.password password}
-
{Mollie::SMS.originator originator}
For example, a Rails initializer might look like:
module Mollie SMS.username = 'Fingertips' SMS.password = 'secret' SMS.originator = 'fngtps.nl' end
require 'mollie/sms' sms = Mollie::SMS.new('+31681664814', 'You have won a bowl of chicken noodle soup!') => #<Mollie::SMS from: <fngtps.nl> to: <+31681664814> body: "You have won a bowl of chicken noodle soup!"> response = sms.deliver # => #<Mollie::SMS::Response succeeded (10) `Message successfully sent.'> response.success? # => true response.result_code # => 10 response.message # => "Message successfully sent."
require 'mollie/sms' require 'mollie/sms/test_helper' Mollie::SMS.http_failure! response = sms.deliver # => #<Mollie::SMS::Response failed (400) `[HTTP: 400] Bad request'> response.success? # => false response.result_code # => 400 response.message # => "[HTTP: 400] Bad request" Mollie::SMS.gateway_failure! # => #<Mollie::SMS::Response failed (20) `No username given.'> response = sms.deliver # => #<Mollie::SMS::Response failed (20) `No username given.'> response.success? # => false response.result_code # => 20 response.message # => "No username given." Mollie::SMS.deliveries => [#<Mollie::SMS from: <fngtps.nl> to: <+31681664814> body: "You have won a bowl of chicken noodle soup!">, #<Mollie::SMS from: <fngtps.nl> to: <+31681664814> body: "You have won a bowl of chicken noodle soup!">]
If you are using Rails and load the Mollie::SMS gem, it will automatically require the test helper in test mode.
It also requires the test helper in development mode, so no actual SMS messages can be send. Instead, the messages are logged to the development.log.
Once you’ve made your great commits:
-
{help.github.com/forking Fork} Mollie-SMS
-
Create a topic branch
git checkout -b my_branch
-
Push to your branch
git push origin my_branch
-
Create an {github.com/Fingertips/Mollie-SMS/issues issue} with a link to your branch
-
That’s it!
Copyright © 2010 Eloy Duran, Fingertips <[email protected]>
This software is MIT licensed. See {file:LICENSE} for more info.