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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6dd83076a56a80eb80bc1ff60c6952a74519d2f3
4
- data.tar.gz: 4c9993c1ab28823f63face88678630c49e938074
3
+ metadata.gz: 23c91d51c847bc9965693fbaa088fea626fb5587
4
+ data.tar.gz: 08b47a82d8d1510c1c27cd16845ebbc968672f93
5
5
  SHA512:
6
- metadata.gz: 865775c7a423600f941f4811a80309aa24cb3a6a8315f30f142b579899bb15ddd577d76906b2d8dbeb3ad2ec856cec993eeed62ff16fe7d0a43824298dc009f2
7
- data.tar.gz: 0d2d2bc96c97ef7198cb580cf0ce08d2582efdd568ba6286af6f918177abd2d69ebe3bee9c54c12486175560b20d32f86d3eb7c08d94973558d8d4d21faf20d2
6
+ metadata.gz: 579c1bfb5d9bd7d1daddcfb1b086c85d91851105856f206d01ead39ac852da1aa1cb93f7d7a0ccf6b0a5429600b09d099ca6231ede8685f3dd706a2bea206e48
7
+ data.tar.gz: 6e6086d4239521e45f71d9fd761d0f5d04c2de2e872d5036c572ab7656e6a48eedfef78382bf09d23b48adcfac010283509f5c69a3856853437772b6a17ff9d7
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.2.3
4
+ - 2.1.7
3
5
  - 2.0.0
4
- - 1.9.3
5
- - jruby-19mode
6
6
 
7
- script: rspec spec
7
+ script: rspec spec
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 exception handling for other HTTPClient errors. HttpError has original attribute exposing the root exception.
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
- Refectored and simplfied alert processing.
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
@@ -4,3 +4,4 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'coveralls', require: false
7
+ gem 'simplecov', require: false
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, SocketError
35
- raise HttpError, 'HTTP error while connecting to NWS web service'
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
@@ -1,3 +1,3 @@
1
1
  module Gull
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
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 error occurs' do
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 = 'HTTP error while connecting to NWS web service'
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 = 'HTTP error while connecting to NWS web service'
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
- require 'coveralls'
5
- Coveralls.wear!
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.1
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-06-25 00:00:00.000000000 Z
11
+ date: 2015-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient