codders-aws-s3 0.6.2 → 0.6.2.1331721623
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 +1 -1
- data/lib/aws/s3/authentication.rb +2 -2
- data/lib/aws/s3/object.rb +1 -1
- data/lib/aws/s3/version.rb +1 -1
- data/test/authentication_test.rb +7 -0
- data/test/object_test.rb +15 -0
- metadata +6 -5
data/README
CHANGED
@@ -72,7 +72,7 @@ Assuming the name you chose isn't already taken, your new bucket will now appear
|
|
72
72
|
Service.buckets
|
73
73
|
# => [#<AWS::S3::Bucket @attributes={"name"=>"jukebox"}>]
|
74
74
|
|
75
|
-
Once you have succesfully created a bucket you can
|
75
|
+
Once you have succesfully created a bucket you can fetch it by name using Bucket.find.
|
76
76
|
|
77
77
|
music_bucket = Bucket.find('jukebox')
|
78
78
|
|
@@ -82,7 +82,7 @@ module AWS
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def date
|
85
|
-
request['date'].to_s.strip.empty? ? Time.now : Time.parse(request['date'])
|
85
|
+
@date ||= request['date'].to_s.strip.empty? ? Time.now : Time.parse(request['date'])
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -218,4 +218,4 @@ module AWS
|
|
218
218
|
end
|
219
219
|
end
|
220
220
|
end
|
221
|
-
end
|
221
|
+
end
|
data/lib/aws/s3/object.rb
CHANGED
@@ -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
|
data/lib/aws/s3/version.rb
CHANGED
data/test/authentication_test.rb
CHANGED
@@ -49,6 +49,13 @@ class QueryStringAuthenticationTest < Test::Unit::TestCase
|
|
49
49
|
query_string = Authentication::QueryString.new(request, key_id, secret, :expires_in => integer_proxy.new(actual_integer))
|
50
50
|
assert_equal actual_integer, query_string.send(:expires_in)
|
51
51
|
end
|
52
|
+
|
53
|
+
def test_ensure_time_is_only_evaluated_once
|
54
|
+
time = Time.now
|
55
|
+
flexmock(Time).should_receive(:now).once.and_return(time)
|
56
|
+
query_string = Authentication::QueryString.new(request, key_id, secret, :expires_in => 60)
|
57
|
+
assert_equal AmazonDocExampleData::Example3.query_string, query_string
|
58
|
+
end
|
52
59
|
|
53
60
|
private
|
54
61
|
def request; AmazonDocExampleData::Example3.request end
|
data/test/object_test.rb
CHANGED
@@ -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
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codders-aws-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 2663443289
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
9
|
- 2
|
10
|
-
|
10
|
+
- 1331721623
|
11
|
+
version: 0.6.2.1331721623
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Marcel Molina Jr.
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date:
|
19
|
+
date: 2012-03-14 00:00:00 +01:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
@@ -163,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
164
|
requirements: []
|
164
165
|
|
165
166
|
rubyforge_project: amazon
|
166
|
-
rubygems_version: 1.
|
167
|
+
rubygems_version: 1.3.7
|
167
168
|
signing_key:
|
168
169
|
specification_version: 3
|
169
170
|
summary: Client library for Amazon's Simple Storage Service's REST API
|