Skip to content

Repository files navigation

Smspartner

This gem allows you to simply send SMS via the smspartner.fr API

Installation

Add this line to your application's Gemfile:

gem'smspartner','~> 0.1'

And then execute:

$ bundle

Or install it yourself as:

$ gem install smspartner

Usage

You first need to configure the gem before using the SMS sending feature :

Smspartner.configuredo |config|
# fetch your API key from a fileconfig.api_key=File.read(Rails.root.join('api_keys','sms_partner'))# or from the environment# config.api_key = ENV['sms_partner_api_key']config.sender='11 chars max'# default values# config.sandbox = false# config.range_value = :premium # valid values are %i[premium low_cost]end

Rails users: put this code inside config/initializers/smspartner.rb

To send a SMS, simply do the following

res=Smspartner.send_smsto: phone_number,body: sms_bodyifres.success?puts"You should store the message's id: #{res.message_id}"elsewarn"Failed to send SMS because: #{res.errors.join("\n")}"endputsJSON.pretty_generateres.raw_data

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. 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.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/moduloTech/smspartner. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Smspartner project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Ruby interface to smspartner's API

Topics

Resources

Code of conduct

Stars

0 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages