lita-onewheel-aqi 2.1.0 → 2.1.1
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 -4
- data/lita-onewheel-aqi.gemspec +1 -1
- data/spec/lita/handlers/onewheel_aqi_spec.rb +27 -0
- 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: bd42fe10321b5bcd555261d6642bbfb203cd0714
|
4
|
+
data.tar.gz: 8967a18a944bca6647a6d92c828357e2428539b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d94d0c185392f7773f1b69dbd7c061ed1b354743759755758a339345b86d59537b6df150b58f2217d24e7bc4066de23745d636c294d0394cb9105b7f5a51d3a8
|
7
|
+
data.tar.gz: f1c6ca55877c3ca0d325d820e1babadf63a7aff62bdd894c4526e51d0d4b216ffa29e48d01c240493237d79d93cfdcd837252ee0b796cabd44c2df4845248df0
|
@@ -17,14 +17,20 @@ module Lita
|
|
17
17
|
route /^aqi$/i,
|
18
18
|
:get_aqi,
|
19
19
|
command: true
|
20
|
-
route /^aqideets
|
20
|
+
route /^aqideets$/i,
|
21
21
|
:get_aqi_deets,
|
22
22
|
command: true,
|
23
23
|
help: { '!aqideets [location]' => 'Gives you moar datas.' }
|
24
|
-
route /^
|
24
|
+
route /^aqideets\s+(.*)$/i,
|
25
|
+
:get_aqi_deets,
|
26
|
+
command: true
|
27
|
+
route /^aqidetails\s+(.*)$/i,
|
25
28
|
:get_aqi_deets,
|
26
29
|
command: true,
|
27
|
-
help: { '!
|
30
|
+
help: { '!aqidetails [location]' => 'Gives you moar datas.' }
|
31
|
+
route /^aqidetails$/i,
|
32
|
+
:get_aqi_deets,
|
33
|
+
command: true
|
28
34
|
|
29
35
|
# IRC colors.
|
30
36
|
def colors
|
@@ -88,7 +94,7 @@ module Lita
|
|
88
94
|
def get_location(response, persist = true)
|
89
95
|
user = response.user
|
90
96
|
query = nil
|
91
|
-
if response.matches[0].is_a?(Array) and response.matches[0].empty?
|
97
|
+
if response.matches[0].is_a?(Array) and !response.matches[0].empty?
|
92
98
|
query = response.matches[0][0]
|
93
99
|
end
|
94
100
|
|
data/lita-onewheel-aqi.gemspec
CHANGED
@@ -30,6 +30,23 @@ describe Lita::Handlers::OnewheelAqi, lita_handler: true do
|
|
30
30
|
}
|
31
31
|
}]
|
32
32
|
)
|
33
|
+
|
34
|
+
Geocoder::Lookup::Test.add_stub(
|
35
|
+
'Beaverton', [{
|
36
|
+
'formatted_address' => 'Beaverton, OR, USA',
|
37
|
+
'geometry' => {
|
38
|
+
'location' => {
|
39
|
+
'lat' => 45.523452,
|
40
|
+
'lng' => -122.976207,
|
41
|
+
'address' => 'Beaverton, OR, USA',
|
42
|
+
'state' => 'Oregon',
|
43
|
+
'state_code' => 'OR',
|
44
|
+
'country' => 'United States',
|
45
|
+
'country_code' => 'US'
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}]
|
49
|
+
)
|
33
50
|
end
|
34
51
|
|
35
52
|
it 'queries the aqi' do
|
@@ -41,4 +58,14 @@ describe Lita::Handlers::OnewheelAqi, lita_handler: true do
|
|
41
58
|
send_command 'aqideets'
|
42
59
|
expect(replies.last).to eq("AQI for Portland, OR, USA, ⚠️ 08Moderate ⚠️ humidity: 11% pressure: 1014mb pm25: 0876 µg/m³(est): 23.99 pm10: 0340 temp: 34.65C updated 0860 minutes ago. 14(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)")
|
43
60
|
end
|
61
|
+
|
62
|
+
it 'queries the aqi by location' do
|
63
|
+
send_command 'aqi Beaverton'
|
64
|
+
expect(replies.last).to include("AQI for Beaverton, OR, USA, ⚠️ 08Moderate ⚠️ pm25: 0876 µg/m³(est): 23.99 pm10: 0340 updated 0860 minutes ago. 14(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)")
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'queries the aqideets' do
|
68
|
+
send_command 'aqideets Beaverton'
|
69
|
+
expect(replies.last).to eq("AQI for Beaverton, OR, USA, ⚠️ 08Moderate ⚠️ humidity: 11% pressure: 1014mb pm25: 0876 µg/m³(est): 23.99 pm10: 0340 temp: 34.65C updated 0860 minutes ago. 14(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)")
|
70
|
+
end
|
44
71
|
end
|