aliyun-sdk 0.3.0 → 0.3.1
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 +3 -3
- data/lib/aliyun/oss/client.rb +2 -2
- data/lib/aliyun/oss/config.rb +2 -2
- data/lib/aliyun/sts/config.rb +2 -2
- data/lib/aliyun/version.rb +1 -1
- data/spec/aliyun/sts/client_spec.rb +1 -1
- data/tests/test_large_file.rb +5 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3442046916c8942bc642201c55dc24cdd2c79c9a
|
4
|
+
data.tar.gz: 1ca2020cb4d9a039dcbd86e84149974b1fd7b7f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 221810c807b825c02f518dc2f4580988dc369c45dcca4741b8ee8e3481996ac03027c1dba8cc10b997ccb317cfca9f0b2c0e251f48b74011bb53aa113ffc3955
|
7
|
+
data.tar.gz: 8999b93dcf20f9aa5a3c69fb312cbbf77b3b24586089cbfdb199ccde137fc39ff181e1e81fdc79953ae5ed722476bf7955a6f650aa0f5639412d855574ca60e8
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -48,7 +48,7 @@ AccessKeySecret,在使用Aliyun OSS SDK时需要提供您的这两个信息。
|
|
48
48
|
### 创建Client
|
49
49
|
|
50
50
|
client = Aliyun::OSS::Client.new(
|
51
|
-
:endpoint => endpoint,
|
51
|
+
:endpoint => 'endpoint',
|
52
52
|
:access_key_id => 'access_key_id',
|
53
53
|
:access_key_secret => 'access_key_secret')
|
54
54
|
|
@@ -98,10 +98,10 @@ aliyun-sdk中包含了STS的SDK,使用时只需要`require 'aliyun/sts'`即可
|
|
98
98
|
token = sts.assume_role('role-arn', 'my-app')
|
99
99
|
|
100
100
|
client = Aliyun::OSS::Client.new(
|
101
|
-
:endpoint => 'http://
|
101
|
+
:endpoint => 'http://oss-cn-hangzhou.aliyuncs.com',
|
102
102
|
:access_key_id => token.access_key_id,
|
103
103
|
:access_key_secret => token.access_key_secret,
|
104
|
-
:sts_token => token.
|
104
|
+
:sts_token => token.security_token)
|
105
105
|
|
106
106
|
注意使用STS时必须指定`:sts_token`参数。用户还可以通过`STS::Client`申请
|
107
107
|
带Policy的token,细节请参考[API文档][sdk-api]。
|
data/lib/aliyun/oss/client.rb
CHANGED
@@ -7,7 +7,7 @@ module Aliyun
|
|
7
7
|
# OSS服务的客户端,用于获取bucket列表,创建/删除bucket。Object相关
|
8
8
|
# 的操作请使用{OSS::Bucket}。
|
9
9
|
# @example 创建Client
|
10
|
-
# endpoint = 'oss-cn-hangzhou.
|
10
|
+
# endpoint = 'oss-cn-hangzhou.aliyuncs.com'
|
11
11
|
# client = Client.new(
|
12
12
|
# :endpoint => endpoint,
|
13
13
|
# :access_key_id => 'access_key_id',
|
@@ -21,7 +21,7 @@ module Aliyun
|
|
21
21
|
# 构造OSS client,用于操作buckets。
|
22
22
|
# @param opts [Hash] 构造Client时的参数选项
|
23
23
|
# @option opts [String] :endpoint [必填]OSS服务的地址,可以是以
|
24
|
-
# oss.aliyuncs.com的标准域名,也可以是用户绑定的域名
|
24
|
+
# oss-cn-hangzhou.aliyuncs.com的标准域名,也可以是用户绑定的域名
|
25
25
|
# @option opts [String] :access_key_id [可选]用户的ACCESS KEY ID,
|
26
26
|
# 如果不填则会尝试匿名访问
|
27
27
|
# @option opts [String] :access_key_secret [可选]用户的ACCESS
|
data/lib/aliyun/oss/config.rb
CHANGED
@@ -16,8 +16,8 @@ module Aliyun
|
|
16
16
|
def initialize(opts = {})
|
17
17
|
super(opts)
|
18
18
|
|
19
|
-
@access_key_id.strip
|
20
|
-
@access_key_secret.strip
|
19
|
+
@access_key_id = @access_key_id.strip if @access_key_id
|
20
|
+
@access_key_secret = @access_key_secret.strip if @access_key_secret
|
21
21
|
normalize_endpoint if endpoint
|
22
22
|
end
|
23
23
|
|
data/lib/aliyun/sts/config.rb
CHANGED
@@ -12,8 +12,8 @@ module Aliyun
|
|
12
12
|
def initialize(opts = {})
|
13
13
|
super(opts)
|
14
14
|
|
15
|
-
@access_key_id.strip
|
16
|
-
@access_key_secret.strip
|
15
|
+
@access_key_id = @access_key_id.strip if @access_key_id
|
16
|
+
@access_key_secret = @access_key_secret.strip if @access_key_secret
|
17
17
|
end
|
18
18
|
end # Config
|
19
19
|
|
data/lib/aliyun/version.rb
CHANGED
@@ -10,7 +10,7 @@ module Aliyun
|
|
10
10
|
context "construct" do
|
11
11
|
it "should setup a/k" do
|
12
12
|
client = Client.new(
|
13
|
-
:access_key_id => 'xxx', :access_key_secret => 'yyy')
|
13
|
+
:access_key_id => ' xxx', :access_key_secret => ' yyy ')
|
14
14
|
|
15
15
|
config = client.instance_variable_get('@config')
|
16
16
|
expect(config.access_key_id).to eq('xxx')
|
data/tests/test_large_file.rb
CHANGED
@@ -5,7 +5,7 @@ require 'yaml'
|
|
5
5
|
$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
|
6
6
|
require 'aliyun/oss'
|
7
7
|
|
8
|
-
class
|
8
|
+
class TestLargeFile < Minitest::Test
|
9
9
|
def setup
|
10
10
|
conf_file = '~/.oss.yml'
|
11
11
|
conf = YAML.load(File.read(File.expand_path(conf_file)))
|
@@ -23,6 +23,8 @@ class TestObjectKey < Minitest::Test
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_large_file_1gb
|
26
|
+
skip "don't run it by default"
|
27
|
+
|
26
28
|
key = get_key("large_file_1gb")
|
27
29
|
Benchmark.bm(32) do |bm|
|
28
30
|
bm.report("Upload with put_object: ") do
|
@@ -44,6 +46,8 @@ class TestObjectKey < Minitest::Test
|
|
44
46
|
end
|
45
47
|
|
46
48
|
def test_large_file_8gb
|
49
|
+
skip "don't run it by default"
|
50
|
+
|
47
51
|
key = get_key("large_file_8gb")
|
48
52
|
Benchmark.bm(32) do |bm|
|
49
53
|
bm.report("Upload with put_object: ") do
|
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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tianlong Wu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -228,4 +228,3 @@ test_files:
|
|
228
228
|
- tests/test_multipart.rb
|
229
229
|
- tests/test_object_key.rb
|
230
230
|
- tests/test_resumable.rb
|
231
|
-
has_rdoc:
|