aliyun-rails 0.1.11 → 0.1.12
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 +4 -4
- data/README.md +10 -1
- data/lib/aliyun/rails/connector/rpc_client.rb +9 -5
- data/lib/aliyun/rails/dysms.rb +3 -3
- data/lib/aliyun/rails/dyvms.rb +3 -3
- data/lib/aliyun/rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dd2919d59678f49ad2cf11ee04b09699998223435406bca266b028450ba498e
|
4
|
+
data.tar.gz: 339a221b039e588e6e0c7070b1264de67ca43260e1ee1f7f9423e54672b308f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eecf24324919ed9725024aa9a83091f7544c3fca085773aee5d4f6576f7a2fa7e7a3294d11785784a9e6f318833da01f1a451e6d4db7d6070ab55d33cf22d45
|
7
|
+
data.tar.gz: 4423ce1c0668764732833a6a0a95f4230243000e91bb5576a09d2780f2a88224a511253bd8242dcd911eed6fadf5e583ba137d4b1cf97246d726f5dcca0ef8af
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
<a href=" https://www.alibabacloud.com"><img src="https://aliyunsdk-pages.alicdn.com/icons/Aliyun.svg"></a>
|
6
6
|
</p>
|
7
7
|
|
8
|
-
<h1 align="center">非官方SDK套件-用于RAILS
|
8
|
+
<h1 align="center">非官方SDK套件-用于RAILS项目管理</h1>
|
9
9
|
|
10
10
|
<p align="center">
|
11
11
|
<a href="https://badge.fury.io/rb/aliyunsdkcore"><img src="https://badge.fury.io/rb/aliyunsdkcore.svg" alt="Gem Version"></a>
|
@@ -40,6 +40,15 @@ client = Dysms.new(
|
|
40
40
|
access_key_secret: ENV['ACCESS_KEY_SECRET'],
|
41
41
|
)
|
42
42
|
|
43
|
+
# 可以直接将API参数放到 initializers下
|
44
|
+
# Aliyun::Rails.config do |i|
|
45
|
+
# i.access_key_id = "XXX"
|
46
|
+
# i.access_key_secret = "YYYY"
|
47
|
+
# end
|
48
|
+
# 随后直接初始化
|
49
|
+
# client = Dysms.new
|
50
|
+
|
51
|
+
# then use the send_sms method
|
43
52
|
response = client.send_sms("1380000000", "SMS_10010", {param1: "11"}, "SIGN_NAME")
|
44
53
|
|
45
54
|
puts response
|
@@ -14,13 +14,13 @@ module Aliyun
|
|
14
14
|
:security_token, :codes, :opts, :verbose
|
15
15
|
|
16
16
|
# 对象初始化属性
|
17
|
-
def initialize(config, verbose = false)
|
17
|
+
def initialize(config = {}, verbose = false)
|
18
18
|
validate config
|
19
19
|
|
20
20
|
self.endpoint = config[:endpoint]
|
21
21
|
self.api_version = config[:api_version]
|
22
|
-
self.access_key_id = Aliyun::Rails.access_key_id
|
23
|
-
self.access_key_secret = Aliyun::Rails.access_key_secret
|
22
|
+
self.access_key_id = config[:access_key_id] || Aliyun::Rails.access_key_id
|
23
|
+
self.access_key_secret = config[:access_key_secret] || Aliyun::Rails.access_key_secret
|
24
24
|
self.security_token = config[:security_token]
|
25
25
|
self.opts = config[:opts] || {}
|
26
26
|
self.verbose = verbose.instance_of?(TrueClass) && verbose
|
@@ -104,8 +104,12 @@ module Aliyun
|
|
104
104
|
raise ArgumentError, '"config.endpoint" must starts with \'https://\' or \'http://\'.'
|
105
105
|
end
|
106
106
|
raise ArgumentError, 'must pass "config[:api_version]"' unless config[:api_version]
|
107
|
-
|
108
|
-
|
107
|
+
unless config[:access_key_id] || Aliyun::Rails.access_key_id
|
108
|
+
raise ArgumentError, 'must pass "config[:access_key_id]" or define "Aliyun::Rails.access_key_id"'
|
109
|
+
end
|
110
|
+
unless config[:access_key_secret] || Aliyun::Rails.access_key_secret
|
111
|
+
raise ArgumentError, 'must pass "config[:access_key_secret]" or define "Aliyun::Rails.access_key_secret"'
|
112
|
+
end
|
109
113
|
end
|
110
114
|
end
|
111
115
|
end
|
data/lib/aliyun/rails/dysms.rb
CHANGED
@@ -5,9 +5,9 @@ module Aliyun
|
|
5
5
|
class Dysms < Aliyun::Rails::Connector::RPCClient
|
6
6
|
# 本产品(Dysmsapi/2017-05-25)的OpenAPI采用RPC签名风格,签名细节参见签名机制说明。
|
7
7
|
# 我们已经为开发者封装了常见编程语言的SDK,开发者可通过下载SDK直接调用本产品OpenAPI而无需关心技术细节。
|
8
|
-
def initialize(config, verbose = nil)
|
9
|
-
config[:endpoint]
|
10
|
-
config[:api_version]
|
8
|
+
def initialize(config = {}, verbose = nil)
|
9
|
+
config[:endpoint] ||= "http://dysmsapi.aliyuncs.com"
|
10
|
+
config[:api_version] ||= "2017-05-25"
|
11
11
|
super(config, verbose)
|
12
12
|
end
|
13
13
|
|
data/lib/aliyun/rails/dyvms.rb
CHANGED
@@ -5,9 +5,9 @@ module Aliyun
|
|
5
5
|
class Dyvms < Aliyun::Rails::Connector::RPCClient
|
6
6
|
# 本产品(Dyvmsapi/2017-05-25)的OpenAPI采用RPC签名风格,签名细节参见签名机制说明。
|
7
7
|
# 我们已经为开发者封装了常见编程语言的SDK,开发者可通过下载SDK直接调用本产品OpenAPI而无需关心技术细节。
|
8
|
-
def initialize(config, verbose = nil)
|
9
|
-
config[:endpoint]
|
10
|
-
config[:api_version]
|
8
|
+
def initialize(config = {}, verbose = nil)
|
9
|
+
config[:endpoint] ||= "http://dyvmsapi.aliyuncs.com"
|
10
|
+
config[:api_version] ||= "2017-05-25"
|
11
11
|
super(config, verbose)
|
12
12
|
end
|
13
13
|
|
data/lib/aliyun/rails/version.rb
CHANGED