wthr 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/wthr/cli.rb +5 -4
  2. data/lib/wthr/version.rb +1 -1
  3. metadata +2 -2
data/lib/wthr/cli.rb CHANGED
@@ -24,8 +24,10 @@ module Wthr
24
24
 
25
25
  desc "forecast [LOCATION]", "fetch and print the current forecast for the location provided for the number of days provided. Defaults to 3 days for location determined by IP."
26
26
  def forecast(location='autoip')
27
+ days_txt = []
27
28
  load_data(location)
28
- days_txt = @forecast_and_conditions.forecast.txt_forecast.forecastday
29
+ days = @forecast_and_conditions.forecast.txt_forecast.forecastday
30
+ days.each_with_index { |d, i| days_txt << d if i%2 == 0 }
29
31
  days_data = @forecast_and_conditions.forecast.simpleforecast.forecastday
30
32
 
31
33
  puts format_forecast(days_txt, days_data)
@@ -43,7 +45,7 @@ module Wthr
43
45
  unless @forecast_and_conditions
44
46
  @dev_key ||= YAML.load_file(CONFIG_FILE)[:key]
45
47
  w = RbWunderground::Base.new(@dev_key)
46
- @forecast_and_conditions = w.forecast_and_conditions(location)
48
+ @forecast_and_conditions = w.forecast10day_and_conditions(location)
47
49
  end
48
50
 
49
51
  @location = location_for(@forecast_and_conditions.current_observation)
@@ -56,8 +58,7 @@ module Wthr
56
58
 
57
59
  def format_forecast(days_txt, data)
58
60
  f = "Forecast for #{@location}\n"
59
- days_txt.each_with_index do |day, index|
60
- i = (index/2).floor
61
+ days_txt.each_with_index do |day, i|
61
62
  f << "#{day.title.underline} (High: #{high_temp(data[i])}, Low: #{low_temp(data[i])})\n"
62
63
  f << day.fcttext << "\n"
63
64
  end
data/lib/wthr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wthr
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wthr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-16 00:00:00.000000000 Z
12
+ date: 2012-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb_wunderground