wthr 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wthr/cli.rb +18 -2
- data/lib/wthr/version.rb +1 -1
- metadata +1 -1
data/lib/wthr/cli.rb
CHANGED
@@ -33,13 +33,21 @@ module Wthr
|
|
33
33
|
puts format_forecast(days_txt, days_data)
|
34
34
|
end
|
35
35
|
|
36
|
-
desc "
|
37
|
-
def
|
36
|
+
desc "current [LOCATION]", "fetch and print the current conditions for [LOCATION]"
|
37
|
+
def current(location='autoip')
|
38
38
|
load_data(location)
|
39
39
|
current_conditions = @forecast_and_conditions.current_observation
|
40
40
|
puts format_current_conditions(current_conditions)
|
41
41
|
end
|
42
42
|
|
43
|
+
desc "temps [LOCATION]", "fetch and print the just the highs / lows for the next 10 days"
|
44
|
+
def temps(location='autoip')
|
45
|
+
load_data(location)
|
46
|
+
days = @forecast_and_conditions.forecast.simpleforecast.forecastday
|
47
|
+
|
48
|
+
puts format_temps(days)
|
49
|
+
end
|
50
|
+
|
43
51
|
private
|
44
52
|
def load_data(location)
|
45
53
|
unless @forecast_and_conditions
|
@@ -65,6 +73,14 @@ module Wthr
|
|
65
73
|
f
|
66
74
|
end
|
67
75
|
|
76
|
+
def format_temps(days)
|
77
|
+
t = "High / Low Temps for #{@location}\n"
|
78
|
+
days.each do |day|
|
79
|
+
t << "#{day.date.weekday_short.underline} (High: #{high_temp(day)}, Low: #{low_temp(day)})\n"
|
80
|
+
end
|
81
|
+
t
|
82
|
+
end
|
83
|
+
|
68
84
|
def location_for(conditions)
|
69
85
|
loc = ""
|
70
86
|
country = conditions.display_location.country
|
data/lib/wthr/version.rb
CHANGED