smart_sms 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7b9fa8f3418d450f565df408ff794eb83a960b58
4
+ data.tar.gz: 4490c8952972f86e02148eb6ae2777a44a36df80
5
+ SHA512:
6
+ metadata.gz: dad9f7408a3e13c4808d4c20fc1edf1a9103a5a2d4c22d6c07ba38e136c9a44506986d545957408d965b4e182acceecfc90ec36ca8086092665ac1309845cf06
7
+ data.tar.gz: b79133e1dded6dea4467b313dbb3f6ea63db595eaf918eb3ae9839f0a45ab43a5d97aa7761693dd7607583416bea6bb5fcfe7cfd454d9a23b6516e48ff39b2f5
data/.gitignore ADDED
@@ -0,0 +1,34 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ # Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.0
7
+
8
+ script:
9
+ - bundle exec rspec spec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in china_sms.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,53 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ smart_sms (0.0.1)
5
+ activerecord (>= 3.0, < 5.0)
6
+ activesupport (>= 3.0, < 5.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (3.2.13)
12
+ activesupport (= 3.2.13)
13
+ builder (~> 3.0.0)
14
+ activerecord (3.2.13)
15
+ activemodel (= 3.2.13)
16
+ activesupport (= 3.2.13)
17
+ arel (~> 3.0.2)
18
+ tzinfo (~> 0.3.29)
19
+ activesupport (3.2.13)
20
+ i18n (= 0.6.1)
21
+ multi_json (~> 1.0)
22
+ addressable (2.3.6)
23
+ arel (3.0.3)
24
+ builder (3.0.4)
25
+ crack (0.4.2)
26
+ safe_yaml (~> 1.0.0)
27
+ diff-lcs (1.2.5)
28
+ i18n (0.6.1)
29
+ multi_json (1.8.4)
30
+ rake (10.2.2)
31
+ rspec (2.14.1)
32
+ rspec-core (~> 2.14.0)
33
+ rspec-expectations (~> 2.14.0)
34
+ rspec-mocks (~> 2.14.0)
35
+ rspec-core (2.14.8)
36
+ rspec-expectations (2.14.5)
37
+ diff-lcs (>= 1.1.3, < 2.0)
38
+ rspec-mocks (2.14.6)
39
+ safe_yaml (1.0.1)
40
+ tzinfo (0.3.38)
41
+ webmock (1.17.4)
42
+ addressable (>= 2.2.7)
43
+ crack (>= 0.3.2)
44
+
45
+ PLATFORMS
46
+ ruby
47
+
48
+ DEPENDENCIES
49
+ bundler (~> 1.2)
50
+ rake
51
+ rspec
52
+ smart_sms!
53
+ webmock
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Felix Liu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ SmartSMS 短信认证或校验服务
2
+ =========
3
+
4
+ 集成了 [云片网络](http://www.yunpian.com) 的短信服务
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,16 @@
1
+ module SmartSms
2
+ module Generators
3
+ class ConfigGenerator < Rails::Generators::Base
4
+ source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
5
+
6
+ desc <<-DESC
7
+ Description:
8
+ Copies SmartSMS configuration file to your application's initializer directory.
9
+ DESC
10
+
11
+ def copy_config_file
12
+ template 'smart_sms_config.rb', 'config/initializers/smart_sms_config.rb'
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,29 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/active_record'
3
+
4
+ module SmartSms
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+ include ::Rails::Generators::Migration
7
+
8
+ source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
9
+
10
+ desc 'Generates (but does not run) a migration to add a message table.'
11
+
12
+ def create_migration_file
13
+ add_smart_sms_migration('create_smart_sms_messages') if SmartSMS.config.store_sms_in_local
14
+ end
15
+
16
+ def self.next_migration_number(dirname)
17
+ ::ActiveRecord::Generators::Base.next_migration_number(dirname)
18
+ end
19
+
20
+ protected
21
+ def add_smart_sms_migration(template)
22
+ migration_dir = File.expand_path('db/migrate')
23
+
24
+ if !self.class.migration_exists?(migration_dir, template)
25
+ migration_template "#{template}.rb", "db/migrate/#{template}.rb"
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,19 @@
1
+ class CreateSmartSmsMessages < ActiveRecord::Migration
2
+ def change
3
+ create_table :smart_sms_messages do |t|
4
+ t.string :sid
5
+ t.string :mobile
6
+ t.datetime :send_time
7
+ t.text :text
8
+ t.string :code
9
+ t.string :send_status
10
+ t.string :report_status
11
+ t.string :fee
12
+ t.datetime :user_receive_time
13
+ t.text :error_msg
14
+ t.belongs_to :smsable, polymorphic: true
15
+ end
16
+ add_index :smart_sms_messages, :sid
17
+ add_index :smart_sms_messages, [:smsable_id, :smsable_type]
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ SmartSMS.configure do |config|
4
+ # config.api_key = nil
5
+ # config.api_version = :v1
6
+ # config.template_id = '2'
7
+ # config.template_value = [:code, :company]
8
+ # config.page_num = 1
9
+ # config.page_size = 20
10
+ # config.company = '云片网'
11
+ # config.default_interval = 1.day
12
+ # config.store_sms_in_local = false
13
+ # config.verification_code_algorithm = :simple
14
+ end
@@ -0,0 +1,20 @@
1
+ #encoding: utf-8
2
+
3
+ module SmartSMS
4
+ module Account
5
+ extend self
6
+
7
+ # 获取用户信息
8
+ def info
9
+ Request.post 'user/get.json'
10
+ end
11
+
12
+ # 设置用户信息
13
+ # emergency_contact: 紧急联系人
14
+ # emergency_mobile: 紧急联系人手机号
15
+ # alarm_balance: 短信余额提醒阈值。一天只提示一次
16
+ def set options = {}
17
+ Request.post 'tpl/get.json', options
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,46 @@
1
+ #encoding: utf-8
2
+ require 'active_support/configurable'
3
+ require 'active_support/core_ext'
4
+
5
+ module SmartSMS
6
+
7
+ # Configures global settings for SmartSMS
8
+ # SmartSMS.configure do |config|
9
+ # config.api_key = 'd63124354422b046081a44466'
10
+ # end
11
+ def self.configure(&block)
12
+ yield @config ||= SmartSMS::Configuration.new
13
+ end
14
+
15
+ # Global settings for SmartSMS
16
+ def self.config
17
+ @config
18
+ end
19
+
20
+ class Configuration #:nodoc:
21
+ include ActiveSupport::Configurable
22
+ config_accessor :api_key # 授权 API KEY
23
+ config_accessor :api_version # API 的版本, 当前仅有v1
24
+ config_accessor :template_id # 指定发送信息时使用的模板
25
+ config_accessor :template_value # 用于指定信息文本中的可替换内容, 数组形势: [:code, :company]
26
+ config_accessor :page_num # 获取信息时, 指定默认的页数
27
+ config_accessor :page_size # 获取信息时, 一页包含信息数量
28
+ config_accessor :company # 默认公司名称
29
+ config_accessor :default_interval # 查询短信时的时间段: end_time - start_time
30
+ config_accessor :store_sms_in_local # 是否存储SMS信息在本地: true or false
31
+ config_accessor :verification_code_algorithm # :simple, :middle, :complex
32
+ end
33
+
34
+ configure do |config|
35
+ config.api_key = nil
36
+ config.api_version = :v1
37
+ config.template_id = '2'
38
+ config.template_value = [:code, :company]
39
+ config.page_num = 1
40
+ config.page_size = 20
41
+ config.company = '云片网'
42
+ config.default_interval = 1.day
43
+ config.store_sms_in_local = false
44
+ config.verification_code_algorithm = :simple
45
+ end
46
+ end
@@ -0,0 +1,128 @@
1
+ # encoding: utf-8
2
+ require File.expand_path(File.join(File.dirname(__FILE__), 'model/message'))
3
+
4
+ module SmartSMS
5
+ module HasSmsVerification
6
+
7
+ def self.included(base)
8
+ base.send :extend, ClassMethods
9
+ end
10
+
11
+ module ClassMethods
12
+
13
+ # 在您的Model里面声明这个方法, 以添加SMS短信验证功能
14
+ # moible_column: mobile 绑定的字段, 用于发送短信
15
+ # verification_column: 验证绑定的字段, 用于判断是否以验证
16
+ #
17
+ # Options:
18
+ # :class_name 自定义的Message类名称. 默认是 `::SmartSMS::Message`
19
+ # :messages 自定义的Message关联名称. 默认是 `:versions`.
20
+ #
21
+ def has_sms_verification moible_column, verification_column, options = {}
22
+ send :include, InstanceMethods
23
+
24
+ # 用于判断是否已经验证的字段, Datetime 类型, 例如 :verified_at
25
+ class_attribute :sms_verification_column
26
+ self.sms_verification_column = verification_column
27
+
28
+ class_attribute :sms_mobile_column
29
+ self.sms_mobile_column = moible_column
30
+
31
+ class_attribute :verify_regexp
32
+ self.verify_regexp = /(【.+】|[^a-zA-Z0-9\.\-\+_])/
33
+
34
+ if SmartSMS.config.store_sms_in_local
35
+
36
+ class_attribute :messages_association_name
37
+ self.messages_association_name = options[:messages] || :messages
38
+
39
+ class_attribute :message_class_name
40
+ self.message_class_name = options[:class_name] || '::SmartSMS::Message'
41
+
42
+ if ::ActiveRecord::VERSION::MAJOR >= 4 # Rails 4 里面, 在 `has_many` 声明中定义order lambda的语法
43
+ has_many self.messages_association_name,
44
+ lambda { order("send_time ASC") },
45
+ :class_name => self.message_class_name, :as => :smsable
46
+ else
47
+ has_many self.messages_association_name,
48
+ :class_name => self.message_class_name,
49
+ :as => :smsable,
50
+ :order => "send_time ASC"
51
+ end
52
+
53
+ end
54
+ end
55
+
56
+ module InstanceMethods
57
+
58
+ def verify! code
59
+ result = verify code
60
+ if result
61
+ self.send("#{self.class.sms_verification_column}=", Time.now)
62
+ self.save(validate: false)
63
+ end
64
+ end
65
+
66
+ def verify code
67
+ sms = latest_message
68
+ return false if sms.blank?
69
+ if SmartSMS.config.store_sms_in_local
70
+ sms.code == code.to_s
71
+ else
72
+ sms['text'].gsub(self.class.verify_regexp, '') == code.to_s
73
+ end
74
+ end
75
+
76
+ def verified?
77
+ self[self.class.sms_verification_column].present?
78
+ end
79
+
80
+ def verified_at
81
+ self[self.class.sms_verification_column]
82
+ end
83
+
84
+ def latest_message
85
+ if SmartSMS.config.store_sms_in_local
86
+ self.send(self.class.messages_association_name).last
87
+ else
88
+ SmartSMS.find(
89
+ start_time: (Time.now - 1.hour),
90
+ end_time: Time.now,
91
+ mobile: self.send(self.class.sms_mobile_column),
92
+ page_size: 1
93
+ )['sms'].first
94
+ end
95
+ end
96
+
97
+ def deliver text = random_verification_code
98
+ result = SmartSMS.deliver self.send(self.class.sms_mobile_column), text
99
+ if result['code'] == 0
100
+ sms = SmartSMS.find_by_sid(result['result']['sid'])['sms']
101
+ if SmartSMS.config.store_sms_in_local
102
+ message = self.send(self.messages_association_name).build sms
103
+ message.code = text
104
+ message.save
105
+ else
106
+ sms
107
+ end
108
+ else
109
+ self.errors.add :deliver, result
110
+ false
111
+ end
112
+ end
113
+
114
+ def random_verification_code
115
+ case SmartSMS.config.verification_code_algorithm
116
+ when :simple
117
+ SmartSMS::VerificationCode.simple
118
+ when :middle
119
+ SmartSMS::VerificationCode.middle
120
+ when :complex
121
+ SmartSMS::VerificationCode.complex
122
+ end
123
+ end
124
+
125
+ end
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,18 @@
1
+ require 'securerandom'
2
+
3
+ module SmartSMS
4
+ module VerificationCode
5
+ extend self
6
+ def simple
7
+ SecureRandom.random_number.to_s.slice(-6..-1)
8
+ end
9
+
10
+ def middle
11
+ SecureRandom.base64.slice(1..6).downcase
12
+ end
13
+
14
+ def complex
15
+ SecureRandom.base64.slice(1..8).downcase
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,75 @@
1
+ module SmartSMS
2
+ module MessageService
3
+
4
+ def self.included(base)
5
+ base.send :extend, ClassMethods
6
+ end
7
+
8
+ module ClassMethods
9
+
10
+ DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
11
+
12
+ def deliver phone, content, options = {}
13
+ if options[:method] == :general
14
+ Request.post 'sms/send.json', mobile: phone, text: content, extend: options[:extend]
15
+ else
16
+ options[:code] = content
17
+ message = parse_content options
18
+ tpl_id = options[:tpl_id] || SmartSMS.config.template_id
19
+ Request.post 'sms/tpl_send.json', tpl_id: tpl_id, mobile: phone, tpl_value: message
20
+ end
21
+ end
22
+
23
+ def find_by_sid sid
24
+ Request.post 'sms/get.json', sid: sid
25
+ end
26
+
27
+ def find options = {}
28
+ find_messages 'sms/get.json', options
29
+ end
30
+
31
+ def get_black_word text = ''
32
+ Request.post 'sms/get_black_word.json', text: text
33
+ end
34
+
35
+ def get_reply options = {}
36
+ find_messages 'sms/get_reply.json', options
37
+ end
38
+
39
+ private
40
+
41
+ # 批量查短信, 参数:
42
+ # start_time: 短信提交开始时间
43
+ # end_time: 短信提交结束时间
44
+ # page_num: 页码,从1开始
45
+ # page_size: 每页个数,最大100个
46
+ # mobile: 接收短信的手机号
47
+ #
48
+ def find_messages api, options = {}
49
+ options[:end_time] = Time.now if options[:end_time].blank?
50
+ options[:start_time] = options[:end_time] - SmartSMS.config.default_interval if options[:start_time].blank?
51
+ options[:end_time] = parse_time(options[:end_time])
52
+ options[:start_time] = parse_time(options[:start_time])
53
+ options[:page_num] ||= SmartSMS.config.page_num
54
+ options[:page_size] ||= SmartSMS.config.page_size
55
+ Request.post api, options
56
+ end
57
+
58
+ def parse_time time = ''
59
+ if time.present? && time.is_a?(Time)
60
+ time.strftime DATETIME_FORMAT
61
+ else
62
+ ''
63
+ end
64
+ end
65
+
66
+ def parse_content options = {}
67
+ options[:code] ||= ''
68
+ options[:company] ||= SmartSMS.config.company
69
+ SmartSMS.config.template_value.map do |key|
70
+ "##{key.to_s}#=#{options[key]}"
71
+ end.join('&')
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,7 @@
1
+ module SmartSMS
2
+ class Message < ::ActiveRecord::Base
3
+ self.table_name = 'smart_sms_messages'
4
+ belongs_to :smsable, polymorphic: true
5
+ attr_accessible :sid, :mobile, :send_time, :text, :code, :send_status, :report_status, :fee, :user_receive_time, :error_msg if SmartSMS.active_record_protected_attributes?
6
+ end
7
+ end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ require 'net/http'
3
+ require 'active_support/json'
4
+
5
+ module SmartSMS
6
+ module Request
7
+ extend self
8
+
9
+ def post api, options = {}
10
+ options[:apikey] = SmartSMS.config.api_key
11
+ uri = URI.join(base_url, api)
12
+ res = Net::HTTP.post_form(uri, options)
13
+ result res.body
14
+ end
15
+
16
+ def get api, options = {}
17
+ options[:apikey] = SmartSMS.config.api_key
18
+ uri = URI.join(base_url, api)
19
+ result Net::HTTP.get(uri, options)
20
+ end
21
+
22
+ private
23
+
24
+ def result body
25
+ begin
26
+ ActiveSupport::JSON.decode body
27
+ rescue => e
28
+ {
29
+ code: 502,
30
+ msg: "内容解析错误",
31
+ detail: e.to_s
32
+ }
33
+ end
34
+ end
35
+
36
+ def base_url
37
+ "http://yunpian.com/#{SmartSMS.config.api_version.to_s}/"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,24 @@
1
+ module SmartSMS
2
+ module Template
3
+ extend self
4
+ def find_default tpl_id = ''
5
+ Request.post 'tpl/get_default.json', tpl_id: tpl_id
6
+ end
7
+
8
+ def find tpl_id = ''
9
+ Request.post 'tpl/get.json', tpl_id: tpl_id
10
+ end
11
+
12
+ def create tpl_content = ''
13
+ Request.post 'tpl/add.json', tpl_content: tpl_content
14
+ end
15
+
16
+ def update tpl_id = '', tpl_content = ''
17
+ Request.post 'tpl/update.json', tpl_id: tpl_id, tpl_content: tpl_content
18
+ end
19
+
20
+ def destroy tpl_id = ''
21
+ Request.post 'tpl/del.json', tpl_id: tpl_id
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,3 @@
1
+ module SmartSMS
2
+ VERSION = '0.0.1'
3
+ end
data/lib/smart_sms.rb ADDED
@@ -0,0 +1,34 @@
1
+ require 'smart_sms/config'
2
+ require 'smart_sms/request'
3
+ require 'smart_sms/template'
4
+ require 'smart_sms/message_service'
5
+ require 'smart_sms/account'
6
+ require 'smart_sms/helper/verification_code'
7
+
8
+ if !defined? ActiveRecord
9
+ begin
10
+ require 'active_record'
11
+ rescue LoadError; end
12
+ end
13
+
14
+ module SmartSMS
15
+ include SmartSMS::MessageService
16
+
17
+ def self.active_record_protected_attributes?
18
+ @active_record_protected_attributes ||= ::ActiveRecord::VERSION::MAJOR < 4 || !!defined?(ProtectedAttributes)
19
+ end
20
+ end
21
+
22
+ # Ensure `ProtectedAttributes` gem gets required if it is available before the `Message` class gets loaded in
23
+ unless SmartSMS.active_record_protected_attributes?
24
+ SmartSMS.send(:remove_instance_variable, :@active_record_protected_attributes)
25
+ begin
26
+ require 'protected_attributes'
27
+ rescue LoadError; end # will rescue if `ProtectedAttributes` gem is not available
28
+ end
29
+
30
+ require 'smart_sms/has_sms_verification'
31
+
32
+ ActiveSupport.on_load(:active_record) do
33
+ include SmartSMS::HasSmsVerification
34
+ end
data/smart_sms.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # encoding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'smart_sms/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "smart_sms"
9
+ s.version = SmartSMS::VERSION
10
+ s.authors = ["lyfeyaj"]
11
+ s.email = ["lyfeyaj@gmail.com"]
12
+ s.description = %q{A smart sms verification tool}
13
+ s.summary = %q{A smart sms verification tool used in China and integrate with yunpian.com}
14
+ s.homepage = "https://github.com/lyfeyaj/smart_sms"
15
+ s.license = "MIT"
16
+
17
+ s.files = `git ls-files`.split($/)
18
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency 'activerecord', ['>= 3.0', '< 5.0']
23
+ s.add_dependency 'activesupport', ['>= 3.0', '< 5.0']
24
+
25
+ s.add_development_dependency "bundler", "~> 1.2"
26
+ s.add_development_dependency "rake"
27
+ s.add_development_dependency "rspec"
28
+ s.add_development_dependency "webmock"
29
+ end
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+ require 'rubygems'
3
+ require 'bundler/setup'
4
+
5
+ require 'webmock/rspec'
6
+ require 'smart_sms'
7
+
8
+ #WebMock.allow_net_connect!
9
+ RSpec.configure do |config|
10
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smart_sms
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - lyfeyaj
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: activesupport
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '3.0'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '5.0'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '3.0'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '5.0'
53
+ - !ruby/object:Gem::Dependency
54
+ name: bundler
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.2'
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '1.2'
67
+ - !ruby/object:Gem::Dependency
68
+ name: rake
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: rspec
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: webmock
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ description: A smart sms verification tool
110
+ email:
111
+ - lyfeyaj@gmail.com
112
+ executables: []
113
+ extensions: []
114
+ extra_rdoc_files: []
115
+ files:
116
+ - ".gitignore"
117
+ - ".travis.yml"
118
+ - Gemfile
119
+ - Gemfile.lock
120
+ - LICENSE
121
+ - README.md
122
+ - Rakefile
123
+ - lib/generators/smart_sms/config_generator.rb
124
+ - lib/generators/smart_sms/install_generator.rb
125
+ - lib/generators/smart_sms/templates/create_smart_sms_messages.rb
126
+ - lib/generators/smart_sms/templates/smart_sms_config.rb
127
+ - lib/smart_sms.rb
128
+ - lib/smart_sms/account.rb
129
+ - lib/smart_sms/config.rb
130
+ - lib/smart_sms/has_sms_verification.rb
131
+ - lib/smart_sms/helper/verification_code.rb
132
+ - lib/smart_sms/message_service.rb
133
+ - lib/smart_sms/model/message.rb
134
+ - lib/smart_sms/request.rb
135
+ - lib/smart_sms/template.rb
136
+ - lib/smart_sms/version.rb
137
+ - smart_sms.gemspec
138
+ - spec/spec_helper.rb
139
+ homepage: https://github.com/lyfeyaj/smart_sms
140
+ licenses:
141
+ - MIT
142
+ metadata: {}
143
+ post_install_message:
144
+ rdoc_options: []
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ requirements: []
158
+ rubyforge_project:
159
+ rubygems_version: 2.2.2
160
+ signing_key:
161
+ specification_version: 4
162
+ summary: A smart sms verification tool used in China and integrate with yunpian.com
163
+ test_files:
164
+ - spec/spec_helper.rb