fog-aliyun 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/.rubocop_todo.yml +0 -27
  4. data/lib/fog/aliyun/compute.rb +4 -8
  5. data/lib/fog/aliyun/models/storage/file.rb +6 -5
  6. data/lib/fog/aliyun/models/storage/files.rb +1 -1
  7. data/lib/fog/aliyun/requests/compute/create_server.rb +12 -8
  8. data/lib/fog/aliyun/requests/compute/join_security_group.rb +0 -8
  9. data/lib/fog/aliyun/requests/compute/leave_security_group.rb +0 -8
  10. data/lib/fog/aliyun/requests/compute/list_server_types.rb +9 -32
  11. data/lib/fog/aliyun/requests/compute/reboot_server.rb +0 -8
  12. data/lib/fog/aliyun/requests/compute/start_server.rb +5 -11
  13. data/lib/fog/aliyun/requests/compute/stop_server.rb +5 -11
  14. data/lib/fog/aliyun/requests/storage/copy_object.rb +0 -4
  15. data/lib/fog/aliyun/requests/storage/delete_bucket.rb +0 -4
  16. data/lib/fog/aliyun/requests/storage/delete_container.rb +0 -3
  17. data/lib/fog/aliyun/requests/storage/delete_object.rb +0 -4
  18. data/lib/fog/aliyun/requests/storage/get_bucket.rb +8 -11
  19. data/lib/fog/aliyun/requests/storage/get_container.rb +1 -6
  20. data/lib/fog/aliyun/requests/storage/get_containers.rb +1 -6
  21. data/lib/fog/aliyun/requests/storage/get_object.rb +0 -4
  22. data/lib/fog/aliyun/requests/storage/get_object_http_url.rb +5 -9
  23. data/lib/fog/aliyun/requests/storage/get_object_https_url.rb +5 -9
  24. data/lib/fog/aliyun/requests/storage/head_object.rb +0 -4
  25. data/lib/fog/aliyun/requests/storage/list_buckets.rb +1 -5
  26. data/lib/fog/aliyun/requests/storage/list_objects.rb +3 -9
  27. data/lib/fog/aliyun/requests/storage/put_bucket.rb +1 -5
  28. data/lib/fog/aliyun/requests/storage/put_container.rb +0 -4
  29. data/lib/fog/aliyun/requests/storage/put_object.rb +7 -12
  30. data/lib/fog/aliyun/storage.rb +1 -16
  31. data/lib/fog/aliyun/version.rb +1 -1
  32. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2f14d1d42f366b42d05bb045478ba66ef8aab6a596826b65acba26ac5bd13ed
4
- data.tar.gz: a3dc9fbeadc7f311e202892fe48ee7b5c1647faca657370aa1af4345646b0f98
3
+ metadata.gz: f08037e2cb10948b237c66efcb1a9f3a125512c54fc2c62c9ca24dfb315bd214
4
+ data.tar.gz: d016945f6e23fdcdd331a4344253af808611971f29d8fc7a9cfe989b92823f14
5
5
  SHA512:
6
- metadata.gz: bebef15bc6fc524dd8a050068aa5ebcf75b76341a721b9372cc43b3c6e78ba0c78125086159da7c0dcba3197d56d2e97fb6424c2c4ad87956a66b52ad927b64a
7
- data.tar.gz: 548d10c215516f737afd32a1b99b776878265a1cedcdc5adcac07327554d65f882b30c2f478c888effe91df2a34a6bf4a792e2c54d860e06008051e10db08d9d
6
+ metadata.gz: 042efe491c541db521d0612b2e3db782b4e32d70a9df255661f65b0ea3bfc4e775ee981dc75c524c1c0dbcc5ae043fe29d3d91df0620fe599e1b8effd5177f30
7
+ data.tar.gz: 67287cf23649648869c2161cc3702c244c1cff0788c6162ea179e37d798a64ae6124fc2294846744b5d6f1ed1420f1cd1107a521d351c9fcf1c32f0fa0e5cbba
data/.rubocop.yml CHANGED
@@ -29,4 +29,7 @@ Naming/VariableName:
29
29
  Enabled: false
30
30
 
31
31
  Lint/UnderscorePrefixedVariableName:
32
+ Enabled: false
33
+
34
+ Metrics/LineLength:
32
35
  Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -6,25 +6,6 @@
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
10
- # Cop supports --auto-correct.
11
- # Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity.
12
- # SupportedStylesAlignWith: start_of_line, def
13
- Layout/DefEndAlignment:
14
- Exclude:
15
- - 'lib/fog/aliyun/requests/storage/put_object.rb'
16
-
17
- # Offense count: 5
18
- # Cop supports --auto-correct.
19
- # Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity.
20
- # SupportedStylesAlignWith: keyword, variable, start_of_line
21
- Layout/EndAlignment:
22
- Exclude:
23
- - 'lib/fog/aliyun/compute.rb'
24
- - 'lib/fog/aliyun/models/storage/file.rb'
25
- - 'lib/fog/aliyun/requests/compute/create_server.rb'
26
- - 'lib/fog/aliyun/storage.rb'
27
-
28
9
  # Offense count: 4
29
10
  # Configuration parameters: AllowSafeAssignment.
30
11
  Lint/AssignmentInCondition:
@@ -167,11 +148,3 @@ Style/MultipleComparison:
167
148
  Exclude:
168
149
  - 'lib/fog/aliyun/requests/storage/get_object_http_url.rb'
169
150
  - 'lib/fog/aliyun/requests/storage/get_object_https_url.rb'
170
-
171
- # Offense count: 1
172
- # Cop supports --auto-correct.
173
- # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
174
- # SupportedStyles: slashes, percent_r, mixed
175
- Style/RegexpLiteral:
176
- Exclude:
177
- - 'lib/fog/aliyun/models/storage/files.rb'
@@ -313,12 +313,10 @@ module Fog
313
313
  Fog::Compute::Aliyun::NotFound.slurp(error)
314
314
  else
315
315
  error
316
- end
316
+ end
317
317
  end
318
318
 
319
- if !response.body.empty? && response.get_header('Content-Type') == 'application/json'
320
- response.body = Fog::JSON.decode(response.body)
321
- end
319
+ response.body = Fog::JSON.decode(response.body) if !response.body.empty? && response.get_header('Content-Type') == 'application/json'
322
320
 
323
321
  response
324
322
  end
@@ -338,12 +336,10 @@ module Fog
338
336
  Fog::Compute::Aliyun::NotFound.slurp(error)
339
337
  else
340
338
  error
341
- end
339
+ end
342
340
  end
343
341
 
344
- if !response.body.empty? && response.get_header('Content-Type') == 'application/json'
345
- response.body = Fog::JSON.decode(response.body)
346
- end
342
+ response.body = Fog::JSON.decode(response.body) if !response.body.empty? && response.get_header('Content-Type') == 'application/json'
347
343
 
348
344
  response
349
345
  end
@@ -19,11 +19,12 @@ module Fog
19
19
  attribute :object_type, aliases: 'x-oss-object-type'
20
20
 
21
21
  def body
22
- attributes[:body] ||= if last_modified
23
- collection.get(identity).body
24
- else
25
- ''
26
- end
22
+ attributes[:body] ||=
23
+ if last_modified
24
+ collection.get(identity).body
25
+ else
26
+ ''
27
+ end
27
28
  end
28
29
 
29
30
  def body=(new_body)
@@ -68,7 +68,7 @@ module Fog
68
68
  data = service.get_object(object)
69
69
  rescue StandardError => error
70
70
  case error.response.body
71
- when /<Code>NoSuchKey<\/Code>/
71
+ when %r{<Code>NoSuchKey</Code>}
72
72
  nil
73
73
  else
74
74
  raise(error)
@@ -105,14 +105,18 @@ module Fog
105
105
  u.name == @openstack_username
106
106
  end
107
107
 
108
- user_id = if user
109
- user.id
110
- else
111
- response = identity.create_user(@openstack_username,
112
- 'password',
113
- "#{@openstack_username}@example.com")
114
- response.body['user']['id']
115
- end
108
+ user_id =
109
+ if user
110
+ user.id
111
+ else
112
+ response =
113
+ identity.create_user(
114
+ @openstack_username,
115
+ 'password',
116
+ "#{@openstack_username}@example.com"
117
+ )
118
+ response.body['user']['id']
119
+ end
116
120
 
117
121
  mock_data = {
118
122
  'addresses' => { 'Private' => [{ 'addr' => Fog::Mock.random_ip }] },
@@ -29,14 +29,6 @@ module Fog
29
29
  )
30
30
  end
31
31
  end
32
-
33
- class Mock
34
- def join_security_group(_server_id, _group_id)
35
- response = Excon::Response.new
36
- response.status = 200
37
- response
38
- end
39
- end
40
32
  end
41
33
  end
42
34
  end
@@ -29,14 +29,6 @@ module Fog
29
29
  )
30
30
  end
31
31
  end
32
-
33
- class Mock
34
- def add_security_group(_server_id, _group_name)
35
- response = Excon::Response.new
36
- response.status = 200
37
- response
38
- end
39
- end
40
32
  end
41
33
  end
42
34
  end
@@ -21,14 +21,7 @@ module Fog
21
21
  method: 'GET',
22
22
  path: _pathURL
23
23
  )
24
-
25
- # _InstanceType = Hash.new
26
- # _InstanceTypeList = Fog::JSON.decode(response.body)["InstanceTypes"]["InstanceType"]
27
- # _InstanceTypeList.each do |instanceType|
28
- # _InstanceType[[instanceType["CpuCoreCount"], instanceType["MemorySize"]]] = instanceType["InstanceTypeId"]
29
- # end
30
- # _InstanceType
31
- end list_server_types
24
+ end
32
25
 
33
26
  def get_instance_type(cpuCount, memorySize)
34
27
  _action = 'DescribeInstanceTypes'
@@ -49,31 +42,15 @@ module Fog
49
42
 
50
43
  _InstanceTypeId = nil
51
44
  _InstanceTypeList = Fog::JSON.decode(response.body)['InstanceTypes']['InstanceType']
52
- _InstanceTypeList.each do |instanceType|
53
- next unless (instanceType['CpuCoreCount'] == cpuCount) && (instanceType['MemorySize'] == memorySize)
54
- _InstanceTypeId = instanceType['InstanceTypeId']
45
+ _InstanceTypeList.each do |instance_type|
46
+ next unless (instance_type['CpuCoreCount'] == cpuCount) && (instance_type['MemorySize'] == memorySize)
47
+ _InstanceTypeId = instance_type['InstanceTypeId']
55
48
  puts '_instanceTypeId: ' + _InstanceTypeId
56
49
  break
57
- # end if
58
- end each
50
+ end
59
51
  _InstanceTypeId
60
- end get_instance_type
61
- end class Real
62
-
63
- # class Mock
64
- # def list_servers(options = {})
65
- # response = Excon::Response.new
66
- # data = list_servers_detail.body['servers']
67
- # servers = []
68
- # for server in data
69
- # servers << server.reject { |key, value| !['id', 'name', 'links'].include?(key) }
70
- # end
71
- # response.status = [200, 203][rand(1)]
72
- # response.body = { 'servers' => servers }
73
- # response
74
- # end
75
- # end
76
- end class Aliyun
77
- end module Compute
78
- # end module Fog
52
+ end
53
+ end
54
+ end
55
+ end
79
56
  end
@@ -32,14 +32,6 @@ module Fog
32
32
  )
33
33
  end
34
34
  end
35
-
36
- class Mock
37
- def reboot_server(_server_id, _type = 'SOFT')
38
- response = Excon::Response.new
39
- response.status = 202
40
- response
41
- end
42
- end
43
35
  end
44
36
  end
45
37
  end
@@ -30,14 +30,8 @@ module Fog
30
30
  method: 'GET',
31
31
  path: _pathURL
32
32
  )
33
- end start_server
34
- end Real
35
-
36
- class Mock
37
- def start_server(_server_id)
38
- true
39
- end start_server
40
- end Mock
41
- end aliyun
42
- end Compute
43
- end Fog
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -30,14 +30,8 @@ module Fog
30
30
  method: 'GET',
31
31
  path: _pathURL
32
32
  )
33
- end stop_server
34
- end Real
35
-
36
- class Mock
37
- def stop_server(_server_id)
38
- true
39
- end stop_server
40
- end Mock
41
- end aliyun
42
- end Compute
43
- end Fog
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -31,10 +31,6 @@ module Fog
31
31
  endpoint: endpoint)
32
32
  end
33
33
  end
34
-
35
- class Mock
36
- def copy_object(source_bucket, source_object, target_bucket, target_object); end
37
- end
38
34
  end
39
35
  end
40
36
  end
@@ -22,10 +22,6 @@ module Fog
22
22
  )
23
23
  end
24
24
  end
25
-
26
- class Mock
27
- def delete_bucket(bucket); end
28
- end
29
25
  end
30
26
  end
31
27
  end
@@ -28,9 +28,6 @@ module Fog
28
28
  )
29
29
  end
30
30
  end
31
- class Mock
32
- def delete_container(container, options = {}); end
33
- end
34
31
  end
35
32
  end
36
33
  end
@@ -43,10 +43,6 @@ module Fog
43
43
  )
44
44
  end
45
45
  end
46
-
47
- class Mock
48
- def delete_object(object, options = {}); end
49
- end
50
46
  end
51
47
  end
52
48
  end
@@ -16,7 +16,7 @@ module Fog
16
16
  endpoint: endpoint
17
17
  )
18
18
  xml = ret.data[:body]
19
- result = XmlSimple.xml_in(xml)
19
+ XmlSimple.xml_in(xml)
20
20
  end
21
21
 
22
22
  def get_bucket_location(bucket)
@@ -29,7 +29,7 @@ module Fog
29
29
  bucket: bucket,
30
30
  resource: resource
31
31
  )
32
- location = XmlSimple.xml_in(ret.data[:body])
32
+ XmlSimple.xml_in(ret.data[:body])
33
33
  end
34
34
 
35
35
  def get_bucket_acl(bucket)
@@ -45,7 +45,7 @@ module Fog
45
45
  resource: resource,
46
46
  endpoint: endpoint
47
47
  )
48
- acl = XmlSimple.xml_in(ret.data[:body])['AccessControlList'][0]['Grant'][0]
48
+ XmlSimple.xml_in(ret.data[:body])['AccessControlList'][0]['Grant'][0]
49
49
  end
50
50
 
51
51
  def get_bucket_CORSRules(bucket)
@@ -61,7 +61,7 @@ module Fog
61
61
  resource: resource,
62
62
  endpoint: endpoint
63
63
  )
64
- cors = XmlSimple.xml_in(ret.data[:body])['CORSRule'][0] if ret.data[:status] != 404
64
+ XmlSimple.xml_in(ret.data[:body])['CORSRule'][0] if ret.data[:status] != 404
65
65
  end
66
66
 
67
67
  def get_bucket_lifecycle(bucket)
@@ -77,7 +77,7 @@ module Fog
77
77
  resource: resource,
78
78
  endpoint: endpoint
79
79
  )
80
- lifecycle = XmlSimple.xml_in(ret.data[:body])['Rule'][0] if ret.data[:status] != 404
80
+ XmlSimple.xml_in(ret.data[:body])['Rule'][0] if ret.data[:status] != 404
81
81
  end
82
82
 
83
83
  def get_bucket_logging(bucket)
@@ -93,7 +93,7 @@ module Fog
93
93
  resource: resource,
94
94
  endpoint: endpoint
95
95
  )
96
- logging = XmlSimple.xml_in(ret.data[:body])['LoggingEnabled'][0]['TargetPrefix']
96
+ XmlSimple.xml_in(ret.data[:body])['LoggingEnabled'][0]['TargetPrefix']
97
97
  end
98
98
 
99
99
  def get_bucket_referer(bucket)
@@ -109,7 +109,7 @@ module Fog
109
109
  resource: resource,
110
110
  endpoint: endpoint
111
111
  )
112
- referer = XmlSimple.xml_in(ret.data[:body])
112
+ XmlSimple.xml_in(ret.data[:body])
113
113
  end
114
114
 
115
115
  def get_bucket_website(bucket)
@@ -125,12 +125,9 @@ module Fog
125
125
  resource: resource,
126
126
  endpoint: endpoint
127
127
  )
128
- website = XmlSimple.xml_in(ret.data[:body]) if ret.data[:status] != 404
128
+ XmlSimple.xml_in(ret.data[:body]) if ret.data[:status] != 404
129
129
  end
130
130
  end
131
- class Mock
132
- def get_bucket(bucket); end
133
- end
134
131
  end
135
132
  end
136
133
  end
@@ -39,7 +39,6 @@ module Fog
39
39
  end
40
40
 
41
41
  location = get_bucket_location(bucket)
42
- endpoint = 'http://' + location + '.aliyuncs.com'
43
42
  resource = bucket + '/'
44
43
  ret = request(
45
44
  expects: [200, 203, 400],
@@ -49,13 +48,9 @@ module Fog
49
48
  bucket: bucket
50
49
  )
51
50
  xml = ret.data[:body]
52
- result = XmlSimple.xml_in(xml)['CommonPrefixes']
51
+ XmlSimple.xml_in(xml)['CommonPrefixes']
53
52
  end
54
53
  end
55
-
56
- class Mock
57
- def get_container(container, options = {}); end
58
- end
59
54
  end
60
55
  end
61
56
  end
@@ -43,7 +43,6 @@ module Fog
43
43
  end
44
44
 
45
45
  location = get_bucket_location(bucket)
46
- endpoint = 'http://' + location + '.aliyuncs.com'
47
46
  resource = bucket + '/'
48
47
  ret = request(
49
48
  expects: [200, 203, 400],
@@ -53,13 +52,9 @@ module Fog
53
52
  bucket: bucket
54
53
  )
55
54
  xml = ret.data[:body]
56
- result = XmlSimple.xml_in(xml)['CommonPrefixes']
55
+ XmlSimple.xml_in(xml)['CommonPrefixes']
57
56
  end
58
57
  end
59
-
60
- class Mock
61
- def get_containers(options = {}); end
62
- end
63
58
  end
64
59
  end
65
60
  end
@@ -37,10 +37,6 @@ module Fog
37
37
  response.data
38
38
  end
39
39
  end
40
-
41
- class Mock
42
- def get_object(object, range = nil, options = {}); end
43
- end
44
40
  end
45
41
  end
46
42
  end
@@ -25,20 +25,16 @@ module Fog
25
25
  expires_time = (Time.now.to_i + expires).to_s
26
26
  resource = bucket + '/' + object
27
27
  signature = sign('GET', expires_time, nil, resource)
28
- url = 'http://' + bucket + '.' + location + '.aliyuncs.com/' + object +
29
- '?OSSAccessKeyId=' + @aliyun_accesskey_id + '&Expires=' + expires_time +
30
- '&Signature=' + URI.encode(signature, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
28
+ 'http://' + bucket + '.' + location + '.aliyuncs.com/' + object +
29
+ '?OSSAccessKeyId=' + @aliyun_accesskey_id + '&Expires=' + expires_time +
30
+ '&Signature=' + URI.encode(signature, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
31
31
  elsif acl == 'public-read' || acl == 'public-read-write'
32
- url = 'http://' + bucket + '.' + location + '.aliyuncs.com/' + object
32
+ 'http://' + bucket + '.' + location + '.aliyuncs.com/' + object
33
33
  else
34
- url = 'acl is wrong with value:' + acl
34
+ 'acl is wrong with value:' + acl
35
35
  end
36
36
  end
37
37
  end
38
-
39
- class Mock
40
- def get_object_http_url_public(object, expires, options = {}); end
41
- end
42
38
  end
43
39
  end
44
40
  end
@@ -25,20 +25,16 @@ module Fog
25
25
  expires_time = (Time.now.to_i + expires).to_s
26
26
  resource = bucket + '/' + object
27
27
  signature = sign('GET', expires_time, nil, resource)
28
- url = 'https://' + bucket + '.' + location + '.aliyuncs.com/' + object +
29
- '?OSSAccessKeyId=' + @aliyun_accesskey_id + '&Expires=' + expires_time +
30
- '&Signature=' + URI.encode(signature, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
28
+ 'https://' + bucket + '.' + location + '.aliyuncs.com/' + object +
29
+ '?OSSAccessKeyId=' + @aliyun_accesskey_id + '&Expires=' + expires_time +
30
+ '&Signature=' + URI.encode(signature, '/[^!*\'()\;?:@#&%=+$,{}[]<>`" ')
31
31
  elsif acl == 'public-read' || acl == 'public-read-write'
32
- url = 'https://' + bucket + '.' + location + '.aliyuncs.com/' + object
32
+ 'https://' + bucket + '.' + location + '.aliyuncs.com/' + object
33
33
  else
34
- url = 'acl is wrong with value:' + acl
34
+ 'acl is wrong with value:' + acl
35
35
  end
36
36
  end
37
37
  end
38
-
39
- class Mock
40
- def get_object_https_url_public(object, expires, options = {}); end
41
- end
42
38
  end
43
39
  end
44
40
  end
@@ -26,10 +26,6 @@ module Fog
26
26
  ret
27
27
  end
28
28
  end
29
-
30
- class Mock
31
- def head_object(object, options = {}); end
32
- end
33
29
  end
34
30
  end
35
31
  end
@@ -29,13 +29,9 @@ module Fog
29
29
  path: path
30
30
  )
31
31
  xml = ret.data[:body]
32
- result = XmlSimple.xml_in(xml)['Buckets'][0]
32
+ XmlSimple.xml_in(xml)['Buckets'][0]
33
33
  end
34
34
  end
35
-
36
- class Mock
37
- def list_buckets(options = {}); end
38
- end
39
35
  end
40
36
  end
41
37
  end
@@ -31,8 +31,6 @@ module Fog
31
31
  path += '?delimiter=' + delimiter
32
32
  end
33
33
 
34
- location = get_bucket_location(bucket)
35
- endpoint = 'http://' + location + '.aliyuncs.com'
36
34
  resource = bucket + '/'
37
35
  ret = request(
38
36
  expects: [200, 203, 400],
@@ -42,7 +40,7 @@ module Fog
42
40
  bucket: bucket
43
41
  )
44
42
  xml = ret.data[:body]
45
- result = XmlSimple.xml_in(xml)
43
+ XmlSimple.xml_in(xml)
46
44
  end
47
45
 
48
46
  def list_multipart_uploads(bucket, endpoint, _options = {})
@@ -61,7 +59,7 @@ module Fog
61
59
  resource: resource,
62
60
  endpoint: endpoint
63
61
  )
64
- uploadid = XmlSimple.xml_in(ret.data[:body])['Upload']
62
+ XmlSimple.xml_in(ret.data[:body])['Upload']
65
63
  end
66
64
 
67
65
  def list_parts(bucket, object, endpoint, uploadid, _options = {})
@@ -80,13 +78,9 @@ module Fog
80
78
  resource: resource,
81
79
  endpoint: endpoint
82
80
  )
83
- parts = XmlSimple.xml_in(ret.data[:body])['Part']
81
+ XmlSimple.xml_in(ret.data[:body])['Part']
84
82
  end
85
83
  end
86
-
87
- class Mock
88
- def list_objects(options = {}); end
89
- end
90
84
  end
91
85
  end
92
86
  end
@@ -6,7 +6,7 @@ module Fog
6
6
  class Real
7
7
  def put_bucket(bucketName)
8
8
  resource = bucketName + '/'
9
- ret = request(
9
+ request(
10
10
  expects: [200, 203],
11
11
  method: 'PUT',
12
12
  resource: resource,
@@ -14,10 +14,6 @@ module Fog
14
14
  )
15
15
  end
16
16
  end
17
-
18
- class Mock
19
- def put_bucket(bucketName); end
20
- end
21
17
  end
22
18
  end
23
19
  end
@@ -27,10 +27,6 @@ module Fog
27
27
  )
28
28
  end
29
29
  end
30
-
31
- class Mock
32
- def put_container(name, options = {}); end
33
- end
34
30
  end
35
31
  end
36
32
  end
@@ -22,7 +22,7 @@ module Fog
22
22
  body = file.read
23
23
 
24
24
  resource = bucket + '/' + object
25
- ret = request(
25
+ request(
26
26
  expects: [200, 203],
27
27
  method: 'PUT',
28
28
  path: object,
@@ -40,7 +40,7 @@ module Fog
40
40
  endpoint = 'http://' + location + '.aliyuncs.com'
41
41
 
42
42
  resource = bucket + '/' + object
43
- ret = request(
43
+ request(
44
44
  expects: [200, 203],
45
45
  method: 'PUT',
46
46
  path: object,
@@ -49,7 +49,7 @@ module Fog
49
49
  body: body,
50
50
  endpoint: endpoint
51
51
  )
52
- end
52
+ end
53
53
 
54
54
  def put_folder(bucket, folder, endpoint)
55
55
  if endpoint.nil?
@@ -58,7 +58,7 @@ module Fog
58
58
  end
59
59
  path = folder + '/'
60
60
  resource = bucket + '/' + folder + '/'
61
- ret = request(
61
+ request(
62
62
  expects: [200, 203],
63
63
  method: 'PUT',
64
64
  path: path,
@@ -76,7 +76,6 @@ module Fog
76
76
  uploads = list_multipart_uploads(bucket, endpoint)
77
77
  upload = (uploads&.find { |tmpupload| tmpupload['Key'][0] == object })
78
78
 
79
- parts = nil
80
79
  uploadedSize = 0
81
80
  start_partNumber = 1
82
81
  if !upload.nil?
@@ -127,7 +126,7 @@ module Fog
127
126
  resource: resource,
128
127
  endpoint: endpoint
129
128
  )
130
- uploadid = XmlSimple.xml_in(ret.data[:body])['UploadId'][0]
129
+ XmlSimple.xml_in(ret.data[:body])['UploadId'][0]
131
130
  end
132
131
 
133
132
  def upload_part(bucket, object, endpoint, partNumber, uploadId, body)
@@ -137,7 +136,7 @@ module Fog
137
136
  end
138
137
  path = object + '?partNumber=' + partNumber + '&uploadId=' + uploadId
139
138
  resource = bucket + '/' + path
140
- ret = request(
139
+ request(
141
140
  expects: [200, 203],
142
141
  method: 'PUT',
143
142
  path: path,
@@ -164,7 +163,7 @@ module Fog
164
163
 
165
164
  path = object + '?uploadId=' + uploadId
166
165
  resource = bucket + '/' + path
167
- ret = request(
166
+ request(
168
167
  expects: 200,
169
168
  method: 'POST',
170
169
  path: path,
@@ -175,10 +174,6 @@ module Fog
175
174
  )
176
175
  end
177
176
  end
178
-
179
- class Mock
180
- def put_object(object, file = nil, options = {}); end
181
- end
182
177
  end
183
178
  end
184
179
  end
@@ -160,7 +160,7 @@ module Fog
160
160
  Fog::Storage::Aliyun::NotFound.slurp(error)
161
161
  else
162
162
  error
163
- end
163
+ end
164
164
  end
165
165
 
166
166
  response
@@ -199,22 +199,7 @@ module Fog
199
199
  @aliyun_accesskey_secret = options[:aliyun_accesskey_secret]
200
200
  @aliyun_oss_bucket = options[:aliyun_oss_bucket]
201
201
 
202
- # missing_credentials = Array.new
203
- # missing_credentials << :aliyun_oss_endpoint unless @aliyun_oss_endpoint
204
- # missing_credentials << :aliyun_region_id unless @aliyun_region_id
205
- # missing_credentials << :aliyun_accesskey_id unless @aliyun_accesskey_id
206
- # missing_credentials << :aliyun_accesskey_secret unless @aliyun_accesskey_secret
207
- # raise ArgumentError, "Missing required arguments: #{missing_credentials.join(', ')}" unless missing_credentials.empty?
208
-
209
202
  @connection_options = options[:connection_options] || {}
210
-
211
- # uri = URI.parse(@aliyun_oss_endpoint)
212
- # @host = uri.host
213
- # @path = uri.path
214
- # @port = uri.port
215
- # @scheme = uri.scheme
216
-
217
- # @persistent = options[:persistent] || false
218
203
  end
219
204
  end
220
205
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fog
4
4
  module Aliyun
5
- VERSION = '0.3.1'
5
+ VERSION = '0.3.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-aliyun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Qinsi Deng, Jianxun Li, Jane Han