1 class ArvadosResourceList
4 def initialize(resource_class)
5 @resource_class = resource_class
13 def limit(max_results)
18 def order(orderby_spec)
19 @orderby_spec = orderby_spec
25 cond.keys.each do |uuid_key|
26 if cond[uuid_key] and (cond[uuid_key].is_a? Array or
27 cond[uuid_key].is_a? ArvadosBase)
28 # Coerce cond[uuid_key] to an array of uuid strings. This
29 # allows caller the convenience of passing an array of real
30 # objects and uuids in cond[uuid_key].
31 if !cond[uuid_key].is_a? Array
32 cond[uuid_key] = [cond[uuid_key]]
34 cond[uuid_key] = cond[uuid_key].collect do |item|
35 if item.is_a? ArvadosBase
43 cond.keys.select { |x| x.match /_kind$/ }.each do |kind_key|
44 if cond[kind_key].is_a? Class
45 cond = cond.merge({ kind_key => 'arvados#' + $arvados_api_client.class_kind(cond[kind_key]) })
52 api_params[:eager] = '1' if @eager
53 api_params[:limit] = @limit if @limit
54 api_params[:order] = @orderby_spec if @orderby_spec
55 res = $arvados_api_client.api @resource_class, '', api_params
56 @results = $arvados_api_client.unpack_api_response res
61 self.where({}) if !@results
85 results.send('[]', *x)
101 Hash[results.collect { |x| [x.uuid, x] }]
109 results.items_available if results.respond_to? :items_available