rain_forest 0.1.2 → 0.2.0
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 +4 -4
- data/VERSION +1 -1
- data/lib/rain_forest/s3.rb +11 -4
- data/rain_forest.gemspec +2 -2
- data/spec/rain_forest/s3_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 053009707b53ff1327d2eb81d8e825f5c8b04b8d
|
4
|
+
data.tar.gz: 486d02c47c770d0c26895c9e27caf2164a788673
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a828ff2f6e9d5a879baf1043923f05c04ff059516ed1d15ac1d3af79846fce19676e349e0957faffa19cc737038fac7d6a377f58af96e20f33c96d21e7eec408
|
7
|
+
data.tar.gz: ffc603e6c91f4b237ba8669217ec8e4bc957c2ec3878ff0a0e568ad6d63b663bc804abd9270b8d086e68082f0aba20021d05064f14a75f0e57c4e3c72fa62bfc
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/rain_forest/s3.rb
CHANGED
@@ -11,8 +11,8 @@ module RainForest
|
|
11
11
|
@client = ::Aws::S3::Client.new(region: region, credentials: credentials)
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.write(storage_key, data,
|
15
|
-
self.new.write(storage_key, data,
|
14
|
+
def self.write(storage_key, data, options={})
|
15
|
+
self.new.write(storage_key, data, options)
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.read(storage_key)
|
@@ -31,9 +31,16 @@ module RainForest
|
|
31
31
|
self.new.delete_objects(prefix)
|
32
32
|
end
|
33
33
|
|
34
|
-
def write(storage_key, data,
|
34
|
+
def write(storage_key, data, options={})
|
35
|
+
attrs = {
|
36
|
+
bucket: @bucket,
|
37
|
+
key: storage_key,
|
38
|
+
body: data,
|
39
|
+
acl: 'public-read'
|
40
|
+
}.merge(options)
|
41
|
+
|
35
42
|
begin
|
36
|
-
@client.put_object(
|
43
|
+
@client.put_object(attrs)
|
37
44
|
rescue Exception => e
|
38
45
|
return false, e.message
|
39
46
|
end
|
data/rain_forest.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rain_forest"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Lukas Beaton"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2016-03-02"
|
13
13
|
s.description = "A simplified adaptor for Amazon Web Services. Only S3 is supported at the moment."
|
14
14
|
s.email = "lukas.beaton@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/rain_forest/s3_spec.rb
CHANGED
@@ -19,6 +19,15 @@ describe RainForest::S3 do
|
|
19
19
|
expect(message).to eq(nil)
|
20
20
|
end
|
21
21
|
|
22
|
+
it "accepts other options" do
|
23
|
+
expect(client).to receive(:put_object).with(bucket: ENV["rain_forest_aws_bucket"], key: "STORAGE-KEY", body: "Some test data...", acl: "public-read", content_encoding: 'utf8').and_return(true)
|
24
|
+
|
25
|
+
success, message = RainForest::S3.write("STORAGE-KEY", "Some test data...", content_encoding: 'utf8')
|
26
|
+
|
27
|
+
expect(success).to eq(true)
|
28
|
+
expect(message).to eq(nil)
|
29
|
+
end
|
30
|
+
|
22
31
|
it "handles errors" do
|
23
32
|
expect(client).to receive(:put_object).with(bucket: ENV["rain_forest_aws_bucket"], key: "STORAGE-KEY", body: "Some test data...", acl: "public-read").and_raise(Exception.new("KABOOM!"))
|
24
33
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rain_forest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Beaton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|