Project

aliyun_sms

0.0
No commit activity in last 3 years
No release in over 3 years
This is a ruby gem helps to use aliyun sms in ruby way.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0
~> 0
 Project Readme

AliyunSms

Installation

Add this line to your application's Gemfile:

gem 'aliyun_sms'

And then execute:

$ bundle

Or install it yourself as:

$ gem install aliyun_sms

Usage

1. Configure first

AliyunSms.configure do |config|

config.access_key_id = 'testid'
config.access_key_secret = 'testsecret'

# config.format = "XML"   ## optional(default 'JSON')
# config.region_id = "cn-hangzhou"  ## optional

end

2. Send a message

args = {:phone=>"123456789",:sign_name=>"标签测试", :tpl_id=>"SMS_1650053", :params=>{"code":"1234"}}
AliyunSms.to args

Integrated with Rails

Put a files(named aliyun_sms.rb for example) in config/initializers/ and the content can be the following:

## config/initializers/aliyun_sms.rb
AliyunSms.configure do |config|

config.access_key_id = 'testid'
config.access_key_secret = 'testsecret'

# config.format = "XML"   ## optional(default 'JSON')
# config.region_id = "cn-hangzhou"  ## optional
end

Now You can send a message in controller:

AliyunSms.to {:phone=>"123456789",:sign_name=>"标签测试", :tpl_id=>"SMS_1650053", :params=>{"code":"1234"}}

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/timlentse/aliyun_sms. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

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