artsy/gris

Name: gris

Owner: Artsy

Description: Gris is a framework for building hypermedia API services using Grape, Roar and ActiveRecord

Created: 2015-02-02 18:51:18.0

Updated: 2017-11-28 03:03:04.0

Pushed: 2016-09-08 22:27:06.0

Homepage:

Size: 212

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Gris

Gris is a framework for building opinionated Rack-based hypermedia APIs. Gris aims to provide useful generators, helpers and middleware common to API microservices. Note that Gris is in development and that the ground may shift.

It makes use of Grape, Roar, RSpec, Hyperclient, and Active Record with PostgreSQL among other excellent projects. Gris is derived from/inspired by the stellar and more sophisticated Napa framework by Bellycard Inc.. We stand on the shoulders of tall people.

Build Status

Gem Version Code Climate Dependency Status


Installation

Gris is available as a gem on rubygems, to install it run:

install gris

Otherwise, if your project uses Bundler, add gris to your Gemfile:

'gris'

And run:

ndle install

Quickstart Demo(s)

You can find example pull requests providing walkthroughs of new app set up here: https://github.com/artsy/gris-demo/pulls


Usage
CLI & Generators

Run the gris terminal prompt to see available features:

ands:
is console [environment]                                                            # Start the Gris console
is generate api <api_name>                                                          # Generate a Grape API, Model and Representer
is generate migration <migration_name> [field[:type][:index] field[:type][:index]]  # Generate a Database Migration
is help [COMMAND]                                                                   # Describe available commands or one specific command
is new <app_name> [app_path]                                                        # Generates a scaffold for a new Gris service
is version                                                                          # Shows the Gris version number

Caching

You can use caching by including this module in your ActiveRecord models,

class OfferEvent < ActiveRecord::Base
  include Gris::Caching
end

and then cache inside GET requests like this

offer_event =  OfferEvent.cached_find(id)

To expire the cache for an object, call

OfferEvent.expire_cache_for(id)

or, if you have an instance, use

offer_event.expire_cache
The name

Gris is named for the Cubist painter Juan Gris.

juan-gris-bottles-and-bowl-1911


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.