class ArtifactsController < ApiController respond_to :json def versioncheck # the reported client version #client_version = params[:ver] # the name of the client product = params[:product] # the os (Win32/MacOSX/Unix) os = params[:os] product = "#{product}/#{os}" logger.debug "version check from #{product}" unless ArtifactUpdate::PRODUCTS.include? product render :json => { :errors => { :product => ['not a valid product'] } }, :status => :unprocessable_entity return end @artifact = ArtifactUpdate.find_by_product_and_environment(product, ArtifactUpdate::DEFAULT_ENVIRONMENT) if @artifact.nil? render :json => {}, :status => :ok else render :json => { "version" => @artifact.version, "uri" => @artifact.uri.path }, :status => :ok end end end