A ruby interface for sending texts free of charge through TextBelt.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install textbelt
The main API is
TextBelt.text. Sending messages should be as simple as passing a number & message, then watching it go!
TextBelt.text('01234567', 'Hello, World!') #=> Your favorite cell phone number gets a text message
If there are any errors that happen server side, we raise then as exceptions locally, see the documentation for
text for a look at the different errors that might be raised.
require 'textbelt' def send_cats(number) TextBelt.text(number, 'https://www.youtube.com/watch?v=tntOCGkgt98') rescue TextBelt::Errors::PhoneQuotaExceededError => e puts 'too many cats!!!!' rescue TextBelt::Errors::BlackListedNumberError => e puts 'can not send any more cats to that number :(' end
After checking out the repo, run
bin/setup to install dependencies. You can also run
bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run
bundle exec rake install. To release a new version, update the version number in
version.rb, and then run
bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the
.gem file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/djds23/textbelt-gem.
The MIT License (MIT)
Copyright (c) 2015 Dean Silfen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.