Module: Acfs::Collections::Paginatable

Extended by:
ActiveSupport::Concern
Included in:
Acfs::Collection
Defined in:
lib/acfs/collections/paginatable.rb

Instance Method Summary collapse

Instance Method Details

#first_page(&block) ⇒ Object



28
29
30
# File 'lib/acfs/collections/paginatable.rb', line 28

def first_page(&block)
  page 'first', &block
end

#last_page(&block) ⇒ Object



32
33
34
# File 'lib/acfs/collections/paginatable.rb', line 32

def last_page(&block)
  page 'last', &block
end

#next_page(&block) ⇒ Object



20
21
22
# File 'lib/acfs/collections/paginatable.rb', line 20

def next_page(&block)
  page 'next', &block
end

#page(rel, &block) ⇒ Object



36
37
38
39
40
# File 'lib/acfs/collections/paginatable.rb', line 36

def page(rel, &block)
  return unless relations[rel]

  @resource_class.all nil, url: relations[rel], &block
end

#prev_page(&block) ⇒ Object



24
25
26
# File 'lib/acfs/collections/paginatable.rb', line 24

def prev_page(&block)
  page 'prev', &block
end

#process_response(response) ⇒ Object



15
16
17
18
# File 'lib/acfs/collections/paginatable.rb', line 15

def process_response(response)
  setup_params response.request.params if response.request
  setup_headers response.headers
end