Project

ifree-sms

0.0
No commit activity in last 3 years
No release in over 3 years
The IfreeSms gem for i-free sms provider
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.7.15
 Project Readme

IfreeSms¶ ↑

The IfreeSms gem for i-free sms provider

Install¶ ↑

gem 'ifree-sms'

rails generate ifree_sms:install

Usage¶ ↑

Use middleware with options:

config.app_middleware.use IfreeSms::Manager do |c|
  c.routes = "/ifree/sms"
end

Initialize IfreeSms and set its configurations.

# config/initializers/ifree_sms.rb
if Object.const_defined?("IfreeSms")

  IfreeSms.setup do |config|
    config.secret_key = ""
    config.project_name = ""
    config.service_number = ""
    config.debug = true
  end

  IfreeSms::Manager.incoming_message do |env, message|  
    # set it if you want to send answer for user
    message.answer_text = "put here sms answer for user"
  end
end

Send sms message to user (asynchronous)

* phone - format => 380971606179
* text - length => 160 Latin or 70 Unicode (encoding utf-8)
* from - sender title, max length: 11

 smsdirect = IfreeSms::SMSDirectAPI.new(login, password)

 smsdirect.submit_message(phone, text, from)

or

IfreeSms::Message.first.send_answer("some text")

Dependences¶ ↑

  • curb

    sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev