lita-onewheel-aqi 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lita/handlers/onewheel_aqi.rb +14 -16
- data/lita-onewheel-aqi.gemspec +1 -1
- data/spec/lita/handlers/onewheel_aqi_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25cb69df45c7bd8c1a657028f5a645999200515e
|
4
|
+
data.tar.gz: 4d9718528a49a36750afd0c2802103214205b779
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f9f4ec9cf44d6970e07ed1e5846cd3d8dc4719d4372532c9c3025fbccaca3cd5fd5af791c93e0e45b14e2f407205f1a3dbf00ce1719a0681fe82e13ce0a181b
|
7
|
+
data.tar.gz: a05302136468af137321c950f1808953777b99bbeff85f7ad1e26d326181f2e28517bee1e263bf586882af07e9d1dbeffe1c1689dc6c3c86873b6354568a751c
|
@@ -130,7 +130,9 @@ module Lita
|
|
130
130
|
reply += 'pm10: ' + color_str(aqi['data']['iaqi']['pm10']['v'].to_s) + ' '
|
131
131
|
end
|
132
132
|
|
133
|
-
|
133
|
+
updated_at = Time.parse aqi['data']['time']['s']
|
134
|
+
|
135
|
+
reply += "updated #{updated_at.strftime("%H:%M %-m/%-d/%y")} #{banner_str}"
|
134
136
|
|
135
137
|
response.reply reply
|
136
138
|
end
|
@@ -172,16 +174,13 @@ module Lita
|
|
172
174
|
end
|
173
175
|
|
174
176
|
def color_str(str, value = nil)
|
175
|
-
if value.nil?
|
176
|
-
value = str.to_i
|
177
|
-
end
|
177
|
+
value = str.to_i if value.nil?
|
178
178
|
|
179
179
|
aqi_range_colors.keys.each do |color_key|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
end
|
180
|
+
next unless color_key.cover? value # Super secred cover sauce
|
181
|
+
if config.mode == :irc
|
182
|
+
color = colors[aqi_range_colors[color_key]]
|
183
|
+
str = "\x03#{color}#{str}\x03"
|
185
184
|
end
|
186
185
|
end
|
187
186
|
|
@@ -191,13 +190,12 @@ module Lita
|
|
191
190
|
def color_str_with_value(range_str:, range_value:)
|
192
191
|
str = nil
|
193
192
|
aqi_range_colors.keys.each do |color_key|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
end
|
193
|
+
next unless color_key.cover? range_value.to_i # Super secred cover sauce
|
194
|
+
color = colors[aqi_range_colors[color_key]]
|
195
|
+
if config.mode == :irc
|
196
|
+
str = "#{aqi_irc_emoji[color_key]} \x03#{color}#{range_str[color_key]}\x03 #{aqi_irc_emoji[color_key]} "
|
197
|
+
elsif config.mode == :slack
|
198
|
+
str = "#{aqi_slack_emoji[color_key]} #{range_str[color_key]} #{aqi_slack_emoji[color_key]} "
|
201
199
|
end
|
202
200
|
end
|
203
201
|
|
data/lita-onewheel-aqi.gemspec
CHANGED
@@ -31,11 +31,11 @@ describe Lita::Handlers::OnewheelAqi, lita_handler: true do
|
|
31
31
|
|
32
32
|
it 'queries the aqi' do
|
33
33
|
send_command 'aqi'
|
34
|
-
expect(replies.last).to include("AQI for Portland, OR, USA,
|
34
|
+
expect(replies.last).to include("AQI for Portland, OR, USA, ⚠️ 08Moderate ⚠️ pm25: 0876 pm10: 0340 updated 15:00 8/11/17 14(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)")
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'queries the aqideets' do
|
38
38
|
send_command 'aqideets'
|
39
|
-
expect(replies.last).to eq("AQI for Portland, OR, USA, \u000308Moderate\u0003 humidity: 11% pressure: 1014mb pm10: \u00030340\u0003 pm25: \u00030876\u0003 temp: 34.65C \u000314(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)\u0003")
|
39
|
+
expect(replies.last).to eq("AQI for Portland, OR, USA, ⚠️ \u000308Moderate\u0003 ⚠️ humidity: 11% pressure: 1014mb pm10: \u00030340\u0003 pm25: \u00030876\u0003 temp: 34.65C \u000314(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)\u0003")
|
40
40
|
end
|
41
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-onewheel-aqi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kreps
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|