Module: RestPack::Resource::Pageable

Defined in:
lib/restpack-resource/resource/pageable.rb

Instance Method Summary collapse

Instance Method Details

#paged_resource(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/restpack-resource/resource/pageable.rb', line 6

def paged_resource(options = {})
  options.reverse_merge!(
    :scope => self.all,
    :page => 1,
    :includes => [],
    :filters => {},
    :sort_by => nil,
    :sort_direction => :ascending
  )
  
  resource_normalise_options!(options)
  resource_validate_options!(options)
  
  get_paged_resource(options)
end