s3 0.3.22 → 0.3.23

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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjM4ZTVkNTRkODZjMWY1MzBmNDU1NDc4YTFjOWI5MzAzM2I4NzhiOA==
5
- data.tar.gz: !binary |-
6
- OWVjNTUwZjFiZDU5NzI3NmEwNWFjNWU1YjMzNmVhNWJlOWVhZTZkMA==
2
+ SHA1:
3
+ metadata.gz: 7ea0ee1684b02cf5fcadc99748bf330317abb957
4
+ data.tar.gz: c48ded25b29a209253cb2b09ae1d4ae192df2373
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MmY2MTFlNWFjMjZiM2UzOTA2NTJmZDUxZGM0NzM1YjZhOWZlZmVkMDE3MWIz
10
- MzhkZjRiZDRiNzFiMDU0ZDZjMDRlNDliMDlkYzZhYWE2YjMzZmVkYzdlZWU0
11
- OTM4Y2RlZDhmYjhmNWY4MjYwMjI2OGQzMzYzZWYwOGJjMjhkNzM=
12
- data.tar.gz: !binary |-
13
- MGU3NzgwOGZlMmUzMzkxMWE0OGEyMmI0Y2I5ZGNjMWVjZDcwZmQwMzkwZTAz
14
- MGI4ZThjZjA1MWNjM2YwMGJmOWJlYzExNjkzYjFhZDc2OGY4OWRjMzk0NmYw
15
- MGRiNzVjMDhjOTRjODllYzIwZDIxZmM5YThmNjNjYWIwMjZhMDk=
6
+ metadata.gz: 343cfa6f0cd5997536fcf18a3c1d839de3bfc417a205e62f25531b4b24fa58daa45ebce5809a1f3315b4ad72de6b617cef74752d15cbff674207e732930c5275
7
+ data.tar.gz: 3a7fe5f9c902779776e462008da107adca6fadcb9acffac771d84864f692851581bd431b71116c2e7c6711b2e8bf38c766e5132322f3712aff173e2f3fab8332
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- s3 (0.3.22)
4
+ s3 (0.3.23)
5
5
  proxies (~> 0.2.0)
6
6
 
7
7
  GEM
@@ -75,7 +75,7 @@ Please refer to: http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictio
75
75
  new_object.save
76
76
  #=> true
77
77
 
78
- Please note that new objects are created with "public-read" ACL by
78
+ Please note that new objects are created with "private" ACL by
79
79
  default.
80
80
 
81
81
  === Fetch ACL
@@ -88,13 +88,14 @@ This will return hash with all users/groups and theirs permissions
88
88
  === Modify ACL
89
89
 
90
90
  object = bucket.objects.find("lenna.png")
91
- object.copy(:key => "lenna.png", :bucket => bucket, :acl => :private)
91
+ object.copy(:key => "lenna.png", :bucket => bucket, :acl => :public_read)
92
92
 
93
93
  === Upload file direct to amazon
94
94
 
95
95
  ==== Rails 3
96
96
 
97
- To do that you just send file using proper form direct to amazon. You can create simple helper for that, for example like this one: https://gist.github.com/3169039
97
+ Check the {example in this gist}[https://gist.github.com/3169039], which describes how to use
98
+ a simple form element to upload files directly to S3.
98
99
 
99
100
  == See also
100
101
 
@@ -40,7 +40,7 @@ module S3
40
40
  end
41
41
 
42
42
  # Assigns a new ACL to the bucket. Please note that ACL is not
43
- # retrieved from the server and set to "public-read" by default.
43
+ # retrieved from the server and set to "private" by default.
44
44
  #
45
45
  # Valid Values: :private | :public_read | :public_read_write | authenticated_read
46
46
  #
@@ -94,7 +94,7 @@ module S3
94
94
  # name. If the bucket contains characters like underscore it can't
95
95
  # be used as +VHOST+ (e.g. <tt>bucket_name.s3.amazonaws.com</tt>)
96
96
  def vhost?
97
- !service.use_ssl && "#@name.#{HOST}" =~ /\A#{URI::REGEXP::PATTERN::HOSTNAME}\Z/
97
+ !service.use_ssl && service.use_vhost && "#@name.#{HOST}" =~ /\A#{URI::REGEXP::PATTERN::HOSTNAME}\Z/
98
98
  end
99
99
 
100
100
  # Returns host name of the bucket according (see #vhost? method)
@@ -131,7 +131,7 @@ module S3
131
131
  def save_acl(options = {})
132
132
  headers = {}
133
133
  headers[:content_length] = 0
134
- headers[:x_amz_acl] = options[:acl] || acl || "public-read"
134
+ headers[:x_amz_acl] = options[:acl] || acl || "private"
135
135
 
136
136
  bucket_request(:put, :headers => headers, :path => name)
137
137
  end
@@ -33,7 +33,7 @@ module S3
33
33
  end
34
34
 
35
35
  # Assigns a new ACL to the object. Please note that ACL is not
36
- # retrieved from the server and set to "public-read" by default.
36
+ # retrieved from the server and set to "private" by default.
37
37
  #
38
38
  # ==== Example
39
39
  # object.acl = :public_read
@@ -102,7 +102,7 @@ module S3
102
102
  # * <tt>:bucket</tt> - New bucket to store object in (instance of
103
103
  # S3::Bucket)
104
104
  # * <tt>:acl</tt> - ACL of the copied object (default:
105
- # "public-read")
105
+ # "private")
106
106
  # * <tt>:content_type</tt> - Content type of the copied object
107
107
  # (default: "application/octet-stream")
108
108
  def copy(options = {})
@@ -156,7 +156,7 @@ module S3
156
156
 
157
157
  headers = {}
158
158
 
159
- headers[:x_amz_acl] = options[:acl] || acl || "public-read"
159
+ headers[:x_amz_acl] = options[:acl] || acl || "private"
160
160
  headers[:content_type] = options[:content_type] || content_type || "application/octet-stream"
161
161
  headers[:content_encoding] = options[:content_encoding] if options[:content_encoding]
162
162
  headers[:content_disposition] = options[:content_disposition] if options[:content_disposition]
@@ -232,7 +232,7 @@ module S3
232
232
 
233
233
  def dump_headers
234
234
  headers = {}
235
- headers[:x_amz_acl] = @acl || "public-read"
235
+ headers[:x_amz_acl] = @acl || "private"
236
236
  headers[:x_amz_storage_class] = @storage_class || "STANDARD"
237
237
  headers[:content_type] = @content_type || "application/octet-stream"
238
238
  headers[:content_encoding] = @content_encoding if @content_encoding
@@ -3,7 +3,7 @@ module S3
3
3
  include Parser
4
4
  include Proxies
5
5
 
6
- attr_reader :access_key_id, :secret_access_key, :use_ssl, :proxy
6
+ attr_reader :access_key_id, :secret_access_key, :use_ssl, :use_vhost, :proxy
7
7
 
8
8
  # Compares service to other, by <tt>access_key_id</tt> and
9
9
  # <tt>secret_access_key</tt>
@@ -18,6 +18,8 @@ module S3
18
18
  # * <tt>:secret_access_key</tt> - Secret access key (REQUIRED)
19
19
  # * <tt>:use_ssl</tt> - Use https or http protocol (false by
20
20
  # default)
21
+ # * <tt>:use_vhost</tt> - Use bucket.s3.amazonaws.com or s3.amazonaws.com/bucket (true by
22
+ # default)
21
23
  # * <tt>:debug</tt> - Display debug information on the STDOUT
22
24
  # (false by default)
23
25
  # * <tt>:timeout</tt> - Timeout to use by the Net::HTTP object
@@ -26,6 +28,7 @@ module S3
26
28
  @access_key_id = options.fetch(:access_key_id)
27
29
  @secret_access_key = options.fetch(:secret_access_key)
28
30
  @use_ssl = options.fetch(:use_ssl, false)
31
+ @use_vhost = options.fetch(:use_vhost, true)
29
32
  @timeout = options.fetch(:timeout, 60)
30
33
  @debug = options.fetch(:debug, false)
31
34
 
@@ -1,3 +1,3 @@
1
1
  module S3
2
- VERSION = "0.3.22"
2
+ VERSION = "0.3.23"
3
3
  end
@@ -3,7 +3,7 @@ require "test_helper"
3
3
  class BucketTest < Test::Unit::TestCase
4
4
  def setup
5
5
  @bucket_vhost = S3::Bucket.send(:new, S3::Service.new(access_key_id: 'test', secret_access_key: 'secret'), "Data-Bucket")
6
- @bucket_path = S3::Bucket.send(:new, S3::Service.new(access_key_id: 'test', secret_access_key: 'secret'), "Data_Bucket")
6
+ @bucket_path = S3::Bucket.send(:new, S3::Service.new(access_key_id: 'test', secret_access_key: 'secret', use_vhost: false), "Data_Bucket")
7
7
  @secure_bucket = S3::Bucket.send(:new, S3::Service.new(access_key_id: 'test', secret_access_key: 'secret', use_ssl: true), "Data-Secured")
8
8
  @bucket = @bucket_vhost
9
9
 
@@ -36,7 +36,7 @@ class BucketTest < Test::Unit::TestCase
36
36
  S3::Object.send(:new, @bucket, :key => "prefix/"),
37
37
  S3::Object.send(:new, @bucket, :key => "prefix/obj3")
38
38
  ]
39
-
39
+
40
40
  @objects_list_prefix = [
41
41
  S3::Object.send(:new, @bucket, :key => "prefix/"),
42
42
  S3::Object.send(:new, @bucket, :key => "prefix/obj3")
@@ -55,11 +55,11 @@ class BucketTest < Test::Unit::TestCase
55
55
 
56
56
  @response_objects_list = Net::HTTPOK.new("1.1", "200", "OK")
57
57
  @response_objects_list.stubs(:body).returns(@response_objects_list_body)
58
-
58
+
59
59
  @response_objects_list_body_prefix = <<-EOObjectsPrefix
60
60
  <?xml version="1.0" encoding="UTF-8"?>\n<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Name>bucket</Name> <Prefix>prefix</Prefix> <Marker></Marker> <MaxKeys>1000</MaxKeys> <IsTruncated>false</IsTruncated> <Contents> <Key>prefix/</Key> <LastModified>2009-07-03T10:17:33.000Z</LastModified> <ETag>&quot;99519cdf14c255e580e1b7bca85a458c&quot;</ETag> <Size>1729</Size> <Owner> <ID>df864aeb6f42be43f1d9e60aaabe3f15e245b035a4b79d1cfe36c4deaec67205</ID> <DisplayName>owner</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Contents> <Contents> <Key>prefix/obj3</Key> <LastModified>2009-07-03T10:17:33.000Z</LastModified> <ETag>&quot;99519cdf14c255e580e1b7bca85a458c&quot;</ETag> <Size>1729</Size> <Owner> <ID>df864aeb6f42be43f1d9e60aaabe3f15e245b035a4b79d1cfe36c4deaec67205</ID> <DisplayName>owner</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Contents> </ListBucketResult>
61
61
  EOObjectsPrefix
62
-
62
+
63
63
 
64
64
  @response_objects_list_prefix = Net::HTTPOK.new("1.1", "200", "OK")
65
65
  @response_objects_list_prefix.stubs(:body).returns(@response_objects_list_body_prefix)
@@ -108,13 +108,13 @@ class ObjectTest < Test::Unit::TestCase
108
108
  end
109
109
 
110
110
  test "save" do
111
- @object_lena.expects(:object_request).with(:put, :body=>"test", :headers=>{ :x_amz_acl=>"public-read", :x_amz_storage_class=>"STANDARD", :content_type=>"application/octet-stream" }).returns(@response_binary)
111
+ @object_lena.expects(:object_request).with(:put, :body=>"test", :headers=>{ :x_amz_acl=>"private", :x_amz_storage_class=>"STANDARD", :content_type=>"application/octet-stream" }).returns(@response_binary)
112
112
  assert @object_lena.save
113
113
  end
114
114
 
115
115
  test "save with cache control headers" do
116
116
  assert_equal "max-age=315360000", @object_mac.cache_control
117
- @object_mac.expects(:object_request).with(:put, :body=>"test2", :headers=>{ :x_amz_acl=>"public-read", :x_amz_storage_class=>"STANDARD", :content_type=>"application/octet-stream", :cache_control=>"max-age=315360000" }).returns(@response_binary)
117
+ @object_mac.expects(:object_request).with(:put, :body=>"test2", :headers=>{ :x_amz_acl=>"private", :x_amz_storage_class=>"STANDARD", :content_type=>"application/octet-stream", :cache_control=>"max-age=315360000" }).returns(@response_binary)
118
118
  assert @object_mac.save
119
119
  end
120
120
 
@@ -203,7 +203,7 @@ class ObjectTest < Test::Unit::TestCase
203
203
  end
204
204
 
205
205
  test "replace" do
206
- @bucket_images.expects(:bucket_request).with(:put, :path => "Lena-copy.png", :headers => { :x_amz_acl => "public-read", :content_type => "application/octet-stream", :x_amz_copy_source => "images/Lena.png", :x_amz_metadata_directive => "REPLACE" }).returns(@response_xml)
206
+ @bucket_images.expects(:bucket_request).with(:put, :path => "Lena-copy.png", :headers => { :x_amz_acl => "private", :content_type => "application/octet-stream", :x_amz_copy_source => "images/Lena.png", :x_amz_metadata_directive => "REPLACE" }).returns(@response_xml)
207
207
 
208
208
  new_object = @object_lena.copy(:key => "Lena-copy.png")
209
209
 
@@ -212,7 +212,7 @@ class ObjectTest < Test::Unit::TestCase
212
212
  end
213
213
 
214
214
  test "copy" do
215
- @bucket_images.expects(:bucket_request).with(:put, :path => "Lena-copy.png", :headers => { :x_amz_acl => "public-read", :content_type => "application/octet-stream", :x_amz_copy_source => "images/Lena.png", :x_amz_metadata_directive => "COPY" }).returns(@response_xml)
215
+ @bucket_images.expects(:bucket_request).with(:put, :path => "Lena-copy.png", :headers => { :x_amz_acl => "private", :content_type => "application/octet-stream", :x_amz_copy_source => "images/Lena.png", :x_amz_metadata_directive => "COPY" }).returns(@response_xml)
216
216
 
217
217
  new_object = @object_lena.copy(:key => "Lena-copy.png", :replace => false)
218
218
 
metadata CHANGED
@@ -1,95 +1,95 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.22
4
+ version: 0.3.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuba Kuźma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-14 00:00:00.000000000 Z
11
+ date: 2015-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: proxies
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: test-unit
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mocha
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description: ! 'S3 library provides access to Amazon''s Simple Storage Service. It
84
- supports both: European and US buckets through REST API.'
83
+ description: 'S3 library provides access to Amazon''s Simple Storage Service. It supports
84
+ both: European and US buckets through REST API.'
85
85
  email:
86
86
  - kuba@jah.pl
87
87
  executables: []
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
- - .gitignore
92
- - .travis.yml
91
+ - ".gitignore"
92
+ - ".travis.yml"
93
93
  - Gemfile
94
94
  - Gemfile.lock
95
95
  - LICENSE
@@ -124,17 +124,17 @@ require_paths:
124
124
  - lib
125
125
  required_ruby_version: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - ! '>='
127
+ - - ">="
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  requirements:
132
- - - ! '>='
132
+ - - ">="
133
133
  - !ruby/object:Gem::Version
134
134
  version: 1.3.6
135
135
  requirements: []
136
136
  rubyforge_project: s3
137
- rubygems_version: 2.4.6
137
+ rubygems_version: 2.4.5
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Library for accessing S3 objects and buckets