The IfreeSms gem for i-free sms provider
Ruby
Switch branches/tags
Nothing to show
Latest commit 0430f00 Sep 16, 2011 @galetahub galetahub Update gemspec
Permalink
Failed to load latest commit information.
app/models/ifree_sms
lib
.gitignore
Gemfile
MIT-LICENSE
README.rdoc
Rakefile
ifree-sms.gemspec

README.rdoc

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