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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18a828b5b2257a136b9266c7a8156bb528980302
4
- data.tar.gz: b624f8d89a548f2114fb37f1815024cfb1ed3d76
3
+ metadata.gz: bd42fe10321b5bcd555261d6642bbfb203cd0714
4
+ data.tar.gz: 8967a18a944bca6647a6d92c828357e2428539b5
5
5
  SHA512:
6
- metadata.gz: 7376eaeb124011ddaf21330d44aa656bd789cfdb3c6f68962d07c9689ae6b4623ba3a2d28b2193f61680d82784bbdd1013078d9c9eb89f8176aef56824db6d83
7
- data.tar.gz: 49b4cb8dfcd24c89acd95802fe1d6629f5699758879abe981cfb14aa3827c07d424e9427f83fee9c079a0fcd2db26f97b353d00b0612b9fc471cc0f3b275852d
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\s*(.*)$/i,
20
+ route /^aqideets$/i,
21
21
  :get_aqi_deets,
22
22
  command: true,
23
23
  help: { '!aqideets [location]' => 'Gives you moar datas.' }
24
- route /^aqidetails\s*(.*)$/i,
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: { '!aqideets [location]' => 'Gives you moar datas.' }
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
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-aqi'
3
- spec.version = '2.1.0'
3
+ spec.version = '2.1.1'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = 'AQI data retrieval bot'
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-aqi
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps