Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
marcel/aws-s3
codders/aws-s3
Bill/aws-s3
Epictetus/aws-s3
Foodspotting/aws-s3
Groupsite/aws-s3
GunioRobot/aws-s3
JezC/aws-s3
JulianoCristian/aws-s3
KarlHerler/aws-s3
PRX/aws-s3
acco/aws-s3
activenetwork/aws-s3
afcapel/aws-s3
aguilarsoto/aws-s3
agworld/aws-s3
alex-knaub/aws-s3
alexhanh/aws-s3
atomicobject/aws-s3
averyj/aws-s3
avocadostore/aws-s3
baloney/aws-s3
bantic/aws-s3
bartoszkopinski/aws-s3
basecamp/aws-s3
bastien/aws-s3
batizhevsky/aws-s3
bloopletech/aws-s3
bookis/aws-s3
bryanwoods/aws-s3
btm/aws-s3
buffym/aws-s3
cannikin/aws-s3
cbjayshao/aliyun-oss-sdk-for-ruby
chaupt/aws-s3
chebyte/aws-s3
chef/aws-s3
chrisumbel/aws-s3
ckdake/aws-s3
cmaion/aws-s3
colin/aws-s3
coupa/aws-s3
crowdint/aws-s3
crystalneth/aws-s3
culturecode/aws-s3
cyruscavalcante/aws-s3
cyx/aws-s3
danielb2/aws-s3
darkslategrey/aws-s3
dbourguignon/aws-s3
dctanner/aws-s3
densitypop/jaf-s3
dfl/aws-s3
dgilperez/aws-s3
dgottesman/aws-s3
dileeppdkr/aws-s3
djtek/aws-s3
dougal/aws-s3
drakerlabs/aws-s3
dsboulder/aws-s3
dudeman/aws-s3
duecorda/aws-s3
duonoid/aws-s3
dvberkel/aws-s3
dvdplm/aws-s3
earbits/aws-s3
ebertech/aws-s3
edenspiekermann/aws-s3
efrendiaz/aws-s3
eisokant/aws-s3
ekoontz/aws-s3
elia/aws-s3
emk/aws-s3
engineyard/aws-s3
eric/aws-s3
fetlife/aws-s3
fmalamitsas/aws-s3
fotomoto/aws-s3
ftopia/aws-s3
fxtentacle/aws-s3
gaelian/aws-s3
gentoo/aws-s3
github/aws-s3
glebpom/aws-s3
gtd/aws-s3
gulbrand/aws-s3
haifeng/aws-s3
haruska/aws-s3
hltbra/aws-s3
ilpoldo/aws-s3
indabamusic/aws-s3
jacobdam/aws-s3
jacqui/aws-s3
jakimowicz/aws-s3
jamiepg1/aws-s3
jasherai/aws-s3
jeffplang/aws-s3
jgre/aws-s3
jiangwenhan/aws-s3
jjb/aws-s3
jkrall/aws-s3
jmoses/aws-s3
jobandtalent/aws-s3
johnschult/aws-s3
jonphillips/aws-s3
jseibert/aws-s3
jtushman/aws-s3
jwagener/aws-s3
jwarchol/aws-s3
jwinter/aws-s3
karmajunkie/aws-s3
kbaum/aws-s3
kewe/aws-s3
kindkid/aws-s3
klarrimore/aws-s3
kpumuk/aws-s3
lantrix/aws-s3
leejones/aws-s3
lmaister/aws-s3
lmarburger/aws-s3
loe/aws-s3
lucasuyezu/aws-s3
lukfugl/aws-s3
mangege/aliyun-oss-sdk-for-ruby
markan/aws-s3
marklazz/aws-s3
mattjamieson/aws-s3
mattmacleod/aws-s3
mattscilipoti/aws-s3
maykelrr/aws-s3
mcary/aws-s3
mcrowe/aws-s3
metasoarous/aws-s3
michaeldwan/aws-s3
mlins/aws-s3
monicao/aws-s3
mza/aws-s3
neshmi/aws-s3
nhemsley/aws-s3
nicholaides/aws-s3
officedrop/aws-s3
onehub/aws-s3
ooleem/aws-s3
orangewise/aws-s3
osallou/aws-s3
packagethief/aws-s3
paperlesspost/aws-s3
pascallouisperez/aws-s3
pivotal-creationmix/aws-s3
pkieltyka/aws-s3
prabode/aws-s3
pschuegr/aws-s3
pyrat/aws-s3
quirkyinc/aws-s3
r2practice/aws-s3
redbubble/aws-s3
reillyse/aws-s3
robertoles/aws-s3
rolandoam/aws-s3
rottmanj/aws-s3
ryanong/aws-s3
samlown/aws-s3
sauberia/aws-s3
scottjacobsen/aws-s3
sdelano/aws-s3
seanhess/aws-s3
seifertd/aws-s3
skarayan/aws-s3
skarmakar/aws-s3
slaskis/aws-s3
smartlogic/aws-s3
spatten/aws-s3
spcrafts/aws-s3
square/aws-s3
stevequinlan/aws-s3
suratpyari/aws-s3
syncrou/aws-s3
teejayvanslyke/aws-s3
tekin/aws-s3
the-guitarman/aws-s3
theanswer42/aws-s3
thomasjoyce/aws-s3
ticketevolution/aws-s3
tinygrasshopper/aws-s3
tribesports/aws-s3
turingstudio/aws-s3
twg/aws-s3
valakirka/aws-s3
venkiwhite/aws-s3
vinbarnes/aws-s3
vladr/aws-s3
whittle/aws-s3
winton/aws-s3
wiseleyb/aws-s3
woodbridge/aws-s3
worst/aws-s3
yevgeny/aws-s3
ys/aws-s3
zach/gsr
zeevex/aws-s3
Nothing to show
Choose a base branch
Nothing to show
...
Choose a Head Repository
marcel/aws-s3
codders/aws-s3
Bill/aws-s3
Epictetus/aws-s3
Foodspotting/aws-s3
Groupsite/aws-s3
GunioRobot/aws-s3
JezC/aws-s3
JulianoCristian/aws-s3
KarlHerler/aws-s3
PRX/aws-s3
acco/aws-s3
activenetwork/aws-s3
afcapel/aws-s3
aguilarsoto/aws-s3
agworld/aws-s3
alex-knaub/aws-s3
alexhanh/aws-s3
atomicobject/aws-s3
averyj/aws-s3
avocadostore/aws-s3
baloney/aws-s3
bantic/aws-s3
bartoszkopinski/aws-s3
basecamp/aws-s3
bastien/aws-s3
batizhevsky/aws-s3
bloopletech/aws-s3
bookis/aws-s3
bryanwoods/aws-s3
btm/aws-s3
buffym/aws-s3
cannikin/aws-s3
cbjayshao/aliyun-oss-sdk-for-ruby
chaupt/aws-s3
chebyte/aws-s3
chef/aws-s3
chrisumbel/aws-s3
ckdake/aws-s3
cmaion/aws-s3
colin/aws-s3
coupa/aws-s3
crowdint/aws-s3
crystalneth/aws-s3
culturecode/aws-s3
cyruscavalcante/aws-s3
cyx/aws-s3
danielb2/aws-s3
darkslategrey/aws-s3
dbourguignon/aws-s3
dctanner/aws-s3
densitypop/jaf-s3
dfl/aws-s3
dgilperez/aws-s3
dgottesman/aws-s3
dileeppdkr/aws-s3
djtek/aws-s3
dougal/aws-s3
drakerlabs/aws-s3
dsboulder/aws-s3
dudeman/aws-s3
duecorda/aws-s3
duonoid/aws-s3
dvberkel/aws-s3
dvdplm/aws-s3
earbits/aws-s3
ebertech/aws-s3
edenspiekermann/aws-s3
efrendiaz/aws-s3
eisokant/aws-s3
ekoontz/aws-s3
elia/aws-s3
emk/aws-s3
engineyard/aws-s3
eric/aws-s3
fetlife/aws-s3
fmalamitsas/aws-s3
fotomoto/aws-s3
ftopia/aws-s3
fxtentacle/aws-s3
gaelian/aws-s3
gentoo/aws-s3
github/aws-s3
glebpom/aws-s3
gtd/aws-s3
gulbrand/aws-s3
haifeng/aws-s3
haruska/aws-s3
hltbra/aws-s3
ilpoldo/aws-s3
indabamusic/aws-s3
jacobdam/aws-s3
jacqui/aws-s3
jakimowicz/aws-s3
jamiepg1/aws-s3
jasherai/aws-s3
jeffplang/aws-s3
jgre/aws-s3
jiangwenhan/aws-s3
jjb/aws-s3
jkrall/aws-s3
jmoses/aws-s3
jobandtalent/aws-s3
johnschult/aws-s3
jonphillips/aws-s3
jseibert/aws-s3
jtushman/aws-s3
jwagener/aws-s3
jwarchol/aws-s3
jwinter/aws-s3
karmajunkie/aws-s3
kbaum/aws-s3
kewe/aws-s3
kindkid/aws-s3
klarrimore/aws-s3
kpumuk/aws-s3
lantrix/aws-s3
leejones/aws-s3
lmaister/aws-s3
lmarburger/aws-s3
loe/aws-s3
lucasuyezu/aws-s3
lukfugl/aws-s3
mangege/aliyun-oss-sdk-for-ruby
markan/aws-s3
marklazz/aws-s3
mattjamieson/aws-s3
mattmacleod/aws-s3
mattscilipoti/aws-s3
maykelrr/aws-s3
mcary/aws-s3
mcrowe/aws-s3
metasoarous/aws-s3
michaeldwan/aws-s3
mlins/aws-s3
monicao/aws-s3
mza/aws-s3
neshmi/aws-s3
nhemsley/aws-s3
nicholaides/aws-s3
officedrop/aws-s3
onehub/aws-s3
ooleem/aws-s3
orangewise/aws-s3
osallou/aws-s3
packagethief/aws-s3
paperlesspost/aws-s3
pascallouisperez/aws-s3
pivotal-creationmix/aws-s3
pkieltyka/aws-s3
prabode/aws-s3
pschuegr/aws-s3
pyrat/aws-s3
quirkyinc/aws-s3
r2practice/aws-s3
redbubble/aws-s3
reillyse/aws-s3
robertoles/aws-s3
rolandoam/aws-s3
rottmanj/aws-s3
ryanong/aws-s3
samlown/aws-s3
sauberia/aws-s3
scottjacobsen/aws-s3
sdelano/aws-s3
seanhess/aws-s3
seifertd/aws-s3
skarayan/aws-s3
skarmakar/aws-s3
slaskis/aws-s3
smartlogic/aws-s3
spatten/aws-s3
spcrafts/aws-s3
square/aws-s3
stevequinlan/aws-s3
suratpyari/aws-s3
syncrou/aws-s3
teejayvanslyke/aws-s3
tekin/aws-s3
the-guitarman/aws-s3
theanswer42/aws-s3
thomasjoyce/aws-s3
ticketevolution/aws-s3
tinygrasshopper/aws-s3
tribesports/aws-s3
turingstudio/aws-s3
twg/aws-s3
valakirka/aws-s3
venkiwhite/aws-s3
vinbarnes/aws-s3
vladr/aws-s3
whittle/aws-s3
winton/aws-s3
wiseleyb/aws-s3
woodbridge/aws-s3
worst/aws-s3
yevgeny/aws-s3
ys/aws-s3
zach/gsr
zeevex/aws-s3
Nothing to show
Choose a head branch
Nothing to show
  • 6 commits
  • 8 files changed
  • 0 commit comments
  • 4 contributors
Commits on Nov 09, 2011
Marcel M. Cary
Marcel M. Cary
Use the options passed to S3Object.copy, supporting reduced redundancy
I need to enable reduced redundancy on some existing S3 objects.
The typical way to do this is copy the object within S3, supplying the
new storage-class (reduced redundancy) as an option to the copy.
However, aws-s3 is ignoring the copy options, instead only using the
default_options to specify the copy-source.

Update the copy method to merge the copy-source options with the passed
options, so that storage-class can be specified.
Merge pull request #44 from mcary/use-copy-options
Merge in options passed to S3Object.copy.
Commits on Dec 26, 2011
Commits on Jan 12, 2012
Commits on Mar 14, 2012
View
2 README
@@ -72,7 +72,7 @@ Assuming the name you chose isn't already taken, your new bucket will now appear
Service.buckets
# => [#<AWS::S3::Bucket @attributes={"name"=>"jukebox"}>]
-Once you have succesfully created a bucket you can you can fetch it by name using Bucket.find.
+Once you have succesfully created a bucket you can fetch it by name using Bucket.find.
music_bucket = Bucket.find('jukebox')
@@ -82,7 +82,8 @@ def expires?
end
def date
- request['date'].to_s.strip.empty? ? Time.now : Time.parse(request['date'])
+ return @date if @date
+ @date = request['date'].to_s.strip.empty? ? Time.now : Time.parse(request['date'])
end
end
@@ -218,4 +219,4 @@ def only_path
end
end
end
-end
+end
View
@@ -58,10 +58,11 @@ def request(verb, path, headers = {}, body = nil, attempts = 0, &block)
def url_for(path, options = {})
authenticate = options.delete(:authenticated)
+ verb = options.delete(:method) || :get
# Default to true unless explicitly false
authenticate = true if authenticate.nil?
path = self.class.prepare_path(path)
- request = request_method(:get).new(path, {})
+ request = request_method(verb).new(path, {})
query_string = query_string_authentication(request, options)
returning "#{protocol(options)}#{http.address}#{port_string}#{path}" do |url|
url << "?#{query_string}" if authenticate
@@ -275,4 +276,4 @@ def validate(options)
end
end
end
-end
+end
View
@@ -184,7 +184,7 @@ def copy(key, copy_key, bucket = nil, options = {})
source_key = path!(bucket, key)
default_options = {'x-amz-copy-source' => source_key}
target_key = path!(bucket, copy_key)
- returning put(target_key, default_options) do
+ returning put(target_key, default_options.merge(options)) do
acl(copy_key, bucket, acl(key, bucket)) if options[:copy_acl]
end
end
@@ -31,7 +31,7 @@ def test_query_string_with_explicit_expiry
assert_equal expires, query_string.send(:canonical_string).instance_variable_get(:@options)[:expires]
assert_equal AmazonDocExampleData::Example3.query_string, query_string
end
-
+
def test_expires_in_is_coerced_to_being_an_integer_in_case_it_is_a_special_integer_proxy
# References bug: http://rubyforge.org/tracker/index.php?func=detail&aid=17458&group_id=2409&atid=9356
integer_proxy = Class.new do
@@ -49,6 +49,13 @@ def to_int
query_string = Authentication::QueryString.new(request, key_id, secret, :expires_in => integer_proxy.new(actual_integer))
assert_equal actual_integer, query_string.send(:expires_in)
end
+
+ def test_ensure_time_is_only_evaluated_once
+ time = Time.now
+ flexmock(Time).should_receive(:now).once.and_return(time)
+ query_string = Authentication::QueryString.new(request, key_id, secret, :expires_in => 60)
+ assert_equal AmazonDocExampleData::Example3.query_string, query_string
+ end
private
def request; AmazonDocExampleData::Example3.request end
@@ -57,6 +64,28 @@ def secret ; AmazonDocExampleData::Example3.secret_access_key end
def expires; AmazonDocExampleData::Example3.expires end
end
+class HeadMethodTest < Test::Unit::TestCase
+
+ def test_authorization_header
+ header = Authentication::Header.new(request, key_id, secret)
+ assert_equal ExampleData::Example1.canonical_string_header, header.send(:canonical_string)
+ assert_equal ExampleData::Example1.authorization_header, header
+ end
+
+ def test_query_string
+ query_string = Authentication::QueryString.new(request, key_id, secret, :expires_in => 60)
+ assert_equal ExampleData::Example1.canonical_string_query, query_string.send(:canonical_string)
+ assert_equal ExampleData::Example1.query_string, query_string
+ end
+
+ private
+ def request; ExampleData::Example1.request end
+ def key_id ; ExampleData::Example1.access_key_id end
+ def secret ; ExampleData::Example1.secret_access_key end
+ def expires; ExampleData::Example1.expires end
+
+end
+
class CanonicalStringTest < Test::Unit::TestCase
def setup
@request = Net::HTTP::Post.new('/test')
@@ -111,4 +140,4 @@ def test_canonical_string
request = AmazonDocExampleData::Example1.request
assert_equal AmazonDocExampleData::Example1.canonical_string, Authentication::CanonicalString.new(request)
end
-end
+end
View
@@ -102,6 +102,11 @@ def test_url_for_with_and_without_authenticated_urls
assert authenticated[connection.url_for('/foo', :authenticated => true)]
assert !authenticated[connection.url_for('/foo', :authenticated => false)]
end
+
+ def test_signing_method_override
+ connection = Connection.new(:access_key_id => '123', :secret_access_key => 'abc', :server => 'example.org')
+ assert connection.url_for('/foo') != connection.url_for('/foo', :method => :head)
+ end
def test_connecting_through_a_proxy
connection = nil
View
@@ -148,6 +148,21 @@ def test_fetching_information_about_an_object_that_does_not_exist_raises_no_such
S3Object.about('asdfasdfasdfas-this-does-not-exist', 'bucket does not matter')
end
end
+ def test_copy_options_are_used
+ options = {'x-amz-storage-class' => 'REDUCED_REDUNDANCY'}
+ resp = FakeResponse.new
+
+ connection = flexmock('Mock connection') do |mock|
+ mock.should_receive(:request).
+ # The storage-class key must be passed to connection.request(:put, ...)
+ with(:put, '/some-bucket/new', hsh(options), any, any).
+ and_return(resp)
+ end
+ flexmock(S3Object).should_receive(:connection).and_return(connection)
+
+ result = S3Object.copy('old', 'new', 'some-bucket', options)
+ assert_equal resp.code, result.code
+ end
end
class MetadataTest < Test::Unit::TestCase
View
@@ -11,6 +11,48 @@
require_library_or_gem 'flexmock/test_unit'
+module ExampleData
+ module Example1
+ module_function
+
+ def request
+ request = Net::HTTP::Head.new('/quotes/nelson')
+ request['Content-Type'] = 'text/html'
+ request['Date'] = 'Thu, 17 Nov 2005 18:49:58 GMT'
+ request['X-Amz-Magic'] = 'abracadabra'
+ request
+ end
+
+ def canonical_string_query
+ "HEAD\n\ntext/html\n1132253458\nx-amz-magic:abracadabra\n/quotes/nelson"
+ end
+
+ def canonical_string_header
+ "HEAD\n\ntext/html\nThu, 17 Nov 2005 18:49:58 GMT\nx-amz-magic:abracadabra\n/quotes/nelson"
+ end
+
+ def access_key_id
+ '44CF9590006BF252F707'
+ end
+
+ def secret_access_key
+ 'OtxrzxIsfpFjA7SwPzILwy8Bw21TLhquhboDYROV'
+ end
+
+ def signature
+ 'jZNOcbfWmD/A/f3hSvVzXZjM2HU='
+ end
+
+ def query_string
+ 'AWSAccessKeyId=44CF9590006BF252F707&Expires=1132253458&Signature=mfm9VGIfnfKc20fYJAaYSuYXPpk%3D'
+ end
+
+ def authorization_header
+ 'AWS 44CF9590006BF252F707:hDwh8uo1zH9XTfSQKiyw4j9QyXs='
+ end
+ end
+end
+
# Data copied from http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAuthentication.html
module AmazonDocExampleData
module Example1
@@ -107,4 +149,4 @@ def mock_connection_for(klass, options = {})
flexmock(klass).should_receive(:connection).and_return(connection)
end
-end
+end

No commit comments for this range