lita-onewheel-odot-tripcheck-web-hack 0.0.4 → 0.0.5

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: d0c0e79fa4793674d0c3b2fdf7cddc650a8162a2
4
- data.tar.gz: 8d21321f7153dbd0ad3dd9ac83303a30ef0ab90c
3
+ metadata.gz: 985b7671fade98b897a592452ec5f38ff7bc0a54
4
+ data.tar.gz: 9197cd2686b802ec539fe9a885b44a9570fb7b93
5
5
  SHA512:
6
- metadata.gz: 22b8f9fd373fad33b2518bd7c5e5e2588761c896eb7cedc2d8bc5904fc0c9688c667f31d7c99300a3bff836cd1ad3786aeb78bc7e0097fd3f45ea67a9b1ebc38
7
- data.tar.gz: 5c6725c0a18db80dd2ae0040b2db8bdb3c6e8052592ba8f94401c16097ad45b05137a72d84fa36c85587b9d858bb2391633fbe5f0e2b735de1019f9e3348fafa
6
+ metadata.gz: 0e951399d1d5fcbdb8b58a2aa6a073a4b2dc5abde53dc1fdd0fa30b0bb0083d2cc5b5db2c2bee441b317d26210a1311345d4c372db3653de7eacac9389f40e6b
7
+ data.tar.gz: c45e8bdf96eae5ebeeeeb1691fb6b0ae422ce720120776423cb636ea59aec699daa4ed4c60cc1deb90d5cfef58270b6749a598e66e82eaf5d8be883612e9948d
@@ -5,32 +5,43 @@ module Lita
5
5
  route(/^tripcheck\s+(.*)/i, :handle_tripcheck, command: true,
6
6
  help: { 'tripcheck 35': 'Displays an image of hwy 26 @ hwy 35'})
7
7
 
8
+ route(/^tripcheck$/i, :handle_tripcheck_list, command: true,
9
+ help: { 'tripcheck': 'Display a list of tripcheck cameras covered.'})
10
+
11
+ def get_cameras
12
+ {
13
+ # 'Hood River': %w(Hood%20River%20Exit%2064a_pid1863.JPG Hood%20River%20Exit%2063_pid1860.JPG),
14
+ 'Hood River': 'Hood%20River%20Exit%2064a_pid1863.JPG',
15
+ '26 at 35': 'US26%20at%20Hwy35_pid1881.JPG',
16
+ '26 at Snow Bunny': 'US26%20at%20Snow%20Bunny_pid1887.JPG',
17
+ # '26 at Govy': %w(GovernmentCamp_pid624.jpg US26%20at%20Govn%20Camp%20Maint_pid1899.JPG),
18
+ '26 at Govy': 'US26%20at%20Govn%20Camp%20Maint_pid1899.JPG',
19
+ '26 at Govy Loop Rd': 'US26%20at%20Govt%20Camp%20Lp%20Rd_pid1776.JPG',
20
+ '26 at Frog Lake': 'US26%20at%20Frog%20Lake%20VMS_pid1773.JPG',
21
+ '26 at Blue Box Pass': 'Blue%20Box%20Pass_pid1919.JPG'
22
+ }
23
+ end
24
+
8
25
  def handle_tripcheck(response)
9
26
  input = response.matches[0][0]
10
27
  Lita.logger.debug "Looking for '#{input}'"
11
28
 
12
29
  uri_base = 'https://tripcheck.com/RoadCams/cams/'
13
- cameras = {
14
- # 'Hood River': %w(Hood%20River%20Exit%2064a_pid1863.JPG Hood%20River%20Exit%2063_pid1860.JPG),
15
- 'Hood River': 'Hood%20River%20Exit%2064a_pid1863.JPG',
16
- '26 at 35': 'US26%20at%20Hwy35_pid1881.JPG',
17
- '26 at Snow Bunny': 'US26%20at%20Snow%20Bunny_pid1887.JPG',
18
- # '26 at Govy': %w(GovernmentCamp_pid624.jpg US26%20at%20Govn%20Camp%20Maint_pid1899.JPG),
19
- '26 at Govy': 'US26%20at%20Govn%20Camp%20Maint_pid1899.JPG',
20
- '26 at Govy Loop Rd': 'US26%20at%20Govt%20Camp%20Lp%20Rd_pid1776.JPG',
21
- '26 at Frog Lake': 'US26%20at%20Frog%20Lake%20VMS_pid1773.JPG',
22
- '26 at Blue Box Pass': 'Blue%20Box%20Pass_pid1919.JPG'
23
- }
24
30
 
25
- cameras.keys.each do |camera_key|
31
+ get_cameras.keys.each do |camera_key|
26
32
  Lita.logger.debug "Trying to match '#{input.downcase}' to '#{camera_key.downcase}'"
27
33
  if camera_key.to_s.downcase.include? input.downcase
28
- response.reply "#{uri_base}#{cameras[camera_key]}?rand=#{Time.now.to_i}123"
34
+ response.reply "#{uri_base}#{get_cameras[camera_key]}?rand=#{Time.now.to_i}123"
29
35
  return # Quick exit.
30
36
  end
31
37
  end
32
38
  end
33
39
 
40
+ def handle_tripcheck_list(response)
41
+ Lita.logger.debug "Replying with: Cameras available include: #{get_cameras.keys.join ', '}"
42
+ response.reply "Cameras available include: #{get_cameras.keys.join ', '}"
43
+ end
44
+
34
45
  end
35
46
  Lita.register_handler(OnewheelOdotTripcheckWebHack)
36
47
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-odot-tripcheck-web-hack'
3
- spec.version = '0.0.4'
3
+ spec.version = '0.0.5'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = %q{ODOT Tripcheck Cameras}
@@ -5,9 +5,15 @@ describe Lita::Handlers::OnewheelOdotTripcheckWebHack, lita_handler: true do
5
5
  end
6
6
 
7
7
  it { is_expected.to route_command('tripcheck blue') }
8
+ it { is_expected.to route_command('tripcheck') }
8
9
 
9
10
  it 'will respond to tripcheck' do
10
11
  send_command 'tripcheck govy'
11
12
  expect(replies.last).to include('https://tripcheck.com/RoadCams/cams/US26%20at%20Govn%20Camp%20Maint_pid1899.JPG')
12
13
  end
14
+
15
+ it 'will list tripchecks' do
16
+ send_command 'tripcheck'
17
+ expect(replies.last).to eq('Cameras available include: Hood River, 26 at 35, 26 at Snow Bunny, 26 at Govy, 26 at Govy Loop Rd, 26 at Frog Lake, 26 at Blue Box Pass')
18
+ end
13
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-odot-tripcheck-web-hack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-04 00:00:00.000000000 Z
11
+ date: 2016-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita