lita-onewheel-forecast-io 1.13.1 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 132b9048f18c511b0eeb2972a6538852ac1429452a5f67ba12a562de12e77bce
4
- data.tar.gz: 5e0889998137118390df5677d9a5f9c64071855df22ed68cb56807eb580d40ee
3
+ metadata.gz: 1fdae8b2d14e6dc665f207ec7152e03fbf5137e6728df014e80fdb35fae91481
4
+ data.tar.gz: cf805995e767267d922da9a5396e4da62d9ba3c98c59d77bab5d79b23bf0903e
5
5
  SHA512:
6
- metadata.gz: 6207a620b70030ccc8e13e510835552f6c3253111f4d3efe856dcb056138f589e53035e4f7ee5e129f24b3a29b6aa8c389e7a0e62c256f03ec186013f47a2cbd
7
- data.tar.gz: b32b71dab4b2bafc4092b16f0d7b98127dec7c57c64d8503ec5334ca65a3d95148e750da92c8ada1ee674a132f54648c2424b982d0c47a97a2758564e81cafe7
6
+ metadata.gz: 1a39bd141c58b8c5ba9bad0008d856373238800af8de19c812075265a063a3946ba74be6900db3c947dbef2cb7cd4b09a5e20e482163a2099a62311a06cbb34c
7
+ data.tar.gz: 1bdb7b243ab11869cc9a6952d68de2947380963e8b1a3afe7bd56a13b8caed938d9ea4016e5d0d952706a09e8be365512db548c647d25d3a7ea69f00fb9723cb
@@ -141,24 +141,28 @@ module ForecastIo
141
141
  end
142
142
 
143
143
  def ansi_temp_forecast(forecast, hours = 24)
144
- str, temperature_data = do_the_temp_thing(forecast, ansi_chars, hours)
144
+ str, temperature_data = do_the_temp_thing(forecast, 'temperature', ansi_chars, hours)
145
145
  "#{hours} hr temps: #{get_temperature temperature_data.first.round(1)} |#{str}| #{get_temperature temperature_data.last.round(1)} Range: #{get_temperature temperature_data.min.round(1)} - #{get_temperature temperature_data.max.round(1)}"
146
146
  end
147
147
 
148
+ def ansi_temp_apparent_forecast(forecast, hours = 24)
149
+ str, temperature_data = do_the_temp_thing(forecast, 'apparentTemperature', ansi_chars, hours)
150
+ "#{hours} hr apparent temps: #{get_temperature temperature_data.first.round(1)} |#{str}| #{get_temperature temperature_data.last.round(1)} Range: #{get_temperature temperature_data.min.round(1)} - #{get_temperature temperature_data.max.round(1)}"
151
+ end
152
+
148
153
  def ansi_windchill_forecast(forecast, hours = 24)
149
154
  str, temperature_data = do_the_windchill_temp_thing(forecast, ansi_chars, hours)
150
155
  "#{hours} hr windchill temps: #{get_temperature temperature_data.first.round(1)} |#{str}| #{get_temperature temperature_data.last.round(1)} Range: #{get_temperature temperature_data.min.round(1)} - #{get_temperature temperature_data.max.round(1)}"
151
156
  end
152
157
 
153
158
  def ascii_temp_forecast(forecast, hours = 24)
154
- str, temperature_data = do_the_temp_thing(forecast, ascii_chars, hours)
159
+ str, temperature_data = do_the_temp_thing(forecast, 'temperature', ascii_chars, hours)
155
160
  "#{hours} hr temps: #{get_temperature temperature_data.first.round(1)} |#{str}| #{get_temperature temperature_data.last.round(1)} Range: #{get_temperature temperature_data.min.round(1)} - #{get_temperature temperature_data.max.round(1)}"
156
161
  end
157
162
 
158
- def do_the_temp_thing(forecast, chars, hours)
163
+ def do_the_temp_thing(forecast, key, chars, hours)
159
164
  temps = []
160
165
  data = forecast['hourly']['data'].slice(0,hours - 1)
161
- key = 'temperature'
162
166
 
163
167
  data.each_with_index do |datum, index|
164
168
  temps.push datum[key]
@@ -337,7 +341,7 @@ module ForecastIo
337
341
  end
338
342
 
339
343
  def conditions(forecast)
340
- temp_str, temps = do_the_temp_thing(forecast, ansi_chars, 8)
344
+ temp_str, temps = do_the_temp_thing(forecast, 'temperature', ansi_chars, 8)
341
345
  wind_str, winds = do_the_wind_direction_thing(forecast, ansi_wind_arrows, 8)
342
346
  rain_str, rains = do_the_rain_chance_thing(forecast, ansi_chars, 'precipProbability', config.colors, 15)
343
347
 
@@ -45,6 +45,12 @@ module ForecastIo
45
45
  response.reply location.location_name + ' ' + ansi_temp_forecast(forecast)
46
46
  end
47
47
 
48
+ def handle_irc_ansitempapparent(response)
49
+ location = geo_lookup(response.user, response.match_data[1])
50
+ forecast = get_forecast_io_results(response.user, location)
51
+ response.reply location.location_name + ' ' + ansi_temp_forecast(forecast)
52
+ end
53
+
48
54
  def handle_irc_ansiwindchill(response)
49
55
  location = geo_lookup(response.user, response.match_data[1])
50
56
  forecast = get_forecast_io_results(response.user, location)
@@ -77,17 +83,15 @@ module ForecastIo
77
83
  end
78
84
 
79
85
  def handle_irc_ansiwind(response)
80
- response.reply "Sorry, darksky's api lies about wind now. Try the main interface at https://darksky.net"
81
- # location = geo_lookup(response.user, response.match_data[1])
82
- # forecast = get_forecast_io_results(response.user, location)
83
- # response.reply location.location_name + ' ' + ansi_wind_direction_forecast(forecast)
86
+ location = geo_lookup(response.user, response.match_data[1])
87
+ forecast = get_forecast_io_results(response.user, location)
88
+ response.reply location.location_name + ' ' + ansi_wind_direction_forecast(forecast)
84
89
  end
85
90
 
86
91
  def handle_irc_ascii_wind(response)
87
- response.reply "Sorry, darksky's api lies about wind now. Try the main interface at https://darksky.net"
88
- # location = geo_lookup(response.user, response.match_data[1])
89
- # forecast = get_forecast_io_results(response.user, location)
90
- # response.reply location.location_name + ' ' + ascii_wind_direction_forecast(forecast)
92
+ location = geo_lookup(response.user, response.match_data[1])
93
+ forecast = get_forecast_io_results(response.user, location)
94
+ response.reply location.location_name + ' ' + ascii_wind_direction_forecast(forecast)
91
95
  end
92
96
 
93
97
  def handle_irc_alerts(response)
@@ -158,10 +162,9 @@ module ForecastIo
158
162
  end
159
163
 
160
164
  def handle_irc_daily_wind(response)
161
- response.reply "Sorry, darksky's api lies about wind now. Try the main interface at https://darksky.net"
162
- # location = geo_lookup(response.user, response.match_data[1])
163
- # forecast = get_forecast_io_results(response.user, location)
164
- # response.reply location.location_name + ' ' + do_the_daily_wind_thing(forecast)
165
+ location = geo_lookup(response.user, response.match_data[1])
166
+ forecast = get_forecast_io_results(response.user, location)
167
+ response.reply location.location_name + ' ' + do_the_daily_wind_thing(forecast)
165
168
  end
166
169
 
167
170
  def handle_irc_daily_humidity(response)
@@ -26,6 +26,9 @@ module Lita
26
26
  route(/^ansitemp\s*$/i, :handle_irc_ansitemp, command: true)
27
27
  route(/^ansitemp\s+(.+)/i, :handle_irc_ansitemp, command: true,
28
28
  help: {'!ansitemp [location]' => 'The 24h temperature scale for [location].'})
29
+ route(/^ansitempapparent\s*$/i, :handle_irc_ansitempapparent, command: true)
30
+ route(/^ansitempapparent\s+(.+)/i, :handle_irc_ansitempapparent, command: true,
31
+ help: {'!ansitemp [location]' => 'The 24h temperature scale for [location].'})
29
32
  route(/^dailytemp\s*$/i, :handle_irc_daily_temp, command: true)
30
33
  route(/^dailytemp\s+(.+)/i, :handle_irc_daily_temp, command: true,
31
34
  help: { '!dailytemp [location]' => '48h temperature scale for [location].'})
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-forecast-io'
3
- spec.version = '1.13.1'
3
+ spec.version = '1.14.0'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = <<-EOS
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-forecast-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.1
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-09 00:00:00.000000000 Z
11
+ date: 2019-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  - !ruby/object:Gem::Version
235
235
  version: '0'
236
236
  requirements: []
237
- rubygems_version: 3.1.2
237
+ rubygems_version: 3.0.1
238
238
  signing_key:
239
239
  specification_version: 4
240
240
  summary: A text-based interactive query engine for http://forecast.io's api.