class Cassia::ResponseHandlers::OpenNotify

Public Class Methods

new(access_controller, aps: ) click to toggle source
# File lib/cassia/response_handlers/open_notify.rb, line 4
def initialize(access_controller, aps: )
  @access_controller = access_controller
  @aps = aps
end

Public Instance Methods

handle(response) click to toggle source
# File lib/cassia/response_handlers/open_notify.rb, line 9
def handle(response)
  if response.success?
    handle_success
  else
    handle_failure(response)
  end
  response.success?
end

Private Instance Methods

handle_failure(response) click to toggle source
# File lib/cassia/response_handlers/open_notify.rb, line 27
def handle_failure(response)
  @access_controller.error = JSON.parse(response.body)['error']
end
handle_success() click to toggle source
# File lib/cassia/response_handlers/open_notify.rb, line 20
def handle_success
  routers_to_open_notify = @access_controller.routers.select {|router| @aps.include?(router.mac) }
  routers_to_open_notify.each do |router|
    router.notification_open = true
  end
end