floodgate 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c358c66d74cbc183c5b78dc6674ec6034d133f91
4
- data.tar.gz: a1214a49004c9700d3abe387669d11307cdf94d5
3
+ metadata.gz: a776d62f41f2d647f2589508faa2a855de794895
4
+ data.tar.gz: 7658c55e5bbd5be47fd5b8d504ea6d3396c799f6
5
5
  SHA512:
6
- metadata.gz: 1987cbbedb2f9dd1b67cd403ea96cadf9bcab0379e8d51f007858f650598013b09f9f15c884ce389f781a87de249d7751682909b0fabdc2ee58634a468900657
7
- data.tar.gz: 0167490f609bc5e11b8129aa601aa40bbe7b8a23600a15e41bfdc7d9b58740e203736aa9c1640e211357384a74e235b86a79380d01584e47fd5d5c37ee49f1eb
6
+ metadata.gz: 5e223fff50753d6aadd790034dae5c306caa6000b63d43e46eb793de3aaa9bf361fafbf04b54589a7e42b2bf50191174f49427e8788f66b937de39b705a9c1b3
7
+ data.tar.gz: 83b04e7f13d7225ab7a0994f59ed66b936ac0a8023def371495cd59890335d735c77f2557db39895d987718da12fe7dc2300d32a184752d9121b7b6c3a5d4cd7
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  You've spent the last few weeks improving significant portions of your application and you're ready to deploy. The maintenance page goes up, the code is pushed, and doubt creeps in as to whether things are actually working. Did you remember to update those third party keys? Is that very clever code your co-worker wrote working as expected? Is there anything different about your production environment that's going to cause things to fail?
6
6
 
7
- As developers we'd all prefer to live in a world where we're continuously deploying all of our test-driven code all the time. In reality, the process typically looks a little broken. Imagine being able to spend a few minutes with your app smoke testing to make sure everything works. With Floodgate in place you are able to provide access to developers, testers, and the product owner to click through and see things work the way they are supposed to before releasing your product to all of your customers.
7
+ As developers we'd all prefer to live in a world where we're continuously deploying all of our test-driven code all the time. In reality, the process typically looks a little broken. Imagine being able to spend a few minutes with your app smoke testing to make sure everything works. With Floodgate in place you are able to provide access to developers, testers, and the product owner to click through and see things work the way they are supposed to <strong>in production</strong> before releasing your product to all of your customers.
8
8
 
9
9
  ## Getting Started
10
10
 
@@ -12,6 +12,10 @@ module Floodgate
12
12
  post('ip_addresses', params)
13
13
  end
14
14
 
15
+ def self.add_my_ip_address
16
+ add_ip_address(my_ip_address)
17
+ end
18
+
15
19
  def self.allowed_ip_addresses
16
20
  status.allowed_ip_addresses
17
21
  end
@@ -22,6 +26,13 @@ module Floodgate
22
26
  put('', params)
23
27
  end
24
28
 
29
+ def self.my_ip_address
30
+ conn = Faraday.new(url: 'http://curlmyip.com/')
31
+ response = conn.get('')
32
+ value = response.body.strip
33
+ IPAddr.new(value, Socket::AF_INET).to_s
34
+ end
35
+
25
36
  def self.open
26
37
  params = { app: { filter_traffic: false } }
27
38
 
@@ -1,3 +1,3 @@
1
1
  module Floodgate
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -31,6 +31,16 @@ namespace :floodgate do
31
31
  puts Floodgate::Client.allowed_ip_addresses
32
32
  end
33
33
 
34
+ desc 'Show my IP Address'
35
+ task :mine do
36
+ puts Floodgate::Client.my_ip_address
37
+ end
38
+
39
+ desc 'Add my IP Address to the list allowed through the floodgate'
40
+ task :add_mine => :environment do
41
+ Floodgate::Client.add_my_ip_address
42
+ end
43
+
34
44
  desc 'Add an IP Address to allow through the floodgate'
35
45
  task :add => :environment do
36
46
  ip_address = ENV['ip_address']
@@ -0,0 +1,31 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://curlmyip.com/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ server:
18
+ - MochiWeb/1.0 (Any of you quaids got a smint?)
19
+ date:
20
+ - Fri, 28 Feb 2014 20:32:56 GMT
21
+ content-type:
22
+ - text/plain
23
+ content-length:
24
+ - '12'
25
+ body:
26
+ encoding: UTF-8
27
+ string: |
28
+ 24.240.74.8
29
+ http_version:
30
+ recorded_at: Fri, 28 Feb 2014 20:34:13 GMT
31
+ recorded_with: VCR 2.8.0
@@ -49,6 +49,15 @@ module Floodgate
49
49
  end
50
50
  end
51
51
 
52
+ describe '.add_my_ip_address' do
53
+ it 'adds my ip address to the list of allowed ip addresses' do
54
+ expect(Client).to receive(:my_ip_address).and_return '1.1.1.1'
55
+ expect(Client).to receive(:add_ip_address).with('1.1.1.1')
56
+
57
+ Client.add_my_ip_address
58
+ end
59
+ end
60
+
52
61
  describe '.allowed_ip_addresses' do
53
62
  let(:ip_address) { '1.1.1.1' }
54
63
 
@@ -68,6 +77,13 @@ module Floodgate
68
77
  end
69
78
  end
70
79
 
80
+ describe '.my_ip_address' do
81
+ it 'is an ip address' do
82
+ ip_address = Client.my_ip_address
83
+ expect { IPAddr.new(ip_address, Socket::AF_INET) }.not_to raise_error
84
+ end
85
+ end
86
+
71
87
  describe '.open' do
72
88
  before { Client.close }
73
89
 
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.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark McEahern
@@ -149,6 +149,7 @@ files:
149
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
150
  - spec/cassettes/Floodgate_Client/_allowed_ip_addresses/returns_the_allowed_ip_addresses.yml
151
151
  - spec/cassettes/Floodgate_Client/_close/changes_filter_traffic_from_false_to_true.yml
152
+ - spec/cassettes/Floodgate_Client/_my_ip_address/is_an_ip_address.yml
152
153
  - spec/cassettes/Floodgate_Client/_open/changes_filter_traffic_from_true_to_false.yml
153
154
  - spec/cassettes/Floodgate_Client/_remove_ip_address/when_an_ip_address_is_specified/removes_it_from_the_list_of_allowed_ip_addresses.yml
154
155
  - spec/cassettes/Floodgate_Client/_set_redirect_url/when_a_redirect_url_is_specified/changes_the_redirect_url.yml
@@ -191,6 +192,7 @@ test_files:
191
192
  - spec/cassettes/Floodgate_Client/_add_ip_address/when_an_ip_address_is_specified/adds_it_to_the_list_of_allowed_ip_addresses.yml
192
193
  - spec/cassettes/Floodgate_Client/_allowed_ip_addresses/returns_the_allowed_ip_addresses.yml
193
194
  - spec/cassettes/Floodgate_Client/_close/changes_filter_traffic_from_false_to_true.yml
195
+ - spec/cassettes/Floodgate_Client/_my_ip_address/is_an_ip_address.yml
194
196
  - spec/cassettes/Floodgate_Client/_open/changes_filter_traffic_from_true_to_false.yml
195
197
  - spec/cassettes/Floodgate_Client/_remove_ip_address/when_an_ip_address_is_specified/removes_it_from_the_list_of_allowed_ip_addresses.yml
196
198
  - spec/cassettes/Floodgate_Client/_set_redirect_url/when_a_redirect_url_is_specified/changes_the_redirect_url.yml