Project

meta_sms

0.0
No release in over 3 years
Low commit activity in last 3 years
Description of MetaSms.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

= 0.19.0
>= 12.0.0, ~> 12.0
~> 0.9.6

Runtime

~> 4.2
 Project Readme

MetaSms

Installation

gem 'meta_sms'
or via github
gem 'meta_sms', :git => "https://github.com/shobhit-m/meta_sms", :branch => "master"

To add initializer, run
rails g meta_sms:install
This will add an initializer file, config/initializers/meta_sms.rb
If you want to add sms logging migration,(optional)
rails g meta_sms:migrations_for_logger
After this, run rake db:migrate

Usage

First, configure meta_sms.rb.

MetaSms.configure do |config|
  config.logging = true

  config.sms_provider_name = :smsbox
  config.smsbox_user_name = ''
  config.smsbox_key = ''
  config.route = ''
  config.from = ''
  config.type = 'TextSMS'


end

Then in your application,

options = {  
:message_text => "Sample message to send",  
:mobile_number => "9982455678",  
:logging => true,
:metadata => {:key => value}  
}
MetaSms.send_sms(options)

options[:message_text] and options[:mobile_number] are the only required fields in the options hash.
options[:logging] is an optional field. In gem, to check whether to log sms in database or not, we use options[:logging] == true or config.logging==true.
options[metadata] is also optional field in which any data regarding sms process can be store as json format.

Errors

MetaSms.send_sms(options) will raise errors as:

MetaSmsError => message: Your balance is low for sending message.
SecurityError => message: Authentication Failed. Please Try Again.
StandardError => message: No table exists. Please run 'rails g meta_sms:migrations_for_logger' and then run 'rake db:migrate'. To disable this warning, make config.logging=false, in config/initializers/meta_sms.rb.