floodgate 0.0.12 → 0.0.13
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/README.md +76 -10
- data/floodgate.gemspec +1 -0
- data/lib/floodgate/config.rb +4 -4
- data/lib/floodgate/version.rb +1 -1
- data/lib/tasks/floodgate_tasks.rake +5 -1
- data/spec/cassettes/Floodgate_Client/_add_ip_address/when_an_ip_address_is_specified/adds_it_to_the_list_of_allowed_ip_addresses.yml +194 -0
- data/spec/cassettes/Floodgate_Client/_allowed_ip_addresses/returns_the_allowed_ip_addresses.yml +118 -0
- data/spec/cassettes/Floodgate_Client/_close/changes_filter_traffic_from_false_to_true.yml +155 -0
- data/spec/cassettes/Floodgate_Client/_open/changes_filter_traffic_from_true_to_false.yml +155 -0
- data/spec/cassettes/Floodgate_Client/_remove_ip_address/when_an_ip_address_is_specified/removes_it_from_the_list_of_allowed_ip_addresses.yml +155 -0
- data/spec/cassettes/Floodgate_Client/_set_redirect_url/when_a_redirect_url_is_specified/changes_the_redirect_url.yml +155 -0
- data/spec/cassettes/Floodgate_Client/_set_redirect_url/when_nil_is_specified/clears_the_redirect_url.yml +155 -0
- data/spec/cassettes/Floodgate_Client/_status/when_the_credentials_are_not_valid/returns_the_default_status.yml +38 -0
- data/spec/cassettes/Floodgate_Client/_status/when_the_credentials_are_valid/and_traffic_filtering_is_enabled/filter_traffic_is_true.yml +40 -0
- data/spec/cassettes/Floodgate_Client/_status/when_the_credentials_are_valid/and_traffic_filtering_is_not_enabled/filter_traffic_is_false.yml +40 -0
- data/spec/lib/floodgate/client_spec.rb +5 -4
- data/spec/lib/floodgate/config_spec.rb +3 -19
- data/spec/lib/floodgate/control_spec.rb +4 -2
- data/spec/support/vcr.rb +8 -0
- metadata +37 -1
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://floodgate-api-staging.herokuapp.com/api/v1/apps/cbaeb13b7f63956ef70c382a7a67407d/status?api_token=349d2b1ee8ec56eb04b909b1eb9993b0
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- FloodgateAgent
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message:
|
16
|
+
headers:
|
17
|
+
cache-control:
|
18
|
+
- max-age=0, private, must-revalidate
|
19
|
+
content-type:
|
20
|
+
- application/json
|
21
|
+
date:
|
22
|
+
- Fri, 28 Feb 2014 17:18:07 GMT
|
23
|
+
etag:
|
24
|
+
- "\"8843d65a25ba489ef0f7eea44981e1f6\""
|
25
|
+
server:
|
26
|
+
- WEBrick/1.3.1 (Ruby/2.1.0/2013-12-25)
|
27
|
+
x-request-id:
|
28
|
+
- fb64ccea-f5a0-4b17-b7dd-95efe530d5d3
|
29
|
+
x-runtime:
|
30
|
+
- '0.139455'
|
31
|
+
content-length:
|
32
|
+
- '131'
|
33
|
+
connection:
|
34
|
+
- Close
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: "{\"allowed_ip_addresses\":[\"166.147.100.145\"],\"filter_traffic\":false,\"name\":\"floodgate-gem-filter-traffic-false\",\"redirect_url\":null}"
|
38
|
+
http_version:
|
39
|
+
recorded_at: Fri, 28 Feb 2014 17:18:07 GMT
|
40
|
+
recorded_with: VCR 2.8.0
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module Floodgate
|
4
|
-
describe Client do
|
4
|
+
describe Client, :vcr do
|
5
5
|
let(:app_id) { '9d2852cff163507330242460c0ca5eec' }
|
6
6
|
let(:api_token) { 'f28b5848e158f96e96168aa37f0002f2' }
|
7
7
|
let(:status) { Client.status }
|
@@ -13,11 +13,12 @@ module Floodgate
|
|
13
13
|
|
14
14
|
describe '.add_ip_address' do
|
15
15
|
context 'when an ip address is specified' do
|
16
|
-
let(:ip_address) {
|
16
|
+
let(:ip_address) { '1.1.1.1' }
|
17
17
|
let(:params) do
|
18
18
|
{ ip_address: { ip_address: ip_address } }
|
19
19
|
end
|
20
20
|
|
21
|
+
before { Client.remove_ip_address(ip_address) }
|
21
22
|
after { Client.remove_ip_address(ip_address) }
|
22
23
|
|
23
24
|
it 'adds it to the list of allowed ip addresses' do
|
@@ -49,7 +50,7 @@ module Floodgate
|
|
49
50
|
end
|
50
51
|
|
51
52
|
describe '.allowed_ip_addresses' do
|
52
|
-
let(:ip_address) {
|
53
|
+
let(:ip_address) { '1.1.1.1' }
|
53
54
|
|
54
55
|
before { Client.add_ip_address(ip_address) }
|
55
56
|
after { Client.remove_ip_address(ip_address) }
|
@@ -77,7 +78,7 @@ module Floodgate
|
|
77
78
|
|
78
79
|
describe '.remove_ip_address' do
|
79
80
|
context 'when an ip address is specified' do
|
80
|
-
let(:ip_address) {
|
81
|
+
let(:ip_address) { '1.1.1.1' }
|
81
82
|
let(:params) do
|
82
83
|
{ ip_address: { ip_address: ip_address } }
|
83
84
|
end
|
@@ -8,7 +8,9 @@ module Floodgate
|
|
8
8
|
Config.api_token = api_token
|
9
9
|
end
|
10
10
|
|
11
|
-
let(:json)
|
11
|
+
let(:json) { Hashie::Mash.new(raw_json) }
|
12
|
+
|
13
|
+
let(:raw_json) do
|
12
14
|
{
|
13
15
|
'allowed_ip_addresses' => allowed_ip_addresses,
|
14
16
|
'filter_traffic' => filter_traffic,
|
@@ -32,15 +34,6 @@ module Floodgate
|
|
32
34
|
}
|
33
35
|
end
|
34
36
|
|
35
|
-
context 'when the allowed ip address list is nil' do
|
36
|
-
let(:allowed_ip_addresses) { nil }
|
37
|
-
let(:ip_address) { '127.0.0.1' }
|
38
|
-
|
39
|
-
it 'is false' do
|
40
|
-
expect(config.client_allowed?(env)).to be_false
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
37
|
context 'when the allowed ip address list is empty' do
|
45
38
|
let(:allowed_ip_addresses) { [] }
|
46
39
|
let(:ip_address) { '127.0.0.1' }
|
@@ -78,15 +71,6 @@ module Floodgate
|
|
78
71
|
}
|
79
72
|
end
|
80
73
|
|
81
|
-
context 'when the allowed ip address list is nil' do
|
82
|
-
let(:allowed_ip_addresses) { nil }
|
83
|
-
let(:ip_address) { '127.0.0.1' }
|
84
|
-
|
85
|
-
it 'is false' do
|
86
|
-
expect(config.client_allowed?(env)).to be_false
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
74
|
context 'when the allowed ip address list is empty' do
|
91
75
|
let(:allowed_ip_addresses) { [] }
|
92
76
|
let(:ip_address) { '127.0.0.1' }
|
@@ -9,11 +9,13 @@ module Floodgate
|
|
9
9
|
let(:app_id) { 'abc123' }
|
10
10
|
let(:api_token) { 'def456' }
|
11
11
|
|
12
|
-
let(:allowed_ip_addresses) {
|
12
|
+
let(:allowed_ip_addresses) { [] }
|
13
13
|
let(:filter_traffic) { false }
|
14
14
|
let(:redirect_url) { 'something' }
|
15
15
|
|
16
|
-
let(:json)
|
16
|
+
let(:json) { Hashie::Mash.new(raw_json) }
|
17
|
+
|
18
|
+
let(:raw_json) do
|
17
19
|
{
|
18
20
|
'allowed_ip_addresses' => allowed_ip_addresses,
|
19
21
|
'filter_traffic' => filter_traffic,
|
data/spec/support/vcr.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: floodgate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark McEahern
|
@@ -109,6 +109,20 @@ dependencies:
|
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0.8'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: vcr
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '2.8'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '2.8'
|
112
126
|
description: floodgate helps you control access to your app
|
113
127
|
email:
|
114
128
|
- mark@adorable.io
|
@@ -132,12 +146,23 @@ files:
|
|
132
146
|
- lib/floodgate/railtie.rb
|
133
147
|
- lib/floodgate/version.rb
|
134
148
|
- lib/tasks/floodgate_tasks.rake
|
149
|
+
- spec/cassettes/Floodgate_Client/_add_ip_address/when_an_ip_address_is_specified/adds_it_to_the_list_of_allowed_ip_addresses.yml
|
150
|
+
- spec/cassettes/Floodgate_Client/_allowed_ip_addresses/returns_the_allowed_ip_addresses.yml
|
151
|
+
- spec/cassettes/Floodgate_Client/_close/changes_filter_traffic_from_false_to_true.yml
|
152
|
+
- spec/cassettes/Floodgate_Client/_open/changes_filter_traffic_from_true_to_false.yml
|
153
|
+
- spec/cassettes/Floodgate_Client/_remove_ip_address/when_an_ip_address_is_specified/removes_it_from_the_list_of_allowed_ip_addresses.yml
|
154
|
+
- spec/cassettes/Floodgate_Client/_set_redirect_url/when_a_redirect_url_is_specified/changes_the_redirect_url.yml
|
155
|
+
- spec/cassettes/Floodgate_Client/_set_redirect_url/when_nil_is_specified/clears_the_redirect_url.yml
|
156
|
+
- spec/cassettes/Floodgate_Client/_status/when_the_credentials_are_not_valid/returns_the_default_status.yml
|
157
|
+
- spec/cassettes/Floodgate_Client/_status/when_the_credentials_are_valid/and_traffic_filtering_is_enabled/filter_traffic_is_true.yml
|
158
|
+
- spec/cassettes/Floodgate_Client/_status/when_the_credentials_are_valid/and_traffic_filtering_is_not_enabled/filter_traffic_is_false.yml
|
135
159
|
- spec/lib/floodgate/client_spec.rb
|
136
160
|
- spec/lib/floodgate/config_spec.rb
|
137
161
|
- spec/lib/floodgate/control_spec.rb
|
138
162
|
- spec/spec_helper.rb
|
139
163
|
- spec/support/helpers/ip_address_helpers.rb
|
140
164
|
- spec/support/rspec.rb
|
165
|
+
- spec/support/vcr.rb
|
141
166
|
homepage: http://github.com/adorableio/floodgate
|
142
167
|
licenses:
|
143
168
|
- MIT
|
@@ -163,9 +188,20 @@ signing_key:
|
|
163
188
|
specification_version: 4
|
164
189
|
summary: floodgate helps you control access to your app
|
165
190
|
test_files:
|
191
|
+
- spec/cassettes/Floodgate_Client/_add_ip_address/when_an_ip_address_is_specified/adds_it_to_the_list_of_allowed_ip_addresses.yml
|
192
|
+
- spec/cassettes/Floodgate_Client/_allowed_ip_addresses/returns_the_allowed_ip_addresses.yml
|
193
|
+
- spec/cassettes/Floodgate_Client/_close/changes_filter_traffic_from_false_to_true.yml
|
194
|
+
- spec/cassettes/Floodgate_Client/_open/changes_filter_traffic_from_true_to_false.yml
|
195
|
+
- spec/cassettes/Floodgate_Client/_remove_ip_address/when_an_ip_address_is_specified/removes_it_from_the_list_of_allowed_ip_addresses.yml
|
196
|
+
- spec/cassettes/Floodgate_Client/_set_redirect_url/when_a_redirect_url_is_specified/changes_the_redirect_url.yml
|
197
|
+
- spec/cassettes/Floodgate_Client/_set_redirect_url/when_nil_is_specified/clears_the_redirect_url.yml
|
198
|
+
- spec/cassettes/Floodgate_Client/_status/when_the_credentials_are_not_valid/returns_the_default_status.yml
|
199
|
+
- spec/cassettes/Floodgate_Client/_status/when_the_credentials_are_valid/and_traffic_filtering_is_enabled/filter_traffic_is_true.yml
|
200
|
+
- spec/cassettes/Floodgate_Client/_status/when_the_credentials_are_valid/and_traffic_filtering_is_not_enabled/filter_traffic_is_false.yml
|
166
201
|
- spec/lib/floodgate/client_spec.rb
|
167
202
|
- spec/lib/floodgate/config_spec.rb
|
168
203
|
- spec/lib/floodgate/control_spec.rb
|
169
204
|
- spec/spec_helper.rb
|
170
205
|
- spec/support/helpers/ip_address_helpers.rb
|
171
206
|
- spec/support/rspec.rb
|
207
|
+
- spec/support/vcr.rb
|