Sha256: ccfc0b919e079514771941e0fe1baaff931f97b192f35d0edb7f1b426c7ecc1d
Contents?: true
Size: 761 Bytes
Versions: 3
Compression:
Stored size: 761 Bytes
Contents
module Pina module Models class ContactList include Virtus.model attribute :items, Array[Contact] attribute :_meta attribute :response def next_page Pina::Contact.all(extract_next_page) end def first_page Pina::Contact.all end def previous_page Pina::Contact.all(extract_prev_page) end private 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pina-0.3.1 | lib/pina/models/contact_list.rb |
pina-0.2.0 | lib/pina/models/contact_list.rb |
pina-0.1.0 | lib/pina/models/contact_list.rb |