has_bucket 0.0.1
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 +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.rubocop.yml +14 -0
- data/.travis.yml +3 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +49 -0
- data/Rakefile +11 -0
- data/has_bucket.gemspec +31 -0
- data/lib/has_bucket.rb +11 -0
- data/lib/has_bucket/facade.rb +49 -0
- data/lib/has_bucket/s3_config.rb +18 -0
- data/lib/has_bucket/version.rb +3 -0
- data/spec/cassettes/HasBucket/should_allow_storage_of_blobs_on_S3.yml +325 -0
- data/spec/has_bucket_spec.rb +32 -0
- data/spec/spec_helper.rb +23 -0
- metadata +190 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 83138a4f5ecc8d9daed056f4387e520f461bcd33
|
4
|
+
data.tar.gz: 6a506222d671686b6afee3c83174410625a56180
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f1a9bc6949c37af34ad46fa2c7ff065a30e320f02896f876c060c041123e6d87d427d905e792bcc3c2077ded37f1962c5cbfe8140972a22abdbdb168f7800b90
|
7
|
+
data.tar.gz: 9541bf46035dcd842ab60585b4c82471a93e47b00f9353352ceded22439a00b1fad95caccafe1568c6547afc0d58df82d169cc3472c8f2932c185adb8469aacd
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Jonathon M. Abbott
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# I Has a Bucket
|
2
|
+
|
3
|
+
[](https://travis-ci.org/JonathonMA/has_bucket)
|
4
|
+
|
5
|
+

|
6
|
+
|
7
|
+
Simple wrapper around single-bucket S3 storage.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'has_bucket'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install has_bucket
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
s3 = HasBucket.of("https://AWS_ACCESS_KEY:AWS_SECRET_ACCESS_KEY@s3.amazonaws.com/BUCKET_NAME")
|
29
|
+
|
30
|
+
s3.include?("key") # => false
|
31
|
+
s3["key"] = "value"
|
32
|
+
s3["key"] # => "value"
|
33
|
+
s3.include?("key") # => true
|
34
|
+
s3.delete("key")
|
35
|
+
s3.include?("key") # => false
|
36
|
+
s3.url_for("key") # => authenticated URL to object
|
37
|
+
```
|
38
|
+
|
39
|
+
## TODO
|
40
|
+
|
41
|
+
- [ ] select region based on hostname
|
42
|
+
|
43
|
+
## Contributing
|
44
|
+
|
45
|
+
1. Fork it ( https://github.com/JonathonMA/has_bucket/fork )
|
46
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
47
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
48
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
49
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/has_bucket.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'has_bucket/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "has_bucket"
|
8
|
+
spec.version = HasBucket::VERSION
|
9
|
+
spec.authors = ["Jonathon M. Abbott"]
|
10
|
+
spec.email = ["jonathona@everydayhero.com.au"]
|
11
|
+
spec.summary = "i has an S3 bucket"
|
12
|
+
spec.description = "Simple wrapper around single-bucket S3 storage"
|
13
|
+
spec.homepage = "https://github.com/JonathonMA/has_bucket"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "uri_config"
|
22
|
+
spec.add_runtime_dependency "s3"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.1.0"
|
27
|
+
spec.add_development_dependency "rubocop", "~> 0.27.0"
|
28
|
+
spec.add_development_dependency "vcr", "~> 2.9.3"
|
29
|
+
spec.add_development_dependency "webmock", "~> 1.20.3"
|
30
|
+
spec.add_development_dependency "timecop"
|
31
|
+
end
|
data/lib/has_bucket.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require "cgi"
|
2
|
+
require "uri"
|
3
|
+
require "s3"
|
4
|
+
|
5
|
+
module HasBucket
|
6
|
+
class Facade
|
7
|
+
def initialize(service, bucket_name)
|
8
|
+
@service = service
|
9
|
+
@bucket_name = bucket_name
|
10
|
+
end
|
11
|
+
|
12
|
+
def include?(key)
|
13
|
+
object(key).exists?
|
14
|
+
end
|
15
|
+
|
16
|
+
def []=(key, content)
|
17
|
+
s3_object = object(key)
|
18
|
+
s3_object.acl = "private"
|
19
|
+
s3_object.content = content
|
20
|
+
s3_object.save
|
21
|
+
end
|
22
|
+
|
23
|
+
def [](key)
|
24
|
+
object(key).content
|
25
|
+
end
|
26
|
+
|
27
|
+
def url_for(key, expiring_at = Time.now + 3600)
|
28
|
+
object(key).temporary_url(expiring_at)
|
29
|
+
end
|
30
|
+
|
31
|
+
def public_url_for(key)
|
32
|
+
object(key).url
|
33
|
+
end
|
34
|
+
|
35
|
+
def delete(key)
|
36
|
+
object(key).destroy
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def object(key)
|
42
|
+
bucket.object(key)
|
43
|
+
end
|
44
|
+
|
45
|
+
def bucket
|
46
|
+
@service.bucket(@bucket_name)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "uri_config"
|
2
|
+
|
3
|
+
module HasBucket
|
4
|
+
class S3Config < URIConfig::Config
|
5
|
+
alias_method :access_key_id, :username
|
6
|
+
alias_method :secret_access_key, :password
|
7
|
+
|
8
|
+
def bucket
|
9
|
+
path[1..-1]
|
10
|
+
end
|
11
|
+
|
12
|
+
def use_ssl
|
13
|
+
uri.scheme == "https"
|
14
|
+
end
|
15
|
+
|
16
|
+
config :access_key_id, :secret_access_key, :use_ssl
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,325 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: https://s3.amazonaws.com/jma-2014-test-bucket/foo
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Date:
|
17
|
+
- Thu, 06 Nov 2014 03:38:12 GMT
|
18
|
+
Authorization:
|
19
|
+
- AWS AKIAICVNTIM4AWNLWR4Q:IbIaMIAkkRsrn0r9Dk4N2ouSfsY=
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 204
|
23
|
+
message: No Content
|
24
|
+
headers:
|
25
|
+
X-Amz-Id-2:
|
26
|
+
- 1o0ybnBTdj9kQ9/4i4yK1WcaZFfwgOYpPGswyyKIs6ZPI7ukzsu62WKxyTX49mY5
|
27
|
+
X-Amz-Request-Id:
|
28
|
+
- CC398B07233982D5
|
29
|
+
Date:
|
30
|
+
- Thu, 06 Nov 2014 03:36:32 GMT
|
31
|
+
Server:
|
32
|
+
- AmazonS3
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: ''
|
36
|
+
http_version:
|
37
|
+
recorded_at: Thu, 06 Nov 2014 03:38:12 GMT
|
38
|
+
- request:
|
39
|
+
method: head
|
40
|
+
uri: https://s3.amazonaws.com/jma-2014-test-bucket/foo
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: ''
|
44
|
+
headers:
|
45
|
+
Accept:
|
46
|
+
- "*/*"
|
47
|
+
User-Agent:
|
48
|
+
- Ruby
|
49
|
+
Date:
|
50
|
+
- Thu, 06 Nov 2014 03:38:12 GMT
|
51
|
+
Authorization:
|
52
|
+
- AWS AKIAICVNTIM4AWNLWR4Q:wFmJ72SZcj3PydOeeaDNlq1hL2s=
|
53
|
+
response:
|
54
|
+
status:
|
55
|
+
code: 404
|
56
|
+
message: Not Found
|
57
|
+
headers:
|
58
|
+
X-Amz-Request-Id:
|
59
|
+
- 7345AC12FCB2D52C
|
60
|
+
X-Amz-Id-2:
|
61
|
+
- FFNOlMTuUc3CioRxAYYxdqa320KDIO2EEZFWtRg+P1asWvs1rx8/4Gk5R+A6naCF
|
62
|
+
Content-Type:
|
63
|
+
- application/xml
|
64
|
+
Transfer-Encoding:
|
65
|
+
- chunked
|
66
|
+
Date:
|
67
|
+
- Thu, 06 Nov 2014 03:36:32 GMT
|
68
|
+
Server:
|
69
|
+
- AmazonS3
|
70
|
+
body:
|
71
|
+
encoding: UTF-8
|
72
|
+
string: ''
|
73
|
+
http_version:
|
74
|
+
recorded_at: Thu, 06 Nov 2014 03:38:12 GMT
|
75
|
+
- request:
|
76
|
+
method: put
|
77
|
+
uri: https://s3.amazonaws.com/jma-2014-test-bucket/foo
|
78
|
+
body:
|
79
|
+
encoding: UTF-8
|
80
|
+
string: bar
|
81
|
+
headers:
|
82
|
+
Accept-Encoding:
|
83
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
84
|
+
Accept:
|
85
|
+
- "*/*"
|
86
|
+
User-Agent:
|
87
|
+
- Ruby
|
88
|
+
X-Amz-Acl:
|
89
|
+
- private
|
90
|
+
X-Amz-Storage-Class:
|
91
|
+
- STANDARD
|
92
|
+
Content-Type:
|
93
|
+
- application/octet-stream
|
94
|
+
Content-Length:
|
95
|
+
- '3'
|
96
|
+
Date:
|
97
|
+
- Thu, 06 Nov 2014 03:38:12 GMT
|
98
|
+
Content-Md5:
|
99
|
+
- N7UdGUp1E+RbVvZSTy1R8g==
|
100
|
+
Authorization:
|
101
|
+
- AWS AKIAICVNTIM4AWNLWR4Q:LclXDxhburWEvq49G7iz6fb7pDc=
|
102
|
+
response:
|
103
|
+
status:
|
104
|
+
code: 200
|
105
|
+
message: OK
|
106
|
+
headers:
|
107
|
+
X-Amz-Id-2:
|
108
|
+
- kfd/HnaA2a8D7WVx1NyaZzMqruzNFRX3uaiUtqyRgtTejDW3zlQElZ2e1wff6LFj
|
109
|
+
X-Amz-Request-Id:
|
110
|
+
- EF36C1A06FBB6047
|
111
|
+
Date:
|
112
|
+
- Thu, 06 Nov 2014 03:36:34 GMT
|
113
|
+
Etag:
|
114
|
+
- '"37b51d194a7513e45b56f6524f2d51f2"'
|
115
|
+
Content-Length:
|
116
|
+
- '0'
|
117
|
+
Server:
|
118
|
+
- AmazonS3
|
119
|
+
body:
|
120
|
+
encoding: UTF-8
|
121
|
+
string: ''
|
122
|
+
http_version:
|
123
|
+
recorded_at: Thu, 06 Nov 2014 03:38:12 GMT
|
124
|
+
- request:
|
125
|
+
method: head
|
126
|
+
uri: https://s3.amazonaws.com/jma-2014-test-bucket/foo
|
127
|
+
body:
|
128
|
+
encoding: US-ASCII
|
129
|
+
string: ''
|
130
|
+
headers:
|
131
|
+
Accept:
|
132
|
+
- "*/*"
|
133
|
+
User-Agent:
|
134
|
+
- Ruby
|
135
|
+
Date:
|
136
|
+
- Thu, 06 Nov 2014 03:38:12 GMT
|
137
|
+
Authorization:
|
138
|
+
- AWS AKIAICVNTIM4AWNLWR4Q:wFmJ72SZcj3PydOeeaDNlq1hL2s=
|
139
|
+
response:
|
140
|
+
status:
|
141
|
+
code: 200
|
142
|
+
message: OK
|
143
|
+
headers:
|
144
|
+
X-Amz-Id-2:
|
145
|
+
- Rreg8RvC73ajnf6HRHlN83vOVKlMenjR4Kt4kZIek6dZYa8353Uf7AdgW1q2kKsc
|
146
|
+
X-Amz-Request-Id:
|
147
|
+
- 4F2CFCF3F8A46E68
|
148
|
+
Date:
|
149
|
+
- Thu, 06 Nov 2014 03:36:35 GMT
|
150
|
+
Last-Modified:
|
151
|
+
- Thu, 06 Nov 2014 03:36:34 GMT
|
152
|
+
Etag:
|
153
|
+
- '"37b51d194a7513e45b56f6524f2d51f2"'
|
154
|
+
Accept-Ranges:
|
155
|
+
- bytes
|
156
|
+
Content-Type:
|
157
|
+
- application/octet-stream
|
158
|
+
Content-Length:
|
159
|
+
- '3'
|
160
|
+
Server:
|
161
|
+
- AmazonS3
|
162
|
+
body:
|
163
|
+
encoding: UTF-8
|
164
|
+
string: ''
|
165
|
+
http_version:
|
166
|
+
recorded_at: Thu, 06 Nov 2014 03:38:12 GMT
|
167
|
+
- request:
|
168
|
+
method: get
|
169
|
+
uri: https://s3.amazonaws.com/jma-2014-test-bucket/foo
|
170
|
+
body:
|
171
|
+
encoding: US-ASCII
|
172
|
+
string: ''
|
173
|
+
headers:
|
174
|
+
Accept-Encoding:
|
175
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
176
|
+
Accept:
|
177
|
+
- "*/*"
|
178
|
+
User-Agent:
|
179
|
+
- Ruby
|
180
|
+
Date:
|
181
|
+
- Thu, 06 Nov 2014 03:38:12 GMT
|
182
|
+
Authorization:
|
183
|
+
- AWS AKIAICVNTIM4AWNLWR4Q:/nTIryVbw5SShQLLjFnR1gSPx+Q=
|
184
|
+
response:
|
185
|
+
status:
|
186
|
+
code: 200
|
187
|
+
message: OK
|
188
|
+
headers:
|
189
|
+
X-Amz-Id-2:
|
190
|
+
- I1IjUx5XQhqcvhIgtGJ/uBa9ORvg7CW2t8x4XqUiCBb0hWLy1OTNFLm8Nru9BKH3
|
191
|
+
X-Amz-Request-Id:
|
192
|
+
- 2B13FA5415AA371D
|
193
|
+
Date:
|
194
|
+
- Thu, 06 Nov 2014 03:36:36 GMT
|
195
|
+
Last-Modified:
|
196
|
+
- Thu, 06 Nov 2014 03:36:34 GMT
|
197
|
+
Etag:
|
198
|
+
- '"37b51d194a7513e45b56f6524f2d51f2"'
|
199
|
+
Accept-Ranges:
|
200
|
+
- bytes
|
201
|
+
Content-Type:
|
202
|
+
- application/octet-stream
|
203
|
+
Content-Length:
|
204
|
+
- '3'
|
205
|
+
Server:
|
206
|
+
- AmazonS3
|
207
|
+
body:
|
208
|
+
encoding: UTF-8
|
209
|
+
string: bar
|
210
|
+
http_version:
|
211
|
+
recorded_at: Thu, 06 Nov 2014 03:38:12 GMT
|
212
|
+
- request:
|
213
|
+
method: get
|
214
|
+
uri: https://s3.amazonaws.com/jma-2014-test-bucket/foo?AWSAccessKeyId=AKIAICVNTIM4AWNLWR4Q&Expires=1415248692&Signature=r8wDERMs9ldVbyFmvUWJ2vnB6Kw=
|
215
|
+
body:
|
216
|
+
encoding: US-ASCII
|
217
|
+
string: ''
|
218
|
+
headers:
|
219
|
+
Accept-Encoding:
|
220
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
221
|
+
Accept:
|
222
|
+
- "*/*"
|
223
|
+
User-Agent:
|
224
|
+
- Ruby
|
225
|
+
response:
|
226
|
+
status:
|
227
|
+
code: 200
|
228
|
+
message: OK
|
229
|
+
headers:
|
230
|
+
X-Amz-Id-2:
|
231
|
+
- rb511Eg6qfu2wZgf3RD46sYxffxmqosLsyJootHUqCP6maHJZTmZxTOC2ucRZ0WH
|
232
|
+
X-Amz-Request-Id:
|
233
|
+
- F24D4345DD72B13C
|
234
|
+
Date:
|
235
|
+
- Thu, 06 Nov 2014 03:36:37 GMT
|
236
|
+
Last-Modified:
|
237
|
+
- Thu, 06 Nov 2014 03:36:34 GMT
|
238
|
+
Etag:
|
239
|
+
- '"37b51d194a7513e45b56f6524f2d51f2"'
|
240
|
+
Accept-Ranges:
|
241
|
+
- bytes
|
242
|
+
Content-Type:
|
243
|
+
- application/octet-stream
|
244
|
+
Content-Length:
|
245
|
+
- '3'
|
246
|
+
Server:
|
247
|
+
- AmazonS3
|
248
|
+
body:
|
249
|
+
encoding: UTF-8
|
250
|
+
string: bar
|
251
|
+
http_version:
|
252
|
+
recorded_at: Thu, 06 Nov 2014 03:38:12 GMT
|
253
|
+
- request:
|
254
|
+
method: delete
|
255
|
+
uri: https://s3.amazonaws.com/jma-2014-test-bucket/foo
|
256
|
+
body:
|
257
|
+
encoding: US-ASCII
|
258
|
+
string: ''
|
259
|
+
headers:
|
260
|
+
Accept-Encoding:
|
261
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
262
|
+
Accept:
|
263
|
+
- "*/*"
|
264
|
+
User-Agent:
|
265
|
+
- Ruby
|
266
|
+
Date:
|
267
|
+
- Thu, 06 Nov 2014 03:38:12 GMT
|
268
|
+
Authorization:
|
269
|
+
- AWS AKIAICVNTIM4AWNLWR4Q:IbIaMIAkkRsrn0r9Dk4N2ouSfsY=
|
270
|
+
response:
|
271
|
+
status:
|
272
|
+
code: 204
|
273
|
+
message: No Content
|
274
|
+
headers:
|
275
|
+
X-Amz-Id-2:
|
276
|
+
- oYh2z7mNrVi8shQAzdXuriUC6/ZpKnGJ4nGRqbnAciDGhfGMGLIv1JEqWsCJ/Wjj
|
277
|
+
X-Amz-Request-Id:
|
278
|
+
- B11418CA8C4574D0
|
279
|
+
Date:
|
280
|
+
- Thu, 06 Nov 2014 03:36:38 GMT
|
281
|
+
Server:
|
282
|
+
- AmazonS3
|
283
|
+
body:
|
284
|
+
encoding: UTF-8
|
285
|
+
string: ''
|
286
|
+
http_version:
|
287
|
+
recorded_at: Thu, 06 Nov 2014 03:38:12 GMT
|
288
|
+
- request:
|
289
|
+
method: head
|
290
|
+
uri: https://s3.amazonaws.com/jma-2014-test-bucket/foo
|
291
|
+
body:
|
292
|
+
encoding: US-ASCII
|
293
|
+
string: ''
|
294
|
+
headers:
|
295
|
+
Accept:
|
296
|
+
- "*/*"
|
297
|
+
User-Agent:
|
298
|
+
- Ruby
|
299
|
+
Date:
|
300
|
+
- Thu, 06 Nov 2014 03:38:12 GMT
|
301
|
+
Authorization:
|
302
|
+
- AWS AKIAICVNTIM4AWNLWR4Q:wFmJ72SZcj3PydOeeaDNlq1hL2s=
|
303
|
+
response:
|
304
|
+
status:
|
305
|
+
code: 404
|
306
|
+
message: Not Found
|
307
|
+
headers:
|
308
|
+
X-Amz-Request-Id:
|
309
|
+
- D7156244622D7908
|
310
|
+
X-Amz-Id-2:
|
311
|
+
- QSYPSAsyxA2tewH8EZxO+0WgTlObTrQsu4Cgl9Ahc4F1WezX6YoKrxGdVjK56N1y
|
312
|
+
Content-Type:
|
313
|
+
- application/xml
|
314
|
+
Transfer-Encoding:
|
315
|
+
- chunked
|
316
|
+
Date:
|
317
|
+
- Thu, 06 Nov 2014 03:36:38 GMT
|
318
|
+
Server:
|
319
|
+
- AmazonS3
|
320
|
+
body:
|
321
|
+
encoding: UTF-8
|
322
|
+
string: ''
|
323
|
+
http_version:
|
324
|
+
recorded_at: Thu, 06 Nov 2014 03:38:12 GMT
|
325
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe HasBucket do
|
4
|
+
it 'has a version number' do
|
5
|
+
expect(HasBucket::VERSION).not_to be nil
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:url) do
|
9
|
+
'https://AKIAICVNTIM4AWNLWR4Q:or68aWn0XdYkU3ACrlBXQlTOnu2afAmhL0BkXfJe@' \
|
10
|
+
's3.amazonaws.com/jma-2014-test-bucket'
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:key) { "foo" }
|
14
|
+
let(:value) { "bar" }
|
15
|
+
|
16
|
+
subject { HasBucket.of(url) }
|
17
|
+
|
18
|
+
it "should allow storage of blobs on S3", :vcr do
|
19
|
+
subject.delete key
|
20
|
+
expect(subject).to_not include(key)
|
21
|
+
|
22
|
+
subject[key] = value
|
23
|
+
expect(subject).to include(key)
|
24
|
+
expect(subject[key]).to eq value
|
25
|
+
|
26
|
+
read_data = Net::HTTP.get(URI subject.url_for key)
|
27
|
+
expect(read_data).to eq value
|
28
|
+
|
29
|
+
subject.delete key
|
30
|
+
expect(subject).to_not include(key)
|
31
|
+
end
|
32
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
require 'has_bucket'
|
3
|
+
|
4
|
+
require 'vcr'
|
5
|
+
|
6
|
+
VCR.configure do |c|
|
7
|
+
c.cassette_library_dir = 'spec/cassettes'
|
8
|
+
c.hook_into "webmock"
|
9
|
+
c.configure_rspec_metadata!
|
10
|
+
end
|
11
|
+
|
12
|
+
require "timecop"
|
13
|
+
|
14
|
+
RSpec.configure do |c|
|
15
|
+
c.before(:each) do
|
16
|
+
cassette = VCR.current_cassette
|
17
|
+
Timecop.freeze(cassette.originally_recorded_at || Time.now) if cassette
|
18
|
+
end
|
19
|
+
|
20
|
+
c.after(:each) do
|
21
|
+
Timecop.return
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: has_bucket
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jonathon M. Abbott
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: uri_config
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: s3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.1.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.1.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.27.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.27.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: vcr
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.9.3
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.9.3
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.20.3
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.20.3
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: timecop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Simple wrapper around single-bucket S3 storage
|
140
|
+
email:
|
141
|
+
- jonathona@everydayhero.com.au
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- ".rubocop.yml"
|
149
|
+
- ".travis.yml"
|
150
|
+
- Gemfile
|
151
|
+
- LICENSE.txt
|
152
|
+
- README.md
|
153
|
+
- Rakefile
|
154
|
+
- has_bucket.gemspec
|
155
|
+
- lib/has_bucket.rb
|
156
|
+
- lib/has_bucket/facade.rb
|
157
|
+
- lib/has_bucket/s3_config.rb
|
158
|
+
- lib/has_bucket/version.rb
|
159
|
+
- spec/cassettes/HasBucket/should_allow_storage_of_blobs_on_S3.yml
|
160
|
+
- spec/has_bucket_spec.rb
|
161
|
+
- spec/spec_helper.rb
|
162
|
+
homepage: https://github.com/JonathonMA/has_bucket
|
163
|
+
licenses:
|
164
|
+
- MIT
|
165
|
+
metadata: {}
|
166
|
+
post_install_message:
|
167
|
+
rdoc_options: []
|
168
|
+
require_paths:
|
169
|
+
- lib
|
170
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
requirements: []
|
181
|
+
rubyforge_project:
|
182
|
+
rubygems_version: 2.4.2
|
183
|
+
signing_key:
|
184
|
+
specification_version: 4
|
185
|
+
summary: i has an S3 bucket
|
186
|
+
test_files:
|
187
|
+
- spec/cassettes/HasBucket/should_allow_storage_of_blobs_on_S3.yml
|
188
|
+
- spec/has_bucket_spec.rb
|
189
|
+
- spec/spec_helper.rb
|
190
|
+
has_rdoc:
|