class Footrest::Pagination

Constants

Public Instance Methods

on_complete(response) click to toggle source
# File lib/footrest/pagination.rb, line 15
def on_complete(response)
  if response[:response_headers]
    if link_header = response[:response_headers][:link]
      links = Links.new
      %w(prev next first last current).each do |page|
        link = find_link(link_header, page)
        response["#{page}_page".to_sym] = link
        links.public_send("#{ page }=", link)
      end
      response[:pagination_links] = links
    end
  end
end