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 +4 -4
- data/lib/qcloud_cos/http.rb +1 -1
- data/lib/qcloud_cos/object_manager.rb +16 -3
- data/lib/qcloud_cos/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd9db0f6abcec37392902c6ccfcd9847e4b08a5e947c7adc0dd3b3f23a8f28a8
|
4
|
+
data.tar.gz: 7140757a257df3a2c838d15291bcec19cd9aa655fdb2d8d8278c820e1060067c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9e065e41b93e2fa6cc48da025662ab02e3418016c5e790ae2120576f7dba7cb53995f794db4ae09ad0bb8243bcc2221422c19dad8784c22a8d4f30ff35c012d
|
7
|
+
data.tar.gz: ab2e6be546bfa548f4a3ee9ef919f58297dcaeb574cedab27b1258fdb1c47c1e699f59c72e9e6889d38bb611d01cb089ac66f1abd39291fdf8b19227eb8169a8
|
data/lib/qcloud_cos/http.rb
CHANGED
@@ -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,
|
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
|
-
|
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://#{
|
42
|
+
URI.join("https://#{host}", path).to_s
|
30
43
|
end
|
31
44
|
end
|
32
45
|
end
|
data/lib/qcloud_cos/version.rb
CHANGED
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
|
+
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:
|
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
|
-
|
117
|
-
|
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: []
|