has_bucket 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83138a4f5ecc8d9daed056f4387e520f461bcd33
4
- data.tar.gz: 6a506222d671686b6afee3c83174410625a56180
3
+ metadata.gz: eb33066de7c4c4ff573e521b6f221158f1716611
4
+ data.tar.gz: 1b86a76ba5bb31a1df5cc2b38c4e2c38c83115fa
5
5
  SHA512:
6
- metadata.gz: f1a9bc6949c37af34ad46fa2c7ff065a30e320f02896f876c060c041123e6d87d427d905e792bcc3c2077ded37f1962c5cbfe8140972a22abdbdb168f7800b90
7
- data.tar.gz: 9541bf46035dcd842ab60585b4c82471a93e47b00f9353352ceded22439a00b1fad95caccafe1568c6547afc0d58df82d169cc3472c8f2932c185adb8469aacd
6
+ metadata.gz: 78aa24e9dc6dfdf75344268f5562f5ad91212fc489e4f0f76da511aab5b855062f3f6063832cfe1f436802a505006ee27291609c8e8663cdf446718545c191f7
7
+ data.tar.gz: a3c16494024f7228711d47679ff0d8c9b82c513c892132365616aabddd2d2e7750b87a0d5f350391f3a69b7cc65fb1e28e66ac8f2dbdf7f85291b19325f2adef
@@ -13,6 +13,10 @@ module HasBucket
13
13
  object(key).exists?
14
14
  end
15
15
 
16
+ def prefixed_with(prefix)
17
+ bucket.objects(prefix: prefix).map(&:key)
18
+ end
19
+
16
20
  def []=(key, content)
17
21
  s3_object = object(key)
18
22
  s3_object.acl = "private"
@@ -1,3 +1,3 @@
1
1
  module HasBucket
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,296 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://s3.amazonaws.com/jma-2014-test-bucket/other/bar
6
+ body:
7
+ encoding: UTF-8
8
+ string: bar
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
+ X-Amz-Acl:
17
+ - private
18
+ X-Amz-Storage-Class:
19
+ - STANDARD
20
+ Content-Type:
21
+ - application/octet-stream
22
+ Content-Length:
23
+ - '3'
24
+ Date:
25
+ - Thu, 06 Nov 2014 05:51:19 GMT
26
+ Content-Md5:
27
+ - N7UdGUp1E+RbVvZSTy1R8g==
28
+ Authorization:
29
+ - AWS AKIAICVNTIM4AWNLWR4Q:YPVKeMFUCwCUPnfItNUf7IQCI0E=
30
+ response:
31
+ status:
32
+ code: 200
33
+ message: OK
34
+ headers:
35
+ X-Amz-Id-2:
36
+ - 0ZloJHs2brWSSpKu3K077wmNaMjwHravbXRaZhvVyzJdDTtVQjorAkCR1QYxBKTt
37
+ X-Amz-Request-Id:
38
+ - 45D50F0FD481AD6B
39
+ Date:
40
+ - Thu, 06 Nov 2014 05:49:40 GMT
41
+ Etag:
42
+ - '"37b51d194a7513e45b56f6524f2d51f2"'
43
+ Content-Length:
44
+ - '0'
45
+ Server:
46
+ - AmazonS3
47
+ body:
48
+ encoding: UTF-8
49
+ string: ''
50
+ http_version:
51
+ recorded_at: Thu, 06 Nov 2014 05:51:19 GMT
52
+ - request:
53
+ method: put
54
+ uri: https://s3.amazonaws.com/jma-2014-test-bucket/foo/bar
55
+ body:
56
+ encoding: UTF-8
57
+ string: bar
58
+ headers:
59
+ Accept-Encoding:
60
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
61
+ Accept:
62
+ - "*/*"
63
+ User-Agent:
64
+ - Ruby
65
+ X-Amz-Acl:
66
+ - private
67
+ X-Amz-Storage-Class:
68
+ - STANDARD
69
+ Content-Type:
70
+ - application/octet-stream
71
+ Content-Length:
72
+ - '3'
73
+ Date:
74
+ - Thu, 06 Nov 2014 05:51:19 GMT
75
+ Content-Md5:
76
+ - N7UdGUp1E+RbVvZSTy1R8g==
77
+ Authorization:
78
+ - AWS AKIAICVNTIM4AWNLWR4Q:UDy0jS3bhBI8MtXR17Hz2zwJfXA=
79
+ response:
80
+ status:
81
+ code: 200
82
+ message: OK
83
+ headers:
84
+ X-Amz-Id-2:
85
+ - qb174s4k6rVbj3BDetOWP6Vcn4jO8GfBb7FnDImVpM3R5wTrBNXqKLUSbkMi5/bR
86
+ X-Amz-Request-Id:
87
+ - F695B0DA2108C9A6
88
+ Date:
89
+ - Thu, 06 Nov 2014 05:49:41 GMT
90
+ Etag:
91
+ - '"37b51d194a7513e45b56f6524f2d51f2"'
92
+ Content-Length:
93
+ - '0'
94
+ Server:
95
+ - AmazonS3
96
+ body:
97
+ encoding: UTF-8
98
+ string: ''
99
+ http_version:
100
+ recorded_at: Thu, 06 Nov 2014 05:51:19 GMT
101
+ - request:
102
+ method: put
103
+ uri: https://s3.amazonaws.com/jma-2014-test-bucket/foo/baz
104
+ body:
105
+ encoding: UTF-8
106
+ string: baz
107
+ headers:
108
+ Accept-Encoding:
109
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
110
+ Accept:
111
+ - "*/*"
112
+ User-Agent:
113
+ - Ruby
114
+ X-Amz-Acl:
115
+ - private
116
+ X-Amz-Storage-Class:
117
+ - STANDARD
118
+ Content-Type:
119
+ - application/octet-stream
120
+ Content-Length:
121
+ - '3'
122
+ Date:
123
+ - Thu, 06 Nov 2014 05:51:19 GMT
124
+ Content-Md5:
125
+ - c/7/pLf2u2jkTPmEyF9uiA==
126
+ Authorization:
127
+ - AWS AKIAICVNTIM4AWNLWR4Q:yeDNIes1AETpB70uPpN+QkEFK/c=
128
+ response:
129
+ status:
130
+ code: 200
131
+ message: OK
132
+ headers:
133
+ X-Amz-Id-2:
134
+ - X41moZPTikmQ9qyXe2MhryuKUL2KNMuLd0n1YuqBBogYxs1S2zIEsXxvOK3qcMpz
135
+ X-Amz-Request-Id:
136
+ - 13519A8721498C24
137
+ Date:
138
+ - Thu, 06 Nov 2014 05:49:42 GMT
139
+ Etag:
140
+ - '"73feffa4b7f6bb68e44cf984c85f6e88"'
141
+ Content-Length:
142
+ - '0'
143
+ Server:
144
+ - AmazonS3
145
+ body:
146
+ encoding: UTF-8
147
+ string: ''
148
+ http_version:
149
+ recorded_at: Thu, 06 Nov 2014 05:51:19 GMT
150
+ - request:
151
+ method: get
152
+ uri: https://s3.amazonaws.com/jma-2014-test-bucket/?prefix=foo/
153
+ body:
154
+ encoding: US-ASCII
155
+ string: ''
156
+ headers:
157
+ Accept-Encoding:
158
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
159
+ Accept:
160
+ - "*/*"
161
+ User-Agent:
162
+ - Ruby
163
+ Date:
164
+ - Thu, 06 Nov 2014 05:51:19 GMT
165
+ Authorization:
166
+ - AWS AKIAICVNTIM4AWNLWR4Q:qriqUriOjBVlpEGibmxSWIPzbQE=
167
+ response:
168
+ status:
169
+ code: 200
170
+ message: OK
171
+ headers:
172
+ X-Amz-Id-2:
173
+ - "/R2qDg4Pznh+xskYG41FrvWLPD6+hKjaoQiNrv60v9fDPzrKs3bcaruZGtTKkrym"
174
+ X-Amz-Request-Id:
175
+ - 8D75F2A7DC47E93A
176
+ Date:
177
+ - Thu, 06 Nov 2014 05:49:43 GMT
178
+ Content-Type:
179
+ - application/xml
180
+ Transfer-Encoding:
181
+ - chunked
182
+ Server:
183
+ - AmazonS3
184
+ body:
185
+ encoding: UTF-8
186
+ string: |-
187
+ <?xml version="1.0" encoding="UTF-8"?>
188
+ <ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>jma-2014-test-bucket</Name><Prefix>foo/</Prefix><Marker></Marker><MaxKeys>1000</MaxKeys><IsTruncated>false</IsTruncated><Contents><Key>foo/bar</Key><LastModified>2014-11-06T05:49:41.000Z</LastModified><ETag>&quot;37b51d194a7513e45b56f6524f2d51f2&quot;</ETag><Size>3</Size><Owner><ID>5d307ea628ee26d90fe9b4b8500d17671fd927387d7d746ba636af2808b85e6a</ID><DisplayName>jma</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents><Contents><Key>foo/baz</Key><LastModified>2014-11-06T05:49:42.000Z</LastModified><ETag>&quot;73feffa4b7f6bb68e44cf984c85f6e88&quot;</ETag><Size>3</Size><Owner><ID>5d307ea628ee26d90fe9b4b8500d17671fd927387d7d746ba636af2808b85e6a</ID><DisplayName>jma</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents></ListBucketResult>
189
+ http_version:
190
+ recorded_at: Thu, 06 Nov 2014 05:51:19 GMT
191
+ - request:
192
+ method: delete
193
+ uri: https://s3.amazonaws.com/jma-2014-test-bucket/other/bar
194
+ body:
195
+ encoding: US-ASCII
196
+ string: ''
197
+ headers:
198
+ Accept-Encoding:
199
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
200
+ Accept:
201
+ - "*/*"
202
+ User-Agent:
203
+ - Ruby
204
+ Date:
205
+ - Thu, 06 Nov 2014 05:51:19 GMT
206
+ Authorization:
207
+ - AWS AKIAICVNTIM4AWNLWR4Q:1i0QmZHN8g8fQdCJF1hPN80besA=
208
+ response:
209
+ status:
210
+ code: 204
211
+ message: No Content
212
+ headers:
213
+ X-Amz-Id-2:
214
+ - kGVtuc0+PQij103A7OeVR4UnWcr9iocfQkFpMlYafTGEPwGE4LP1EbnBmSKrEwE4
215
+ X-Amz-Request-Id:
216
+ - A58A9D606F53E29C
217
+ Date:
218
+ - Thu, 06 Nov 2014 05:49:44 GMT
219
+ Server:
220
+ - AmazonS3
221
+ body:
222
+ encoding: UTF-8
223
+ string: ''
224
+ http_version:
225
+ recorded_at: Thu, 06 Nov 2014 05:51:19 GMT
226
+ - request:
227
+ method: delete
228
+ uri: https://s3.amazonaws.com/jma-2014-test-bucket/foo/bar
229
+ body:
230
+ encoding: US-ASCII
231
+ string: ''
232
+ headers:
233
+ Accept-Encoding:
234
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
235
+ Accept:
236
+ - "*/*"
237
+ User-Agent:
238
+ - Ruby
239
+ Date:
240
+ - Thu, 06 Nov 2014 05:51:19 GMT
241
+ Authorization:
242
+ - AWS AKIAICVNTIM4AWNLWR4Q:15NmXZGdKaCsgC1cfcM4Ft2K0IM=
243
+ response:
244
+ status:
245
+ code: 204
246
+ message: No Content
247
+ headers:
248
+ X-Amz-Id-2:
249
+ - aUkh5l6ozZFt0Fe2C408I2aLtMFGVcl0px+wjKcrh5d/WpXv3tXwmrhRxUYtHBsl
250
+ X-Amz-Request-Id:
251
+ - D4C27C12EA249077
252
+ Date:
253
+ - Thu, 06 Nov 2014 05:49:45 GMT
254
+ Server:
255
+ - AmazonS3
256
+ body:
257
+ encoding: UTF-8
258
+ string: ''
259
+ http_version:
260
+ recorded_at: Thu, 06 Nov 2014 05:51:19 GMT
261
+ - request:
262
+ method: delete
263
+ uri: https://s3.amazonaws.com/jma-2014-test-bucket/foo/baz
264
+ body:
265
+ encoding: US-ASCII
266
+ string: ''
267
+ headers:
268
+ Accept-Encoding:
269
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
270
+ Accept:
271
+ - "*/*"
272
+ User-Agent:
273
+ - Ruby
274
+ Date:
275
+ - Thu, 06 Nov 2014 05:51:19 GMT
276
+ Authorization:
277
+ - AWS AKIAICVNTIM4AWNLWR4Q:rEP0FtX3y3Ipjj/gIOjUp9K1VSI=
278
+ response:
279
+ status:
280
+ code: 204
281
+ message: No Content
282
+ headers:
283
+ X-Amz-Id-2:
284
+ - M0ankGKK8OxTyZwxX5dJNwmc+z3JzlOklU/xfhDIRMmYfK5unz0LL7ff9LGjRGOr
285
+ X-Amz-Request-Id:
286
+ - 5BAD8CF854E442B8
287
+ Date:
288
+ - Thu, 06 Nov 2014 05:49:46 GMT
289
+ Server:
290
+ - AmazonS3
291
+ body:
292
+ encoding: UTF-8
293
+ string: ''
294
+ http_version:
295
+ recorded_at: Thu, 06 Nov 2014 05:51:19 GMT
296
+ recorded_with: VCR 2.9.3
@@ -29,4 +29,19 @@ describe HasBucket do
29
29
  subject.delete key
30
30
  expect(subject).to_not include(key)
31
31
  end
32
+
33
+ it "#prefixed_with should allow for directory-like keys", :vcr do
34
+ subject["other/bar"] = "bar"
35
+ subject["foo/bar"] = "bar"
36
+ subject["foo/baz"] = "baz"
37
+
38
+ expect(subject.prefixed_with("foo/")).to eq %w(
39
+ foo/bar
40
+ foo/baz
41
+ )
42
+
43
+ subject.delete "other/bar"
44
+ subject.delete "foo/bar"
45
+ subject.delete "foo/baz"
46
+ end
32
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_bucket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathon M. Abbott
@@ -156,6 +156,7 @@ files:
156
156
  - lib/has_bucket/facade.rb
157
157
  - lib/has_bucket/s3_config.rb
158
158
  - lib/has_bucket/version.rb
159
+ - spec/cassettes/HasBucket/_prefixed_with_should_allow_for_directory-like_keys.yml
159
160
  - spec/cassettes/HasBucket/should_allow_storage_of_blobs_on_S3.yml
160
161
  - spec/has_bucket_spec.rb
161
162
  - spec/spec_helper.rb
@@ -184,6 +185,7 @@ signing_key:
184
185
  specification_version: 4
185
186
  summary: i has an S3 bucket
186
187
  test_files:
188
+ - spec/cassettes/HasBucket/_prefixed_with_should_allow_for_directory-like_keys.yml
187
189
  - spec/cassettes/HasBucket/should_allow_storage_of_blobs_on_S3.yml
188
190
  - spec/has_bucket_spec.rb
189
191
  - spec/spec_helper.rb