lita-onewheel-forecast-io 1.8.0 → 1.9.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 429dfa682ff7dbbd15315d8c46046f9e556c5d2738efc8f7a52dd516ebf30ced
|
4
|
+
data.tar.gz: 338f7d711135abc03bfe3e46e5d4040273c0a98804a88aea0a7ddd080af87260
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2550e1fd5af98671496f6a6611bb6b8f69bb2d6cddd300892900d6da3303521e4a71437561c3f080f7fad410c391b699ec64167891b3742cb6b3f212ba9622bb
|
7
|
+
data.tar.gz: 23759a74521fbc70062ac61f7d908d99a7694c2f5aae87f004c2b193b8e7524fab2be63fc002226bbb169fd6c677da2a5825d043011879525766014a2f7c0017
|
@@ -291,6 +291,28 @@ module ForecastIo
|
|
291
291
|
"24h cloud cover |#{str}| range #{min * 100}% - #{max * 100}%"
|
292
292
|
end
|
293
293
|
|
294
|
+
def do_the_fog_thing(forecast, chars)
|
295
|
+
key = 'visibility'
|
296
|
+
data_points = []
|
297
|
+
data = forecast['hourly']['data']
|
298
|
+
|
299
|
+
max = 0
|
300
|
+
min = 10
|
301
|
+
|
302
|
+
data.each do |datum|
|
303
|
+
max = datum[key] if datum[key] > max
|
304
|
+
min = datum[key] if datum[key] < min
|
305
|
+
data_points.push (10 - datum[key]).to_f # It's a visibility number, so let's inverse it to give us fog.
|
306
|
+
datum[key] = (10 - datum[key]).to_f # Mod the source data for the get_dot_str call below.
|
307
|
+
end
|
308
|
+
|
309
|
+
differential = data_points.max - data_points.min
|
310
|
+
|
311
|
+
str = get_dot_str(chars, data, data_points.min, differential, key)
|
312
|
+
|
313
|
+
"48h fog report |#{str}| visibility #{min}mi - #{max}mi"
|
314
|
+
end
|
315
|
+
|
294
316
|
def do_the_sunrise_thing(forecast)
|
295
317
|
t = Time.at(fix_time(forecast['daily']['data'][0]['sunriseTime'], forecast['offset']))
|
296
318
|
t.strftime("%H:%M:%S")
|
@@ -125,6 +125,18 @@ module ForecastIo
|
|
125
125
|
response.reply location.location_name + ' ' + do_the_cloud_thing(forecast, ascii_chars)
|
126
126
|
end
|
127
127
|
|
128
|
+
def handle_irc_ansifog(response)
|
129
|
+
location = geo_lookup(response.user, response.match_data[1])
|
130
|
+
forecast = get_forecast_io_results(response.user, location)
|
131
|
+
response.reply location.location_name + ' ' + do_the_fog_thing(forecast, ansi_chars)
|
132
|
+
end
|
133
|
+
|
134
|
+
def handle_irc_asciifog(response)
|
135
|
+
location = geo_lookup(response.user, response.match_data[1])
|
136
|
+
forecast = get_forecast_io_results(response.user, location)
|
137
|
+
response.reply location.location_name + ' ' + do_the_fog_thing(forecast, ascii_chars)
|
138
|
+
end
|
139
|
+
|
128
140
|
def handle_irc_seven_day(response)
|
129
141
|
location = geo_lookup(response.user, response.match_data[1])
|
130
142
|
forecast = get_forecast_io_results(response.user, location)
|
@@ -15,6 +15,7 @@ module Lita
|
|
15
15
|
config :colors
|
16
16
|
config :snowflake, default: '❄'
|
17
17
|
config :default_location, default: 'Portland, OR'
|
18
|
+
config :geocoder_key
|
18
19
|
|
19
20
|
include ::ForecastIo::Constants
|
20
21
|
include ::ForecastIo::IrcHandlers
|
@@ -174,6 +175,12 @@ module Lita
|
|
174
175
|
route(/^ansiclouds*\s*$/i, :handle_irc_ansicloud, command: true)
|
175
176
|
route(/^ansiclouds*\s+(.+)/i, :handle_irc_ansicloud, command: true,
|
176
177
|
help: { '!ansicloud [location]' => '24h cloud cover report for [location].'})
|
178
|
+
route(/^asciifog*\s*$/i, :handle_irc_asciifog, command: true)
|
179
|
+
route(/^asciifog*\s+(.+)/i, :handle_irc_asciifog, command: true,
|
180
|
+
help: { '!ansicloud [location]' => '24h fog/visibility report for [location].'})
|
181
|
+
route(/^ansifog*\s*$/i, :handle_irc_ansifog, command: true)
|
182
|
+
route(/^ansifog*\s+(.+)/i, :handle_irc_ansifog, command: true,
|
183
|
+
help: { '!ansicloud [location]' => '24h fog/visibility report for [location].'})
|
177
184
|
|
178
185
|
# oooOOOoooo
|
179
186
|
route(/^ansiozone\s*$/i, :handle_irc_ansiozone, command: true)
|
data/lib/lita/handlers/utils.rb
CHANGED
@@ -48,6 +48,10 @@ module ForecastIo
|
|
48
48
|
def optimistic_geo_wrapper(query)
|
49
49
|
Lita.logger.debug "Optimistically geo wrapping #{query}!"
|
50
50
|
geocoded = nil
|
51
|
+
# ::Geocoder.configure(
|
52
|
+
# api_key: config.geocoder_key,
|
53
|
+
# timeout: 10
|
54
|
+
# )
|
51
55
|
result = ::Geocoder.search(query)
|
52
56
|
Lita.logger.debug "Geocoder result: '#{result.inspect}'"
|
53
57
|
if result[0]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'lita-onewheel-forecast-io'
|
3
|
-
spec.version = '1.
|
3
|
+
spec.version = '1.9.0'
|
4
4
|
spec.authors = ['Andrew Kreps']
|
5
5
|
spec.email = ['andrew.kreps@gmail.com']
|
6
6
|
spec.description = <<-EOS
|
@@ -30,7 +30,7 @@ EOS
|
|
30
30
|
spec.add_development_dependency 'coveralls', '~> 0.8'
|
31
31
|
|
32
32
|
spec.add_runtime_dependency 'rest-client', '~> 2'
|
33
|
-
spec.add_runtime_dependency 'geocoder', '~> 1.
|
33
|
+
spec.add_runtime_dependency 'geocoder', '~> 1.5'
|
34
34
|
spec.add_runtime_dependency 'multi_json', '~> 1.7'
|
35
35
|
spec.add_runtime_dependency 'magic-eightball', '~> 0.0'
|
36
36
|
spec.add_runtime_dependency 'tzinfo', '~> 1.2'
|
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.
|
4
|
+
version: 1.9.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: 2019-
|
11
|
+
date: 2019-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '1.
|
131
|
+
version: '1.5'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '1.
|
138
|
+
version: '1.5'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: multi_json
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|