No commit activity in last 3 years
No release in over 3 years
A collection of Rails generator scripts for Grape.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.9
~> 4.2
~> 10.0

Runtime

 Project Readme

Grape API Generators

A collection all Rails generator scripts for Grape.

Getting started

Add this line to your Rails application's Gemfile:

gem 'grape-api-generator'

Then run bundle command to install it.

After you installed the gem, you could run the install generator to generate basic MyApp API structure:

rails generate grape:install my_app

You could also specify the API version and authentication model in the generator:

rails generate grape:install my_app --version 2 --model_name customer

Scaffolding new resource

To scaffold a resource API, e.g. Post

rails generate grape:scaffold my_app post

It will create the resource API, entity and spec/test files.

You could also specify list of attributes for the resource API:

rails generate grape:scaffold my_app post title:string:r content published_at:date_time

It will expose tilte, content and published_at in the entity as well as define the params list as following:

requires :title, type: String
optional :content, type: String
optional :published_at, type: DateTime

Contributing

  1. Fork it ( https://github.com/vinh0604/grape-api-generator/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