skip_before_filter :render_404_if_no_object
skip_before_filter :require_auth_scope
+ include DbCurrentTime
+
def index
expires_in 24.hours, public: true
discovery = Rails.cache.fetch 'arvados_v1_rest_discovery' do
name: "arvados",
version: "v1",
revision: "20131114",
- source_version: (Rails.application.config.source_version ? Rails.application.config.source_version : "No version information available") + (Rails.application.config.local_modified ? Rails.application.config.local_modified.to_s : ''),
- generatedAt: Time.now.iso8601,
+ source_version: AppVersion.hash,
+ generatedAt: db_current_time.iso8601,
title: "Arvados API",
description: "The API to interact with Arvados.",
documentationLink: "http://doc.arvados.org/api/index.html",
defaultCollectionReplication: Rails.configuration.default_collection_replication,
- gitHttpBase: Rails.configuration.git_http_base,
protocol: "rest",
baseUrl: root_url + "arvados/v1/",
basePath: "/arvados/v1/",
servicePath: "arvados/v1/",
batchPath: "batch",
defaultTrashLifetime: Rails.application.config.default_trash_lifetime,
+ blobSignatureTtl: Rails.application.config.blob_signature_ttl,
maxRequestSize: Rails.application.config.max_request_size,
+ dockerImageFormats: Rails.application.config.docker_image_formats,
+ crunchLogBytesPerEvent: Rails.application.config.crunch_log_bytes_per_event,
+ crunchLogSecondsBetweenEvents: Rails.application.config.crunch_log_seconds_between_events,
+ crunchLogThrottlePeriod: Rails.application.config.crunch_log_throttle_period,
+ crunchLogThrottleBytes: Rails.application.config.crunch_log_throttle_bytes,
+ crunchLogThrottleLines: Rails.application.config.crunch_log_throttle_lines,
+ crunchLimitLogBytesPerJob: Rails.application.config.crunch_limit_log_bytes_per_job,
+ crunchLogPartialLineThrottlePeriod: Rails.application.config.crunch_log_partial_line_throttle_period,
+ websocketUrl: Rails.application.config.websocket_address,
parameters: {
alt: {
type: "string",
resources: {}
}
- if Rails.application.config.websocket_address
- discovery[:websocketUrl] = Rails.application.config.websocket_address
- elsif ENV['ARVADOS_WEBSOCKETS']
- discovery[:websocketUrl] = (root_url.sub /^http/, 'ws') + "websocket"
- end
-
ActiveRecord::Base.descendants.reject(&:abstract_class?).each do |k|
begin
ctl_class = "Arvados::V1::#{k.to_s.pluralize}Controller".constantize
},
select: {
type: "array",
- description: "Select which fields to return",
+ description: "Select which fields to return.",
location: "query"
},
distinct: {
type: "boolean",
- description: "Return each distinct object",
+ description: "Return each distinct object.",
+ location: "query"
+ },
+ count: {
+ type: "string",
+ description: "Type of count to return in items_available ('none' or 'exact').",
+ default: "exact",
location: "query"
}
},
method = d_methods[action.to_sym]
end
if ctl_class.respond_to? "_#{action}_requires_parameters".to_sym
- ctl_class.send("_#{action}_requires_parameters".to_sym).each do |k, v|
+ ctl_class.send("_#{action}_requires_parameters".to_sym).each do |l, v|
if v.is_a? Hash
- method[:parameters][k] = v
+ method[:parameters][l] = v
else
- method[:parameters][k] = {}
+ method[:parameters][l] = {}
end
- if !method[:parameters][k][:default].nil?
+ if !method[:parameters][l][:default].nil?
# The JAVA SDK is sensitive to all values being strings
- method[:parameters][k][:default] = method[:parameters][k][:default].to_s
+ method[:parameters][l][:default] = method[:parameters][l][:default].to_s
end
- method[:parameters][k][:type] ||= 'string'
- method[:parameters][k][:description] ||= ''
- method[:parameters][k][:location] = (route.segment_keys.include?(k) ? 'path' : 'query')
- if method[:parameters][k][:required].nil?
- method[:parameters][k][:required] = v != false
+ method[:parameters][l][:type] ||= 'string'
+ method[:parameters][l][:description] ||= ''
+ method[:parameters][l][:location] = (route.segment_keys.include?(l) ? 'path' : 'query')
+ if method[:parameters][l][:required].nil?
+ method[:parameters][l][:required] = v != false
end
end
end
end
end
end
+ Rails.configuration.disable_api_methods.each do |method|
+ ctrl, action = method.split('.', 2)
+ discovery[:resources][ctrl][:methods].delete(action.to_sym)
+ end
discovery
end
send_json discovery