1 class OrvosResourceList
2 def initialize(resource_class)
3 @resource_class = resource_class
11 def limit(max_results)
18 cond.keys.each do |uuid_key|
19 if cond[uuid_key] and (cond[uuid_key].is_a? Array or
20 cond[uuid_key].is_a? OrvosBase)
21 # Coerce cond[uuid_key] to an array of uuid strings. This
22 # allows caller the convenience of passing an array of real
23 # objects and uuids in cond[uuid_key].
24 if !cond[uuid_key].is_a? Array
25 cond[uuid_key] = [cond[uuid_key]]
27 cond[uuid_key] = cond[uuid_key].collect do |item|
28 if item.is_a? OrvosBase
36 cond.keys.select { |x| x.match /_kind$/ }.each do |kind_key|
37 if cond[kind_key].is_a? Class
38 cond = cond.merge({ kind_key => 'orvos#' + $orvos_api_client.class_kind(cond[kind_key]) })
45 api_params[:eager] = '1' if @eager
46 api_params[:limit] = @limit if @limit
47 res = $orvos_api_client.api @resource_class, '', api_params
48 @results = $orvos_api_client.unpack_api_response res
64 Hash[results.collect { |x| [x.uuid, x] }]