aliyunsdkcore 0.0.12 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README-CN.md +3 -0
- data/README.md +3 -0
- data/lib/aliyunsdkcore.rb +1 -1
- data/lib/aliyunsdkcore/roa_client.rb +20 -6
- data/lib/aliyunsdkcore/rpc_client.rb +3 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ed4e462c3eaa7596b33d65643bf03517df70e3744bfb7f68a2119b03164d965
|
4
|
+
data.tar.gz: '0947af20ae38e51f691b214fe58000d8848b6adeaf30bde00586b22359b0663e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96df4423e6bf75d3b5a5671ecc4210975402023ec00b30a6fb3d723156e2da5ba39da2ca45d32dccc6c034efb19a2f083651a78cdcea4ce099a097a90a1a6d8f
|
7
|
+
data.tar.gz: 1686c65013f6b02f46cf94b3f68fb40d75e16d33888c09d7536a84cca6dd52c23faf8b79019fa08979902a7b59b0212241fdea131b4e656c369d01f82edfb0f7
|
data/README-CN.md
CHANGED
@@ -19,6 +19,9 @@ Alibaba Cloud Core SDK for Ruby 支持 Ruby 开发者轻松访问阿里云服务
|
|
19
19
|
|
20
20
|
本文档介绍如何安装和使用 Alibaba Cloud Core SDK for Ruby。
|
21
21
|
|
22
|
+
## 使用诊断
|
23
|
+
[Troubleshoot](https://troubleshoot.api.aliyun.com/?source=github_sdk) 提供 OpenAPI 使用诊断服务,通过 `RequestID` 或 `报错信息` ,帮助开发者快速定位,为开发者提供解决方案。
|
24
|
+
|
22
25
|
## 安装
|
23
26
|
|
24
27
|
```sh
|
data/README.md
CHANGED
@@ -19,6 +19,9 @@ Alibaba Cloud Core SDK for Ruby allows you to access Alibaba Cloud services such
|
|
19
19
|
|
20
20
|
This document introduces how to install and use Alibaba Cloud Core SDK for Ruby.
|
21
21
|
|
22
|
+
## Troubleshoot
|
23
|
+
[Troubleshoot](https://troubleshoot.api.aliyun.com/?source=github_sdk) Provide OpenAPI diagnosis service to help developers locate quickly and provide solutions for developers through `RequestID` or `error message`.
|
24
|
+
|
22
25
|
## Installation
|
23
26
|
|
24
27
|
```sh
|
data/lib/aliyunsdkcore.rb
CHANGED
@@ -2,7 +2,7 @@ require 'aliyunsdkcore/rpc_client'
|
|
2
2
|
require 'aliyunsdkcore/roa_client'
|
3
3
|
|
4
4
|
module AliyunSDKCore
|
5
|
-
VERSION = "0.0.
|
5
|
+
VERSION = "0.0.17"
|
6
6
|
DEFAULT_UA = "AlibabaCloud (#{Gem::Platform.local.os}; " +
|
7
7
|
"#{Gem::Platform.local.cpu}) Ruby/#{RUBY_VERSION} Core/#{VERSION}"
|
8
8
|
end
|
@@ -1,6 +1,14 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'securerandom'
|
3
3
|
require 'active_support/all'
|
4
|
+
require 'net/http'
|
5
|
+
|
6
|
+
module Net::HTTPHeader
|
7
|
+
def capitalize(name)
|
8
|
+
name
|
9
|
+
end
|
10
|
+
private :capitalize
|
11
|
+
end
|
4
12
|
|
5
13
|
module AliyunSDKCore
|
6
14
|
|
@@ -26,11 +34,17 @@ module AliyunSDKCore
|
|
26
34
|
|
27
35
|
response = connection.send(method.downcase) do |request|
|
28
36
|
request.url uri, params
|
29
|
-
if body
|
30
|
-
|
31
|
-
|
37
|
+
if body
|
38
|
+
if mix_headers['content-type'].start_with? 'application/json'
|
39
|
+
request_body = body.to_json
|
40
|
+
elsif mix_headers['content-type'].start_with? 'application/x-www-form-urlencoded'
|
41
|
+
request_body = URI.encode_www_form(body)
|
42
|
+
else
|
43
|
+
request_body = body
|
44
|
+
end
|
32
45
|
mix_headers['content-md5'] = Digest::MD5.base64digest request_body
|
33
46
|
mix_headers['content-length'] = request_body.length.to_s
|
47
|
+
request.body = request_body
|
34
48
|
end
|
35
49
|
string2sign = string_to_sign(method, uri, mix_headers, params)
|
36
50
|
mix_headers.merge!(authorization: authorization(string2sign))
|
@@ -64,15 +78,15 @@ module AliyunSDKCore
|
|
64
78
|
end
|
65
79
|
|
66
80
|
def post(uri: '', headers: {}, params: {}, body: {}, options: {})
|
67
|
-
request(method: :
|
81
|
+
request(method: :post, uri: uri, params: params, body: body, headers: headers, options: options)
|
68
82
|
end
|
69
83
|
|
70
84
|
def put(uri: '', headers: {}, params: {}, body: {}, options: {})
|
71
|
-
request(method: :
|
85
|
+
request(method: :put, uri: uri, params: params, body: body, headers: headers, options: options)
|
72
86
|
end
|
73
87
|
|
74
88
|
def delete(uri: '', headers: {}, params: {}, options: {})
|
75
|
-
request(method: :
|
89
|
+
request(method: :delete, uri: uri, params: params, body: {}, headers: headers, options: options)
|
76
90
|
end
|
77
91
|
|
78
92
|
def default_headers
|
@@ -51,8 +51,8 @@ module AliyunSDKCore
|
|
51
51
|
end
|
52
52
|
|
53
53
|
response_body = JSON.parse(response.body)
|
54
|
-
if response_body['Code'] && !self.codes.include?(response_body['Code'])
|
55
|
-
raise StandardError, "#{response_body['Message']}, URL: #{uri}"
|
54
|
+
if response_body['Code'] && !response_body['Code'].to_s.empty? && !self.codes.include?(response_body['Code'])
|
55
|
+
raise StandardError, "Code: #{response_body['Code']}, Message: #{response_body['Message']}, URL: #{uri}"
|
56
56
|
end
|
57
57
|
|
58
58
|
response_body
|
@@ -88,6 +88,7 @@ module AliyunSDKCore
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def encode(string)
|
91
|
+
string = string.to_s unless string.is_a?(String)
|
91
92
|
encoded = CGI.escape string
|
92
93
|
encoded.gsub(/[\+]/, '%20')
|
93
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aliyunsdkcore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alibaba Cloud SDK
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -56,7 +56,7 @@ homepage: http://www.alibabacloud.com/
|
|
56
56
|
licenses:
|
57
57
|
- MIT
|
58
58
|
metadata: {}
|
59
|
-
post_install_message:
|
59
|
+
post_install_message:
|
60
60
|
rdoc_options: []
|
61
61
|
require_paths:
|
62
62
|
- lib
|
@@ -64,15 +64,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: 2.3.0
|
68
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '0'
|
73
73
|
requirements: []
|
74
|
-
rubygems_version: 3.
|
75
|
-
signing_key:
|
74
|
+
rubygems_version: 3.2.3
|
75
|
+
signing_key:
|
76
76
|
specification_version: 4
|
77
77
|
summary: Alibaba Cloud Ruby Core SDK
|
78
78
|
test_files: []
|