qcloud-cos 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fcd9ad3b80685b30e64389f95b633b707b5a5c43e389cb93d9ad3ca9a7e5de56
4
- data.tar.gz: f2c7f6285c1fab0834903055324d786d823afd34f0da4760ca3c462198b73ee9
3
+ metadata.gz: dd9db0f6abcec37392902c6ccfcd9847e4b08a5e947c7adc0dd3b3f23a8f28a8
4
+ data.tar.gz: 7140757a257df3a2c838d15291bcec19cd9aa655fdb2d8d8278c820e1060067c
5
5
  SHA512:
6
- metadata.gz: 58661d7ff828784455d75ee51d7ef45fd64f654fa1dd3a6b423f2c206d99c0a438bd9eec9c0e9548f012f1c6211503e03a4d0b86d12558f41a413de479798c14
7
- data.tar.gz: 38b103b8e3fe98857d0896dfa5a3826cb3c528f7495f4547bb4c42d2578187c4fe2a2bbb6d323eaf3e677bc2246c405574bb0dbfc1a92ed7b647c8be72259ea5
6
+ metadata.gz: d9e065e41b93e2fa6cc48da025662ab02e3418016c5e790ae2120576f7dba7cb53995f794db4ae09ad0bb8243bcc2221422c19dad8784c22a8d4f30ff35c012d
7
+ data.tar.gz: ab2e6be546bfa548f4a3ee9ef919f58297dcaeb574cedab27b1258fdb1c47c1e699f59c72e9e6889d38bb611d01cb089ac66f1abd39291fdf8b19227eb8169a8
@@ -52,7 +52,7 @@ module QcloudCos
52
52
  q_url_params = query_string.to_s.split("&").map { |s| s.split("=").first }.compact.map(&:downcase).sort.join(";")
53
53
 
54
54
  sign_key = OpenSSL::HMAC.hexdigest("SHA1", access_key, q_sign_time)
55
- http_parameters = query_string.to_s.split("&").map { |s| s.split("=") }.map { |field, value| [field.downcase, value]}.sort_by { |field, value| field}.map { |field, value| [field, value].compact.join("=") }.join("&")
55
+ http_parameters = query_string.to_s.split("&").map { |s| s.split("=") }.map { |field, value| [field.downcase, value] }.sort_by { |field, _| field.to_s }.map { |field, value| [field, value].compact.join("=") }.join("&")
56
56
  http_headers = headers.map { |h, v| [h.downcase, CGI.escape(v)].join("=") }.join("&")
57
57
  http_string = "#{method.downcase}\n#{path}\n#{http_parameters}\n#{http_headers}\n"
58
58
  string_to_sign = "sha1\n#{q_sign_time}\n#{Digest::SHA1.hexdigest(http_string)}\n"
@@ -16,8 +16,9 @@ module QcloudCos
16
16
  http.put(compute_url(path), data, headers)
17
17
  end
18
18
 
19
- def copy_object(path, copy_source)
20
- body = http.put(compute_url(path), nil, 'x-cos-copy-source' => copy_source).body
19
+ def copy_object(path, copy_source, headers = {})
20
+ headers['x-cos-copy-source'] = copy_source
21
+ body = http.put(compute_url(path), nil, headers).body
21
22
  ActiveSupport::HashWithIndifferentAccess.new(ActiveSupport::XmlMini.parse(body))
22
23
  end
23
24
 
@@ -25,8 +26,20 @@ module QcloudCos
25
26
  http.delete(compute_url(path))
26
27
  end
27
28
 
29
+ def delete_objects(pathes, quiet = false)
30
+ data = {
31
+ "Quiet" => quiet,
32
+ "Object" => pathes.map { |p| { "Key" => p } },
33
+ }
34
+ http.post(compute_url("/?delete"), data.to_xml(root: "Delete", skip_instruct: true, skip_types: false), "Content-Type" => "application/xml")
35
+ end
36
+
37
+ def host
38
+ "#{bucket}.cos.#{region}.myqcloud.com"
39
+ end
40
+
28
41
  def compute_url(path)
29
- URI.join("https://#{bucket}.cos.#{region}.myqcloud.com", path).to_s
42
+ URI.join("https://#{host}", path).to_s
30
43
  end
31
44
  end
32
45
  end
@@ -1,3 +1,3 @@
1
1
  module QcloudCos
2
- VERSION = "0.0.4".freeze
2
+ VERSION = "0.0.5".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qcloud-cos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - xuxiangyang
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-27 00:00:00.000000000 Z
11
+ date: 2024-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_xml
@@ -98,7 +98,7 @@ metadata:
98
98
  homepage_uri: http://github.com/xuxiangyang/qcloud-cos
99
99
  source_code_uri: http://github.com/xuxiangyang/qcloud-cos
100
100
  changelog_uri: http://github.com/xuxiangyang/qcloud-cos/CHANGELOG.md
101
- post_install_message:
101
+ post_install_message:
102
102
  rdoc_options: []
103
103
  require_paths:
104
104
  - lib
@@ -113,9 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  requirements: []
116
- rubyforge_project:
117
- rubygems_version: 2.7.7
118
- signing_key:
116
+ rubygems_version: 3.4.10
117
+ signing_key:
119
118
  specification_version: 4
120
119
  summary: qcloud cos ruby sdk
121
120
  test_files: []