module Medivo class LabsController < ActionController::Base layout false def lab_data lab_data = Medivo::Lab.data_for_zip(params[:zip_code]) render :json=> lab_data end def appointment_data data = Medivo::Appointment.find(params[:lab_code], params[:appointment_date], params[:am_pm]) render :json=> data rescue RestClient::RequestTimeout, RestClient::InternalServerError => te render :status=> te.http_code, :json=> {:message=>"Could be lab_code is wrong, or labcorp server is down"} rescue RestClient::Exception => br render :status=> br.http_code, :json=> {:message=>br.response} rescue Exception => e render :status=> 500, :json=> {:message=>e.message} end end end