tencent_cos_sdk 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c05cabab083444a58f54d2c23e20ad1a77a5889
4
- data.tar.gz: cf903de3f333951eba8d7cc29737b5dd05544e33
3
+ metadata.gz: 6325f628a2f8cd7608b737a435dd2f14d47fc5dd
4
+ data.tar.gz: c3e351642800250bbf8040fa6115d23589b25bd5
5
5
  SHA512:
6
- metadata.gz: ab87e308ff8fc5907558384ad7c8eeb919a5e14098f78f81c707fcba53108d404e3970a6eafc6b2e07fa02416384e9f6ad0ec6f93d386d44ef9cf8e4c65d0ae0
7
- data.tar.gz: df7cf33752d4cf4058fc517ed93ede94f63a2d6765b8a936bfd98297f44788d096e5f47baab8df34cde67ee946d9f07ce4d9f6c329e1d0e5ed7233a4363e7a18
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',
@@ -1,3 +1,3 @@
1
1
  module TencentCosSdk
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
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-26 00:00:00.000000000 Z
11
+ date: 2018-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: openssl