Sha256: 5cd9f3fe82cf5dea69343a7b25d0677ce792935c2143df4ebbd362be5556fd34
Contents?: true
Size: 749 Bytes
Versions: 16
Compression:
Stored size: 749 Bytes
Contents
module Restly::Collection::Pagination def page(num) with_params(page: num, per_page: per_page).all.paginate(page: num, per_page: per_page) end def current_page pagination[:current_page] || pagination[:page] end def per_page @pagination_opts[:per_page] || pagination[:per_page] end def response_per_page pagination[:per_page] end def total_pages pagination[:total_pages] end def total_entries pagination[:total_entries] end private def pagination parsed = @response.parsed || {} pagination = parsed[:pagination] || parsed pagination.select!{ |k,v| /page|current_page|entries|total_entries|per_page|total_pages|total/ =~ k.to_s } pagination.with_indifferent_access end end
Version data entries
16 entries across 16 versions & 1 rubygems