Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Api Pagination | 653 | 329 | 14 | 2 years ago | 32 | October 26, 2021 | 23 | mit | Ruby | |
:page_facing_up: Link header pagination for Rails and Grape APIs. | ||||||||||
Grape Pagination | 13 | 7 | 9 years ago | 4 | August 23, 2013 | 3 | mit | Ruby | ||
Pagination helpers for Grape. | ||||||||||
Grape_ape_rails | 8 | 8 years ago | 15 | June 29, 2015 | mit | Ruby | ||||
Kaminari Grape | 7 | 24 | 3 | 2 years ago | 4 | January 25, 2017 | mit | Ruby | ||
Kaminari Grape adapter | ||||||||||
Her Kaminari | 5 | 2 | 1 | 7 years ago | 3 | October 09, 2015 | 4 | mit | Ruby | |
Kaminari pagination for Her models | ||||||||||
Yakports | 1 | 9 years ago | JavaScript | |||||||
Grape Client | 1 | 7 years ago | 1 | mit | Ruby | |||||
Simple access from your client to Grape APIs. Automatically supports: kaminari pagination, network access cache, nested objects, http basic authentication. |
Makes Her aware of APIs that return pagination headers like grape-kaminari gem.
Her models can now query these APIs like any other kaminari model:
User.page(1).per(10)
IMPORTANT: Pagination is done by the API not by this gem, this gem just parses the response data and creates a Kaminari compatible collection that you can use in your views.
Add this line to your application's Gemfile:
gem 'her-kaminari'
And then execute:
$ bundle
Or install it yourself as:
$ gem install her-kaminari
First include Her::Kaminari::HeaderParser in your Her setup like this:
Her::API.setup url: 'https://api.example.com' do |c|
#...
# Response
c.use Her::Kaminari::HeaderParser
# ...
end
HeaderParser expects that the API request returns the following headers:
X-Total: Total number of records.
X-Page: Current page number.
X-Per-Page: Number of records per page.
X-Offset: (optional) the starting point for the return data.
Then include Her::Kaminari::Collection in your Her model like this:
class User
include Her::Model
include Her::Kaminari::Collection
end
Now you can use your Her model like any other Kaminari model.
After reading How to pass pagination headers with Kaminari, Her and Grape? post by Artur Hebda I decided that it was a good idea to create a gem with his code.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)