New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grape-cursor_paginate_helper

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grape-cursor_paginate_helper

  • 0.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Grape::CursorPagineHelper

This library is Grape API Helper for ActiveRecord::CursorPaginator

Supported environment

Installation

Add the following line to your Gemfile and execute bundle install

gem 'grape-cursor_paginate_helper'

Usage

Here is a typical api definition using Grape::CursorPaginateHelper

class FakeAPI < Grape::API
  helpers Grape::CursorPaginateHelper
  resource :fake do
    desc 'cursor_paginate'
    cursor_paginate per_page: 10
    get '/cursor_paginate' do
      present cursor_paginate(Post.order(:display_index)).map(&:attributes).to_json
    end
  end
end

parameters of CursorPaginator

  • cursor: String - cursor to paginate
  • per_page: Integer - record count per page (default to 10)
  • direction: Symbol - direction to paginate. :forward (default) or :backward
  • with_total: Boolean - if true, add total record count to headers as 'X-Total-Count'

Items in Response Header

  • X-Previous-Cursor: String - cursor of the first record. used for the backward paginate call.
  • X-Next-Cursor: String - cursor of the last record. used for the forward paginate call.
  • X-Total-Count: Integer - total count of relation

Development

Run test

ADAPTER=mysql bundle exec rspec
ADAPTER=postgresql bundle exec rspec

Contributing

Bug reports and pull requests are welcome on GitHub at . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Activerecord::CursorPagination project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 03 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc