gull 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +7 -3
- data/Gemfile +1 -0
- data/lib/gull/client.rb +3 -2
- data/lib/gull/version.rb +1 -1
- data/spec/client_spec.rb +25 -3
- data/spec/spec_helper.rb +7 -2
- 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: 23c91d51c847bc9965693fbaa088fea626fb5587
|
4
|
+
data.tar.gz: 08b47a82d8d1510c1c27cd16845ebbc968672f93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 579c1bfb5d9bd7d1daddcfb1b086c85d91851105856f206d01ead39ac852da1aa1cb93f7d7a0ccf6b0a5429600b09d099ca6231ede8685f3dd706a2bea206e48
|
7
|
+
data.tar.gz: 6e6086d4239521e45f71d9fd761d0f5d04c2de2e872d5036c572ab7656e6a48eedfef78382bf09d23b48adcfac010283509f5c69a3856853437772b6a17ff9d7
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
+
#### 0.3.2 (11/10/2015)
|
2
|
+
Added BadResponseError to client error handling.
|
3
|
+
***
|
1
4
|
#### 0.3.1 (6/25/2015)
|
2
|
-
Added nested
|
5
|
+
Added nested error handling for other HTTPClient errors. HttpError has original attribute exposing the root error.
|
6
|
+
***
|
3
7
|
#### 0.3.0 (6/23/2015)
|
4
8
|
Added Client class for error handling (bad entries accessed via errors array). Exposed option to turn on strict XML parsing for debugging. Alert.fetch uses new Client but is backwards compatible, however it doesn't give you access to errors array.
|
5
|
-
***
|
9
|
+
***
|
6
10
|
#### 0.2.13 (6/20/2015)
|
7
11
|
Handle missing cap section
|
8
12
|
***
|
@@ -22,7 +26,7 @@ Added static map image to polygons.
|
|
22
26
|
Introduced Polygon type.
|
23
27
|
***
|
24
28
|
#### 0.1.1 (10/01/2014)
|
25
|
-
|
29
|
+
Refactored and simplified alert processing.
|
26
30
|
***
|
27
31
|
#### 0.1.0 (10/01/2014)
|
28
32
|
Initial release, basic functionality of fetching and parsing alerts.
|
data/Gemfile
CHANGED
data/lib/gull/client.rb
CHANGED
@@ -31,8 +31,9 @@ module Gull
|
|
31
31
|
return client.get_content @options[:url]
|
32
32
|
rescue HTTPClient::TimeoutError
|
33
33
|
raise TimeoutError, 'Timeout while connecting to NWS web service'
|
34
|
-
rescue HTTPClient::KeepAliveDisconnected,
|
35
|
-
|
34
|
+
rescue HTTPClient::KeepAliveDisconnected, HTTPClient::BadResponseError,
|
35
|
+
SocketError, Errno::ECONNREFUSED
|
36
|
+
raise HttpError, 'Could not connect to NWS web service'
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
data/lib/gull/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -57,25 +57,47 @@ describe Gull::Client do
|
|
57
57
|
expect { client.fetch }.to raise_error(Gull::TimeoutError, message)
|
58
58
|
end
|
59
59
|
|
60
|
-
it 'should raise own error if http
|
60
|
+
it 'should raise own error if http errors occur' do
|
61
61
|
stub_request(:get, 'http://alerts.weather.gov/cap/us.php?x=1')
|
62
62
|
.with(headers: { 'Accept' => '*/*' })
|
63
63
|
.to_raise(HTTPClient::KeepAliveDisconnected)
|
64
64
|
|
65
|
-
message = '
|
65
|
+
message = 'Could not connect to NWS web service'
|
66
66
|
client = Gull::Client.new
|
67
67
|
expect { client.fetch }.to raise_error(Gull::HttpError, message) do |error|
|
68
68
|
expect(error.original).to be_a(HTTPClient::KeepAliveDisconnected)
|
69
69
|
end
|
70
70
|
|
71
|
+
stub_request(:get, 'http://alerts.weather.gov/cap/us.php?x=1')
|
72
|
+
.with(headers: { 'Accept' => '*/*' })
|
73
|
+
.to_raise(HTTPClient::BadResponseError)
|
74
|
+
|
75
|
+
message = 'Could not connect to NWS web service'
|
76
|
+
client = Gull::Client.new
|
77
|
+
expect { client.fetch }.to raise_error(Gull::HttpError, message) do |error|
|
78
|
+
expect(error.original).to be_a(HTTPClient::BadResponseError)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'should raise own error if connection errors occur' do
|
71
83
|
stub_request(:get, 'http://alerts.weather.gov/cap/us.php?x=1')
|
72
84
|
.with(headers: { 'Accept' => '*/*' })
|
73
85
|
.to_raise(SocketError)
|
74
86
|
|
75
|
-
message = '
|
87
|
+
message = 'Could not connect to NWS web service'
|
76
88
|
client = Gull::Client.new
|
77
89
|
expect { client.fetch }.to raise_error(Gull::HttpError, message) do |error|
|
78
90
|
expect(error.original).to be_a(SocketError)
|
79
91
|
end
|
92
|
+
|
93
|
+
stub_request(:get, 'http://alerts.weather.gov/cap/us.php?x=1')
|
94
|
+
.with(headers: { 'Accept' => '*/*' })
|
95
|
+
.to_raise(Errno::ECONNREFUSED)
|
96
|
+
|
97
|
+
message = 'Could not connect to NWS web service'
|
98
|
+
client = Gull::Client.new
|
99
|
+
expect { client.fetch }.to raise_error(Gull::HttpError, message) do |error|
|
100
|
+
expect(error.original).to be_a(Errno::ECONNREFUSED)
|
101
|
+
end
|
80
102
|
end
|
81
103
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
require 'gull'
|
2
|
+
require 'coveralls'
|
3
|
+
require 'simplecov'
|
2
4
|
require 'webmock/rspec'
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
7
|
+
SimpleCov::Formatter::HTMLFormatter,
|
8
|
+
Coveralls::SimpleCov::Formatter
|
9
|
+
]
|
10
|
+
SimpleCov.start
|
6
11
|
|
7
12
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
8
13
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gull
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Deckard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|