Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/byroot/explicit-parameters
Explicit parameters validation and casting for Rails APIs.
https://github.com/byroot/explicit-parameters
Last synced: 5 days ago
JSON representation
Explicit parameters validation and casting for Rails APIs.
- Host: GitHub
- URL: https://github.com/byroot/explicit-parameters
- Owner: byroot
- License: mit
- Created: 2015-02-22T20:40:36.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-03-04T11:17:23.000Z (almost 3 years ago)
- Last Synced: 2024-12-13T13:24:39.067Z (14 days ago)
- Language: Ruby
- Size: 19.5 KB
- Stars: 18
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ExplicitParameters
[![Build Status](https://secure.travis-ci.org/byroot/explicit-parameters.png)](http://travis-ci.org/byroot/explicit-parameters)
[![Gem Version](https://badge.fury.io/rb/explicit-parameters.png)](http://badge.fury.io/rb/explicit-parameters)Explicit parameters validation and casting for Rails APIs.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'explicit-parameters'
```And then execute:
$ bundle
## Usage
Example:
```ruby
class DummyController < ApiController
params do
requires :search, String
accepts :limit, Integer, default: 30validates :limit, :numericality: {greater_than: 0, less_than_or_equal_to: 100}
end
def index
Dummy.search(params.search).limit(params.limit)
end
end
```## TODO
- Real README
## Contributing
1. Fork it ( https://github.com/byroot/explicit_parameters/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