jam-cloud/admin/app/controllers/artifacts_controller.rb

29 lines
638 B
Ruby

class ArtifactsController < ApplicationController
respond_to :json
# create or update a client_artifact row
def update_artifacts
product = params[:product]
version = params[:version]
uri = params[:uri]
file = params[:file]
environment = params[:environment]
@artifact = ArtifactUpdate.find_or_create_by_product_and_environment(product, environment)
@artifact.version = version
@artifact.uri = file
@artifact.save
unless @artifact.errors.any?
render :json => {}, :status => :ok
else
response.status = :unprocessable_entity
respond_with @artifact
end
end
end