carbon 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/carbon.gemspec +1 -1
- data/lib/carbon/emission_estimate/response.rb +1 -1
- data/spec/lib/carbon/emission_estimate/response_spec.rb +4 -5
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -118,7 +118,7 @@ Since this gem connects to a web service, you need to be ready for network probl
|
|
118
118
|
|
119
119
|
begin
|
120
120
|
my_emission = my_car.emission_estimate
|
121
|
-
rescue ::SocketError, ::Timeout::Error, ::Errno::ETIMEDOUT, ::Errno::ENETUNREACH, ::Errno::ECONNRESET, ::Errno::ECONNREFUSED
|
121
|
+
rescue ::SocketError, ::EOFError, ::Timeout::Error, ::Errno::ETIMEDOUT, ::Errno::ENETUNREACH, ::Errno::ECONNRESET, ::Errno::ECONNREFUSED
|
122
122
|
# These are general network errors raised by Net::HTTP.
|
123
123
|
# Your internet connection might be down, or our servers might be down.
|
124
124
|
rescue ::Carbon::RateLimited
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.7
|
data/carbon.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{carbon}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Derek Kastner", "Seamus Abshere", "Andy Rossmeissl"]
|
@@ -21,7 +21,7 @@ module Carbon
|
|
21
21
|
begin
|
22
22
|
response = perform
|
23
23
|
raise ::Carbon::RateLimited if response.status_code == 403 and response.body =~ /Rate Limit/i #TODO: Should we expect an HTTP 402: payment required, instead?
|
24
|
-
rescue ::Carbon::RateLimited
|
24
|
+
rescue ::Carbon::RateLimited
|
25
25
|
if attempts < 4
|
26
26
|
attempts += 1
|
27
27
|
sleep 0.2 * attempts
|
@@ -21,14 +21,13 @@ describe Carbon::EmissionEstimate::Response do
|
|
21
21
|
response.send :load_realtime_data
|
22
22
|
end
|
23
23
|
|
24
|
-
it 'should
|
24
|
+
it 'should not rescue from generic network errors' do
|
25
25
|
response.should_receive(:perform).once.ordered.
|
26
26
|
and_raise EOFError
|
27
|
-
response.should_receive(:perform).once.ordered.
|
28
|
-
and_return rest_response
|
29
27
|
|
30
|
-
|
28
|
+
lambda {
|
29
|
+
response.send :load_realtime_data
|
30
|
+
}.should raise_error EOFError
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carbon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 7
|
10
|
+
version: 0.2.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Derek Kastner
|