class Botvac::Web
Public Instance Methods
call(env)
click to toggle source
# File lib/botvac/web.rb, line 5 def call(env) if supported_actions.include?(env["REQUEST_PATH"][1..-1]) [200, {'Content-Type' => 'application/json'}, [robot.send(env["REQUEST_PATH"][1..-1])]] else [404, {'Content-Type' => 'application/json'}, ['{}']] end end
robot()
click to toggle source
# File lib/botvac/web.rb, line 17 def robot @robot ||= Botvac::Robot.new(ENV['SERIAL'], ENV['SECRET']) end
supported_actions()
click to toggle source
# File lib/botvac/web.rb, line 13 def supported_actions %w(start_cleaning pause_cleaning stop_cleaning send_to_base get_robot_state disable_schedule enable_schedule get_schedule) end