Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

api_helper

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api_helper

  • 0.1.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

APIHelper Gem Version Build Status Coverage Status Docs Status

Helpers for creating standard RESTful API for Rails or Grape with Active Record.

API Standards

Fieldsettable
Let clients choose the fields they wanted to be returned with the fields query parameter, making their API calls optimizable to gain efficiency and speed.
Includable
Clients can use the include query parameter to enable inclusion of related items - for instance, get the author's data along with a post.
Paginatable
Paginate the results of a resource collection, client can get a specific page with the page query parameter and set a custom page size with the "per_page" query parameter.
Sortable
Client can set custom sorting with the sort query parameter while getting a resource collection.
Filterable
Enables clients to filter through a resource collection with their fields with the filter query parameter.
Multigettable
Let Client execute operations on multiple resources with a single request.

Installation

Add this line to your application's Gemfile:

gem 'api_helper'

And then execute:

$ bundle

Usage

Ruby on Rails (Action Pack)

Include each helper concern you need in an ActionController::Base:

PostsController < ApplicationController
  include APIHelper::Filterable
  include APIHelper::Paginatable
  include APIHelper::Sortable

  # ...

end

Further usage of each helper can be found in the docs.

Grape

Set the helpers you need in an Grape::API:

class PostsAPI < Grape::API
  helpers APIHelper::Filterable
  helpers APIHelper::Paginatable
  helpers APIHelper::Sortable

  # ...

end

Further usage of each helper can be found in the docs.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run appraisal rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Neson/api_helper.

FAQs

Package last updated on 28 Jul 2016

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