alidayu_sms 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -2
- data/.idea/vcs.xml +1 -0
- data/README.md +3 -3
- data/bin/alidayu_sms +2 -5
- data/lib/alidayu_sms/alidayu.rb +1 -0
- data/lib/alidayu_sms/version.rb +1 -1
- data/lib/alidayu_sms.rb +8 -5
- metadata +2 -10
- data/.idea/.rakeTasks +0 -7
- data/.idea/misc.xml +0 -14
- data/.idea/modules.xml +0 -8
- data/.idea/workspace.xml +0 -41
- data/pkg/alidayu_sms-0.1.0.gem +0 -0
- data/pkg/alidayu_sms-0.2.0.gem +0 -0
- data/pkg/alidayu_sms-0.3.0.gem +0 -0
- data/pkg/alidayu_sms-0.3.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a49b560940b7a42d217237304af67b259c0bca0d
|
4
|
+
data.tar.gz: a91fdc58d71551c128c85ef923fb3335857da24f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c0893f61e83099c48305d0fc008f60492aa9788d0368db00ea46bc54cf5c7685261e4f41c36e5d2bd1ed5d0e546514563975d1a1c014b743e142977356efc48
|
7
|
+
data.tar.gz: 713ef0cf8287f427b4390c96353082a026384feb6906d1da2f3efd4a4d5be43e45ba6adfddbc23f360e382bafc0210c49744f55d764203b678023fd7aba8d807
|
data/.gitignore
CHANGED
data/.idea/vcs.xml
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# alidayu_sms
|
2
|
-
阿里大鱼的短信发送api,暂时只支持 alibaba.aliqin.fc.sms.num.send 短信发送
|
1
|
+
# alidayu_sms 简介
|
2
|
+
- 阿里大鱼的短信发送api,暂时只支持 alibaba.aliqin.fc.sms.num.send 短信发送
|
3
3
|
|
4
4
|
# Gemfile
|
5
5
|
```ruby
|
@@ -43,7 +43,7 @@ production:
|
|
43
43
|
Alidayu::Sms.send_code_for_sign_up("15921076830", {code: '1314520'}, '')
|
44
44
|
```
|
45
45
|
|
46
|
-
#
|
46
|
+
# 自定义发送短信, 不基于模板哦
|
47
47
|
|
48
48
|
```ruby
|
49
49
|
|
data/bin/alidayu_sms
CHANGED
@@ -58,7 +58,7 @@ options.merge!(attributes)
|
|
58
58
|
#测试用的, 不过我的key可能无效了哦
|
59
59
|
options = options.merge(
|
60
60
|
:code=> 1314520,
|
61
|
-
:product => "
|
61
|
+
:product => "平 love 玲",
|
62
62
|
:extend => '',
|
63
63
|
:sms_free_sign_name=> "注册验证",
|
64
64
|
:sms_template_code=> "SMS_5045503"
|
@@ -76,7 +76,4 @@ rescue => e
|
|
76
76
|
puts 'Uncaught exception'
|
77
77
|
puts e.message
|
78
78
|
puts e.backtrace.join("\n")
|
79
|
-
end
|
80
|
-
|
81
|
-
# sms -p 13262902619 -s taobao -a 'app_secret=5aff003ac3c7243da65adef1e7c9c363&app_key=23272925&sms_free_sign_name=爱客验证码&sms_template_code=SMS_2575137&sms_param[code]=xxx&sms_param[product]=ddd'
|
82
|
-
|
79
|
+
end
|
data/lib/alidayu_sms/alidayu.rb
CHANGED
data/lib/alidayu_sms/version.rb
CHANGED
data/lib/alidayu_sms.rb
CHANGED
@@ -8,6 +8,7 @@ require "alidayu_sms/alidayu"
|
|
8
8
|
|
9
9
|
require 'yaml' unless defined? YMAL
|
10
10
|
|
11
|
+
# 连接配置文件
|
11
12
|
def load_config
|
12
13
|
if defined? ::Rails
|
13
14
|
@sms_config ||= HashWithIndifferentAccess.new(YAML.load_file("#{::Rails.root}/config/alidayu_sms.yml")[::Rails.env] || {})
|
@@ -29,6 +30,7 @@ class AlidayuSmsSender
|
|
29
30
|
self.source = AlidayuSms::Alidayu.new(options)
|
30
31
|
|
31
32
|
# 动态方法
|
33
|
+
# 生成配置文件配置的对应的发送各种类型短信的方法
|
32
34
|
class_eval do
|
33
35
|
load_config[:alidayu][:sms_templates].each do |sms_template|
|
34
36
|
define_method("send_code_for_#{sms_template[:name]}") do |phone, _sms_param = {}, extend = ""|
|
@@ -36,7 +38,7 @@ class AlidayuSmsSender
|
|
36
38
|
|
37
39
|
options = {
|
38
40
|
sms_param: _sms_param.to_json,
|
39
|
-
phones: phone, #
|
41
|
+
phones: phone, # 手机号码, 可以传入多个哦,用 "," 分格
|
40
42
|
extend: extend, # 公共回传参数,在“消息返回”中会透传回该参数;举例:用户可以传入自己下级的会员ID,在消息返回时,该会员ID会包含在内,用户可以根据该会员ID识别是哪位会员使用了你的应用
|
41
43
|
sms_free_sign_name: sms_template[:sms_free_sign_name], # 短信签名
|
42
44
|
sms_template_code: sms_template[:sms_template_code] # 短信模板
|
@@ -47,7 +49,8 @@ class AlidayuSmsSender
|
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
50
|
-
#
|
52
|
+
# 发送短信的基本方法, 不走配置文件
|
53
|
+
# 只需要传入相应的参数 sms_param phones extend sms_free_sign_name sms_template_code 即可
|
51
54
|
def batchSendSms(options = {})
|
52
55
|
options = HashWithIndifferentAccess.new(options)
|
53
56
|
arr = %w(sms_param phones extend sms_free_sign_name sms_template_code)
|
@@ -58,16 +61,17 @@ class AlidayuSmsSender
|
|
58
61
|
end
|
59
62
|
|
60
63
|
check_params(flag, options)
|
61
|
-
puts "阿里大鱼传入参数为:#{attr}"
|
62
64
|
|
63
65
|
source.standard_send_msg(attr)
|
64
66
|
end
|
65
67
|
|
66
68
|
private
|
69
|
+
# 自定义参数检查
|
67
70
|
def check_params(flag, options)
|
68
71
|
raise "阿里大鱼自定义参数不全!\n你传入的: #{options.map{|k,v| k.to_sym}}\n需要传入: [:code :product :phones :extend :sms_free_sign_name :sms_template_code]" if flag
|
69
72
|
end
|
70
73
|
|
74
|
+
# 系统参数检查
|
71
75
|
def check_system_params(options)
|
72
76
|
arr = %w(app_key app_secret post_url)
|
73
77
|
attr, flag = [], false
|
@@ -75,8 +79,7 @@ class AlidayuSmsSender
|
|
75
79
|
flag = true unless options[a]
|
76
80
|
attr << options[a]
|
77
81
|
end
|
78
|
-
raise "阿里大鱼系统参数不全!\n你传入的: #{options.map{|k,v| k.to_sym}}\n需要传入: [:app_key, :app_secret, :post_url]\n请配置 alidayu_sms.yml" if flag
|
79
|
-
puts "阿里大鱼系统参数检测完毕!"
|
82
|
+
raise "阿里大鱼系统参数不全!\n你传入的: #{options.map{|k,v| k.to_sym}}\n需要传入: [:app_key, :app_secret, :post_url]\n请配置 config/alidayu_sms.yml " if flag
|
80
83
|
end
|
81
84
|
end
|
82
85
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alidayu_sms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jack ping
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -89,11 +89,7 @@ extensions: []
|
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
91
|
- ".gitignore"
|
92
|
-
- ".idea/.rakeTasks"
|
93
|
-
- ".idea/misc.xml"
|
94
|
-
- ".idea/modules.xml"
|
95
92
|
- ".idea/vcs.xml"
|
96
|
-
- ".idea/workspace.xml"
|
97
93
|
- Gemfile
|
98
94
|
- Gemfile.lock
|
99
95
|
- README.md
|
@@ -106,10 +102,6 @@ files:
|
|
106
102
|
- lib/tasks/alidayu_sms.rake
|
107
103
|
- lib/templates/alidayu.rb
|
108
104
|
- lib/templates/alidayu_sms.yml
|
109
|
-
- pkg/alidayu_sms-0.1.0.gem
|
110
|
-
- pkg/alidayu_sms-0.2.0.gem
|
111
|
-
- pkg/alidayu_sms-0.3.0.gem
|
112
|
-
- pkg/alidayu_sms-0.3.1.gem
|
113
105
|
homepage: https://github.com/wangping0105/alidayu_sms
|
114
106
|
licenses: []
|
115
107
|
metadata: {}
|
data/.idea/.rakeTasks
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
-
You are allowed to:
|
4
|
-
1. Remove rake task
|
5
|
-
2. Add existing rake tasks
|
6
|
-
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
-
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build alidayu_sms-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install alidayu_sms-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install alidayu_sms-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push alidayu_sms-0.1.0.gem to Rubygems" fullCmd="release" taksId="release" /><RakeTask description="Run tests" fullCmd="test" taksId="test" /><RakeGroup description="" fullCmd="" taksId="alidayu_sms"><RakeTask description="" fullCmd="alidayu_sms:create_default_config_file" taksId="create_default_config_file" /></RakeGroup><RakeTask description="" fullCmd="default" taksId="default" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
data/.idea/misc.xml
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
4
|
-
<OptionsSetting value="true" id="Add" />
|
5
|
-
<OptionsSetting value="true" id="Remove" />
|
6
|
-
<OptionsSetting value="true" id="Checkout" />
|
7
|
-
<OptionsSetting value="true" id="Update" />
|
8
|
-
<OptionsSetting value="true" id="Status" />
|
9
|
-
<OptionsSetting value="true" id="Edit" />
|
10
|
-
<ConfirmationsSetting value="0" id="Add" />
|
11
|
-
<ConfirmationsSetting value="0" id="Remove" />
|
12
|
-
</component>
|
13
|
-
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.1.5" project-jdk-type="RUBY_SDK" />
|
14
|
-
</project>
|
data/.idea/modules.xml
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="ProjectModuleManager">
|
4
|
-
<modules>
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/alidayu_sms.iml" filepath="$PROJECT_DIR$/.idea/alidayu_sms.iml" />
|
6
|
-
</modules>
|
7
|
-
</component>
|
8
|
-
</project>
|
data/.idea/workspace.xml
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="ChangeListManager">
|
4
|
-
<option name="TRACKING_ENABLED" value="true" />
|
5
|
-
<option name="SHOW_DIALOG" value="false" />
|
6
|
-
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
7
|
-
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
8
|
-
<option name="LAST_RESOLUTION" value="IGNORE" />
|
9
|
-
</component>
|
10
|
-
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
11
|
-
<component name="CreatePatchCommitExecutor">
|
12
|
-
<option name="PATCH_PATH" value="" />
|
13
|
-
</component>
|
14
|
-
<component name="NamedScopeManager">
|
15
|
-
<order />
|
16
|
-
</component>
|
17
|
-
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
18
|
-
<OptionsSetting value="true" id="Add" />
|
19
|
-
<OptionsSetting value="true" id="Remove" />
|
20
|
-
<OptionsSetting value="true" id="Checkout" />
|
21
|
-
<OptionsSetting value="true" id="Update" />
|
22
|
-
<OptionsSetting value="true" id="Status" />
|
23
|
-
<OptionsSetting value="true" id="Edit" />
|
24
|
-
<ConfirmationsSetting value="0" id="Add" />
|
25
|
-
<ConfirmationsSetting value="0" id="Remove" />
|
26
|
-
</component>
|
27
|
-
<component name="ShelveChangesManager" show_recycled="false" />
|
28
|
-
<component name="TaskManager">
|
29
|
-
<task active="true" id="Default" summary="Default task">
|
30
|
-
<option name="number" value="Default" />
|
31
|
-
</task>
|
32
|
-
<servers />
|
33
|
-
</component>
|
34
|
-
<component name="VcsContentAnnotationSettings">
|
35
|
-
<option name="myLimit" value="2678400000" />
|
36
|
-
</component>
|
37
|
-
<component name="XDebuggerManager">
|
38
|
-
<breakpoint-manager />
|
39
|
-
<watches-manager />
|
40
|
-
</component>
|
41
|
-
</project>
|
data/pkg/alidayu_sms-0.1.0.gem
DELETED
Binary file
|
data/pkg/alidayu_sms-0.2.0.gem
DELETED
Binary file
|
data/pkg/alidayu_sms-0.3.0.gem
DELETED
Binary file
|
data/pkg/alidayu_sms-0.3.1.gem
DELETED
Binary file
|