s3 0.3.24 → 0.3.25

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d25a652e976f52b851fda22f71d9b7cce09acfbe
4
- data.tar.gz: 46df7f5afeeb91d86df9b0a43e393b3a88a8867f
3
+ metadata.gz: 66cf7c8b5f8f96174d65bedf2a54160503f6036b
4
+ data.tar.gz: f78a9262d7b9972116f2125ee8f118a467200c5e
5
5
  SHA512:
6
- metadata.gz: 739666db3562252f1c6af666dec6ae70e310e42d129e7870df0f978930180a668875c016a49f9529410905e0c1b84ba212a283c5d24c7e22fb24f458ca49b8b9
7
- data.tar.gz: 46801114bb6c5731876e686053f5f76f732b36e12d005a869534572e5931497f87d9740af7d543b73b5961fa96fdecf6380decbad10ee4894b4f3c8636219b32
6
+ metadata.gz: a61766e049d380fc82a53d709e68caa36e44e250f981412139264d7c23b6f3a4e68169c9a1389a194f3ee1e83208bbe70be9b91a8f23d7cd092cffbfc63af773
7
+ data.tar.gz: 0135258cb2c6dc9b32f3c1b6e1b56c1984944f3a6d42365781c2b77b68ee92ccbed86902d55995ae93da9442734c8445aadb9ff35ee0e48fc0e5bbd32fb71e59
data/Gemfile.lock CHANGED
@@ -1,18 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- s3 (0.3.24)
4
+ s3 (0.3.25)
5
5
  proxies (~> 0.2.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
10
  metaclass (0.0.4)
11
- mocha (1.0.0)
11
+ mocha (1.2.1)
12
12
  metaclass (~> 0.0.1)
13
+ power_assert (0.3.1)
13
14
  proxies (0.2.1)
14
- rake (10.1.1)
15
- test-unit (2.5.5)
15
+ rake (11.3.0)
16
+ test-unit (3.2.1)
17
+ power_assert
16
18
 
17
19
  PLATFORMS
18
20
  ruby
@@ -25,4 +27,4 @@ DEPENDENCIES
25
27
  test-unit
26
28
 
27
29
  BUNDLED WITH
28
- 1.10.6
30
+ 1.12.5
data/README.rdoc CHANGED
@@ -30,6 +30,13 @@ It supports *all* S3 regions through the {REST API}[http://docs.amazonwebservice
30
30
  first_bucket = service.buckets.find("first-bucket")
31
31
  #=> #<S3::Bucket:first-bucket>
32
32
 
33
+ or
34
+
35
+ first_bucket = service.bucket("first-bucket")
36
+ #=> #<S3::Bucket:first-bucket>
37
+
38
+ <tt>service.bucket("first-bucket")</tt> does not check whether a bucket with the name <tt>"first-bucket"</tt> exists, but it also does not issue any HTTP requests. Thus, the second example is much faster than <tt>buckets.find</tt>. You can use <tt>first_bucket.exists?</tt> to check whether the bucket exists after calling <tt>service.bucket</tt>.
39
+
33
40
  === Create bucket
34
41
 
35
42
  new_bucket = service.buckets.build("newbucketname")
@@ -72,12 +79,20 @@ Please refer to: http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictio
72
79
 
73
80
  new_object.content = open("bender.png")
74
81
 
82
+ new_object.acl = :public_read
83
+
75
84
  new_object.save
76
85
  #=> true
77
86
 
78
87
  Please note that new objects are created with "private" ACL by
79
88
  default.
80
89
 
90
+ === Request access to a private object
91
+
92
+ Returns a temporary url to the object that expires on the timestamp given. Defaults to one hour expire time.
93
+
94
+ new_object.temporary_url(Time.now + 1800)
95
+
81
96
  === Fetch ACL
82
97
 
83
98
  object = bucket.objects.find('lenna.png')
data/lib/s3.rb CHANGED
@@ -22,6 +22,10 @@ require "s3/signature"
22
22
  require "s3/version"
23
23
 
24
24
  module S3
25
- # Default (and only) host serving S3 stuff
26
- HOST = "s3.amazonaws.com"
25
+ class << self
26
+ attr_accessor :host # Default host serving S3 stuff
27
+ def host
28
+ @host ||= "s3.amazonaws.com"
29
+ end
30
+ end
27
31
  end
data/lib/s3/bucket.rb CHANGED
@@ -94,12 +94,12 @@ 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 && service.use_vhost && "#@name.#{HOST}" =~ /\A#{URI::REGEXP::PATTERN::HOSTNAME}\Z/
97
+ !service.use_ssl && service.use_vhost && "#@name.#{S3.host}" =~ /\A#{URI::REGEXP::PATTERN::HOSTNAME}\Z/
98
98
  end
99
99
 
100
100
  # Returns host name of the bucket according (see #vhost? method)
101
101
  def host
102
- vhost? ? "#@name.#{HOST}" : "#{HOST}"
102
+ vhost? ? "#@name.#{S3.host}" : "#{S3.host}"
103
103
  end
104
104
 
105
105
  # Returns path prefix for non +VHOST+ bucket. Path prefix is used
data/lib/s3/connection.rb CHANGED
@@ -54,7 +54,7 @@ module S3
54
54
  # ==== Returns
55
55
  # Net::HTTPResponse object -- response from the server
56
56
  def request(method, options)
57
- host = options.fetch(:host, HOST)
57
+ host = options.fetch(:host, S3.host)
58
58
  path = options.fetch(:path)
59
59
  body = options.fetch(:body, nil)
60
60
  params = options.fetch(:params, {})
data/lib/s3/signature.rb CHANGED
@@ -90,7 +90,7 @@ module S3
90
90
  resource = options[:resource]
91
91
  access_key = options[:access_key]
92
92
  expires = options[:expires_at].to_i
93
- host = S3::HOST
93
+ host = S3.host
94
94
 
95
95
  if options[:add_bucket_to_host]
96
96
  host = bucket + '.' + host
@@ -227,7 +227,7 @@ module S3
227
227
  # requests that don't address a bucket, do nothing. For more
228
228
  # information on virtual hosted-style requests, see Virtual
229
229
  # Hosting of Buckets.
230
- bucket_name = host.sub(/\.?#{S3::HOST}\Z/, "")
230
+ bucket_name = host.sub(/\.?#{S3.host}\Z/, "")
231
231
  string << "/#{bucket_name}" unless bucket_name.empty?
232
232
 
233
233
  # 3. Append the path part of the un-decoded HTTP Request-URI,
data/lib/s3/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module S3
2
- VERSION = "0.3.24"
2
+ VERSION = "0.3.25"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.24
4
+ version: 0.3.25
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: 2016-01-22 00:00:00.000000000 Z
11
+ date: 2016-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: proxies
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  version: 1.3.6
135
135
  requirements: []
136
136
  rubyforge_project: s3
137
- rubygems_version: 2.4.5
137
+ rubygems_version: 2.5.1
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Library for accessing S3 objects and buckets