You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: pusher_controller.rb
    path of file: ./repos/onebody/app/controllers
    
    the code of the file until where you have to start completion: class PusherController < ApplicationController
  protect_from_forgery except: :auth_printer

  def auth_printer
    if printer
      response = Pusher[params[:channel_name]].authenticate(
        params[:socket_id],
        user_id: printer[:id],
        user_info: {
          user: {
            id: @checkin_logged_in.id,
            name: @checkin_logged_in.name
          },
          printer: printer
        }
      )
      render json: response
    elsif presence?
      response = Pusher[params[:channel_name]]
    
  def auth_printer
    if printer
      response = Pusher[params[:channel_name]].authenticate(
        params[:socket_id],
        user_id: printer[:id],
        user_info: {
          user: {
            id: @checkin_logged_in.id,
            name: @checkin_logged_in.name
          },
          printer: printer
        }
      )
      render json: response
    elsif presence?
      response = Pusher[params[:channel_name]].authenticate(
        params[:socket_id],
        user_id: session.id,
        user_info: {
          ip: request.remote_ip
        }
      )
      render json: response
    else
      render json: { error: I18n.t('not_authorized') }, status: 403
    end