Class: Dotloop::Admin
- Inherits:
-
Object
- Object
- Dotloop::Admin
- Includes:
- QueryParamHelpers
- Defined in:
- lib/dotloop/admin.rb
Constant Summary
Constants included from QueryParamHelpers
QueryParamHelpers::BATCH_SIZE, QueryParamHelpers::MAX_LOOPS
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #all(options = {}) ⇒ Object
-
#initialize(client:) ⇒ Admin
constructor
A new instance of Admin.
Constructor Details
#initialize(client:) ⇒ Admin
Returns a new instance of Admin.
6 7 8 |
# File 'lib/dotloop/admin.rb', line 6 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/dotloop/admin.rb', line 4 def client @client end |
Instance Method Details
#all(options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dotloop/admin.rb', line 10 def all( = {}) admins = [] url = "/profile/#{profile_id(options)}/admin" (1..MAX_LOOPS).each do |i| [:batch_number] = i current_admin = @client.get(url, query_params()).map do |admin_attrs| Dotloop::Models::Admin.new(admin_attrs) end admins += current_admin break if current_admin.size < BATCH_SIZE end admins end |