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']
      results = @client.raw_call(path, :get, call_body)
      return self.class.new(@client, results)
    end
  end

end

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

Fix pagination bug where the limit parsed to an array value
Fix pagination bug where the limit parsed to an array value

When that's given, the (new) QueryParser that is used for `get` requests 
would pass this through as `limit[] => n` instead of `limit => n`.

Introduced in 
https://github.com/nationbuilder/nationbuilder-rb/pull/45/commits/25f80a0f15edf0e86cda2abce55bd0e4fd97f0dd
