undergroundweather 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,9 +1,31 @@
1
1
  # Underground Weather
2
+ http://www.wunderground.com/weather/api/d/documentation.html
2
3
 
3
4
  ## Usage
4
5
 
6
+ Implemented Endpoints
7
+
8
+ * conditions - Returns the current temperature, weather condition, humidity, wind, 'feels like' temperature, barometric pressure, and visibility.
9
+ * forecast - Returns a summary of the weather for the next 3 days. This includes high and low temperatures, a string text forecast and the conditions.
10
+ * astronomy - Returns The moon phase, sunrise and sunset times.
11
+ * radar - Returns a URL link to the .gif radar image.
12
+ * satellite - Returns a URL link to .gif visual and infrared satellite images.
13
+ * webcams - Returns locations of nearby Personal Weather Stations and URL's for images from their web cams.
14
+
15
+ ```
16
+ gem install undergroundweather
17
+ api_key = 'xxxxxxxx' # Your WU API Key
18
+ uw = UndergroundWeather.new(api_key)
19
+
20
+ zip_code = 19106
21
+ uw.<endpoint>(zip_code) # conditions, forecast, astronomy, etc...
22
+ ```
23
+
5
24
  ## Development
6
25
 
26
+ ### ToDo
27
+ https://github.com/brookemckim/undergroundweather/issues?labels=Story&sort=created&direction=desc&state=open&page=1
28
+
7
29
  ### Testing
8
30
  Using minitest/spec
9
31
 
@@ -15,7 +15,7 @@ module UndergroundWeather
15
15
  @error = false
16
16
 
17
17
  @response = JSON.parse(get)
18
- @error = true if @response['error']
18
+ @error = true if @response['response']['error']
19
19
  end
20
20
 
21
21
  def url
@@ -23,14 +23,14 @@ module UndergroundWeather
23
23
  end
24
24
 
25
25
  def get
26
- puts "Calling #{url}"
27
26
  resp = Net::HTTP.get_response(url)
28
27
 
29
28
  if resp.code == "200"
30
29
  resp.body
31
30
  else
32
- puts "error retrieving weather feed"
33
31
  @error = true
32
+
33
+ # raise exception here
34
34
  {}
35
35
  end
36
36
  end
@@ -7,23 +7,24 @@ module UndergroundWeather
7
7
  :astronomy => { :class => Astronomy },
8
8
  :radar => { :class => Radar },
9
9
  :satellite => { :class => Satellite },
10
- :webcams => { :class => Webcams },
11
- :history => { :class => ''},
12
- :alerts => { :class => ''},
13
- :hourly => { :class => ''},
14
- :hourly7day => { :class => ''},
15
- :forecast7day => { :class => ''},
16
- :yesterday => { :class => ''}
10
+ :webcams => { :class => Webcams }
11
+ #:history => { :class => ''},
12
+ #:alerts => { :class => ''},
13
+ #:hourly => { :class => ''},
14
+ #:hourly7day => { :class => ''},
15
+ #:forecast7day => { :class => ''},
16
+ #:yesterday => { :class => ''}
17
17
  }
18
18
 
19
19
  features.each do |feature, v|
20
20
  define_method(feature) do |zip_code|
21
21
  call = ApiCall.new(@api_key, feature, zip_code)
22
+
22
23
  if call.response && !call.error
23
24
  v[:class].new(call.response)
24
25
  else
25
- #?
26
- "error"
26
+ # raise exception here
27
+ []
27
28
  end
28
29
  end
29
30
  end
@@ -8,7 +8,6 @@ module UndergroundWeather
8
8
  days << DailyForecast.new(daily)
9
9
  end
10
10
 
11
- puts days.inspect
12
11
  days.each do |d|
13
12
  instance_variable_set("@#{d.day.downcase}", d)
14
13
  end
@@ -1,3 +1,3 @@
1
1
  module UndergroundWeather
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,8 +1,8 @@
1
1
  require './specs/helper'
2
2
 
3
3
  describe UndergroundWeather do
4
- it "instaniate Client on new" do
4
+ it "instaniates Client on self.new" do
5
5
  uw = UndergroundWeather.new("a")
6
6
  uw.must_be_instance_of(UndergroundWeather::Client)
7
- end
7
+ end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: undergroundweather
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: