Class: Lita::Handlers::OnewheelOdotTripcheckWebHack
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::OnewheelOdotTripcheckWebHack
- Defined in:
- lib/lita/handlers/onewheel_odot_tripcheck_web_hack.rb
Instance Method Summary collapse
- #get_camera_url(input) ⇒ Object
- #get_cameras ⇒ Object
- #handle_sandycam(response) ⇒ Object
- #handle_tripcheck(response) ⇒ Object
- #handle_tripcheck_list(response) ⇒ Object
Instance Method Details
#get_camera_url(input) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/lita/handlers/onewheel_odot_tripcheck_web_hack.rb', line 40 def get_camera_url(input) get_cameras.keys.each do |camera_key| Lita.logger.debug "Trying to match '#{input.downcase}' to '#{camera_key.downcase}'" if camera_key.to_s.downcase.include? input.downcase image = get_cameras[camera_key] unless camera_key.to_s == 'Sandy Blvd in Hollywood' image += "?rand=#{Time.now.to_i}123" end return image end end end |
#get_cameras ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/lita/handlers/onewheel_odot_tripcheck_web_hack.rb', line 11 def get_cameras uri_base = 'https://tripcheck.com/RoadCams/cams/' { # 'Hood River': %w(Hood%20River%20Exit%2064a_pid1863.JPG Hood%20River%20Exit%2063_pid1860.JPG), 'Hood River': uri_base + 'Hood%20River%20Exit%2064a_pid1863.JPG', '26 at 35': uri_base + 'US26%20at%20Hwy35_pid1881.JPG', '26 at Snow Bunny': uri_base + 'US26%20at%20Snow%20Bunny_pid1887.JPG', # '26 at Govy': %w(GovernmentCamp_pid624.jpg US26%20at%20Govn%20Camp%20Maint_pid1899.JPG), '26 at Govy': uri_base + 'US26%20at%20Govn%20Camp%20Maint_pid1899.JPG', '26 at Govy Loop Rd': uri_base + 'US26%20at%20Govt%20Camp%20Lp%20Rd_pid1776.JPG', '26 at Frog Lake': uri_base + 'US26%20at%20Frog%20Lake%20VMS_pid1773.JPG', '26 at Blue Box Pass': uri_base + 'Blue%20Box%20Pass_pid1919.JPG', 'Sandy Blvd in Hollywood': 'https://launchpad.pin13.net/cam/sandy.jpg' } end |
#handle_sandycam(response) ⇒ Object
28 29 30 31 |
# File 'lib/lita/handlers/onewheel_odot_tripcheck_web_hack.rb', line 28 def handle_sandycam(response) Lita.logger.debug "SANDYCAM" response.reply get_camera_url('sandy') end |
#handle_tripcheck(response) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/lita/handlers/onewheel_odot_tripcheck_web_hack.rb', line 33 def handle_tripcheck(response) input = response.matches[0][0] Lita.logger.debug "Looking for '#{input}'" response.reply get_camera_url(input) end |
#handle_tripcheck_list(response) ⇒ Object
54 55 56 57 |
# File 'lib/lita/handlers/onewheel_odot_tripcheck_web_hack.rb', line 54 def handle_tripcheck_list(response) Lita.logger.debug "Replying with: Cameras available include: #{get_cameras.keys.join ', '}" response.reply "Cameras available include: #{get_cameras.keys.join ', '}" end |