Sha256: 770f6f06d9191f3680c3cf227928b803b3986af2ef7de6066bd9771cb8b90e35
Contents?: true
Size: 578 Bytes
Versions: 1
Compression:
Stored size: 578 Bytes
Contents
class NationBuilder::Paginator attr_reader :body def initialize(client, body) @client = client @body = body end [:next, :prev].each do |page_type| define_method(:"#{page_type}?") do @body[page_type.to_s] end define_method(:"#{page_type}") do |call_body = {}| return nil unless send(:"#{page_type}?") path = send(:"#{page_type}?").split('/api/v1').last call_body[:limit] ||= CGI.parse(path)['limit'][0] results = @client.raw_call(path, :get, call_body) return self.class.new(@client, results) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nationbuilder-rb-1.6.2 | lib/nationbuilder/paginator.rb |