json_api_responders 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +7 -3
- data/lib/json_api_responders.rb +2 -2
- data/lib/json_api_responders/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7df311b93bbca363d13105a1db7d3d3edad5f2739f5b4c59fa9e9ba55cf917c5
|
4
|
+
data.tar.gz: 1f7eb04edff138ccfdf2a0cfab648c2236200665124b1a9d4e875a28a53ebc64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09e3590a12b0578c798796c5bfe35351d5282cb6159034e3127b4f9c163d04393417fe4da194526a3ec78f3e7aa8d7d0fe44436583125588db017730b6f87349'
|
7
|
+
data.tar.gz: 591341c5b4585cdc55ae6646fd7b8698bb42812cb9e1a0fcfd3eb9ff4f1b70fbdb88b1c20ef7e7a428c130684aebfdb57ffd55e07f72cb34aeba3fa82730d42b
|
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/json_api_responders.svg)](https://badge.fury.io/rb/json_api_responders)
|
4
4
|
[![Build Status](https://semaphoreci.com/api/v1/infinum/json_api_responders/branches/master/shields_badge.svg)](https://semaphoreci.com/infinum/json_api_responders)
|
5
|
-
[![
|
6
|
-
[![Test Coverage](https://codeclimate.com/
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/f0735e647a41336a7f0a/maintainability)](https://codeclimate.com/github/infinum/json_api_responders/maintainability)
|
6
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/f0735e647a41336a7f0a/test_coverage)](https://codeclimate.com/github/infinum/json_api_responders/test_coverage)
|
7
7
|
|
8
8
|
This gem gives a few convenient methods for working with JSONAPI. It is inspired by the [responders](https://github.com/plataformatec/responders) gem.
|
9
9
|
|
@@ -60,13 +60,15 @@ This method requires HTTP status code and an optional parameter explaining the e
|
|
60
60
|
## Configuration
|
61
61
|
Currently you can only configure which options are required to be passed through the `respond_with` method. These required options are categorized by the controller's actions. Bellow you can find an example:
|
62
62
|
|
63
|
+
# config/initializers/json_api_responders.rb
|
63
64
|
JsonApiResponders.configure do |config|
|
64
65
|
config.required_options = {
|
65
66
|
index: [:each_serializer],
|
66
67
|
create: [:serializer]
|
67
68
|
}
|
68
69
|
end
|
69
|
-
|
70
|
+
|
71
|
+
# app/controllers/v1/users_controller.rb
|
70
72
|
def create
|
71
73
|
user = User.create(...)
|
72
74
|
respond_with user, serializer: UserSerializer
|
@@ -90,6 +92,7 @@ If `:serializer` was left out of the above `respond_with` method you would see t
|
|
90
92
|
render json: resource, status: 201
|
91
93
|
else
|
92
94
|
render error: errors, status: 409
|
95
|
+
end
|
93
96
|
|
94
97
|
### update
|
95
98
|
|
@@ -97,6 +100,7 @@ If `:serializer` was left out of the above `respond_with` method you would see t
|
|
97
100
|
render json: resource, status: 200
|
98
101
|
else
|
99
102
|
render error: errors, status: 409
|
103
|
+
end
|
100
104
|
|
101
105
|
### destroy
|
102
106
|
|
data/lib/json_api_responders.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_api_responders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanko Krtalić Rusendić
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
155
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.7.3
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: Automatically respond to JSON::API requests
|