VRFS-4074 - cloud uri/storage for jamblaster

This commit is contained in:
Seth Call 2016-05-12 18:54:00 -05:00
parent 94128e7115
commit 166647d112
3 changed files with 12 additions and 2 deletions

View File

@ -4,7 +4,7 @@ module JamRuby
DEFAULT_ENVIRONMENT = 'public' DEFAULT_ENVIRONMENT = 'public'
CLIENT_PREFIX = 'JamClient' CLIENT_PREFIX = 'JamClient'
PRODUCTS = ["#{CLIENT_PREFIX}/Win32", "#{CLIENT_PREFIX}/MacOSX"] PRODUCTS = ["#{CLIENT_PREFIX}/Win32", "#{CLIENT_PREFIX}/MacOSX", "#{CLIENT_PREFIX}/JamBlaster"]
self.primary_key = 'id' self.primary_key = 'id'
attr_accessible :version, :uri, :sha1, :environment, :product, as: :admin attr_accessible :version, :uri, :sha1, :environment, :product, as: :admin

View File

@ -6,15 +6,24 @@ class ArtifactsController < ApiController
def client_downloads def client_downloads
clients = ArtifactUpdate.where("product like '%JamClient%' and environment = '#{ArtifactUpdate::DEFAULT_ENVIRONMENT}'").order(:product) clients = ArtifactUpdate.where("product like '%JamClient%' and environment = '#{ArtifactUpdate::DEFAULT_ENVIRONMENT}'").order(:product)
if params[:type]
cliens = clients.where("product ilike 'JamClient/#{params[:type]}'")
end
result = {} result = {}
clients.each do |client| clients.each do |client|
url = client.determine_url url = client.determine_url
result[client.product] = { :uri => url, :size => client.size } if params[:type]
result[params[:type]] = { :uri => url, :size => client.size, :version => client.version, :md5 => client.sha1}
else
result[client.product] = { :uri => url, :size => client.size, :version => client.version, :md5 => client.sha1}
end
end end
render :json => result, :status => :ok render :json => result, :status => :ok
end end
def healthcheck def healthcheck
render :json => {} render :json => {}
end end

View File

@ -633,6 +633,7 @@ SampleApp::Application.routes.draw do
# list all uris for available clients on mac, windows, linux, if available # list all uris for available clients on mac, windows, linux, if available
match '/artifacts/clients' => 'artifacts#client_downloads' match '/artifacts/clients' => 'artifacts#client_downloads'
match '/artifacts/:type' => 'artifacts#client_downloads'
# crash logs # crash logs
match '/crashes' => 'api_users#crash_dump', :via => :put match '/crashes' => 'api_users#crash_dump', :via => :put