Her Kaminari

Kaminari pagination for Her models
Alternatives To Her Kaminari
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Api Pagination653329142 years ago32October 26, 202123mitRuby
:page_facing_up: Link header pagination for Rails and Grape APIs.
Grape Pagination13
79 years ago4August 23, 20133mitRuby
Pagination helpers for Grape.
Grape_ape_rails8
8 years ago15June 29, 2015mitRuby
Kaminari Grape72432 years ago4January 25, 2017mitRuby
Kaminari Grape adapter
Her Kaminari5217 years ago3October 09, 20154mitRuby
Kaminari pagination for Her models
Yakports1
9 years agoJavaScript
Grape Client1
7 years ago1mitRuby
Simple access from your client to Grape APIs. Automatically supports: kaminari pagination, network access cache, nested objects, http basic authentication.
Alternatives To Her Kaminari
Select To Compare


Alternative Project Comparisons
Readme

Her::Kaminari

Gem Version Build Status Code Climate Coverage Status

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.

Gem Dependencies

Installation

Add this line to your application's Gemfile:

gem 'her-kaminari'

And then execute:

$ bundle

Or install it yourself as:

$ gem install her-kaminari

Usage

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.

History

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.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/her-kaminari/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request
Popular Pagination Projects
Popular Grape Projects
Popular User Interface Components Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Ruby
Pagination
Grape