aliyun-sdk 0.5.0 → 0.6.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +174 -172
- data/lib/aliyun/oss/http.rb +20 -44
- data/lib/aliyun/oss/protocol.rb +10 -9
- data/lib/aliyun/sts/protocol.rb +2 -2
- data/lib/aliyun/version.rb +1 -1
- data/spec/aliyun/oss/bucket_spec.rb +17 -17
- data/spec/aliyun/oss/client/bucket_spec.rb +8 -8
- data/spec/aliyun/oss/client/client_spec.rb +1 -1
- data/spec/aliyun/oss/multipart_spec.rb +10 -10
- data/spec/aliyun/oss/object_spec.rb +15 -15
- metadata +13 -8
    
        data/lib/aliyun/oss/http.rb
    CHANGED
    
    | @@ -105,35 +105,11 @@ module Aliyun | |
| 105 105 | 
             
                      false
         | 
| 106 106 | 
             
                    end
         | 
| 107 107 |  | 
| 108 | 
            -
                    def inspect
         | 
| 109 | 
            -
                      "@buffer: " + @buffer[0, 32].inspect + "...#{@buffer.size} bytes"
         | 
| 110 | 
            -
                    end
         | 
| 111 | 
            -
                  end
         | 
| 112 | 
            -
             | 
| 113 | 
            -
                  # RestClient requires the payload to respones to :read(bytes)
         | 
| 114 | 
            -
                  # and return a stream.
         | 
| 115 | 
            -
                  # We are not doing the real read here, just return a
         | 
| 116 | 
            -
                  # readable stream for RestClient playload.rb treats it as:
         | 
| 117 | 
            -
                  #     def read(bytes=nil)
         | 
| 118 | 
            -
                  #       @stream.read(bytes)
         | 
| 119 | 
            -
                  #     end
         | 
| 120 | 
            -
                  #     alias :to_s :read
         | 
| 121 | 
            -
                  #     net_http_do_request(http, req, payload ? payload.to_s : nil,
         | 
| 122 | 
            -
                  #                     &@block_response)
         | 
| 123 | 
            -
                  class StreamPayload
         | 
| 124 | 
            -
                    def initialize(crc_enable = false, init_crc = 0, &block)
         | 
| 125 | 
            -
                      @stream = StreamWriter.new(crc_enable, init_crc, &block)
         | 
| 126 | 
            -
                    end
         | 
| 127 | 
            -
             | 
| 128 | 
            -
                    def read(bytes = nil)
         | 
| 129 | 
            -
                      @stream
         | 
| 130 | 
            -
                    end
         | 
| 131 | 
            -
             | 
| 132 108 | 
             
                    def close
         | 
| 133 109 | 
             
                    end
         | 
| 134 110 |  | 
| 135 | 
            -
                    def  | 
| 136 | 
            -
                       | 
| 111 | 
            +
                    def inspect
         | 
| 112 | 
            +
                      "@buffer: " + @buffer[0, 32].inspect + "...#{@buffer.size} bytes"
         | 
| 137 113 | 
             
                    end
         | 
| 138 114 | 
             
                  end
         | 
| 139 115 |  | 
| @@ -281,44 +257,44 @@ module Aliyun | |
| 281 257 | 
             
                    headers[:params] = (sub_res || {}).merge(http_options[:query] || {})
         | 
| 282 258 |  | 
| 283 259 | 
             
                    block_response = ->(r) { handle_response(r, &block) } if block
         | 
| 284 | 
            -
                     | 
| 260 | 
            +
                    request = RestClient::Request.new(
         | 
| 285 261 | 
             
                      :method => verb,
         | 
| 286 262 | 
             
                      :url => get_request_url(bucket, object),
         | 
| 287 263 | 
             
                      :headers => headers,
         | 
| 288 264 | 
             
                      :payload => http_options[:body],
         | 
| 289 265 | 
             
                      :block_response => block_response,
         | 
| 290 266 | 
             
                      :open_timeout => @config.open_timeout || OPEN_TIMEOUT,
         | 
| 291 | 
            -
                      : | 
| 292 | 
            -
                    ) | 
| 293 | 
            -
             | 
| 294 | 
            -
                      if  | 
| 295 | 
            -
                        e = ServerError.new( | 
| 267 | 
            +
                      :read_timeout => @config.read_timeout || READ_TIMEOUT
         | 
| 268 | 
            +
                    )
         | 
| 269 | 
            +
                    response = request.execute do |resp, &blk|
         | 
| 270 | 
            +
                      if resp.code >= 300
         | 
| 271 | 
            +
                        e = ServerError.new(resp)
         | 
| 296 272 | 
             
                        logger.error(e.to_s)
         | 
| 297 273 | 
             
                        raise e
         | 
| 298 274 | 
             
                      else
         | 
| 299 | 
            -
                         | 
| 275 | 
            +
                        resp.return!(&blk)
         | 
| 300 276 | 
             
                      end
         | 
| 301 277 | 
             
                    end
         | 
| 302 278 |  | 
| 303 279 | 
             
                    # If streaming read_body is used, we need to create the
         | 
| 304 280 | 
             
                    # RestClient::Response ourselves
         | 
| 305 | 
            -
                    unless  | 
| 306 | 
            -
                      if  | 
| 307 | 
            -
                         | 
| 308 | 
            -
                          RestClient::Request.decode( | 
| 309 | 
            -
                           | 
| 310 | 
            -
                        e = ServerError.new( | 
| 281 | 
            +
                    unless response.is_a?(RestClient::Response)
         | 
| 282 | 
            +
                      if response.code.to_i >= 300
         | 
| 283 | 
            +
                        response = RestClient::Response.create(
         | 
| 284 | 
            +
                          RestClient::Request.decode(response['content-encoding'], response.body),
         | 
| 285 | 
            +
                          response, request)
         | 
| 286 | 
            +
                        e = ServerError.new(response)
         | 
| 311 287 | 
             
                        logger.error(e.to_s)
         | 
| 312 288 | 
             
                        raise e
         | 
| 313 289 | 
             
                      end
         | 
| 314 | 
            -
                       | 
| 315 | 
            -
                       | 
| 290 | 
            +
                      response = RestClient::Response.create(nil, response, request)
         | 
| 291 | 
            +
                      response.return!
         | 
| 316 292 | 
             
                    end
         | 
| 317 293 |  | 
| 318 | 
            -
                    logger.debug("Received HTTP response, code: #{ | 
| 319 | 
            -
                                  "#{ | 
| 294 | 
            +
                    logger.debug("Received HTTP response, code: #{response.code}, headers: " \
         | 
| 295 | 
            +
                                  "#{response.headers}, body: #{response.body}")
         | 
| 320 296 |  | 
| 321 | 
            -
                     | 
| 297 | 
            +
                    response
         | 
| 322 298 | 
             
                  end
         | 
| 323 299 |  | 
| 324 300 | 
             
                  def get_user_agent
         | 
    
        data/lib/aliyun/oss/protocol.rb
    CHANGED
    
    | @@ -535,7 +535,7 @@ module Aliyun | |
| 535 535 | 
             
                      headers[CALLBACK_HEADER] = opts[:callback].serialize
         | 
| 536 536 | 
             
                    end
         | 
| 537 537 |  | 
| 538 | 
            -
                    payload = HTTP:: | 
| 538 | 
            +
                    payload = HTTP::StreamWriter.new(@config.upload_crc_enable, opts[:init_crc], &block)
         | 
| 539 539 | 
             
                    r = @http.put(
         | 
| 540 540 | 
             
                      {:bucket => bucket_name, :object => object_name},
         | 
| 541 541 | 
             
                      {:headers => headers, :body => payload})
         | 
| @@ -547,7 +547,7 @@ module Aliyun | |
| 547 547 | 
             
                    end
         | 
| 548 548 |  | 
| 549 549 | 
             
                    if @config.upload_crc_enable && !r.headers[:x_oss_hash_crc64ecma].nil?
         | 
| 550 | 
            -
                      data_crc = payload. | 
| 550 | 
            +
                      data_crc = payload.data_crc
         | 
| 551 551 | 
             
                      Aliyun::OSS::Util.crc_check(data_crc, r.headers[:x_oss_hash_crc64ecma], 'put')
         | 
| 552 552 | 
             
                    end
         | 
| 553 553 |  | 
| @@ -593,16 +593,17 @@ module Aliyun | |
| 593 593 |  | 
| 594 594 | 
             
                    headers.merge!(to_lower_case(opts[:headers])) if opts.key?(:headers)
         | 
| 595 595 |  | 
| 596 | 
            -
                    payload = HTTP:: | 
| 596 | 
            +
                    payload = HTTP::StreamWriter.new(
         | 
| 597 | 
            +
                      @config.upload_crc_enable && !opts[:init_crc].nil?, opts[:init_crc], &block)
         | 
| 597 598 |  | 
| 598 599 | 
             
                    r = @http.post(
         | 
| 599 600 | 
             
                      {:bucket => bucket_name, :object => object_name, :sub_res => sub_res},
         | 
| 600 601 | 
             
                      {:headers => headers, :body => payload})
         | 
| 601 602 |  | 
| 602 | 
            -
                    if @config.upload_crc_enable && | 
| 603 | 
            -
                      !r.headers[:x_oss_hash_crc64ecma].nil? && | 
| 603 | 
            +
                    if @config.upload_crc_enable &&
         | 
| 604 | 
            +
                      !r.headers[:x_oss_hash_crc64ecma].nil? &&
         | 
| 604 605 | 
             
                      !opts[:init_crc].nil?
         | 
| 605 | 
            -
                      data_crc = payload. | 
| 606 | 
            +
                      data_crc = payload.data_crc
         | 
| 606 607 | 
             
                      Aliyun::OSS::Util.crc_check(data_crc, r.headers[:x_oss_hash_crc64ecma], 'append')
         | 
| 607 608 | 
             
                    end
         | 
| 608 609 |  | 
| @@ -780,7 +781,7 @@ module Aliyun | |
| 780 781 | 
             
                      {:bucket => bucket_name, :object => object_name,
         | 
| 781 782 | 
             
                       :sub_res => sub_res},
         | 
| 782 783 | 
             
                      {:headers => headers}
         | 
| 783 | 
            -
                    ) do |chunk| | 
| 784 | 
            +
                    ) do |chunk|
         | 
| 784 785 | 
             
                      if block_given?
         | 
| 785 786 | 
             
                        # crc enable and no range and oss server support crc
         | 
| 786 787 | 
             
                        data_crc = Aliyun::OSS::Util.crc(chunk, data_crc) if @config.download_crc_enable && range.nil?
         | 
| @@ -1110,13 +1111,13 @@ module Aliyun | |
| 1110 1111 |  | 
| 1111 1112 | 
             
                    sub_res = {'partNumber' => part_no, 'uploadId' => txn_id}
         | 
| 1112 1113 |  | 
| 1113 | 
            -
                    payload = HTTP:: | 
| 1114 | 
            +
                    payload = HTTP::StreamWriter.new(@config.upload_crc_enable, &block)
         | 
| 1114 1115 | 
             
                    r = @http.put(
         | 
| 1115 1116 | 
             
                      {:bucket => bucket_name, :object => object_name, :sub_res => sub_res},
         | 
| 1116 1117 | 
             
                      {:body => payload})
         | 
| 1117 1118 |  | 
| 1118 1119 | 
             
                    if @config.upload_crc_enable && !r.headers[:x_oss_hash_crc64ecma].nil?
         | 
| 1119 | 
            -
                      data_crc = payload. | 
| 1120 | 
            +
                      data_crc = payload.data_crc
         | 
| 1120 1121 | 
             
                      Aliyun::OSS::Util.crc_check(data_crc, r.headers[:x_oss_hash_crc64ecma], 'put')
         | 
| 1121 1122 | 
             
                    end
         | 
| 1122 1123 |  | 
    
        data/lib/aliyun/sts/protocol.rb
    CHANGED
    
    | @@ -88,14 +88,14 @@ module Aliyun | |
| 88 88 | 
             
                      :method => 'POST',
         | 
| 89 89 | 
             
                      :url => @config.endpoint || ENDPOINT,
         | 
| 90 90 | 
             
                      :payload => query
         | 
| 91 | 
            -
                    ) do |response,  | 
| 91 | 
            +
                    ) do |response, &blk|
         | 
| 92 92 |  | 
| 93 93 | 
             
                      if response.code >= 300
         | 
| 94 94 | 
             
                        e = ServerError.new(response)
         | 
| 95 95 | 
             
                        logger.error(e.to_s)
         | 
| 96 96 | 
             
                        raise e
         | 
| 97 97 | 
             
                      else
         | 
| 98 | 
            -
                        response.return!( | 
| 98 | 
            +
                        response.return!(&blk)
         | 
| 99 99 | 
             
                      end
         | 
| 100 100 | 
             
                    end
         | 
| 101 101 |  | 
    
        data/lib/aliyun/version.rb
    CHANGED
    
    
| @@ -356,7 +356,7 @@ module Aliyun | |
| 356 356 |  | 
| 357 357 | 
             
                  context "acl, logging, website, referer, lifecycle" do
         | 
| 358 358 | 
             
                    it "should update acl" do
         | 
| 359 | 
            -
                      query = {'acl' =>  | 
| 359 | 
            +
                      query = {'acl' => nil}
         | 
| 360 360 | 
             
                      stub_request(:put, request_path).with(:query => query)
         | 
| 361 361 |  | 
| 362 362 | 
             
                      @protocol.put_bucket_acl(@bucket, ACL::PUBLIC_READ)
         | 
| @@ -366,7 +366,7 @@ module Aliyun | |
| 366 366 | 
             
                    end
         | 
| 367 367 |  | 
| 368 368 | 
             
                    it "should get acl" do
         | 
| 369 | 
            -
                      query = {'acl' =>  | 
| 369 | 
            +
                      query = {'acl' => nil}
         | 
| 370 370 | 
             
                      return_acl = ACL::PUBLIC_READ
         | 
| 371 371 | 
             
                      stub_request(:get, request_path)
         | 
| 372 372 | 
             
                        .with(:query => query)
         | 
| @@ -380,7 +380,7 @@ module Aliyun | |
| 380 380 | 
             
                    end
         | 
| 381 381 |  | 
| 382 382 | 
             
                    it "should enable logging" do
         | 
| 383 | 
            -
                      query = {'logging' =>  | 
| 383 | 
            +
                      query = {'logging' => nil}
         | 
| 384 384 | 
             
                      stub_request(:put, request_path).with(:query => query)
         | 
| 385 385 |  | 
| 386 386 | 
             
                      logging_opts = BucketLogging.new(
         | 
| @@ -393,7 +393,7 @@ module Aliyun | |
| 393 393 | 
             
                    end
         | 
| 394 394 |  | 
| 395 395 | 
             
                    it "should disable logging" do
         | 
| 396 | 
            -
                      query = {'logging' =>  | 
| 396 | 
            +
                      query = {'logging' => nil}
         | 
| 397 397 | 
             
                      stub_request(:put, request_path).with(:query => query)
         | 
| 398 398 |  | 
| 399 399 | 
             
                      logging_opts = BucketLogging.new(:enable => false)
         | 
| @@ -404,7 +404,7 @@ module Aliyun | |
| 404 404 | 
             
                    end
         | 
| 405 405 |  | 
| 406 406 | 
             
                    it "should get logging" do
         | 
| 407 | 
            -
                      query = {'logging' =>  | 
| 407 | 
            +
                      query = {'logging' => nil}
         | 
| 408 408 | 
             
                      logging_opts = BucketLogging.new(
         | 
| 409 409 | 
             
                        :enable => true,
         | 
| 410 410 | 
             
                        :target_bucket => 'target-bucket', :target_prefix => 'foo')
         | 
| @@ -421,7 +421,7 @@ module Aliyun | |
| 421 421 | 
             
                    end
         | 
| 422 422 |  | 
| 423 423 | 
             
                    it "should delete logging" do
         | 
| 424 | 
            -
                      query = {'logging' =>  | 
| 424 | 
            +
                      query = {'logging' => nil}
         | 
| 425 425 | 
             
                      stub_request(:delete, request_path).with(:query => query)
         | 
| 426 426 |  | 
| 427 427 | 
             
                      @protocol.delete_bucket_logging(@bucket)
         | 
| @@ -431,7 +431,7 @@ module Aliyun | |
| 431 431 | 
             
                    end
         | 
| 432 432 |  | 
| 433 433 | 
             
                    it "should update website" do
         | 
| 434 | 
            -
                      query = {'website' =>  | 
| 434 | 
            +
                      query = {'website' => nil}
         | 
| 435 435 | 
             
                      stub_request(:put, request_path).with(:query => query)
         | 
| 436 436 |  | 
| 437 437 | 
             
                      website_opts = BucketWebsite.new(
         | 
| @@ -443,7 +443,7 @@ module Aliyun | |
| 443 443 | 
             
                    end
         | 
| 444 444 |  | 
| 445 445 | 
             
                    it "should get website" do
         | 
| 446 | 
            -
                      query = {'website' =>  | 
| 446 | 
            +
                      query = {'website' => nil}
         | 
| 447 447 | 
             
                      website_opts = BucketWebsite.new(
         | 
| 448 448 | 
             
                        :enable => true, :index => 'index.html', :error => 'error.html')
         | 
| 449 449 |  | 
| @@ -459,7 +459,7 @@ module Aliyun | |
| 459 459 | 
             
                    end
         | 
| 460 460 |  | 
| 461 461 | 
             
                    it "should delete website" do
         | 
| 462 | 
            -
                      query = {'website' =>  | 
| 462 | 
            +
                      query = {'website' => nil}
         | 
| 463 463 | 
             
                      stub_request(:delete, request_path).with(:query => query)
         | 
| 464 464 |  | 
| 465 465 | 
             
                      @protocol.delete_bucket_website(@bucket)
         | 
| @@ -469,7 +469,7 @@ module Aliyun | |
| 469 469 | 
             
                    end
         | 
| 470 470 |  | 
| 471 471 | 
             
                    it "should update referer" do
         | 
| 472 | 
            -
                      query = {'referer' =>  | 
| 472 | 
            +
                      query = {'referer' => nil}
         | 
| 473 473 | 
             
                      stub_request(:put, request_path).with(:query => query)
         | 
| 474 474 |  | 
| 475 475 | 
             
                      referer_opts = BucketReferer.new(
         | 
| @@ -481,7 +481,7 @@ module Aliyun | |
| 481 481 | 
             
                    end
         | 
| 482 482 |  | 
| 483 483 | 
             
                    it "should get referer" do
         | 
| 484 | 
            -
                      query = {'referer' =>  | 
| 484 | 
            +
                      query = {'referer' => nil}
         | 
| 485 485 | 
             
                      referer_opts = BucketReferer.new(
         | 
| 486 486 | 
             
                        :allow_empty => true, :whitelist => ['xxx', 'yyy'])
         | 
| 487 487 |  | 
| @@ -497,7 +497,7 @@ module Aliyun | |
| 497 497 | 
             
                    end
         | 
| 498 498 |  | 
| 499 499 | 
             
                    it "should update lifecycle" do
         | 
| 500 | 
            -
                      query = {'lifecycle' =>  | 
| 500 | 
            +
                      query = {'lifecycle' => nil}
         | 
| 501 501 | 
             
                      stub_request(:put, request_path).with(:query => query)
         | 
| 502 502 |  | 
| 503 503 | 
             
                      rules = (1..5).map do |i|
         | 
| @@ -513,7 +513,7 @@ module Aliyun | |
| 513 513 | 
             
                    end
         | 
| 514 514 |  | 
| 515 515 | 
             
                    it "should get lifecycle" do
         | 
| 516 | 
            -
                      query = {'lifecycle' =>  | 
| 516 | 
            +
                      query = {'lifecycle' => nil}
         | 
| 517 517 | 
             
                      return_rules = (1..5).map do |i|
         | 
| 518 518 | 
             
                        LifeCycleRule.new(
         | 
| 519 519 | 
             
                          :id => i, :enable => i % 2 == 0, :prefix => "foo#{i}",
         | 
| @@ -532,7 +532,7 @@ module Aliyun | |
| 532 532 | 
             
                    end
         | 
| 533 533 |  | 
| 534 534 | 
             
                    it "should delete lifecycle" do
         | 
| 535 | 
            -
                      query = {'lifecycle' =>  | 
| 535 | 
            +
                      query = {'lifecycle' => nil}
         | 
| 536 536 | 
             
                      stub_request(:delete, request_path).with(:query => query)
         | 
| 537 537 |  | 
| 538 538 | 
             
                      @protocol.delete_bucket_lifecycle(@bucket)
         | 
| @@ -542,7 +542,7 @@ module Aliyun | |
| 542 542 | 
             
                    end
         | 
| 543 543 |  | 
| 544 544 | 
             
                    it "should set cors" do
         | 
| 545 | 
            -
                      query = {'cors' =>  | 
| 545 | 
            +
                      query = {'cors' => nil}
         | 
| 546 546 | 
             
                      stub_request(:put, request_path).with(:query => query)
         | 
| 547 547 |  | 
| 548 548 | 
             
                      rules = (1..5).map do |i|
         | 
| @@ -559,7 +559,7 @@ module Aliyun | |
| 559 559 | 
             
                    end
         | 
| 560 560 |  | 
| 561 561 | 
             
                    it "should get cors" do
         | 
| 562 | 
            -
                      query = {'cors' =>  | 
| 562 | 
            +
                      query = {'cors' => nil}
         | 
| 563 563 | 
             
                      return_rules = (1..5).map do |i|
         | 
| 564 564 | 
             
                        CORSRule.new(
         | 
| 565 565 | 
             
                          :allowed_origins => (1..3).map {|x| "origin-#{x}"},
         | 
| @@ -580,7 +580,7 @@ module Aliyun | |
| 580 580 | 
             
                    end
         | 
| 581 581 |  | 
| 582 582 | 
             
                    it "should delete cors" do
         | 
| 583 | 
            -
                      query = {'cors' =>  | 
| 583 | 
            +
                      query = {'cors' => nil}
         | 
| 584 584 |  | 
| 585 585 | 
             
                      stub_request(:delete, request_path).with(:query => query)
         | 
| 586 586 |  | 
| @@ -120,7 +120,7 @@ module Aliyun | |
| 120 120 |  | 
| 121 121 | 
             
                  context "bucket operations" do
         | 
| 122 122 | 
             
                    it "should get acl" do
         | 
| 123 | 
            -
                      query = {'acl' =>  | 
| 123 | 
            +
                      query = {'acl' => nil}
         | 
| 124 124 | 
             
                      return_acl = ACL::PUBLIC_READ
         | 
| 125 125 |  | 
| 126 126 | 
             
                      stub_request(:get, bucket_url)
         | 
| @@ -135,7 +135,7 @@ module Aliyun | |
| 135 135 | 
             
                    end
         | 
| 136 136 |  | 
| 137 137 | 
             
                    it "should set acl" do
         | 
| 138 | 
            -
                      query = {'acl' =>  | 
| 138 | 
            +
                      query = {'acl' => nil}
         | 
| 139 139 |  | 
| 140 140 | 
             
                      stub_request(:put, bucket_url).with(:query => query)
         | 
| 141 141 |  | 
| @@ -146,7 +146,7 @@ module Aliyun | |
| 146 146 | 
             
                    end
         | 
| 147 147 |  | 
| 148 148 | 
             
                    it "should delete logging setting" do
         | 
| 149 | 
            -
                      query = {'logging' =>  | 
| 149 | 
            +
                      query = {'logging' => nil}
         | 
| 150 150 |  | 
| 151 151 | 
             
                      stub_request(:delete, bucket_url).with(:query => query)
         | 
| 152 152 |  | 
| @@ -303,7 +303,7 @@ module Aliyun | |
| 303 303 |  | 
| 304 304 | 
             
                    it "should set custom headers when append object" do
         | 
| 305 305 | 
             
                      key = 'ruby'
         | 
| 306 | 
            -
                      query = {'append' =>  | 
| 306 | 
            +
                      query = {'append' => nil, 'position' => 11}
         | 
| 307 307 | 
             
                      stub_request(:post, object_url(key)).with(:query => query)
         | 
| 308 308 |  | 
| 309 309 | 
             
                      @bucket.append_object(
         | 
| @@ -362,7 +362,7 @@ module Aliyun | |
| 362 362 |  | 
| 363 363 | 
             
                    it "should append object from file" do
         | 
| 364 364 | 
             
                      key = 'ruby'
         | 
| 365 | 
            -
                      query = {'append' =>  | 
| 365 | 
            +
                      query = {'append' => nil, 'position' => 11}
         | 
| 366 366 | 
             
                      stub_request(:post, object_url(key)).with(:query => query)
         | 
| 367 367 |  | 
| 368 368 | 
             
                      content = (1..10).map{ |i| i.to_s.rjust(9, '0') }.join("\n")
         | 
| @@ -378,7 +378,7 @@ module Aliyun | |
| 378 378 |  | 
| 379 379 | 
             
                    it "should append object with acl" do
         | 
| 380 380 | 
             
                      key = 'ruby'
         | 
| 381 | 
            -
                      query = {'append' =>  | 
| 381 | 
            +
                      query = {'append' => nil, 'position' => 11}
         | 
| 382 382 | 
             
                      stub_request(:post, object_url(key)).with(:query => query)
         | 
| 383 383 |  | 
| 384 384 | 
             
                      @bucket.append_object(key, 11, :acl => ACL::PUBLIC_READ_WRITE)
         | 
| @@ -497,7 +497,7 @@ module Aliyun | |
| 497 497 | 
             
                      query_1 = {
         | 
| 498 498 | 
             
                        :prefix => 'list-',
         | 
| 499 499 | 
             
                        'encoding-type' => 'url',
         | 
| 500 | 
            -
                        'uploads' =>  | 
| 500 | 
            +
                        'uploads' => nil
         | 
| 501 501 | 
             
                      }
         | 
| 502 502 | 
             
                      return_up_1 = (1..5).map{ |i| Multipart::Transaction.new(
         | 
| 503 503 | 
             
                        :id => "txn-#{i}",
         | 
| @@ -513,7 +513,7 @@ module Aliyun | |
| 513 513 | 
             
                        :prefix => 'list-',
         | 
| 514 514 | 
             
                        'upload-id-marker' => 'txn-5',
         | 
| 515 515 | 
             
                        'encoding-type' => 'url',
         | 
| 516 | 
            -
                        'uploads' =>  | 
| 516 | 
            +
                        'uploads' => nil
         | 
| 517 517 | 
             
                      }
         | 
| 518 518 | 
             
                      return_up_2 = (6..8).map{ |i| Multipart::Transaction.new(
         | 
| 519 519 | 
             
                        :id => "txn-#{i}",
         | 
| @@ -26,8 +26,8 @@ module Aliyun | |
| 26 26 | 
             
                  def crc_protocol
         | 
| 27 27 | 
             
                    Protocol.new(
         | 
| 28 28 | 
             
                      Config.new(:endpoint => @endpoint,
         | 
| 29 | 
            -
                                 :access_key_id => 'xxx', | 
| 30 | 
            -
                                 :access_key_secret => 'yyy', | 
| 29 | 
            +
                                 :access_key_id => 'xxx',
         | 
| 30 | 
            +
                                 :access_key_secret => 'yyy',
         | 
| 31 31 | 
             
                                 :upload_crc_enable => true,
         | 
| 32 32 | 
             
                                 :download_crc_enable => true))
         | 
| 33 33 | 
             
                  end
         | 
| @@ -111,7 +111,7 @@ module Aliyun | |
| 111 111 | 
             
                  context "Initiate multipart upload" do
         | 
| 112 112 |  | 
| 113 113 | 
             
                    it "should POST to create transaction" do
         | 
| 114 | 
            -
                      query = {'uploads' =>  | 
| 114 | 
            +
                      query = {'uploads' => nil}
         | 
| 115 115 | 
             
                      stub_request(:post, request_path).with(:query => query)
         | 
| 116 116 |  | 
| 117 117 | 
             
                      @protocol.initiate_multipart_upload(
         | 
| @@ -129,7 +129,7 @@ module Aliyun | |
| 129 129 | 
             
                    end
         | 
| 130 130 |  | 
| 131 131 | 
             
                    it "should return transaction id" do
         | 
| 132 | 
            -
                      query = {'uploads' =>  | 
| 132 | 
            +
                      query = {'uploads' => nil}
         | 
| 133 133 | 
             
                      return_txn_id = 'zyx'
         | 
| 134 134 | 
             
                      stub_request(:post, request_path).
         | 
| 135 135 | 
             
                        with(:query => query).
         | 
| @@ -143,7 +143,7 @@ module Aliyun | |
| 143 143 | 
             
                    end
         | 
| 144 144 |  | 
| 145 145 | 
             
                    it "should raise Exception on error" do
         | 
| 146 | 
            -
                      query = {'uploads' =>  | 
| 146 | 
            +
                      query = {'uploads' => nil}
         | 
| 147 147 |  | 
| 148 148 | 
             
                      code = 'InvalidArgument'
         | 
| 149 149 | 
             
                      message = 'Invalid argument.'
         | 
| @@ -462,7 +462,7 @@ module Aliyun | |
| 462 462 |  | 
| 463 463 | 
             
                    it "should GET to list multiparts" do
         | 
| 464 464 | 
             
                      request_path = "#{@bucket}.#{@endpoint}/"
         | 
| 465 | 
            -
                      query = {'uploads' =>  | 
| 465 | 
            +
                      query = {'uploads' => nil}
         | 
| 466 466 |  | 
| 467 467 | 
             
                      stub_request(:get, request_path).with(:query => query)
         | 
| 468 468 |  | 
| @@ -475,7 +475,7 @@ module Aliyun | |
| 475 475 | 
             
                    it "should send extra params when list multiparts" do
         | 
| 476 476 | 
             
                      request_path = "#{@bucket}.#{@endpoint}/"
         | 
| 477 477 | 
             
                      query = {
         | 
| 478 | 
            -
                        'uploads' =>  | 
| 478 | 
            +
                        'uploads' => nil,
         | 
| 479 479 | 
             
                        'prefix' => 'foo-',
         | 
| 480 480 | 
             
                        'upload-id-marker' => 'id-marker',
         | 
| 481 481 | 
             
                        'key-marker' => 'key-marker',
         | 
| @@ -501,7 +501,7 @@ module Aliyun | |
| 501 501 | 
             
                    it "should get multipart transactions" do
         | 
| 502 502 | 
             
                      request_path = "#{@bucket}.#{@endpoint}/"
         | 
| 503 503 | 
             
                      query = {
         | 
| 504 | 
            -
                        'uploads' =>  | 
| 504 | 
            +
                        'uploads' => nil,
         | 
| 505 505 | 
             
                        'prefix' => 'foo-',
         | 
| 506 506 | 
             
                        'upload-id-marker' => 'id-marker',
         | 
| 507 507 | 
             
                        'key-marker' => 'key-marker',
         | 
| @@ -548,7 +548,7 @@ module Aliyun | |
| 548 548 | 
             
                    it "should decode object key" do
         | 
| 549 549 | 
             
                      request_path = "#{@bucket}.#{@endpoint}/"
         | 
| 550 550 | 
             
                      query = {
         | 
| 551 | 
            -
                        'uploads' =>  | 
| 551 | 
            +
                        'uploads' => nil,
         | 
| 552 552 | 
             
                        'prefix' => 'foo-',
         | 
| 553 553 | 
             
                        'upload-id-marker' => 'id-marker',
         | 
| 554 554 | 
             
                        'key-marker' => 'key-marker',
         | 
| @@ -614,7 +614,7 @@ module Aliyun | |
| 614 614 |  | 
| 615 615 | 
             
                    it "should raise Exception on error" do
         | 
| 616 616 | 
             
                      request_path = "#{@bucket}.#{@endpoint}/"
         | 
| 617 | 
            -
                      query = {'uploads' =>  | 
| 617 | 
            +
                      query = {'uploads' => nil}
         | 
| 618 618 |  | 
| 619 619 | 
             
                      code = 'InvalidArgument'
         | 
| 620 620 | 
             
                      message = 'Invalid argument.'
         |