Module: PDC::Resource::Finder

Extended by:
ActiveSupport::Concern
Included in:
Relation
Defined in:
lib/pdc/resource/relation/finder.rb

Instance Method Summary collapse

Instance Method Details

#contents!Object

returns the contents for the current scope without any pagination as an Array of Resources



7
8
9
10
# File 'lib/pdc/resource/relation/finder.rb', line 7

def contents!
  return @contents if @contents
  @contents = result.data.map { |result| new(result) }
end

#find_one!Object



12
13
14
15
16
# File 'lib/pdc/resource/relation/finder.rb', line 12

def find_one!
  raise(PDC::ResourceNotFound, params) if result.data.empty?
  raise(PDC::MultipleResultsError, params) if result.data.length > 1
  @find_one ||= new(result.data.first)
end