Module: Keycloak::Admin::Resource::Pagination

Included in:
Groups, Users
Defined in:
lib/keycloak/admin/resource/pagination.rb

Overview

Abstract class extension for Keycloak::Admin resources with methods providing pagination.

  • #all

Constant Summary collapse

MAX_ENTRIES =
100

Instance Method Summary collapse

Instance Method Details

#allObject

List all resources.



16
17
18
19
20
21
22
23
24
# File 'lib/keycloak/admin/resource/pagination.rb', line 16

def all
  objects = []
  (1..pages).each do |page|
    first = (page * MAX_ENTRIES) - MAX_ENTRIES
    objects << @agent.get("#{resource}?first=#{first}&max=#{MAX_ENTRIES}")
  end

  objects.flatten.map { |object| mash(object) }
end