lita-onewheel-aqi 2.0.8 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e27d524f005e0be87b815ae759d56f0e07fad868
4
- data.tar.gz: 1a48e0cecf32db4c7841a0c3bf6b4e849d00e8aa
3
+ metadata.gz: 790b606deb76e9e81cbfde72a363c46e4d5d2aa0
4
+ data.tar.gz: 3e827a32469286d8785e7c5f364483aa8ae1f6f4
5
5
  SHA512:
6
- metadata.gz: 0d9dd946c65703921359be97751d3f941812e4391b1963b1862b2ff0ae8240c14d7911bc8080bfa5f588691ca6bee69e4ff04467272c4054b17671a6dcd76257
7
- data.tar.gz: 370060b4acaf7459784caed07c2744a74b75121404995257ca73a767a93a682cd922312d0e8a0159db874cdaeeb3b49e1152930d49a034c508f91d238c3efd2a
6
+ metadata.gz: f58f3e7abbd496f090757b5432a15b6b3bb61909958900e9c61f2455ab7908c40c7867ec1ea9dd913efd15e3906408bb40ee73429d6eb4b4aaa9315ffaef75e7
7
+ data.tar.gz: 1710cbc07724c8c8e64e3a036eb3ba42a11fbf871a617c90163cd87395742f3200278ba85142d8e1a2d9b1dc5326fa9c249b28d04226cf2b8f7ea12a1ecad957
@@ -170,7 +170,10 @@ module Lita
170
170
  reply += 'temp: ' + aqi['data']['iaqi']['t']['v'].to_s + 'C '
171
171
  end
172
172
 
173
- reply += banner_str
173
+ updated_at = Time.parse aqi['data']['time']['s']
174
+ diff = (Time.now - updated_at).to_i / 60
175
+
176
+ reply += "updated #{color_str(diff.to_s)} minutes ago. #{banner_str}"
174
177
  response.reply reply
175
178
  end
176
179
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-aqi'
3
- spec.version = '2.0.8'
3
+ spec.version = '2.0.9'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = 'AQI data retrieval bot'
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'rake', '~> 10.4'
22
22
  spec.add_development_dependency 'rack-test', '~> 0.6'
23
23
  spec.add_development_dependency 'rspec', '~> 3.0'
24
+ spec.add_development_dependency 'timecop', '~> 0'
24
25
 
25
26
  spec.add_runtime_dependency 'geocoder', '~> 1.2'
26
27
  spec.add_runtime_dependency 'rest-client', '~> 1.8'
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'timecop'
2
3
 
3
4
  describe Lita::Handlers::OnewheelAqi, lita_handler: true do
4
5
  it { is_expected.to route_command('aqi') }
@@ -9,6 +10,8 @@ describe Lita::Handlers::OnewheelAqi, lita_handler: true do
9
10
  mock = File.open('spec/fixtures/Output.json').read
10
11
  allow(RestClient).to receive(:get) { mock }
11
12
 
13
+ Timecop.freeze Time.local(2017, 8, 11, 16, 0, 0)
14
+
12
15
  Geocoder.configure(lookup: :test)
13
16
 
14
17
  Geocoder::Lookup::Test.add_stub(
@@ -31,11 +34,11 @@ describe Lita::Handlers::OnewheelAqi, lita_handler: true do
31
34
 
32
35
  it 'queries the aqi' do
33
36
  send_command 'aqi'
34
- expect(replies.last).to include("AQI for Portland, OR, USA, ⚠️ 08Moderate ⚠️ pm25: 0876 pm10: 0340 updated 15:00 8/11/17 14(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)")
37
+ expect(replies.last).to include("AQI for Portland, OR, USA, ⚠️ 08Moderate ⚠️ pm25: 0876 pm10: 0340 updated 0860 minutes ago. 14(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)")
35
38
  end
36
39
 
37
40
  it 'queries the aqideets' do
38
41
  send_command 'aqideets'
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")
42
+ expect(replies.last).to eq("AQI for Portland, OR, USA, ⚠️ 08Moderate ⚠️ humidity: 11% pressure: 1014mb pm10: 0340 pm25: 0876 temp: 34.65C updated 0860 minutes ago. 14(http://aqicn.org/city/usa/oregon/government-camp-multorpor-visibility/)")
40
43
  end
41
44
  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.0.8
4
+ version: 2.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: timecop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: geocoder
85
99
  requirement: !ruby/object:Gem::Requirement