Skip to content
This repository has been archived by the owner on Oct 6, 2024. It is now read-only.

v1.1.0

Compare
Choose a tag to compare
@10xSebastian 10xSebastian released this 25 May 12:46
· 14 commits to main since this release
223c170

Adds offset_page pagination strategy:

Pagination strategy: offset_page

The offest_page strategy is based on the page strategy with the only difference
that the pages are counted from 0 onwards (not from 1).

# app/models/transaction.rb

class Transaction < DHS::Record
  configuration pagination_strategy: 'offset_page', pagination_key: 'page'

  endpoint '{+service}/transactions'
end
# app/controllers/some_controller.rb

Record.all
GET https://service.example.com/records?limit=100
{
  items: [{...}, ...],
  total: 300,
  limit: 100,
  page: 0
}
In parallel:
  GET https://service.example.com/records?limit=100&page=1
  GET https://service.example.com/records?limit=100&page=2