epa_uv_index 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/epa_uv_index.gemspec +1 -1
- data/lib/epa_uv_index/version.rb +1 -1
- data/lib/epa_uv_index.rb +1 -1
- data/spec/client_spec.rb +12 -0
- metadata +2 -2
data/epa_uv_index.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["greg@shelrick.com"]
|
11
11
|
gem.description = %q{Ruby client library for accessing the U.S. EPA's UV Index API (http://www.epa.gov/enviro/facts/services.html#uvindex)'}
|
12
12
|
gem.summary = %q{Get UV Index values by daily and hourly for zip code or city/state}
|
13
|
-
gem.homepage = ""
|
13
|
+
gem.homepage = "http://github.com/GSA-OCSIT/epa_uv_index"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/epa_uv_index/version.rb
CHANGED
data/lib/epa_uv_index.rb
CHANGED
@@ -27,7 +27,7 @@ module EpaUvIndex
|
|
27
27
|
protected
|
28
28
|
|
29
29
|
def self.do_request(base_url, params)
|
30
|
-
raise
|
30
|
+
raise "Please provide either a city/state or a zip code." unless params[:zip] or (params[:city] and params[:state])
|
31
31
|
request_url = build_request_url(base_url, params)
|
32
32
|
http_response = HTTParty.get(request_url)
|
33
33
|
begin
|
data/spec/client_spec.rb
CHANGED
@@ -4,6 +4,12 @@ describe EpaUvIndex::Client do
|
|
4
4
|
|
5
5
|
describe "#daily_for" do
|
6
6
|
context "when querying for a daily UV index for a zip code" do
|
7
|
+
context "when neither a zip nor a city/state are passed as parameters" do
|
8
|
+
it "should raise an exception" do
|
9
|
+
lambda { EpaUvIndex::Client.daily_for(:city => 'Baltimore')}.should raise_error "Please provide either a city/state or a zip code."
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
7
13
|
context "when the response is good" do
|
8
14
|
before do
|
9
15
|
response = mock(Object)
|
@@ -100,6 +106,12 @@ describe EpaUvIndex::Client do
|
|
100
106
|
end
|
101
107
|
|
102
108
|
describe "#hourly_for" do
|
109
|
+
context "when neither a zip nor a city/state are passed as parameters" do
|
110
|
+
it "should raise an exception" do
|
111
|
+
lambda { EpaUvIndex::Client.hourly_for(:city => 'Baltimore')}.should raise_error "Please provide either a city/state or a zip code."
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
103
115
|
context "when querying for an hourly UV index for a zip code" do
|
104
116
|
context "when the response is good" do
|
105
117
|
before do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epa_uv_index
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -29,7 +29,7 @@ files:
|
|
29
29
|
- lib/epa_uv_index/version.rb
|
30
30
|
- spec/client_spec.rb
|
31
31
|
- spec/spec_helper.rb
|
32
|
-
homepage:
|
32
|
+
homepage: http://github.com/GSA-OCSIT/epa_uv_index
|
33
33
|
licenses: []
|
34
34
|
post_install_message:
|
35
35
|
rdoc_options: []
|