aliyun-vms 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +192 -0
- data/Rakefile +2 -0
- data/aliyun-vms.gemspec +29 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/aliyun/vms.rb +123 -0
- data/lib/aliyun/vms/version.rb +5 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c619251fb57eaa1dd5a74a6aa273aad53d4333a36333aa5115e87e492afd358a
|
4
|
+
data.tar.gz: e096dcbc4dcc3c18f18656f00514d16e65b4b4435bd937b9655d9099304dbd98
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e3dfcb9fd7df3210e922ca26e1a1ea40513faff8820b3c8468b8246c74aaf35cde70deba8d0829f79d6ec8f4fdd293d689462fe0cae6bbee2e199294fa8161f3
|
7
|
+
data.tar.gz: 5f8f9e8e6d14d957a593ea9dd122dff069d3e4c59d8b31c8c83ab2e8cc3249d5775f967a6c85bada127757557636d2da146142bc7335b57c0cc70eea27e257e6
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at wellsmuker@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Wells Muker
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
# Aliyun::Vms 阿里云语音服务 Ruby Gem aliyun-vms
|
2
|
+
|
3
|
+
**适用于阿里云语音服务最新的 *2017-05-25* 版接口**
|
4
|
+
|
5
|
+
## 特别说明
|
6
|
+
|
7
|
+
目前阿里云通信语音服务提供4个产品,分别是:
|
8
|
+
|
9
|
+
1. 语音验证码
|
10
|
+
2. 语音通知
|
11
|
+
3. 语音IVR
|
12
|
+
4. 智能外呼
|
13
|
+
|
14
|
+
**这个 gem 目前只调通的是前面所述的第 2 个语音产品,即“语音通知”。请您在使用 aliyun-vms 前,请参考官方说明文档[阿里云语音业务说明](https://help.aliyun.com/product/54853.html)。**
|
15
|
+
|
16
|
+
## 使用前提
|
17
|
+
|
18
|
+
使用 aliyun-vms 前,您必须已经是阿里云注册用户,申请开通了“阿里云语音服务”,并且获得了以下几个关键参数:
|
19
|
+
|
20
|
+
1. ACCESS\_KEY\_SECRET: 阿里云用户密钥,在阿里云控制台申请获取。
|
21
|
+
2. ACCESS\_KEY\_ID: 阿里云用户 ID, 在阿里云控制台申请获取。
|
22
|
+
3. Tts\_CODE: 语音模版代码,在阿里云申请开通语音服务时申请获取。
|
23
|
+
|
24
|
+
## Installation 安装
|
25
|
+
|
26
|
+
### Ruby 通用安装方法
|
27
|
+
在命令行中输入命令(电脑已经安装 gems 命令行工具)
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
gem install aliyun-vms
|
31
|
+
```
|
32
|
+
|
33
|
+
### Rails 应用安装方法
|
34
|
+
|
35
|
+
在应用的 Gemfile 文件中添加 Ruby Gems 安装源:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
gem 'aliyun-vms' # Ruby Gems 安装源
|
39
|
+
```
|
40
|
+
|
41
|
+
应用的根目录下运行:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
bundle
|
45
|
+
```
|
46
|
+
|
47
|
+
### 下载后安装
|
48
|
+
|
49
|
+
使用 Git 将代码克隆到本地后使用 Rake 命令安装
|
50
|
+
|
51
|
+
```bash
|
52
|
+
git clone https://github.com/kejincan0527/aliyun-vms.git
|
53
|
+
|
54
|
+
cd aliyun-vms
|
55
|
+
|
56
|
+
rake build
|
57
|
+
|
58
|
+
rake install
|
59
|
+
```
|
60
|
+
|
61
|
+
### 安装可能遇到的问题及其解决方式
|
62
|
+
|
63
|
+
安装后,如果在 irb 命令行输入命令
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
require 'aliyun/vms'
|
67
|
+
```
|
68
|
+
|
69
|
+
后,无法正确获取 Gem 引用,或者在 Rails 启动时报错提示如下:
|
70
|
+
|
71
|
+
> ./config/initializers/aliyun-vms.rb:1:in `<top (required)>': uninitialized constant Aliyun::Vms (NameError)
|
72
|
+
|
73
|
+
可以改为 Github 安装源,例如 Rails Gemfile 文件引用可以改为下面格式,即可正确安装。
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
gem 'aliyun-vms', '0.0.1', git: 'https://github.com/kejincan0527/aliyun-vms.git'
|
77
|
+
```
|
78
|
+
|
79
|
+
## Usage 使用
|
80
|
+
|
81
|
+
### Ruby 程序通用方法(irb命令行示例)
|
82
|
+
|
83
|
+
#### 第一步:
|
84
|
+
|
85
|
+
```bash
|
86
|
+
$ require 'aliyun/vms'
|
87
|
+
```
|
88
|
+
|
89
|
+
```bash
|
90
|
+
=> true
|
91
|
+
```
|
92
|
+
|
93
|
+
#### 第二步:
|
94
|
+
|
95
|
+
参数设置:
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
$ Aliyun::Vms.configure do |config|
|
99
|
+
config.access_key_secret = ACCESS_KEY_SECRET # 阿里云接入密钥,在阿里云控制台申请
|
100
|
+
config.access_key_id = ACCESS_KEY_ID # 阿里云接入 ID, 在阿里云控制台申请
|
101
|
+
config.action = 'SingleCallByTts' # 默认设置
|
102
|
+
config.format = 'XML' # 语音推送返回信息格式,可以填写 'JSON'或者'XML'
|
103
|
+
config.region_id = 'cn-hangzhou' # 默认设置,如果没有特殊需要,可以不改
|
104
|
+
config.signature_method = 'HMAC-SHA1' # 加密算法,默认设置
|
105
|
+
config.signature_version = '1.0' # 签名版本,默认设置,不用修改
|
106
|
+
config.version = '2017-05-25' # 服务版本,默认设置,不用修改
|
107
|
+
end
|
108
|
+
|
109
|
+
```
|
110
|
+
返回
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
=> "2017-05-25"
|
114
|
+
```
|
115
|
+
|
116
|
+
#### 第三步:
|
117
|
+
|
118
|
+
发送语音:
|
119
|
+
|
120
|
+
$ Aliyun::Vms.send(called_show_number, called_number, tts_code, tts_param, out_id)
|
121
|
+
|
122
|
+
参数说明:
|
123
|
+
|
124
|
+
1. called_show_number: 被叫显示号码,必须为字符型,例如 '057112345678';
|
125
|
+
2. called_number: 接收语音的手机号,必须为字符型,例如 '1234567890';
|
126
|
+
3. tts\_code: 语音模版代码,必须为字符型,申请开通语音服务后,由阿里云提供,例如 'TTS_12345678';
|
127
|
+
4. tts\_param: 请求字符串,向语音模版提供参数,必须是转为字符串的json格式对象,例如 '{"code":"666666", "product":"测试网站" }';
|
128
|
+
5. out_id: 外部流水扩展字段,必须为字符型,可以为空。
|
129
|
+
|
130
|
+
|
131
|
+
### Rails 应用使用方法
|
132
|
+
|
133
|
+
#### 第一步:
|
134
|
+
|
135
|
+
在 Rails 应用目录 config/initializers/ 下创建脚本文件 aliyun-vms.rb,在文件中加入以下内容:
|
136
|
+
|
137
|
+
config/initializers/aliyun-vms.rb
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
Aliyun::Vms.configure do |config|
|
141
|
+
config.access_key_secret = ACCESS_KEY_SECRET # 阿里云接入密钥,在阿里云控制台申请
|
142
|
+
config.access_key_id = ACCESS_KEY_ID # 阿里云接入 ID, 在阿里云控制台申请
|
143
|
+
config.action = 'SingleCallByTts' # 默认设置
|
144
|
+
config.format = 'XML' # 语音推送返回信息格式,可以填写 'JSON'或者'XML'
|
145
|
+
config.region_id = 'cn-hangzhou' # 默认设置,如果没有特殊需要,可以不改
|
146
|
+
config.signature_method = 'HMAC-SHA1' # 加密算法,默认设置
|
147
|
+
config.signature_version = '1.0' # 签名版本,默认设置,不用修改
|
148
|
+
config.version = '2017-05-25' # 服务版本,默认设置,不用修改
|
149
|
+
end
|
150
|
+
```
|
151
|
+
之后,重新启动 Rails,加载配置。
|
152
|
+
|
153
|
+
#### 第二步:
|
154
|
+
|
155
|
+
在 Rails 应用中调用语音发送代码:
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
Aliyun::Vms.send(called_show_number, called_number, tts_code, tts_param, out_id)
|
159
|
+
```
|
160
|
+
|
161
|
+
参数说明:
|
162
|
+
|
163
|
+
1. called_show_number: 被叫显示号码,必须为字符型,例如 '057112345678';
|
164
|
+
2. called_number: 接收语音的手机号,必须为字符型,例如 '1234567890';
|
165
|
+
3. tts\_code: 语音模版代码,必须为字符型,申请开通语音服务后,由阿里云提供,例如 'TTS_12345678';
|
166
|
+
4. tts\_param: 请求字符串,向语音模版提供参数,必须是转为字符串的json格式对象,例如 '{"code":"666666", "product":"测试网站" }';
|
167
|
+
5. out_id: 外部流水扩展字段,必须为字符型,可以为空。
|
168
|
+
|
169
|
+
特别说明:
|
170
|
+
|
171
|
+
在程序中可以先用 HASH 组织 tts\_param 内容,再使用 to_json 方法转换为 json 格式字符串,例如:
|
172
|
+
|
173
|
+
```ruby
|
174
|
+
...
|
175
|
+
called_show_number = '057112345678'
|
176
|
+
called_number = '1234567890'
|
177
|
+
tts_code = 'TTS_12345678'
|
178
|
+
tts_param = {"code"=>"666666", "product"=>"测试网站" }.to_json
|
179
|
+
Aliyun::Vms.send(called_show_number, called_number, tts_code, tts_param)
|
180
|
+
...
|
181
|
+
```
|
182
|
+
|
183
|
+
## Development 开发
|
184
|
+
|
185
|
+
按照阿里云[官方接口文档](https://help.aliyun.com/document_detail/56190.html)提供的 VMS 样例做了 spect 测试,可以 clone 项目后,在根目录下用命令行运行以下命令测试:
|
186
|
+
|
187
|
+
$ bundle exec rspec spec
|
188
|
+
|
189
|
+
|
190
|
+
## License 许可
|
191
|
+
|
192
|
+
MIT 协议下的开源项目。 [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/aliyun-vms.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'aliyun/vms/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "aliyun-vms"
|
8
|
+
spec.version = Aliyun::Vms::VERSION
|
9
|
+
spec.authors = ["Wells Muker"]
|
10
|
+
spec.email = ["wellsmuker@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A Ruby Gem for using aliyun vms service, in accordance with aliyun vms 2017-05-25 version api. 适用于阿里云语音服务最新的 2017-05-25 版接口.}
|
13
|
+
spec.description = %q{A Ruby Gem for using aliyun vms service, in accordance with aliyun vms 2017-05-25 version api. 适用于阿里云语音服务最新的 2017-05-25 版接口.}
|
14
|
+
spec.homepage = "https://github.com/kejincan0527/aliyun-vms"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rspec"
|
28
|
+
spec.add_dependency "typhoeus"
|
29
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "aliyun/vms"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/aliyun/vms.rb
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
require "aliyun/vms/version"
|
2
|
+
require "openssl"
|
3
|
+
require "base64"
|
4
|
+
require 'typhoeus'
|
5
|
+
require "erb"
|
6
|
+
include ERB::Util
|
7
|
+
|
8
|
+
module Aliyun
|
9
|
+
module Vms
|
10
|
+
class Configuration
|
11
|
+
attr_accessor :access_key_secret, :access_key_id, :action, :format, :region_id,
|
12
|
+
:signature_method, :signature_version, :version
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@access_key_secret = ''
|
16
|
+
@access_key_id = ''
|
17
|
+
@action = ''
|
18
|
+
@format = ''
|
19
|
+
@region_id = ''
|
20
|
+
@signature_method = ''
|
21
|
+
@signature_version = ''
|
22
|
+
@version = ''
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class << self
|
27
|
+
attr_writer :configuration
|
28
|
+
|
29
|
+
def configuration
|
30
|
+
@configuration ||= Configuration.new
|
31
|
+
end
|
32
|
+
|
33
|
+
def configure
|
34
|
+
yield(configuration)
|
35
|
+
end
|
36
|
+
|
37
|
+
def send(called_show_number, called_number, tts_code, tts_param, out_id = '')
|
38
|
+
Typhoeus.get(get_url({
|
39
|
+
'CalledShowNumber' => called_show_number,
|
40
|
+
'CalledNumber' => called_number,
|
41
|
+
'TtsCode' => tts_code,
|
42
|
+
'TtsParam' => tts_param,
|
43
|
+
'OutId' => out_id,
|
44
|
+
'SignatureNonce' => seed_signature_nonce,
|
45
|
+
'Timestamp' => seed_timestamp
|
46
|
+
}))
|
47
|
+
end
|
48
|
+
|
49
|
+
def get_url(user_params)
|
50
|
+
params = get_params(user_params)
|
51
|
+
coded_params = canonicalized_query_string(params)
|
52
|
+
key_secret = configuration.access_key_secret
|
53
|
+
url = 'http://dyvmsapi.aliyuncs.com/?' + 'Signature=' + sign(key_secret, coded_params) + '&' + coded_params
|
54
|
+
end
|
55
|
+
|
56
|
+
def get_params(user_params)
|
57
|
+
params = config_params.merge(user_params)
|
58
|
+
end
|
59
|
+
|
60
|
+
def config_params()
|
61
|
+
params ={
|
62
|
+
'AccessKeyId' => configuration.access_key_id,
|
63
|
+
'Action' => configuration.action,
|
64
|
+
'Format' => configuration.format,
|
65
|
+
'RegionId' => configuration.region_id,
|
66
|
+
'SignatureMethod' => configuration.signature_method,
|
67
|
+
'SignatureVersion' => configuration.signature_version,
|
68
|
+
'Version' => configuration.version
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
def canonicalized_query_string(params)
|
73
|
+
cqstring = ''
|
74
|
+
params.sort_by{|key, val| key}.each do |key, value|
|
75
|
+
if cqstring.empty?
|
76
|
+
cqstring += "#{encode(key)}=#{encode(value)}"
|
77
|
+
else
|
78
|
+
cqstring += "&#{encode(key)}=#{encode(value)}"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
cqstring
|
82
|
+
end
|
83
|
+
|
84
|
+
# 生成数字签名
|
85
|
+
def sign(key_secret, coded_params)
|
86
|
+
key = key_secret + '&'
|
87
|
+
signature = 'GET' + '&' + encode('/') + '&' + encode(coded_params)
|
88
|
+
sign = Base64.encode64("#{OpenSSL::HMAC.digest('sha1',key, signature)}")
|
89
|
+
encode(sign.chomp) # 通过chomp去掉最后的换行符 LF
|
90
|
+
end
|
91
|
+
|
92
|
+
# 对字符串进行 PERCENT 编码
|
93
|
+
def encode(input)
|
94
|
+
output = url_encode(input)
|
95
|
+
end
|
96
|
+
|
97
|
+
# 生成语音时间戳
|
98
|
+
def seed_timestamp
|
99
|
+
Time.now.utc.strftime("%FT%TZ")
|
100
|
+
end
|
101
|
+
|
102
|
+
# 生成语音唯一标识码,采用到微秒的时间戳
|
103
|
+
def seed_signature_nonce
|
104
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S%L")
|
105
|
+
end
|
106
|
+
|
107
|
+
# 测试参数未编码时生成的字符串是否正确(多一道保险)
|
108
|
+
def test_query_string(params)
|
109
|
+
qstring = ''
|
110
|
+
params.sort_by{|key, val| key}.each do |key, value|
|
111
|
+
if qstring.empty?
|
112
|
+
qstring += "#{key}=#{value}"
|
113
|
+
else
|
114
|
+
qstring += "&#{key}=#{value}"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
qstring
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aliyun-vms
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Wells Muker
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: typhoeus
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A Ruby Gem for using aliyun vms service, in accordance with aliyun vms
|
70
|
+
2017-05-25 version api. 适用于阿里云语音服务最新的 2017-05-25 版接口.
|
71
|
+
email:
|
72
|
+
- wellsmuker@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- CODE_OF_CONDUCT.md
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- aliyun-vms.gemspec
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- lib/aliyun/vms.rb
|
87
|
+
- lib/aliyun/vms/version.rb
|
88
|
+
homepage: https://github.com/kejincan0527/aliyun-vms
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubygems_version: 3.0.1
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: A Ruby Gem for using aliyun vms service, in accordance with aliyun vms 2017-05-25
|
111
|
+
version api. 适用于阿里云语音服务最新的 2017-05-25 版接口.
|
112
|
+
test_files: []
|