Class: JsonApiQueryBuilder

Inherits:
JsonApiClient::Query::Builder
  • Object
show all
Defined in:
lib/json_api_query_builder.rb

Instance Method Summary collapse

Instance Method Details

#allObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/json_api_query_builder.rb', line 2

def all
  @all ||= begin
    results = page = find
    next_page = 2

    loop do
      break if page.links.links['next'].nil?

      page = page(next_page).find
      results += page

      next_page += 1
    end

    results
  end
end