0.0
No commit activity in last 3 years
No release in over 3 years
Send short messages to a specific SMS Gateway
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

> 3.2.0
 Project Readme

ShortMessage

Gem Version

Installation

Add it to your Gemfile:

gem 'short_message'

Run the following command to install it:

bundle install

Run the generator:

rails generate short_message:install

And run the migrations:

rake db:migrate

Usage

Create a message and deliver it:

@sms = ShortMessage::Message.new(sender: "0041791234567", recipient: "0041799876543", text: "Hello World!")
@sms.deliver

Delivery Report

ShortMessage listens for status updates on /short_message/messages/status. Provide :id and :status by either POST or GET.

Customization

Status Codes

If you need to customize the status response codes simply edit the internationalization files in config/locales

Params

To override the params string add the code below into config/initializers/short_message.rb:

ShortMessage::Message.module_eval do
  private
  def build_deliver_params_string
    # your code here
  end

  def build_recharge_params_string amount
    # your code here
  end
end

Events

ShortMessage sends event notifications on message delivery short_message.delivered and on status update short_message.status_updated. Add following code to an initializer to listen:

ActiveSupport::Notifications.subscribe('short_message.status_updated') do |name, start, finish, id, payload|
  Activity.create(successful: true, message: "Message #{payload[:options][:key]} has now status #{payload[:options][:status]}.")
end