Method: MyApiClient::Request::Pagination#pageable_get
- Defined in:
- lib/my_api_client/request/pagination.rb
#pageable_get(pathname, paging:, headers: nil, query: nil) ⇒ Enumerator::Lazy Also known as: pget
Executes HTTP request with GET method, for pagination API. Expects the pagination API to provide pagination links as part of the content of the response.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/my_api_client/request/pagination.rb', line 22 def pageable_get(pathname, paging:, headers: nil, query: nil) Enumerator.new do |y| response = call(:_request_with_relative_uri, :get, pathname, headers, query, nil) loop do y << response.data next_uri = get_next_url(paging, response) break if next_uri.blank? response = call(:_request_with_absolute_uri, :get, next_uri, headers, nil) end end.lazy end |