lita-onewheel-odot-tripcheck-web-hack 0.1.2 → 0.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: 14c9fe5870b4cb571c63163583a4620e10ab671f
4
- data.tar.gz: 14384014295e92172856d88e79ddad13839072c8
3
+ metadata.gz: a596bd514c89059af24c0f57a93ec5df53f4c37f
4
+ data.tar.gz: fbef921edadad9bce4c501f2fec0d63c5a848e2d
5
5
  SHA512:
6
- metadata.gz: 9a5a2064711021a799f4a6ccb6b4ab0b231c621cb4fd7225329d501a0697ac2341b784d2259a4cbf55b6dc7ca0fb6b1cd57a948f6330a5a64c3cecefc00796f7
7
- data.tar.gz: 44482c39c6e70f8633c32a538ec05951e706a5c4e9f5bba3686206328ec440dede0b6e05d832d0b9d0142284ffac7abe773a7ccc0187e1b0c93f12b3d20b0899
6
+ metadata.gz: 3a421f905c77bb01950924e50fc0b23b4850c7c6af1a54a10a96fb5053c555901d5209b6f62fdd04130209c1c9a3d8811227ee85e1da19d53f4c5ca0c04e8466
7
+ data.tar.gz: e307da0480e45adde9dd026bfe8b69802bdcd2254387d861c4082f373ef1d9e7d842485710afe46b26eefba5538ff40f50a5993c250d809eadb65923b1ed80ec
@@ -8,6 +8,8 @@ module Lita
8
8
  route(/^tripcheck$/i, :handle_tripcheck_list, command: true,
9
9
  help: { 'tripcheck': 'Display a list of tripcheck cameras covered.'})
10
10
 
11
+ route(/^sandycam$/i, :handle_sandycam, command: true)
12
+
11
13
  def get_cameras
12
14
  uri_base = 'https://tripcheck.com/RoadCams/cams/'
13
15
 
@@ -25,10 +27,19 @@ module Lita
25
27
  }
26
28
  end
27
29
 
30
+ def handle_sandycam(response)
31
+ Lita.logger.debug "SANDYCAM"
32
+ response.reply get_camera_url('sandy')
33
+ end
34
+
28
35
  def handle_tripcheck(response)
29
36
  input = response.matches[0][0]
30
37
  Lita.logger.debug "Looking for '#{input}'"
31
38
 
39
+ response.reply get_camera_url(input)
40
+ end
41
+
42
+ def get_camera_url(input)
32
43
  get_cameras.keys.each do |camera_key|
33
44
  Lita.logger.debug "Trying to match '#{input.downcase}' to '#{camera_key.downcase}'"
34
45
  if camera_key.to_s.downcase.include? input.downcase
@@ -36,8 +47,8 @@ module Lita
36
47
  unless camera_key.to_s == 'Sandy Blvd in Hollywood'
37
48
  image += "?rand=#{Time.now.to_i}123"
38
49
  end
39
- response.reply image
40
- return # Quick exit.
50
+
51
+ return image
41
52
  end
42
53
  end
43
54
  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.1.2'
3
+ spec.version = '0.2.0'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = %q{ODOT Tripcheck Cameras}
@@ -6,6 +6,7 @@ describe Lita::Handlers::OnewheelOdotTripcheckWebHack, lita_handler: true do
6
6
 
7
7
  it { is_expected.to route_command('tripcheck blue') }
8
8
  it { is_expected.to route_command('tripcheck') }
9
+ it { is_expected.to route_command('sandycam') }
9
10
 
10
11
  it 'will respond to tripcheck' do
11
12
  send_command 'tripcheck govy'
@@ -21,4 +22,9 @@ describe Lita::Handlers::OnewheelOdotTripcheckWebHack, lita_handler: true do
21
22
  send_command 'tripcheck sandy'
22
23
  expect(replies.last).to_not include('rand=')
23
24
  end
25
+
26
+ it 'sandycam' do
27
+ send_command 'sandycam'
28
+ expect(replies.last).to eq('https://launchpad.pin13.net/cam/sandy.jpg')
29
+ end
24
30
  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.1.2
4
+ version: 0.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: 2016-12-06 00:00:00.000000000 Z
11
+ date: 2016-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  requirements: []
149
149
  rubyforge_project:
150
- rubygems_version: 2.5.2
150
+ rubygems_version: 2.5.1
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: Find out how the traffic-related weather on Mt. Hood is doing, visually.