rain_forest 0.4.1 → 0.4.4
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/cloud_front.rb +25 -0
- data/rain_forest.gemspec +2 -2
- data/spec/rain_forest/cloud_front_spec.rb +37 -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: 2c8078fadbdc4c6063f514affac5d65eb9e3df0c
|
4
|
+
data.tar.gz: 147555bc64682650c5e55c7d4081541541f946cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e4aa64c948feb61a4b43680006e4989f77b5ee50c01b1a10ae8df9682aaae84dd8932520f1f726ff05d2e7ef061ce6c59da4fb1824f89e710ba9978f03d9755
|
7
|
+
data.tar.gz: a34cd95f583f0f2710fae598246157f33258003e73a4a9eb14f04a7273a2c89f1bef329c7e7efea05653bd8daaf030ddf953201b42c6250c10efb38360577380
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.4
|
@@ -14,6 +14,10 @@ module RainForest
|
|
14
14
|
self.new.update_origin(distribution_id, new_origin_key)
|
15
15
|
end
|
16
16
|
|
17
|
+
def self.create_invalidation(distribution_id, invalidate_paths_array)
|
18
|
+
self.new.create_invalidation(distribution_id, invalidate_paths_array)
|
19
|
+
end
|
20
|
+
|
17
21
|
def update_origin(distribution_id, new_origin_key)
|
18
22
|
begin
|
19
23
|
dist = @client.get_distribution(id: distribution_id)
|
@@ -38,5 +42,26 @@ module RainForest
|
|
38
42
|
|
39
43
|
return true, nil
|
40
44
|
end
|
45
|
+
|
46
|
+
def create_invalidation(distribution_id, invalidate_paths_array, caller_reference=SecureRandom.hex(16))
|
47
|
+
begin
|
48
|
+
parameters = {
|
49
|
+
distribution_id: distribution_id,
|
50
|
+
invalidation_batch: {
|
51
|
+
paths: {
|
52
|
+
quantity: invalidate_paths_array.count,
|
53
|
+
items: invalidate_paths_array
|
54
|
+
},
|
55
|
+
caller_reference: caller_reference
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
resp = @client.create_invalidation(parameters)
|
60
|
+
|
61
|
+
return true, resp
|
62
|
+
rescue Exception => e
|
63
|
+
return false, e.message
|
64
|
+
end
|
65
|
+
end
|
41
66
|
end
|
42
67
|
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.4.
|
8
|
+
s.version = "0.4.4"
|
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 = "2016-
|
12
|
+
s.date = "2016-08-22"
|
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 = [
|
@@ -62,4 +62,41 @@ describe RainForest::CloudFront do
|
|
62
62
|
expect(success).to eq(false)
|
63
63
|
end
|
64
64
|
end
|
65
|
+
|
66
|
+
describe "#create_invalidation" do
|
67
|
+
before do
|
68
|
+
expect(SecureRandom).to receive(:hex).with(16).and_return("A_RANDOM_CALLER_REFERENCE")
|
69
|
+
end
|
70
|
+
|
71
|
+
let(:aws_response_object){double("AWS Response Object")}
|
72
|
+
|
73
|
+
it "created an invalidation" do
|
74
|
+
expected_parameters = {
|
75
|
+
distribution_id: "DISTRIBUTION_ID",
|
76
|
+
invalidation_batch: {
|
77
|
+
paths: {
|
78
|
+
quantity: 3,
|
79
|
+
items: ["FIRST_PATH", "SECOND_PATH", "THIRD_PATH"]
|
80
|
+
},
|
81
|
+
caller_reference: "A_RANDOM_CALLER_REFERENCE"
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
expect(client).to receive(:create_invalidation).with(expected_parameters).and_return(aws_response_object)
|
86
|
+
|
87
|
+
success, message_or_object = RainForest::CloudFront.create_invalidation("DISTRIBUTION_ID", ["FIRST_PATH", "SECOND_PATH", "THIRD_PATH"])
|
88
|
+
|
89
|
+
expect(message_or_object).to eq(aws_response_object)
|
90
|
+
expect(success).to eq(true)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "handles errors" do
|
94
|
+
expect(client).to receive(:create_invalidation).and_raise(Exception.new("KABOOM!"))
|
95
|
+
|
96
|
+
success, message = RainForest::CloudFront.create_invalidation("DISTRIBUTION_ID", ["FIRST_PATH", "SECOND_PATH", "THIRD_PATH"])
|
97
|
+
|
98
|
+
expect(message).to eq("KABOOM!")
|
99
|
+
expect(success).to eq(false)
|
100
|
+
end
|
101
|
+
end
|
65
102
|
end
|
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.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Beaton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|