Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rosylilly/grape-msgpack
Message pack formatter for grape
https://github.com/rosylilly/grape-msgpack
Last synced: 5 days ago
JSON representation
Message pack formatter for grape
- Host: GitHub
- URL: https://github.com/rosylilly/grape-msgpack
- Owner: rosylilly
- License: mit
- Created: 2013-10-18T21:56:57.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-04-03T02:11:29.000Z (almost 9 years ago)
- Last Synced: 2024-12-22T13:14:53.311Z (15 days ago)
- Language: Ruby
- Size: 13.7 KB
- Stars: 10
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Grape::Msgpack
[![Gem Version](https://badge.fury.io/rb/grape-msgpack.svg)](http://badge.fury.io/rb/grape-msgpack) [![Build Status](https://travis-ci.org/rosylilly/grape-msgpack.svg?branch=master)](https://travis-ci.org/rosylilly/grape-msgpack) [![Coverage Status](https://coveralls.io/repos/rosylilly/grape-msgpack/badge.svg?branch=master)](https://coveralls.io/r/rosylilly/grape-msgpack?branch=master) [![Code Climate](https://codeclimate.com/github/rosylilly/grape-msgpack.svg)](https://codeclimate.com/github/rosylilly/grape-msgpack)
Message pack formatter for grape.
## Installation
Add this line to your application's Gemfile:
gem 'grape-msgpack'
And then execute:
$ bundle
Or install it yourself as:
$ gem install grape-msgpack
## Usage
set default format msgpack:
```ruby
class TwitterAPI < Grape::API
default_format :msgpack
end
```and grape-msgpack supoorts grape-entity:
```ruby
class ModelEntity < Grape::Entity
expose :id
endclass ModelAPI < Grape::API
default_format :msgpackget ':id' do
present Model.find(params[:id]), with: ModelEntity
# => { 'id' => 1 }
end
end
```## Contributing
1. Fork it
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 new Pull Request