All Projects → fabrik42 → Acts_as_api

fabrik42 / Acts_as_api

Licence: mit
makes creating API responses in Rails easy and fun

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Acts as api

Jsonapi Utils
Build JSON API-compliant APIs on Rails with no (or less) learning curve.
Stars: ✭ 191 (-62.25%)
Mutual labels:  api, json, serializer, rails
Jsonapi parameters
Rails-way to consume JSON:API input
Stars: ✭ 50 (-90.12%)
Mutual labels:  api, json, rails
Dictfier
Python library to convert/serialize class instances(Objects) both flat and nested into a dictionary data structure. It's very useful in converting Python Objects into JSON format
Stars: ✭ 67 (-86.76%)
Mutual labels:  api, json, serializer
Api Client Generator
Angular REST API client generator from Swagger YAML or JSON file with camel case settigs
Stars: ✭ 92 (-81.82%)
Mutual labels:  api, json, models
Blueprinter
Simple, Fast, and Declarative Serialization Library for Ruby
Stars: ✭ 623 (+23.12%)
Mutual labels:  json, serializer, rails
Flexirest
Flexirest - The really flexible REST API client for Ruby
Stars: ✭ 188 (-62.85%)
Mutual labels:  api, json, rails
Pager Api
Easy API pagination for Rails
Stars: ✭ 86 (-83%)
Mutual labels:  api, json, rails
Symfony Jsonapi
JSON API Transformer Bundle for Symfony 2 and Symfony 3
Stars: ✭ 114 (-77.47%)
Mutual labels:  api, json, serializer
Sabisu Rails
Simple and powerful engine for exploring your Rails api application
Stars: ✭ 129 (-74.51%)
Mutual labels:  api, json, rails
Jsonapi.rb
Lightweight, simple and maintained JSON:API support for your next Ruby HTTP API.
Stars: ✭ 116 (-77.08%)
Mutual labels:  api, serializer, rails
Datoji
A tiny JSON storage service. Create, Read, Update, Delete and Search JSON data.
Stars: ✭ 222 (-56.13%)
Mutual labels:  api, json, rails
Jsonapi Rails
Rails gem for fast jsonapi-compliant APIs.
Stars: ✭ 242 (-52.17%)
Mutual labels:  api, json, rails
Laravel Json Api Paginate
A paginator that plays nice with the JSON API spec
Stars: ✭ 351 (-30.63%)
Mutual labels:  api, json
Allorigins
👽 Pull contents from any page as JSON via API
Stars: ✭ 343 (-32.21%)
Mutual labels:  api, json
Newton Api
➗ A really micro micro-service for advanced math.
Stars: ✭ 358 (-29.25%)
Mutual labels:  api, json
Polr
🚡 A modern, powerful, and robust URL shortener
Stars: ✭ 4,147 (+719.57%)
Mutual labels:  api, json
Api.rss
RSS as RESTful. This service allows you to transform RSS feed into an awesome API.
Stars: ✭ 340 (-32.81%)
Mutual labels:  api, rails
Diplomat
A HTTP Ruby API for Consul
Stars: ✭ 358 (-29.25%)
Mutual labels:  api, rails
Dog Ceo Api
The API hosted at dog.ceo
Stars: ✭ 393 (-22.33%)
Mutual labels:  api, json
Store model
Work with JSON-backed attributes as ActiveRecord-ish models
Stars: ✭ 410 (-18.97%)
Mutual labels:  json, rails

acts_as_api makes creating XML/JSON responses in Rails 3, 4, 5 and 6 easy and fun.

It provides a simple interface to determine the representation of your model data, that should be rendered in your API responses.

In addition to Rails it theoretically can be used with any ruby app and any database (ActiveRecord, Mongoid and ActiveResource are supported out of the box) as it only has few dependencies.

The lib is very fast in generating your responses and battle tested in production with platforms like Diaspora or flinc.

Introduction

acts_as_api enriches the models and controllers of your app in a Rails-like way so you can easily determine how your API responses should look like:

class User < ActiveRecord::Base

  acts_as_api

  api_accessible :public do |template|
    template.add :first_name
    template.add :age
  end
  # will render json: { "user": { "first_name": "John", "age":  26 } }

  api_accessible :private, extend: :public do |template|
    template.add :last_name
    template.add :email
  end
  # will render json: { "user": { "first_name": "John", "last_name": "Doe", "age":  26, "email": "[email protected]" } }

end

Getting started

A nice introduction about acts_as_api with examples can be found here:

http://fabrik42.github.com/acts_as_api

See the Wiki for a lot of usage examples and features:

https://github.com/fabrik42/acts_as_api/wiki

There are a lot of how-tos like:

Features:

  • DRY templates for your api responses
  • Ships with support for ActiveRecord and Mongoid
  • Support for Rails 3/4 Responders (extracted to responders gem since Rails 5)
  • Plays very well together with client libs like Backbone.js, RestKit (iOS) or gson (Android).
  • Easy but very flexible syntax for defining the templates
  • XML, JSON and JSON-P support out of the box, easy to extend
  • Minimal dependecies (you can also use it without Rails)
  • Supports multiple api rendering templates per model. This is especially useful for API versioning or for example for private vs. public access points to a user’s profile.

Requirements:

  • ActiveModel (>= 3.0.0)
  • ActiveSupport (>= 3.0.0)
  • Rack (>= 1.1.0)

Links

Downwards Compatibility

Note that upgrading to 0.3.0 will break code that worked with previous versions due to a complete overhaul of the lib. For a legacy version of this readme file look here: https://github.com/fabrik42/acts_as_api/wiki/legacy-acts_as_api-0.2-readme

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].