lita-onewheel-aqi 2.1.1 → 2.2.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
  SHA1:
3
- metadata.gz: bd42fe10321b5bcd555261d6642bbfb203cd0714
4
- data.tar.gz: 8967a18a944bca6647a6d92c828357e2428539b5
3
+ metadata.gz: 81483fb89281d2c410eb52a8c5b11e25a97b5411
4
+ data.tar.gz: 4f69cadf2b60299e30d8bb84f854c40b8c8cd63a
5
5
  SHA512:
6
- metadata.gz: d94d0c185392f7773f1b69dbd7c061ed1b354743759755758a339345b86d59537b6df150b58f2217d24e7bc4066de23745d636c294d0394cb9105b7f5a51d3a8
7
- data.tar.gz: f1c6ca55877c3ca0d325d820e1babadf63a7aff62bdd894c4526e51d0d4b216ffa29e48d01c240493237d79d93cfdcd837252ee0b796cabd44c2df4845248df0
6
+ metadata.gz: fd3edb80b9d3c0d47586938bbbdd19ad52f293ea0d5a06f3dbe1c9dd8db5e1ff6185e50d6ad5e571daef8ae6c37813aa685988ee2e185019fec93ac488256de6
7
+ data.tar.gz: c43e5d86aad791eba3064201a81821949622d4b8d5b903f72dc70ea7e3978cb07c8b8a8206aa3f260e65da24b221f1751ac618d6614a2eb9edf66fda67c01256
@@ -59,7 +59,7 @@ module Lita
59
59
  101..150 => :orange,
60
60
  151..200 => :red,
61
61
  201..300 => :purple,
62
- 301..500 => :pink }
62
+ 301..999 => :pink }
63
63
  end
64
64
 
65
65
  def aqi_range_labels
@@ -68,7 +68,7 @@ module Lita
68
68
  101..150 => 'Unhealthy for Sensitive Groups',
69
69
  151..200 => 'Unhealthy for All',
70
70
  201..300 => 'Very Unhealthy',
71
- 301..500 => 'Hazardous' }
71
+ 301..999 => 'Hazardous' }
72
72
  end
73
73
 
74
74
  def aqi_slack_emoji
@@ -77,7 +77,7 @@ module Lita
77
77
  101..150 => ':large_orange_diamond:',
78
78
  151..200 => ':no_entry_sign:',
79
79
  201..300 => ':radioactive_sign:',
80
- 301..500 => ':no_entry_sign: :radioactive_sign: :no_entry_sign:' }
80
+ 301..999 => ':no_entry_sign: :radioactive_sign: :no_entry_sign:' }
81
81
  end
82
82
 
83
83
  def aqi_irc_emoji
@@ -86,7 +86,7 @@ module Lita
86
86
  101..150 => '🔶',
87
87
  151..200 => '🚫',
88
88
  201..300 => '☣️',
89
- 301..500 => '🚫☣🚫' }
89
+ 301..999 => '🚫☣🚫' }
90
90
  end
91
91
 
92
92
  # Perform a geocoder lookup based on a) the query or b) the user's serialized state.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-aqi'
3
- spec.version = '2.1.1'
3
+ spec.version = '2.2.0'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = 'AQI data retrieval bot'
@@ -0,0 +1,63 @@
1
+ {
2
+ "status": "ok",
3
+ "data": {
4
+ "aqi": 875,
5
+ "idx": 2555,
6
+ "attributions": [
7
+ {
8
+ "url": "http://dpccairdata.com/",
9
+ "name": "Delhi Pollution Control Commitee (Government of NCT of Delhi)"
10
+ },
11
+ {
12
+ "url": "http://cpcb.nic.in/",
13
+ "name": "CPCB - India Central Pollution Control Board"
14
+ }
15
+ ],
16
+ "city": {
17
+ "geo": [
18
+ 28.6682245,
19
+ 77.1167427
20
+ ],
21
+ "name": "Punjabi Bagh, Delhi",
22
+ "url": "http://aqicn.org/city/delhi/punjabi-bagh/"
23
+ },
24
+ "dominentpol": "pm10",
25
+ "iaqi": {
26
+ "co": {
27
+ "v": 47
28
+ },
29
+ "h": {
30
+ "v": 100
31
+ },
32
+ "no2": {
33
+ "v": 78
34
+ },
35
+ "o3": {
36
+ "v": 6.9
37
+ },
38
+ "p": {
39
+ "v": 1016
40
+ },
41
+ "pm10": {
42
+ "v": 875
43
+ },
44
+ "pm25": {
45
+ "v": 641
46
+ },
47
+ "so2": {
48
+ "v": 0.9
49
+ },
50
+ "t": {
51
+ "v": 16.15
52
+ },
53
+ "w": {
54
+ "v": 1.32
55
+ }
56
+ },
57
+ "time": {
58
+ "s": "2017-11-08 09:00:00",
59
+ "tz": "+05:30",
60
+ "v": 1510131600
61
+ }
62
+ }
63
+ }
@@ -6,10 +6,12 @@ describe Lita::Handlers::OnewheelAqi, lita_handler: true do
6
6
  it { is_expected.to route_command('aqidetails') }
7
7
  it { is_expected.to route_command('aqideets') }
8
8
 
9
- before do
10
- mock = File.open('spec/fixtures/Output.json').read
9
+ def mock(file)
10
+ mock = File.open("spec/fixtures/#{file}.json").read
11
11
  allow(RestClient).to receive(:get) { mock }
12
+ end
12
13
 
14
+ before do
13
15
  Timecop.freeze Time.local(2017, 8, 11, 16, 0, 0)
14
16
 
15
17
  Geocoder.configure(lookup: :test)
@@ -50,22 +52,32 @@ describe Lita::Handlers::OnewheelAqi, lita_handler: true do
50
52
  end
51
53
 
52
54
  it 'queries the aqi' do
55
+ mock('Output')
53
56
  send_command 'aqi'
54
57
  expect(replies.last).to include("AQI for Portland, 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/)")
55
58
  end
56
59
 
57
60
  it 'queries the aqideets' do
61
+ mock('Output')
58
62
  send_command 'aqideets'
59
63
  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/)")
60
64
  end
61
65
 
62
66
  it 'queries the aqi by location' do
67
+ mock('Output')
63
68
  send_command 'aqi Beaverton'
64
69
  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
70
  end
66
71
 
67
72
  it 'queries the aqideets' do
73
+ mock('Output')
68
74
  send_command 'aqideets Beaverton'
69
75
  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
76
  end
77
+
78
+ it 'dehli' do
79
+ mock('dehli')
80
+ send_command 'aqi'
81
+ expect(replies.last).to eq("AQI for Portland, OR, USA, 🚫☣🚫 13Hazardous 🚫☣🚫 pm25: 13641 µg/m³(est): [0..50, 51..100, 101..150, 151..200, 201..300, 301..500] pm10: 13875 updated -127740 minutes ago. 14(http://aqicn.org/city/delhi/punjabi-bagh/)")
82
+ end
71
83
  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.1.1
4
+ version: 2.2.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: 2017-09-16 00:00:00.000000000 Z
11
+ date: 2017-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -166,6 +166,7 @@ files:
166
166
  - lib/lita/handlers/onewheel_aqi.rb
167
167
  - lita-onewheel-aqi.gemspec
168
168
  - spec/fixtures/Output.json
169
+ - spec/fixtures/dehli.json
169
170
  - spec/lita/handlers/onewheel_aqi_spec.rb
170
171
  - spec/spec_helper.rb
171
172
  homepage: https://github.com/onewheelskyward/lita-onewheel-aqi
@@ -195,5 +196,6 @@ specification_version: 4
195
196
  summary: Reads the current AQI from aqicn.org and displays it.
196
197
  test_files:
197
198
  - spec/fixtures/Output.json
199
+ - spec/fixtures/dehli.json
198
200
  - spec/lita/handlers/onewheel_aqi_spec.rb
199
201
  - spec/spec_helper.rb