lita-onewheel-aqi 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/onewheel_aqi.rb +10 -7
- data/lita-onewheel-aqi.gemspec +1 -1
- data/spec/lita/handlers/onewheel_aqi_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c5165a40a4ebb7f15ccbf1a61b59df5133db641
|
4
|
+
data.tar.gz: 8ca0e6aa63c63bbf96b00a903cd5c916fe577196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2973472272b235454fb418a3b8e1576104064e77a8dfa4f39aefc16b2863ba39c5accc09a813129609396d4288821e178fd05856d8f98bdedb55c625e0f453d2
|
7
|
+
data.tar.gz: 930de566af10c2ab5b0b587ff8c0cc0b82a5d3503bc48211509a8ba5c43d3b6e0eab5fe41929479688c007938eb1a5808d601787abbe6907866b1d258d50d36d
|
@@ -109,9 +109,11 @@ module Lita
|
|
109
109
|
if config.mode == :irc
|
110
110
|
reply += color_str_with_value(range_str: aqi_range_labels, range_value: aqi['data']['iaqi']['pm25']['v'].to_s)
|
111
111
|
banner_str = "\x03#{colors[:grey]}#{banner_str}\x03"
|
112
|
+
elsif config.mode == :slack
|
113
|
+
reply += color_str_with_value(range_str: aqi_range_labels, range_value: aqi['data']['iaqi']['pm25']['v'].to_s)
|
114
|
+
banner_str = "\x03#{colors[:grey]}#{banner_str}\x03"
|
112
115
|
end
|
113
116
|
|
114
|
-
|
115
117
|
if aqi['data']['iaqi']['pm10']
|
116
118
|
reply += 'pm10: ' + color_str(aqi['data']['iaqi']['pm10']['v'].to_s) + ' '
|
117
119
|
end
|
@@ -133,6 +135,7 @@ module Lita
|
|
133
135
|
banner_str = "(#{aqi['data']['city']['url']})"
|
134
136
|
|
135
137
|
if config.mode == :irc
|
138
|
+
reply += color_str_with_value(range_str: aqi_range_labels, range_value: aqi['data']['iaqi']['pm25']['v'].to_s)
|
136
139
|
banner_str = "\x03#{colors[:grey]}#{banner_str}\x03"
|
137
140
|
end
|
138
141
|
|
@@ -160,13 +163,13 @@ module Lita
|
|
160
163
|
end
|
161
164
|
|
162
165
|
def color_str(str, value = nil)
|
163
|
-
if
|
164
|
-
|
165
|
-
|
166
|
-
end
|
166
|
+
if value.nil?
|
167
|
+
value = str.to_i
|
168
|
+
end
|
167
169
|
|
168
|
-
|
169
|
-
|
170
|
+
aqi_range_colors.keys.each do |color_key|
|
171
|
+
if color_key.cover? value # Super secred cover sauce
|
172
|
+
if config.mode == :irc
|
170
173
|
color = colors[aqi_range_colors[color_key]]
|
171
174
|
str = "\x03#{color}#{str}\x03"
|
172
175
|
end
|
data/lita-onewheel-aqi.gemspec
CHANGED
@@ -36,6 +36,6 @@ describe Lita::Handlers::OnewheelAqi, lita_handler: true do
|
|
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, \
|
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
|