qingstor-sdk 2.1.1 → 2.2.0

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
  SHA1:
3
- metadata.gz: 0d52711ac86dec42786e6d2feb170b1e50b2a3fb
4
- data.tar.gz: eaa1f4b1bb5b3f6cfc828edb3f629a91f89ceff0
3
+ metadata.gz: c017ab0377c9dbe06078e86770f14657f3a3c119
4
+ data.tar.gz: a94c9695d19a24647392a92ee09ea5cd0da7e831
5
5
  SHA512:
6
- metadata.gz: 192c7d030d9a8158ae2b113de846272fc6f293263b3ea687145d3cdf80acda532f4ac569b0ed094551818473c583ba41a6e2fcc7851384dcfb7a2bdae7ada07b
7
- data.tar.gz: 42002bf0729585b85852a23c755672a98159d353ee4285d21169667da84958e3c9c8de3be065f7e43b2f981f50e00279dcc7b42e2d0fe7dc26aa32dfbe7b6b09
6
+ metadata.gz: beb1bf011b11f37dc244d3840ff7fba7ea0130ae3177d167da5e45368c8d5636e68d27a5da4fd1b653a5cf0e25b45ecfd99186135f0d2967f4da4d97544487ce
7
+ data.tar.gz: 8a4627ef7a91cd0fee08aee91d9769e9fa87ccd34ef4fe0b23161137168f79b8cdfce92e3b2222060fbdda2d7ccb28ca1af4e433fde488fec029d4052c125bce
data/README.md CHANGED
@@ -169,29 +169,44 @@ log_level: 'warn'
169
169
  ## Change Log
170
170
  All notable changes to QingStor SDK for Ruby will be documented here.
171
171
 
172
- ### [v2.1.1] - 2016-12-24
172
+ ## [v2.2.0] - 2017-02-28
173
+
174
+ ### Added
175
+
176
+ - Add ListMultipartUploads API.
177
+
178
+ ### Fixed
179
+
180
+ - Fix request builder & signer.
181
+
182
+ ### [v2.1.1] - 2017-01-16
173
183
 
174
184
  #### Fixed
185
+
175
186
  - Fix signer bug.
176
187
 
177
188
  ### [v2.1.0] - 2016-12-24
178
189
 
179
190
  #### Changed
191
+
180
192
  - Fix signer bug.
181
193
  - Add more parameters to sign.
182
194
 
183
195
  #### Added
196
+
184
197
  - Add request parameters for GET Object.
185
198
  - Add IP address conditions for bucket policy.
186
199
 
187
200
  ### [v2.0.1] - 2016-12-16
188
201
 
189
202
  #### Changed
203
+
190
204
  - Improve the implementation of deleting multiple objects.
191
205
 
192
206
  ### v2.0.0 - 2016-12-14
193
207
 
194
208
  #### Added
209
+
195
210
  - QingStor SDK for the Ruby programming language.
196
211
 
197
212
  ## Reference Documentations
@@ -213,6 +228,7 @@ All notable changes to QingStor SDK for Ruby will be documented here.
213
228
  The Apache License (Version 2.0, January 2004).
214
229
 
215
230
  [compatible]: https://github.com/yunify/qingstor-sdk-ruby/tree/compatible
231
+ [v2.2.0]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.1.2...v2.2.0
216
232
  [v2.1.1]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.1.0...v2.1.1
217
233
  [v2.1.0]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.0.1...v2.1.0
218
234
  [v2.0.1]: https://github.com/yunify/qingstor-sdk-ruby/compare/v2.0.0...v2.0.1
@@ -51,7 +51,7 @@ module QingStor
51
51
  def self.request_uri(input)
52
52
  unless input[:properties].nil?
53
53
  input[:properties].each do |k, v|
54
- input[:request_uri].gsub! "<#{k}>", v.to_s
54
+ input[:request_uri].gsub! "<#{k}>", (escape v.to_s)
55
55
  end
56
56
  end
57
57
  input[:request_uri]
@@ -99,14 +99,19 @@ module QingStor
99
99
  input[:request_headers][:'Content-MD5'] = Base64.encode64(Digest::MD5.digest(input[:request_body])).strip
100
100
  end
101
101
 
102
+ input[:request_headers].map { |k, v|
103
+ unless v.to_s.ascii_only?
104
+ input[:request_headers][k] = escape v.to_s
105
+ end
106
+ }
107
+
102
108
  input[:request_headers]
103
109
  end
104
110
 
105
111
  def self.request_params(input)
106
112
  unless input[:request_params].nil?
107
113
  input[:request_params].map do |k, v|
108
- input[:request_params][k] = CGI.escape v.to_s
109
- input[:request_params][k].gsub! '+', '%20'
114
+ input[:request_params][k] = escape v.to_s
110
115
  end
111
116
  end
112
117
  input[:request_params]
@@ -125,6 +130,14 @@ module QingStor
125
130
  end
126
131
  object
127
132
  end
133
+
134
+ def self.escape(origin)
135
+ origin = CGI.escape origin
136
+ origin.gsub! '%2F', '/'
137
+ origin.gsub! '%3D', '='
138
+ origin.gsub! '+', '%20'
139
+ origin
140
+ end
128
141
  end
129
142
  end
130
143
  end
@@ -87,19 +87,14 @@ module QingStor
87
87
  end
88
88
 
89
89
  def self.canonicalized_resource(input)
90
- path = CGI.escape input[:request_uri]
91
- path.gsub! '%3F', '?'
92
- path.gsub! '%2F', '/'
93
- path.gsub! '+', '%20'
94
-
95
90
  params = input[:request_params].keys.sort.map { |k|
96
91
  if sub_resource? k.to_s
97
92
  v = input[:request_params][k].to_s.strip
98
93
  !v.nil? && v != '' ? "#{k}=#{CGI.unescape v}" : k
99
94
  end
100
95
  }.compact.join '&'
101
- params = path.include?('?') ? "&#{params}" : "?#{params}" if params != ''
102
- "#{path}#{params}"
96
+ params = input[:request_uri].include?('?') ? "&#{params}" : "?#{params}" if params != ''
97
+ "#{input[:request_uri]}#{params}"
103
98
  end
104
99
 
105
100
  def self.sub_resource?(key)
@@ -456,6 +456,57 @@ module QingStor
456
456
 
457
457
  public
458
458
 
459
+ # list_multipart_uploads: List multipart uploads in the bucket.
460
+ # Documentation URL: https://docs.qingcloud.com/qingstor/api/bucket/list_multipart_uploads.html
461
+ def list_multipart_uploads(delimiter: '',
462
+ limit: nil,
463
+ marker: '',
464
+ prefix: '')
465
+ request = list_multipart_uploads_request delimiter: delimiter,
466
+ limit: limit,
467
+ marker: marker,
468
+ prefix: prefix
469
+ request.send
470
+ end
471
+
472
+ def list_multipart_uploads_request(delimiter: '',
473
+ limit: nil,
474
+ marker: '',
475
+ prefix: '')
476
+ input = {
477
+ config: config,
478
+ properties: properties,
479
+ api_name: 'List Multipart Uploads',
480
+ request_method: 'GET',
481
+ request_uri: '/<bucket-name>?uploads',
482
+ request_params: {
483
+ 'delimiter' => delimiter,
484
+ 'limit' => limit,
485
+ 'marker' => marker,
486
+ 'prefix' => prefix,
487
+ },
488
+ request_headers: {
489
+ },
490
+ request_elements: {
491
+ },
492
+ request_body: nil,
493
+ status_code: [
494
+ 200, # OK
495
+ ],
496
+ }
497
+
498
+ list_multipart_uploads_input_validate input
499
+ Request.new input
500
+ end
501
+
502
+ private
503
+
504
+ def list_multipart_uploads_input_validate(input)
505
+ input.deep_stringify_keys!
506
+ end
507
+
508
+ public
509
+
459
510
  # list_objects: Retrieve the object list in a bucket.
460
511
  # Documentation URL: https://docs.qingcloud.com/qingstor/api/bucket/get.html
461
512
  def list_objects(delimiter: '',
@@ -16,6 +16,6 @@
16
16
 
17
17
  module QingStor
18
18
  module SDK
19
- VERSION = '2.1.1'.freeze
19
+ VERSION = '2.2.0'.freeze
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qingstor-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yunify SDK Group
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-15 00:00:00.000000000 Z
11
+ date: 2017-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport