Repository is archived
No commit activity in last 3 years
No release in over 3 years
AnySMS backend for sms.ru service
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
~> 2.14
~> 10.0
~> 3.0
~> 2.1

Runtime

~> 0.4.0
 Project Readme

AnySMS sms.ru backend

Build Status Gem Version

backend for AnySMS to work with sms.ru

Installation and usage

Add this line to your application's Gemfile:

gem "any_sms-backend-smsru", "~> 0.1.0"

Then somewhere in your initialization code:

require "any_sms-backend-smsru"

AnySMS.configure do |c|
  c.register_backend :my_main_backend,
                     AnySMS::Backend::Smsru,
                     api_id: ENV["SMSRU_TOKEN"]

  c.default_backend = :my_main_backend
end

Now, whenever you need to send SMS, just do:

phone = "799999999"
text = "My sms text"

# Should actually send sms
AnySMS.send_sms("79999999999", "text")

For more advanced usage please go to AnySMS documentation

Don't forget, you need to put real api_id in SMSRU_TOKEN environment variable. In bash you would do it like that:

export SMSRU_TOKEN "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"

Read below how to receive own token to work with sms.ru.

Receiving api_id from sms.ru

First of all, you should register on https://sms.ru/ . Then, when you are registered, make sure you have some small amount of balance to actually send sms. On your main page (when you are logged) you should see:

api_id block at the right

instead of XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX you should see your actual api_id key.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Fedcomp/any_sms-backend-smsru

License

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