tencent_cos_sdk 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/tencent_cos_sdk/request.rb +3 -2
- data/lib/tencent_cos_sdk/utils.rb +17 -1
- data/lib/tencent_cos_sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6325f628a2f8cd7608b737a435dd2f14d47fc5dd
|
4
|
+
data.tar.gz: c3e351642800250bbf8040fa6115d23589b25bd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fd70b047c64ab731641f15f682e47fdfbd2a8d22b52c0246bcd773c09d600302e4ed59fe48337511877873c724f56358e4ac67950b180a8476453faa3ff14b7
|
7
|
+
data.tar.gz: 51ebc7ab9ff93953e1d0d13ebb33104a12d3f3d5786de39954511a21c2cc350077bdd29a97819e57ae5bb9c042fde7db0b709648488650edf8d1925a6ad3532a
|
data/README.md
CHANGED
@@ -57,3 +57,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
57
57
|
## Code of Conduct
|
58
58
|
|
59
59
|
Everyone interacting in the TencentCosSdk project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/xxjapp/tencent_cos_sdk/blob/master/CODE_OF_CONDUCT.md).
|
60
|
+
|
61
|
+
## Links
|
62
|
+
|
63
|
+
* [ruby gem tencent_cos_sdk](https://rubygems.org/gems/tencent_cos_sdk)
|
@@ -6,8 +6,11 @@ module TencentCosSdk
|
|
6
6
|
class Request
|
7
7
|
attr_accessor :http_method, :path, :headers, :body, :file
|
8
8
|
attr_accessor :response, :time_used
|
9
|
+
attr_accessor :options
|
9
10
|
|
10
11
|
def initialize options
|
12
|
+
self.options = options
|
13
|
+
|
11
14
|
self.http_method = options[:http_method]
|
12
15
|
self.path = options[:path]
|
13
16
|
self.headers = options[:headers] || {}
|
@@ -55,8 +58,6 @@ module TencentCosSdk
|
|
55
58
|
response
|
56
59
|
end
|
57
60
|
|
58
|
-
private
|
59
|
-
|
60
61
|
def description
|
61
62
|
s = "\n\n"
|
62
63
|
s << "#{http_method.upcase} #{TencentCosSdk.uri(@path)} HTTP/1.1\n".light_magenta
|
@@ -13,13 +13,29 @@ module TencentCosSdk
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class Request
|
16
|
+
def log_debug *values
|
17
|
+
p values if options[:log_debug]
|
18
|
+
end
|
19
|
+
|
16
20
|
def get_authorization
|
17
|
-
sign_time = "#{Time.now.to_i - 3600};#{Time.now.to_i + 3600}"
|
21
|
+
sign_time = options[:sign_time] || "#{Time.now.to_i - 3600};#{Time.now.to_i + 3600}"
|
22
|
+
log_debug '=>', sign_time
|
23
|
+
|
24
|
+
log_debug '[', TencentCosSdk.conf.secret_key, ']'
|
18
25
|
sign_key = OpenSSL::HMAC.hexdigest('sha1', TencentCosSdk.conf.secret_key, sign_time)
|
26
|
+
log_debug '=>', sign_key
|
27
|
+
|
19
28
|
http_string = get_http_string
|
29
|
+
log_debug '=>', http_string
|
30
|
+
|
20
31
|
sha1ed_http_string = Digest::SHA1.hexdigest http_string
|
32
|
+
log_debug '=>', sha1ed_http_string
|
33
|
+
|
21
34
|
string_to_sign = "sha1\n#{sign_time}\n#{sha1ed_http_string}\n"
|
35
|
+
log_debug '=>', string_to_sign
|
36
|
+
|
22
37
|
signature = OpenSSL::HMAC.hexdigest('sha1', sign_key, string_to_sign)
|
38
|
+
log_debug '=>', signature
|
23
39
|
|
24
40
|
{
|
25
41
|
'q-sign-algorithm' => 'sha1',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tencent_cos_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xia xiongjun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: openssl
|