lita-onewheel-aqi 1.0.1 → 1.1.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: 0deefb91408f3e16cd7f2487a2cc6c10206beaba
4
- data.tar.gz: 334a9b553b5f290dd000a2afa15461b35ba7bf96
3
+ metadata.gz: '0449f2926e7b3170f465631d795000ef17840603'
4
+ data.tar.gz: 3de732d584ce510414117b0ce09f92c05ad994e7
5
5
  SHA512:
6
- metadata.gz: 9b6a3b7f5365b18006d8b41d4da88bd0b416cec0f03488bcc2ac442f9848b2f0286b57c258841e3640b0457feb4c551fdb9731096862e42788f030b8b29a32a6
7
- data.tar.gz: 298b9c099104290ad2fdb4a5a2c2cc4ea1363194464d803db8fb340061db0b70ec95d14419cdf4da51370a981dbc82cb1e9df54e1a301dcbf19a16452e5193e2
6
+ metadata.gz: 6f50e387aea137640878045c14319309fc14386f8f11f5c33a0ea6d919fc641b599829c7784ff41dc13da0db142d29c6c1bec6d153d7a27107d073b75bad9240
7
+ data.tar.gz: 6c38929597f86e3159cde7bbf092f345ca1e7d1920adf7e129422f78f7ca2f8f86a728dc86452cae8ad1e50449b4145cf8e7013d1f99e5bf91995df8fa48fe99
@@ -6,6 +6,7 @@ module Lita
6
6
  class OnewheelAqi < Handler
7
7
  config :api_key
8
8
  config :distance
9
+ config :colors, default: true
9
10
 
10
11
  route /^aqi(.*)$/i,
11
12
  :get_aqi,
@@ -67,19 +68,29 @@ module Lita
67
68
  # unless forecasted_aqi == []
68
69
  # reply += "Forecasted: #{(forecasted_aqi['ActionDay'] == 'true')? 'Action Day! ' : ''}#{forecasted_aqi['AQI']} #{forecasted_aqi['Category']['Name']} "
69
70
  # end
71
+
72
+ banner_str = "(aqicn.org)"
73
+ if config.colors
74
+ banner_str = "\x03#{colors[:grey]}#{banner_str}\x03"
75
+ end
76
+
70
77
  unless observed_aqi == []
71
- reply += "Observed: #{color_str(observed_aqi)} \x03#{colors[:grey]}(aqicn.org)\x03"
78
+ reply += "Observed: #{color_str(observed_aqi)} #{banner_str}"
72
79
  end
73
80
  response.reply reply
74
81
  end
75
82
 
76
83
  def color_str(str)
77
- aqi_range_colors.keys.each do |color_key|
78
- if color_key.cover? str.to_i # Super secred cover sauce
79
- color = colors[aqi_range_colors[color_key]]
80
- str = "\x03#{color}#{str}\x03"
84
+
85
+ if config.colors
86
+ aqi_range_colors.keys.each do |color_key|
87
+ if color_key.cover? str.to_i # Super secred cover sauce
88
+ color = colors[aqi_range_colors[color_key]]
89
+ str = "\x03#{color}#{str}\x03"
90
+ end
81
91
  end
82
92
  end
93
+
83
94
  str
84
95
  end
85
96
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-aqi'
3
- spec.version = '1.0.1'
3
+ spec.version = '1.1.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 @@
1
+ {"status":"ok","data":{"aqi":76,"idx":8371,"attributions":[{"url":"http://worldweather.wmo.int","name":"World Meteorological Organization - surface synoptic observations (WMO-SYNOP)"},{"url":"http://www.deq.state.or.us/","name":"Oregon Department of Environmental Quality (DEQ)"},{"url":"http://www.airnow.gov/","name":"Air Now - US EPA"}],"city":{"geo":[45.28845,-121.782775],"name":"Government Camp - Multorpor Visibility, Oregon","url":"http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/"},"dominentpol":"pm25","iaqi":{"h":{"v":11},"p":{"v":1014},"pm10":{"v":40},"pm25":{"v":76},"t":{"v":34.65}},"time":{"s":"2017-08-11 15:00:00","tz":"-08:00","v":1502463600}}}
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: 1.0.1
4
+ version: 1.1.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-08-11 00:00:00.000000000 Z
11
+ date: 2017-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -151,6 +151,7 @@ files:
151
151
  - lib/lita-onewheel-aqi.rb
152
152
  - lib/lita/handlers/onewheel_aqi.rb
153
153
  - lita-onewheel-aqi.gemspec
154
+ - spec/fixtures/Output.json
154
155
  - spec/lita/handlers/onewheel_aqi_spec.rb
155
156
  - spec/spec_helper.rb
156
157
  homepage: https://github.com/onewheelskyward/lita-onewheel-aqi
@@ -179,5 +180,6 @@ signing_key:
179
180
  specification_version: 4
180
181
  summary: Reads the current AQI from aqicn.org and displays it.
181
182
  test_files:
183
+ - spec/fixtures/Output.json
182
184
  - spec/lita/handlers/onewheel_aqi_spec.rb
183
185
  - spec/spec_helper.rb