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
| @@ -20,8 +20,8 @@ module Aliyun | |
| 20 20 | 
             
                  def crc_protocol
         | 
| 21 21 | 
             
                    Protocol.new(
         | 
| 22 22 | 
             
                      Config.new(:endpoint => @endpoint,
         | 
| 23 | 
            -
                                 :access_key_id => 'xxx', | 
| 24 | 
            -
                                 :access_key_secret => 'yyy', | 
| 23 | 
            +
                                 :access_key_id => 'xxx',
         | 
| 24 | 
            +
                                 :access_key_secret => 'yyy',
         | 
| 25 25 | 
             
                                 :upload_crc_enable => true,
         | 
| 26 26 | 
             
                                 :download_crc_enable => true))
         | 
| 27 27 | 
             
                  end
         | 
| @@ -236,7 +236,7 @@ module Aliyun | |
| 236 236 | 
             
                      object_name = 'ruby'
         | 
| 237 237 | 
             
                      url = get_request_path(object_name)
         | 
| 238 238 |  | 
| 239 | 
            -
                      query = {'append' =>  | 
| 239 | 
            +
                      query = {'append' => nil, 'position' => 11}
         | 
| 240 240 | 
             
                      return_headers = {'x-oss-next-append-position' => '101'}
         | 
| 241 241 | 
             
                      stub_request(:post, url).with(:query => query)
         | 
| 242 242 | 
             
                        .to_return(:headers => return_headers)
         | 
| @@ -255,7 +255,7 @@ module Aliyun | |
| 255 255 | 
             
                      object_name = 'ruby'
         | 
| 256 256 | 
             
                      url = get_request_path(object_name)
         | 
| 257 257 |  | 
| 258 | 
            -
                      query = {'append' =>  | 
| 258 | 
            +
                      query = {'append' => nil, 'position' => 11}
         | 
| 259 259 | 
             
                      code = 'ObjectNotAppendable'
         | 
| 260 260 | 
             
                      message = 'Normal object cannot be appended.'
         | 
| 261 261 | 
             
                      stub_request(:post, url).with(:query => query).
         | 
| @@ -275,7 +275,7 @@ module Aliyun | |
| 275 275 | 
             
                    it "should use default content-type" do
         | 
| 276 276 | 
             
                      object_name = 'ruby'
         | 
| 277 277 | 
             
                      url = get_request_path(object_name)
         | 
| 278 | 
            -
                      query = {'append' =>  | 
| 278 | 
            +
                      query = {'append' => nil, 'position' => 0}
         | 
| 279 279 |  | 
| 280 280 | 
             
                      stub_request(:post, url).with(:query => query)
         | 
| 281 281 |  | 
| @@ -292,7 +292,7 @@ module Aliyun | |
| 292 292 | 
             
                    it "should use customized content-type" do
         | 
| 293 293 | 
             
                      object_name = 'ruby'
         | 
| 294 294 | 
             
                      url = get_request_path(object_name)
         | 
| 295 | 
            -
                      query = {'append' =>  | 
| 295 | 
            +
                      query = {'append' => nil, 'position' => 0}
         | 
| 296 296 |  | 
| 297 297 | 
             
                      stub_request(:post, url).with(:query => query)
         | 
| 298 298 |  | 
| @@ -311,7 +311,7 @@ module Aliyun | |
| 311 311 | 
             
                    it "should set user defined metas" do
         | 
| 312 312 | 
             
                      object_name = 'ruby'
         | 
| 313 313 | 
             
                      url = get_request_path(object_name)
         | 
| 314 | 
            -
                      query = {'append' =>  | 
| 314 | 
            +
                      query = {'append' => nil, 'position' => 0}
         | 
| 315 315 |  | 
| 316 316 | 
             
                      stub_request(:post, url).with(:query => query)
         | 
| 317 317 |  | 
| @@ -335,7 +335,7 @@ module Aliyun | |
| 335 335 | 
             
                      content = "hello world"
         | 
| 336 336 | 
             
                      content_crc = Aliyun::OSS::Util.crc(content)
         | 
| 337 337 |  | 
| 338 | 
            -
                      query = {'append' =>  | 
| 338 | 
            +
                      query = {'append' => nil, 'position' => 11}
         | 
| 339 339 | 
             
                      return_headers = {'x-oss-next-append-position' => '101', :x_oss_hash_crc64ecma => content_crc.to_i + 1}
         | 
| 340 340 | 
             
                      stub_request(:post, url).with(:query => query)
         | 
| 341 341 | 
             
                        .to_return(:headers => return_headers)
         | 
| @@ -353,7 +353,7 @@ module Aliyun | |
| 353 353 | 
             
                      content = "hello world"
         | 
| 354 354 | 
             
                      content_crc = Aliyun::OSS::Util.crc(content)
         | 
| 355 355 |  | 
| 356 | 
            -
                      query = {'append' =>  | 
| 356 | 
            +
                      query = {'append' => nil, 'position' => 11}
         | 
| 357 357 | 
             
                      return_headers = {'x-oss-next-append-position' => '101', :x_oss_hash_crc64ecma => content_crc}
         | 
| 358 358 | 
             
                      stub_request(:post, url).with(:query => query)
         | 
| 359 359 | 
             
                        .to_return(:headers => return_headers)
         | 
| @@ -377,11 +377,11 @@ module Aliyun | |
| 377 377 | 
             
                      content = "hello world"
         | 
| 378 378 | 
             
                      content_crc = Aliyun::OSS::Util.crc(content)
         | 
| 379 379 |  | 
| 380 | 
            -
                      query = {'append' =>  | 
| 380 | 
            +
                      query = {'append' => nil, 'position' => 11}
         | 
| 381 381 | 
             
                      return_headers = {'x-oss-next-append-position' => '101', :x_oss_hash_crc64ecma => content_crc + 1}
         | 
| 382 382 | 
             
                      stub_request(:post, url).with(:query => query)
         | 
| 383 383 | 
             
                        .to_return(:headers => return_headers)
         | 
| 384 | 
            -
             | 
| 384 | 
            +
             | 
| 385 385 | 
             
                      expect(crc_protocol.upload_crc_enable).to eq(true)
         | 
| 386 386 | 
             
                      next_pos = 0
         | 
| 387 387 | 
             
                      expect {
         | 
| @@ -804,7 +804,7 @@ module Aliyun | |
| 804 804 |  | 
| 805 805 | 
             
                    it "should batch delete objects" do
         | 
| 806 806 | 
             
                      url = get_request_path
         | 
| 807 | 
            -
                      query = {'delete' =>  | 
| 807 | 
            +
                      query = {'delete' => nil, 'encoding-type' => KeyEncoding::URL}
         | 
| 808 808 |  | 
| 809 809 | 
             
                      object_names = (1..5).map do |i|
         | 
| 810 810 | 
             
                        "object-#{i}"
         | 
| @@ -824,7 +824,7 @@ module Aliyun | |
| 824 824 |  | 
| 825 825 | 
             
                    it "should decode object key in batch delete response" do
         | 
| 826 826 | 
             
                      url = get_request_path
         | 
| 827 | 
            -
                      query = {'delete' =>  | 
| 827 | 
            +
                      query = {'delete' => nil, 'encoding-type' => KeyEncoding::URL}
         | 
| 828 828 |  | 
| 829 829 | 
             
                      object_names = (1..5).map do |i|
         | 
| 830 830 | 
             
                        "对象-#{i}"
         | 
| @@ -851,7 +851,7 @@ module Aliyun | |
| 851 851 | 
             
                      object_name = 'ruby'
         | 
| 852 852 | 
             
                      url = get_request_path(object_name)
         | 
| 853 853 |  | 
| 854 | 
            -
                      query = {'acl' =>  | 
| 854 | 
            +
                      query = {'acl' => nil}
         | 
| 855 855 | 
             
                      stub_request(:put, url).with(:query => query)
         | 
| 856 856 |  | 
| 857 857 | 
             
                      @protocol.put_object_acl(@bucket, object_name, ACL::PUBLIC_READ)
         | 
| @@ -866,7 +866,7 @@ module Aliyun | |
| 866 866 | 
             
                      object_name = 'ruby'
         | 
| 867 867 | 
             
                      url = get_request_path(object_name)
         | 
| 868 868 |  | 
| 869 | 
            -
                      query = {'acl' =>  | 
| 869 | 
            +
                      query = {'acl' => nil}
         | 
| 870 870 | 
             
                      return_acl = ACL::PUBLIC_READ
         | 
| 871 871 |  | 
| 872 872 | 
             
                      stub_request(:get, url)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: aliyun-sdk
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.6.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Tianlong Wu
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: lib/aliyun
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2017-07-23 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: nokogiri
         | 
| @@ -17,6 +17,9 @@ dependencies: | |
| 17 17 | 
             
                - - "~>"
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 19 | 
             
                    version: '1.6'
         | 
| 20 | 
            +
                - - "<"
         | 
| 21 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 22 | 
            +
                    version: 1.7.0
         | 
| 20 23 | 
             
              type: :runtime
         | 
| 21 24 | 
             
              prerelease: false
         | 
| 22 25 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -24,20 +27,23 @@ dependencies: | |
| 24 27 | 
             
                - - "~>"
         | 
| 25 28 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 29 | 
             
                    version: '1.6'
         | 
| 30 | 
            +
                - - "<"
         | 
| 31 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 32 | 
            +
                    version: 1.7.0
         | 
| 27 33 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 34 | 
             
              name: rest-client
         | 
| 29 35 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 36 | 
             
                requirements:
         | 
| 31 37 | 
             
                - - "~>"
         | 
| 32 38 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version:  | 
| 39 | 
            +
                    version: 2.0.2
         | 
| 34 40 | 
             
              type: :runtime
         | 
| 35 41 | 
             
              prerelease: false
         | 
| 36 42 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 43 | 
             
                requirements:
         | 
| 38 44 | 
             
                - - "~>"
         | 
| 39 45 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version:  | 
| 46 | 
            +
                    version: 2.0.2
         | 
| 41 47 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 48 | 
             
              name: bundler
         | 
| 43 49 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -100,14 +106,14 @@ dependencies: | |
| 100 106 | 
             
                requirements:
         | 
| 101 107 | 
             
                - - "~>"
         | 
| 102 108 | 
             
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            -
                    version: ' | 
| 109 | 
            +
                    version: '3.0'
         | 
| 104 110 | 
             
              type: :development
         | 
| 105 111 | 
             
              prerelease: false
         | 
| 106 112 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 113 | 
             
                requirements:
         | 
| 108 114 | 
             
                - - "~>"
         | 
| 109 115 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            -
                    version: ' | 
| 116 | 
            +
                    version: '3.0'
         | 
| 111 117 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 112 118 | 
             
              name: simplecov
         | 
| 113 119 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -231,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 231 237 | 
             
                  version: '0'
         | 
| 232 238 | 
             
            requirements: []
         | 
| 233 239 | 
             
            rubyforge_project: 
         | 
| 234 | 
            -
            rubygems_version: 2. | 
| 240 | 
            +
            rubygems_version: 2.5.2
         | 
| 235 241 | 
             
            signing_key: 
         | 
| 236 242 | 
             
            specification_version: 4
         | 
| 237 243 | 
             
            summary: Aliyun OSS SDK for Ruby
         | 
| @@ -261,4 +267,3 @@ test_files: | |
| 261 267 | 
             
            - tests/test_object_key.rb
         | 
| 262 268 | 
             
            - tests/test_object_url.rb
         | 
| 263 269 | 
             
            - tests/test_resumable.rb
         | 
| 264 | 
            -
            has_rdoc: 
         |