aliyun-oss-sdk 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/aliyun/oss/api/bucket_objects.rb +0 -9
- data/lib/aliyun/oss/http.rb +18 -13
- data/lib/aliyun/oss/utils.rb +0 -5
- data/lib/aliyun/oss/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbf195d34ce4df49ea7a519ff4d05f2c53844a4a
|
4
|
+
data.tar.gz: 0acc746359cfb2ce02a6eb005a61f10f41acbd9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5faaf0e6ac940d44ddd5a2367d54ffdfdc7d8008badf749159fb83a15092f003fd8c7b11017736823fa2d112ac294ec51ecc249f413abc0807ca516fba14fb2
|
7
|
+
data.tar.gz: fe02419091a96c091998b603d0cc9d08e28639d3f4e9c28c1a03e86f865d7702782deee8d1c7457dedd64239153a1004c4b0bb3e08908729ca96f755d6b6239d
|
data/CHANGELOG.md
CHANGED
@@ -40,7 +40,6 @@ module Aliyun
|
|
40
40
|
#
|
41
41
|
# @return [Response]
|
42
42
|
def bucket_create_object(key, file, headers = {})
|
43
|
-
Utils.clean_object_name!(key)
|
44
43
|
Utils.stringify_keys!(headers)
|
45
44
|
http.put("/#{key}", headers: headers, body: Utils.to_data(file), bucket: bucket, key: key)
|
46
45
|
end
|
@@ -68,7 +67,6 @@ module Aliyun
|
|
68
67
|
fail('source_bucket must be not empty!') if source_bucket.nil? || source_bucket.empty?
|
69
68
|
fail('source_key must be not empty!') if source_key.nil? || source_key.empty?
|
70
69
|
|
71
|
-
Utils.clean_object_name!(key)
|
72
70
|
Utils.stringify_keys!(headers)
|
73
71
|
headers.merge!('x-oss-copy-source' => "/#{source_bucket}/#{source_key}")
|
74
72
|
|
@@ -88,7 +86,6 @@ module Aliyun
|
|
88
86
|
#
|
89
87
|
# @return [Response]
|
90
88
|
def bucket_append_object(key, file, position = 0, headers = {})
|
91
|
-
Utils.clean_object_name!(key)
|
92
89
|
Utils.stringify_keys!(headers)
|
93
90
|
|
94
91
|
query = { 'append' => true, 'position' => position }
|
@@ -118,7 +115,6 @@ module Aliyun
|
|
118
115
|
#
|
119
116
|
# @return [Response]
|
120
117
|
def bucket_get_object(key, query = {}, headers = {})
|
121
|
-
Utils.clean_object_name!(key)
|
122
118
|
Utils.stringify_keys!(query)
|
123
119
|
Utils.stringify_keys!(headers)
|
124
120
|
|
@@ -134,7 +130,6 @@ module Aliyun
|
|
134
130
|
def bucket_get_object_share_link(key, expired_in_seconds)
|
135
131
|
expire_time = Time.now.to_i + expired_in_seconds
|
136
132
|
|
137
|
-
Utils.clean_object_name!(key)
|
138
133
|
signature = Authorization.get_temporary_signature(
|
139
134
|
@secret_key,
|
140
135
|
expire_time,
|
@@ -155,7 +150,6 @@ module Aliyun
|
|
155
150
|
#
|
156
151
|
# @return [Response]
|
157
152
|
def bucket_delete_object(key)
|
158
|
-
Utils.clean_object_name!(key)
|
159
153
|
http.delete("/#{key}", bucket: bucket, key: key)
|
160
154
|
end
|
161
155
|
|
@@ -190,7 +184,6 @@ module Aliyun
|
|
190
184
|
#
|
191
185
|
# @return [Response]
|
192
186
|
def bucket_get_meta_object(key, headers = {})
|
193
|
-
Utils.clean_object_name!(key)
|
194
187
|
Utils.stringify_keys!(headers)
|
195
188
|
http.head("/#{key}", headers: headers, bucket: bucket, key: key)
|
196
189
|
end
|
@@ -205,7 +198,6 @@ module Aliyun
|
|
205
198
|
#
|
206
199
|
# @return [Response]
|
207
200
|
def bucket_get_object_acl(key)
|
208
|
-
Utils.clean_object_name!(key)
|
209
201
|
query = { 'acl' => true }
|
210
202
|
http.get("/#{key}", query: query, bucket: bucket, key: key)
|
211
203
|
end
|
@@ -221,7 +213,6 @@ module Aliyun
|
|
221
213
|
#
|
222
214
|
# @return [Response]
|
223
215
|
def bucket_set_object_acl(key, acl)
|
224
|
-
Utils.clean_object_name!(key)
|
225
216
|
query = { 'acl' => true }
|
226
217
|
headers = { 'x-oss-object-acl' => acl }
|
227
218
|
http.put("/#{key}", query: query, headers: headers, bucket: bucket, key: key)
|
data/lib/aliyun/oss/http.rb
CHANGED
@@ -13,31 +13,31 @@ module Aliyun
|
|
13
13
|
@host = host
|
14
14
|
end
|
15
15
|
|
16
|
-
def get(
|
17
|
-
request('GET',
|
16
|
+
def get(path, options = {})
|
17
|
+
request('GET', path, options)
|
18
18
|
end
|
19
19
|
|
20
|
-
def put(
|
20
|
+
def put(path, options = {})
|
21
21
|
headers = default_content_type.merge(options[:headers] || {})
|
22
|
-
request('PUT',
|
22
|
+
request('PUT', path, options.merge(headers: headers))
|
23
23
|
end
|
24
24
|
|
25
|
-
def post(
|
25
|
+
def post(path, options = {})
|
26
26
|
headers = default_content_type.merge(options[:headers] || {})
|
27
|
-
request('POST',
|
27
|
+
request('POST', path, options.merge(headers: headers))
|
28
28
|
end
|
29
29
|
|
30
|
-
def delete(
|
30
|
+
def delete(path, options = {})
|
31
31
|
headers = default_content_type.merge(options[:headers] || {})
|
32
|
-
request('DELETE',
|
32
|
+
request('DELETE', path, options.merge(headers: headers))
|
33
33
|
end
|
34
34
|
|
35
|
-
def options(
|
36
|
-
request('OPTIONS',
|
35
|
+
def options(path, options = {})
|
36
|
+
request('OPTIONS', path, options)
|
37
37
|
end
|
38
38
|
|
39
|
-
def head(
|
40
|
-
request('HEAD',
|
39
|
+
def head(path, options = {})
|
40
|
+
request('HEAD', path, options)
|
41
41
|
end
|
42
42
|
|
43
43
|
private
|
@@ -49,7 +49,7 @@ module Aliyun
|
|
49
49
|
|
50
50
|
append_headers!(headers, verb, body, options)
|
51
51
|
|
52
|
-
path =
|
52
|
+
path = get_path(headers['Host'], resource)
|
53
53
|
options = { headers: headers, query: query, body: body, uri_adapter: Addressable::URI }
|
54
54
|
|
55
55
|
wrap(HTTParty.__send__(verb.downcase, path, options))
|
@@ -128,6 +128,11 @@ module Aliyun
|
|
128
128
|
"http://#{host}"
|
129
129
|
end
|
130
130
|
|
131
|
+
def get_path(host, resource)
|
132
|
+
fixed = resource.split('/').map { |res| CGI.escape(res) }.join('/')
|
133
|
+
api_endpoint(host) + fixed
|
134
|
+
end
|
135
|
+
|
131
136
|
def user_agent
|
132
137
|
"aliyun-oss-sdk-ruby/#{Aliyun::Oss::VERSION} " \
|
133
138
|
"(#{RbConfig::CONFIG['host_os']} ruby-#{RbConfig::CONFIG['ruby_version']})"
|
data/lib/aliyun/oss/utils.rb
CHANGED
data/lib/aliyun/oss/version.rb
CHANGED