class Cassia::ResponseHandlers::SwitchAutoselect

Public Class Methods

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

Public Instance Methods

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

Private Instance Methods

handle_failure(response) click to toggle source
# File lib/cassia/response_handlers/switch_autoselect.rb, line 23
def handle_failure(response)
  @access_controller.error = JSON.parse(response.body)['error']
  @access_controller.error_description = JSON.parse(response.body)['error_description']
end
handle_success(response) click to toggle source
# File lib/cassia/response_handlers/switch_autoselect.rb, line 19
def handle_success(response)
  @access_controller.autoselect_switch = response.body['flag']
end