aliyun-rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aliyun/aliyun-rails.rb +4 -0
- data/lib/aliyun/rails/connector/roa_client.rb +2 -2
- data/lib/aliyun/rails/connector/rpc_client.rb +2 -1
- data/lib/aliyun/rails/dysms.rb +22 -20
- data/lib/aliyun/rails/dyvms.rb +22 -20
- 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: add5b748d6ea374d744363efa78050f60a3bd35f468a899b5ae8dfba75b65776
|
4
|
+
data.tar.gz: 68082b8b4b235d2b629186baebc0cc16f551abb2a6e450e3df59d2b5fa7fe3a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27fb3cc8491a59d769ef0c52ad9583926806362aaf6280585ab898279024c457124e5b24af4ed4f1168848a004a3d5991ec40ef6b7763915d602d8557c454813
|
7
|
+
data.tar.gz: e21e261ef6659c4fc26aef50678e57e77d7aafc5f793ce8eed26157fc8ea810eca1cf4b53db58f85619a10937489cb30878c154c4a2d04d7fe36ac0a5ce66c0b
|
data/lib/aliyun/aliyun-rails.rb
CHANGED
@@ -2,12 +2,16 @@
|
|
2
2
|
|
3
3
|
require_relative "rails/version"
|
4
4
|
|
5
|
+
require "aliyun/rails/version"
|
5
6
|
require "aliyun/rails/connector/roa_client"
|
6
7
|
require "aliyun/rails/connector/rpc_client"
|
8
|
+
require "aliyun/rails/dysms"
|
9
|
+
require "aliyun/rails/dyvms"
|
7
10
|
|
8
11
|
module Aliyun
|
9
12
|
module Rails
|
10
13
|
class Error < StandardError; end
|
14
|
+
|
11
15
|
# Your code goes here...
|
12
16
|
end
|
13
17
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "faraday"
|
2
4
|
require "securerandom"
|
3
5
|
require "active_support/all"
|
@@ -14,7 +16,6 @@ module Aliyun
|
|
14
16
|
module Rails
|
15
17
|
module Connector
|
16
18
|
class ROAClient
|
17
|
-
|
18
19
|
attr_accessor :endpoint, :api_version, :access_key_id,
|
19
20
|
:access_key_secret, :security_token, :hostname, :opts
|
20
21
|
|
@@ -161,7 +162,6 @@ module Aliyun
|
|
161
162
|
super("#{message} host_id: #{host_id}, request_id: #{request_id}")
|
162
163
|
end
|
163
164
|
end
|
164
|
-
|
165
165
|
end
|
166
166
|
end
|
167
167
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "set"
|
2
4
|
require "openssl"
|
3
5
|
require "faraday"
|
@@ -17,7 +19,6 @@ module Aliyun
|
|
17
19
|
|
18
20
|
# 对象初始化属性
|
19
21
|
def initialize(config = configure, verbose = false)
|
20
|
-
|
21
22
|
validate config
|
22
23
|
|
23
24
|
self.endpoint = config[:endpoint]
|
data/lib/aliyun/rails/dysms.rb
CHANGED
@@ -1,26 +1,28 @@
|
|
1
|
-
|
2
|
-
class Dysms < Aliyun::Rails::Connector::RPCClient
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module Aliyun
|
4
|
+
module Rails
|
5
|
+
class Dysms < Aliyun::Rails::Connector::RPCClient
|
6
|
+
# 本产品(Dysmsapi/2017-05-25)的OpenAPI采用RPC签名风格,签名细节参见签名机制说明。
|
7
|
+
# 我们已经为开发者封装了常见编程语言的SDK,开发者可通过下载SDK直接调用本产品OpenAPI而无需关心技术细节。
|
8
|
+
def initialize(config, verbose = nil)
|
9
|
+
config["endpoint"] = "http://dysmsapi.aliyuncs.com"
|
10
|
+
config["api_version"] = "2017-05-25"
|
7
11
|
|
8
|
-
|
9
|
-
|
12
|
+
super
|
13
|
+
end
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
opts = { method: "POST", timeout: 15000 }
|
23
|
-
request(action: "SendSms", params: params, opts: opts)
|
15
|
+
# 发送短信,发送前要申请短信签名和短信模板,并确保签名和模板已审核通过。
|
16
|
+
def send_sms(phone_numbers, template_code, template_param, sign_name = "")
|
17
|
+
params = {
|
18
|
+
PhoneNumbers: phone_numbers,
|
19
|
+
SignName: sign_name,
|
20
|
+
TemplateCode: template_code,
|
21
|
+
TemplateParam: template_param.to_json
|
22
|
+
}
|
23
|
+
opts = { method: "POST", timeout: 15000 }
|
24
|
+
request(action: "SendSms", params: params, opts: opts)
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
data/lib/aliyun/rails/dyvms.rb
CHANGED
@@ -1,26 +1,28 @@
|
|
1
|
-
|
2
|
-
class Dysms < Aliyun::Rails::Connector::RPCClient
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module Aliyun
|
4
|
+
module Rails
|
5
|
+
class Dysms < Aliyun::Rails::Connector::RPCClient
|
6
|
+
# 本产品(Dyvmsapi/2017-05-25)的OpenAPI采用RPC签名风格,签名细节参见签名机制说明。
|
7
|
+
# 我们已经为开发者封装了常见编程语言的SDK,开发者可通过下载SDK直接调用本产品OpenAPI而无需关心技术细节。
|
8
|
+
def initialize(config, verbose = nil)
|
9
|
+
config["endpoint"] = "http://dyvmsapi.aliyuncs.com"
|
10
|
+
config["api_version"] = "2017-05-25"
|
7
11
|
|
8
|
-
|
9
|
-
|
12
|
+
super
|
13
|
+
end
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
opts = { method: "POST", timeout: 15000 }
|
23
|
-
request(action: "SendSms", params: params, opts: opts)
|
15
|
+
# 调用SingleCallByTts接口向指定号码发送语音验证码和带参数变量的语音通知
|
16
|
+
def single_call_by_tts(called_show_number, called_number, tts_code, tts_param)
|
17
|
+
params = {
|
18
|
+
CalledShowNumber: called_show_number,
|
19
|
+
CalledNumber: called_number,
|
20
|
+
TtsCode: tts_code,
|
21
|
+
TtsParam: tts_param.to_json
|
22
|
+
}
|
23
|
+
opts = { method: "POST", timeout: 15000 }
|
24
|
+
request(action: "SendSms", params: params, opts: opts)
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
data/lib/aliyun/rails/version.rb
CHANGED