Class: Dotloop::Person
- Inherits:
-
Object
- Object
- Dotloop::Person
- Includes:
- QueryParamHelpers
- Defined in:
- lib/dotloop/person.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
- #find(person_id:) ⇒ Object
-
#initialize(client:) ⇒ Person
constructor
A new instance of Person.
Constructor Details
#initialize(client:) ⇒ Person
Returns a new instance of Person.
6 7 8 |
# File 'lib/dotloop/person.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/person.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/person.rb', line 10 def all( = {}) persons = [] url = '/person' (1..MAX_LOOPS).each do |i| [:batch_number] = i current_person = @client.get(url, query_params()).map do |person_attrs| Dotloop::Models::Person.new(person_attrs) end persons += current_person break if current_person.size < BATCH_SIZE end persons end |