aws-s3 0.6.2 → 0.6.3

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.
data/README CHANGED
@@ -195,10 +195,10 @@ You can change the content type as well if you like:
195
195
  song.content_type = 'application/pdf'
196
196
  song.store
197
197
 
198
- (Keep in mind that due to limitiations in S3's exposed API, the only way to change things like the content_type
198
+ (Keep in mind that due to limitations in S3's exposed API, the only way to change things like the content_type
199
199
  is to PUT the object onto S3 again. In the case of large files, this will result in fully re-uploading the file.)
200
200
 
201
- A bevie of information about an object can be had using the <tt>about</tt> method:
201
+ A bevy of information about an object can be had using the <tt>about</tt> method:
202
202
 
203
203
  pp song.about
204
204
  {"last-modified" => "Sat, 28 Oct 2006 21:29:26 GMT",
@@ -531,7 +531,7 @@ You could use this information to redisplay the error in a way you see fit, or j
531
531
  ==== Accessing the last request's response
532
532
 
533
533
  Sometimes methods that make requests to the S3 servers return some object, like a Bucket or an S3Object.
534
- Othertimes they return just <tt>true</tt>. Other times they raise an exception that you may want to rescue. Despite all these
534
+ Other times they return just <tt>true</tt>. Other times they raise an exception that you may want to rescue. Despite all these
535
535
  possible outcomes, every method that makes a request stores its response object for you in Service.response. You can always
536
536
  get to the last request's response via Service.response.
537
537
 
@@ -63,7 +63,7 @@ module AWS
63
63
  path = self.class.prepare_path(path)
64
64
  request = request_method(:get).new(path, {})
65
65
  query_string = query_string_authentication(request, options)
66
- returning "#{protocol(options)}#{http.address}#{port_string}#{path}" do |url|
66
+ "#{protocol(options)}#{http.address}#{port_string}#{path}".tap do |url|
67
67
  url << "?#{query_string}" if authenticate
68
68
  end
69
69
  end
@@ -1,3 +1,4 @@
1
+ #encoding: BINARY
1
2
  #:stopdoc:
2
3
 
3
4
  class Hash
@@ -38,6 +39,11 @@ class String
38
39
  end
39
40
  end
40
41
 
42
+ def tap
43
+ yield(self)
44
+ self
45
+ end unless ''.respond_to?(:tap)
46
+
41
47
  def previous
42
48
  dup.previous!
43
49
  end
@@ -75,10 +75,10 @@ module AWS
75
75
  # song.content_type = 'application/pdf'
76
76
  # song.store
77
77
  #
78
- # (Keep in mind that due to limitiations in S3's exposed API, the only way to change things like the content_type
78
+ # (Keep in mind that due to limitations in S3's exposed API, the only way to change things like the content_type
79
79
  # is to PUT the object onto S3 again. In the case of large files, this will result in fully re-uploading the file.)
80
80
  #
81
- # A bevie of information about an object can be had using the <tt>about</tt> method:
81
+ # A bevy of information about an object can be had using the <tt>about</tt> method:
82
82
  #
83
83
  # pp song.about
84
84
  # {"last-modified" => "Sat, 28 Oct 2006 21:29:26 GMT",
@@ -184,7 +184,7 @@ module AWS
184
184
  source_key = path!(bucket, key)
185
185
  default_options = {'x-amz-copy-source' => source_key}
186
186
  target_key = path!(bucket, copy_key)
187
- returning put(target_key, default_options) do
187
+ returning put(target_key, default_options.merge(options)) do
188
188
  acl(copy_key, bucket, acl(key, bucket)) if options[:copy_acl]
189
189
  end
190
190
  end
@@ -28,7 +28,7 @@ module AWS
28
28
  memoized :buckets
29
29
 
30
30
  # Sometimes methods that make requests to the S3 servers return some object, like a Bucket or an S3Object.
31
- # Othertimes they return just <tt>true</tt>. Other times they raise an exception that you may want to rescue. Despite all these
31
+ # Other times they return just <tt>true</tt>. Other times they raise an exception that you may want to rescue. Despite all these
32
32
  # possible outcomes, every method that makes a request stores its response object for you in Service.response. You can always
33
33
  # get to the last request's response via Service.response.
34
34
  #
@@ -48,4 +48,4 @@ module AWS
48
48
  end
49
49
  end
50
50
  end
51
- end
51
+ end
@@ -3,8 +3,8 @@ module AWS
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = '0'
5
5
  MINOR = '6'
6
- TINY = '2'
7
- BETA = nil #Time.now.to_i.to_s
6
+ TINY = '3'
7
+ BETA = nil # Time.now.to_i.to_s
8
8
  end
9
9
 
10
10
  Version = [VERSION::MAJOR, VERSION::MINOR, VERSION::TINY, VERSION::BETA].compact * '.'
@@ -74,6 +74,11 @@ class StringExtensionsTest < Test::Unit::TestCase
74
74
  assert "318597/620065/GTL_75\24300_A600_A610.zip".remove_extended.valid_utf8?
75
75
  assert "318597/620065/GTL_75£00_A600_A610.zip".remove_extended.valid_utf8?
76
76
  end
77
+
78
+ def test_tap
79
+ assert_equal("http://google.com/foo/", "http://google.com".tap {|url| url << "/foo/" })
80
+ end
81
+
77
82
  end
78
83
 
79
84
  class CoercibleStringTest < Test::Unit::TestCase
@@ -148,6 +148,21 @@ class ObjectTest < Test::Unit::TestCase
148
148
  S3Object.about('asdfasdfasdfas-this-does-not-exist', 'bucket does not matter')
149
149
  end
150
150
  end
151
+ def test_copy_options_are_used
152
+ options = {'x-amz-storage-class' => 'REDUCED_REDUNDANCY'}
153
+ resp = FakeResponse.new
154
+
155
+ connection = flexmock('Mock connection') do |mock|
156
+ mock.should_receive(:request).
157
+ # The storage-class key must be passed to connection.request(:put, ...)
158
+ with(:put, '/some-bucket/new', hsh(options), any, any).
159
+ and_return(resp)
160
+ end
161
+ flexmock(S3Object).should_receive(:connection).and_return(connection)
162
+
163
+ result = S3Object.copy('old', 'new', 'some-bucket', options)
164
+ assert_equal resp.code, result.code
165
+ end
151
166
  end
152
167
 
153
168
  class MetadataTest < Test::Unit::TestCase
@@ -65,7 +65,7 @@ class RemoteACLTest < Test::Unit::TestCase
65
65
  new_grant = ACL::Grant.new
66
66
  new_grant.permission = 'READ'
67
67
  new_grant_grantee = ACL::Grantee.new
68
- new_grant_grantee.email_address = 'marcel@vernix.org'
68
+ new_grant_grantee.email_address = [['amazon', 'marcelmolina'].join('@'), 'com'].join('.')
69
69
  new_grant.grantee = new_grant_grantee
70
70
  acl.grants << new_grant
71
71
 
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ hash: 1
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 3
10
+ version: 0.6.3
5
11
  platform: ruby
6
12
  authors:
7
13
  - Marcel Molina Jr.
@@ -9,39 +15,51 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-04-28 00:00:00 -07:00
18
+ date: 2012-05-29 00:00:00 -07:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: xml-simple
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
23
32
  version: "0"
24
- version:
33
+ type: :runtime
34
+ version_requirements: *id001
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: builder
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
30
40
  requirements:
31
41
  - - ">="
32
42
  - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
33
46
  version: "0"
34
- version:
47
+ type: :runtime
48
+ version_requirements: *id002
35
49
  - !ruby/object:Gem::Dependency
36
50
  name: mime-types
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
40
54
  requirements:
41
55
  - - ">="
42
56
  - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
43
60
  version: "0"
44
- version:
61
+ type: :runtime
62
+ version_requirements: *id003
45
63
  description: Client library for Amazon's Simple Storage Service's REST API
46
64
  email: marcel@vernix.org
47
65
  executables:
@@ -78,6 +96,35 @@ files:
78
96
  - support/faster-xml-simple/test/test_helper.rb
79
97
  - support/faster-xml-simple/test/xml_simple_comparison_test.rb
80
98
  - support/rdoc/code_info.rb
99
+ - test/acl_test.rb
100
+ - test/authentication_test.rb
101
+ - test/base_test.rb
102
+ - test/bucket_test.rb
103
+ - test/connection_test.rb
104
+ - test/error_test.rb
105
+ - test/extensions_test.rb
106
+ - test/fixtures/buckets.yml
107
+ - test/fixtures/errors.yml
108
+ - test/fixtures/headers.yml
109
+ - test/fixtures/logging.yml
110
+ - test/fixtures/loglines.yml
111
+ - test/fixtures/logs.yml
112
+ - test/fixtures/policies.yml
113
+ - test/fixtures.rb
114
+ - test/logging_test.rb
115
+ - test/mocks/fake_response.rb
116
+ - test/object_test.rb
117
+ - test/parsing_test.rb
118
+ - test/remote/acl_test.rb
119
+ - test/remote/bittorrent_test.rb
120
+ - test/remote/bucket_test.rb
121
+ - test/remote/logging_test.rb
122
+ - test/remote/object_test.rb
123
+ - test/remote/test_file.data
124
+ - test/remote/test_helper.rb
125
+ - test/response_test.rb
126
+ - test/service_test.rb
127
+ - test/test_helper.rb
81
128
  - README
82
129
  - COPYING
83
130
  - INSTALL
@@ -96,21 +143,27 @@ rdoc_options:
96
143
  require_paths:
97
144
  - lib
98
145
  required_ruby_version: !ruby/object:Gem::Requirement
146
+ none: false
99
147
  requirements:
100
148
  - - ">="
101
149
  - !ruby/object:Gem::Version
150
+ hash: 3
151
+ segments:
152
+ - 0
102
153
  version: "0"
103
- version:
104
154
  required_rubygems_version: !ruby/object:Gem::Requirement
155
+ none: false
105
156
  requirements:
106
157
  - - ">="
107
158
  - !ruby/object:Gem::Version
159
+ hash: 3
160
+ segments:
161
+ - 0
108
162
  version: "0"
109
- version:
110
163
  requirements: []
111
164
 
112
165
  rubyforge_project: amazon
113
- rubygems_version: 1.3.2
166
+ rubygems_version: 1.5.0
114
167
  signing_key:
115
168
  specification_version: 3
116
169
  summary: Client library for Amazon's Simple Storage Service's REST API