Sha256: 895e962c6147915894a509c0c939e0eded5d4ecc9a294654c610326a7fbcbe4d
Contents?: true
Size: 728 Bytes
Versions: 18
Compression:
Stored size: 728 Bytes
Contents
module Pina module Utils module Pagination def next_page resource.all(extract_next_page) end def first_page resource.all end def previous_page resource.all(extract_prev_page) end private def resource Object.const_get("Pina::#{self.class.to_s.split('::').last}") end def extract_next_page string = _meta['pagination']['next'] return unless string index = string.index('?') string[index..-1] end def extract_prev_page string = _meta['pagination']['prev'] return unless string index = string.index('?') string[index..-1] end end end end
Version data entries
18 entries across 18 versions & 1 rubygems