Module: LHS::Record::All::ClassMethods
- Defined in:
- lib/lhs/concerns/record/all.rb
Instance Method Summary collapse
-
#all(params = {}) ⇒ Object
Should be an edge case but sometimes all objects from a certain resource are required.
Instance Method Details
#all(params = {}) ⇒ Object
Should be an edge case but sometimes all objects from a certain resource are required. In this case we load the first page with the default max limit, compute the amount of left over requests, do all the the left over requests for the following pages and concatenate all the results in order to return all the objects for a given resource.
14 15 16 17 18 19 |
# File 'lib/lhs/concerns/record/all.rb', line 14 def all(params = {}) limit = params[limit_key] || LHS::Pagination::DEFAULT_LIMIT data = request(params: params.merge(limit_key => limit)) request_all_the_rest(data, params) if paginated?(data._raw) data._record.new(LHS::Data.new(data, nil, self)) end |