aws-s3-instructure 0.6.2.1319222580

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/COPYING +19 -0
  2. data/INSTALL +55 -0
  3. data/README +545 -0
  4. data/Rakefile +300 -0
  5. data/bin/s3sh +6 -0
  6. data/bin/setup.rb +10 -0
  7. data/lib/aws/s3.rb +60 -0
  8. data/lib/aws/s3/acl.rb +636 -0
  9. data/lib/aws/s3/authentication.rb +266 -0
  10. data/lib/aws/s3/base.rb +240 -0
  11. data/lib/aws/s3/bittorrent.rb +58 -0
  12. data/lib/aws/s3/bucket.rb +319 -0
  13. data/lib/aws/s3/connection.rb +295 -0
  14. data/lib/aws/s3/error.rb +69 -0
  15. data/lib/aws/s3/exceptions.rb +133 -0
  16. data/lib/aws/s3/extensions.rb +356 -0
  17. data/lib/aws/s3/logging.rb +314 -0
  18. data/lib/aws/s3/object.rb +612 -0
  19. data/lib/aws/s3/owner.rb +44 -0
  20. data/lib/aws/s3/parsing.rb +99 -0
  21. data/lib/aws/s3/response.rb +180 -0
  22. data/lib/aws/s3/service.rb +51 -0
  23. data/lib/aws/s3/version.rb +12 -0
  24. data/support/faster-xml-simple/lib/faster_xml_simple.rb +187 -0
  25. data/support/faster-xml-simple/test/regression_test.rb +47 -0
  26. data/support/faster-xml-simple/test/test_helper.rb +17 -0
  27. data/support/faster-xml-simple/test/xml_simple_comparison_test.rb +46 -0
  28. data/support/rdoc/code_info.rb +211 -0
  29. data/test/acl_test.rb +254 -0
  30. data/test/authentication_test.rb +156 -0
  31. data/test/base_test.rb +136 -0
  32. data/test/bucket_test.rb +74 -0
  33. data/test/connection_test.rb +256 -0
  34. data/test/error_test.rb +70 -0
  35. data/test/extensions_test.rb +340 -0
  36. data/test/fixtures.rb +89 -0
  37. data/test/fixtures/buckets.yml +133 -0
  38. data/test/fixtures/errors.yml +34 -0
  39. data/test/fixtures/headers.yml +3 -0
  40. data/test/fixtures/logging.yml +15 -0
  41. data/test/fixtures/loglines.yml +5 -0
  42. data/test/fixtures/logs.yml +7 -0
  43. data/test/fixtures/policies.yml +16 -0
  44. data/test/logging_test.rb +89 -0
  45. data/test/mocks/fake_response.rb +26 -0
  46. data/test/object_test.rb +205 -0
  47. data/test/parsing_test.rb +66 -0
  48. data/test/remote/acl_test.rb +117 -0
  49. data/test/remote/bittorrent_test.rb +45 -0
  50. data/test/remote/bucket_test.rb +146 -0
  51. data/test/remote/logging_test.rb +82 -0
  52. data/test/remote/object_test.rb +371 -0
  53. data/test/remote/test_file.data +0 -0
  54. data/test/remote/test_helper.rb +33 -0
  55. data/test/response_test.rb +68 -0
  56. data/test/service_test.rb +23 -0
  57. data/test/test_helper.rb +110 -0
  58. metadata +198 -0
@@ -0,0 +1,23 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class ServiceTest < Test::Unit::TestCase
4
+ def test_bucket_list_with_empty_bucket_list
5
+ mock_connection_for(Service, :returns => {:body => Fixtures::Buckets.empty_bucket_list, :code => 200})
6
+ list = Service.buckets(:reload)
7
+ assert_equal [], list
8
+ end
9
+
10
+ def test_bucket_list_with_bucket_list_containing_one_bucket
11
+ mock_connection_for(Service, :returns => {:body => Fixtures::Buckets.bucket_list_with_one_bucket, :code => 200})
12
+ list = Service.buckets(:reload)
13
+ assert_equal 1, list.size
14
+ assert_equal 'marcel_molina', list.first.name
15
+ end
16
+
17
+ def test_bucket_list_with_bucket_list_containing_more_than_one_bucket
18
+ mock_connection_for(Service, :returns => {:body => Fixtures::Buckets.bucket_list_with_more_than_one_bucket, :code => 200})
19
+ list = Service.buckets(:reload)
20
+ assert_equal 2, list.size
21
+ assert_equal %w(marcel_molina marcel_molina_jr), list.map {|bucket| bucket.name}.sort
22
+ end
23
+ end
@@ -0,0 +1,110 @@
1
+ require 'test/unit'
2
+ $:.unshift File.dirname(__FILE__) + '/../lib'
3
+ require 'aws/s3'
4
+ require File.dirname(__FILE__) + '/mocks/fake_response'
5
+ require File.dirname(__FILE__) + '/fixtures'
6
+ begin
7
+ require_library_or_gem 'ruby-debug'
8
+ rescue LoadError
9
+ end
10
+ require_library_or_gem 'flexmock'
11
+ require_library_or_gem 'flexmock/test_unit'
12
+
13
+
14
+ # Data copied from http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAuthentication.html
15
+ module AmazonDocExampleData
16
+ module Example1
17
+ module_function
18
+
19
+ def request
20
+ request = Net::HTTP::Put.new('/quotes/nelson')
21
+ request['Content-Md5'] = 'c8fdb181845a4ca6b8fec737b3581d76'
22
+ request['Content-Type'] = 'text/html'
23
+ request['Date'] = 'Thu, 17 Nov 2005 18:49:58 GMT'
24
+ request['X-Amz-Meta-Author'] = 'foo@bar.com'
25
+ request['X-Amz-Magic'] = 'abracadabra'
26
+ request
27
+ end
28
+
29
+ def canonical_string
30
+ "PUT\nc8fdb181845a4ca6b8fec737b3581d76\ntext/html\nThu, 17 Nov 2005 18:49:58 GMT\nx-amz-magic:abracadabra\nx-amz-meta-author:foo@bar.com\n/quotes/nelson"
31
+ end
32
+
33
+ def access_key_id
34
+ '44CF9590006BF252F707'
35
+ end
36
+
37
+ def secret_access_key
38
+ 'OtxrzxIsfpFjA7SwPzILwy8Bw21TLhquhboDYROV'
39
+ end
40
+
41
+ def signature
42
+ 'jZNOcbfWmD/A/f3hSvVzXZjM2HU='
43
+ end
44
+
45
+ def authorization_header
46
+ 'AWS 44CF9590006BF252F707:jZNOcbfWmD/A/f3hSvVzXZjM2HU='
47
+ end
48
+ end
49
+
50
+ module Example3
51
+ module_function
52
+
53
+ def request
54
+ request = Net::HTTP::Get.new('/quotes/nelson')
55
+ request['Date'] = date
56
+ request
57
+ end
58
+
59
+ def date
60
+ 'Thu Mar 9 01:24:20 CST 2006'
61
+ end
62
+
63
+ def access_key_id
64
+ Example1.access_key_id
65
+ end
66
+
67
+ def secret_access_key
68
+ Example1.secret_access_key
69
+ end
70
+
71
+ def expires
72
+ 1141889120
73
+ end
74
+
75
+ def query_string
76
+ 'AWSAccessKeyId=44CF9590006BF252F707&Expires=1141889120&Signature=vjbyPxybdZaNmGa%2ByT272YEAiv4%3D'
77
+ end
78
+
79
+ def canonical_string
80
+ "GET\n\n\n1141889120\n/quotes/nelson"
81
+ end
82
+
83
+ end
84
+ end
85
+
86
+ class Test::Unit::TestCase
87
+ include AWS::S3
88
+
89
+ def sample_proxy_settings
90
+ {:host => 'http://google.com', :port => 8080, :user => 'marcel', :password => 'secret'}
91
+ end
92
+
93
+ def mock_connection_for(klass, options = {})
94
+ data = options[:returns]
95
+ return_values = case data
96
+ when Hash
97
+ FakeResponse.new(data)
98
+ when Array
99
+ data.map {|hash| FakeResponse.new(hash)}
100
+ else
101
+ abort "Response data for mock connection must be a Hash or an Array. Was #{data.inspect}."
102
+ end
103
+
104
+ connection = flexmock('Mock connection') do |mock|
105
+ mock.should_receive(:request).and_return(*return_values).at_least.once
106
+ end
107
+
108
+ flexmock(klass).should_receive(:connection).and_return(connection)
109
+ end
110
+ end
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aws-s3-instructure
3
+ version: !ruby/object:Gem::Version
4
+ hash: 2638445087
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 2
10
+ - 1319222580
11
+ version: 0.6.2.1319222580
12
+ platform: ruby
13
+ authors:
14
+ - Jacob Fugal
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2011-10-21 00:00:00 Z
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: xml-simple
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: builder
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: mime-types
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :runtime
62
+ version_requirements: *id003
63
+ description: Client library for Amazon's Simple Storage Service's REST API, forked by Instructure pending action on pull request https://github.com/marcel/aws-s3/pull/40
64
+ email: jacob@instructure.com
65
+ executables:
66
+ - s3sh
67
+ extensions: []
68
+
69
+ extra_rdoc_files:
70
+ - README
71
+ - COPYING
72
+ - INSTALL
73
+ files:
74
+ - Rakefile
75
+ - lib/aws/s3/acl.rb
76
+ - lib/aws/s3/authentication.rb
77
+ - lib/aws/s3/base.rb
78
+ - lib/aws/s3/bittorrent.rb
79
+ - lib/aws/s3/bucket.rb
80
+ - lib/aws/s3/connection.rb
81
+ - lib/aws/s3/error.rb
82
+ - lib/aws/s3/exceptions.rb
83
+ - lib/aws/s3/extensions.rb
84
+ - lib/aws/s3/logging.rb
85
+ - lib/aws/s3/object.rb
86
+ - lib/aws/s3/owner.rb
87
+ - lib/aws/s3/parsing.rb
88
+ - lib/aws/s3/response.rb
89
+ - lib/aws/s3/service.rb
90
+ - lib/aws/s3/version.rb
91
+ - lib/aws/s3.rb
92
+ - bin/s3sh
93
+ - bin/setup.rb
94
+ - support/faster-xml-simple/lib/faster_xml_simple.rb
95
+ - support/faster-xml-simple/test/regression_test.rb
96
+ - support/faster-xml-simple/test/test_helper.rb
97
+ - support/faster-xml-simple/test/xml_simple_comparison_test.rb
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
128
+ - README
129
+ - COPYING
130
+ - INSTALL
131
+ homepage: http://amazon.rubyforge.org
132
+ licenses: []
133
+
134
+ post_install_message:
135
+ rdoc_options:
136
+ - --title
137
+ - AWS::S3 -- Support for Amazon S3's REST api
138
+ - --main
139
+ - README
140
+ - --line-numbers
141
+ - --inline-source
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ hash: 3
150
+ segments:
151
+ - 0
152
+ version: "0"
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ hash: 3
159
+ segments:
160
+ - 0
161
+ version: "0"
162
+ requirements: []
163
+
164
+ rubyforge_project:
165
+ rubygems_version: 1.8.10
166
+ signing_key:
167
+ specification_version: 3
168
+ summary: Client library for Amazon's Simple Storage Service's REST API
169
+ test_files:
170
+ - test/acl_test.rb
171
+ - test/authentication_test.rb
172
+ - test/base_test.rb
173
+ - test/bucket_test.rb
174
+ - test/connection_test.rb
175
+ - test/error_test.rb
176
+ - test/extensions_test.rb
177
+ - test/fixtures/buckets.yml
178
+ - test/fixtures/errors.yml
179
+ - test/fixtures/headers.yml
180
+ - test/fixtures/logging.yml
181
+ - test/fixtures/loglines.yml
182
+ - test/fixtures/logs.yml
183
+ - test/fixtures/policies.yml
184
+ - test/fixtures.rb
185
+ - test/logging_test.rb
186
+ - test/mocks/fake_response.rb
187
+ - test/object_test.rb
188
+ - test/parsing_test.rb
189
+ - test/remote/acl_test.rb
190
+ - test/remote/bittorrent_test.rb
191
+ - test/remote/bucket_test.rb
192
+ - test/remote/logging_test.rb
193
+ - test/remote/object_test.rb
194
+ - test/remote/test_file.data
195
+ - test/remote/test_helper.rb
196
+ - test/response_test.rb
197
+ - test/service_test.rb
198
+ - test/test_helper.rb