Guest User

Untitled

a guest
May 26th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. class Sensor
  2.  
  3. def initialize(ip_address:, api_key:)
  4. # Set up our connection to the sensor so we can easily make requests to it later
  5.  
  6. end
  7.  
  8. def booking_has_presence(start_time, end_time)
  9. # Every x amount of time, check if presence is true
  10. Thread.new do
  11. ::Libuv::Reactor.new.run do |reactor|
  12. reactor.scheduler.at(start_time) do
  13. reactor.scheduler.every('2m') do
  14. this.has_presence()
  15. end
  16. end
  17. end
  18. end
  19.  
  20. def has_presence
  21. # Return true when detected and false when not
  22. end
  23.  
  24. def current_booking(bookings)
  25.  
  26. end
  27.  
  28. def get_bookings
  29. # Get a list of bookings
  30. end
  31.  
  32. # This function will be replaced by a scheduled call
  33. def start
  34.  
  35. # Get our bookings
  36. bookings = get_bookings
  37.  
  38. # Check what's on now
  39. booking = current_booking(bookings)
  40.  
  41. # Just output if booking has usage for now
  42. puts
  43. end
  44. end
Add Comment
Please, Sign In to add comment