Class: ONEAccess::Request::InvestorsRequestHandler
- Inherits:
-
Object
- Object
- ONEAccess::Request::InvestorsRequestHandler
- Defined in:
- lib/oneaccess/request/investors_request_handler.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(url:, limit: PAGE_SIZE) ⇒ InvestorsRequestHandler
constructor
A new instance of InvestorsRequestHandler.
Constructor Details
#initialize(url:, limit: PAGE_SIZE) ⇒ InvestorsRequestHandler
Returns a new instance of InvestorsRequestHandler.
8 9 10 11 |
# File 'lib/oneaccess/request/investors_request_handler.rb', line 8 def initialize(url:, limit: PAGE_SIZE) @url = url @limit = limit end |
Instance Method Details
#each ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/oneaccess/request/investors_request_handler.rb', line 13 def each offset = 0 loop do http_response = Http::HttpClient.get(url, build_params(offset)) response = Response::InvestorsResponse.from_json(http_response.body) response&.data&.each do |investor| yield investor end break unless more_records?(response.) offset += 1 end end |