jsonapi.rb 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -4
- data/jsonapi.rb.gemspec +1 -1
- data/lib/jsonapi/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ca17012f7d05bc83011ff1fb014a865320f75bd3b3f7cbb2fdc7a699a4b4808
|
4
|
+
data.tar.gz: 85a54f3af32338616644679e2a8655b8c6ce0f9481d7652e82498688170d7556
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aac2e2d9505aff33c1a5ea5560b662f227d7fb508683dd868b408b5e83fa7d1c05f94ef86f034759a641a31e1fc44f16508bc74c969c35270189dd3eec4fe742
|
7
|
+
data.tar.gz: d01a54d231a2b5e90378154023092c42cd6f3181ffb50efddb5e1aea311ddb9ed691962ed957762d5bc3f2045475a505211c04879c599bf06c917eef59a3ace3
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ Main goals:
|
|
31
31
|
|
32
32
|
The available features include:
|
33
33
|
|
34
|
-
* object serialization powered by
|
34
|
+
* object serialization (powered by Fast JSON API)
|
35
35
|
* [error handling](https://jsonapi.org/format/#errors) (parameters,
|
36
36
|
validation, generic errors)
|
37
37
|
* fetching of the data (support for
|
@@ -128,8 +128,6 @@ class MyController < ActionController::Base
|
|
128
128
|
include JSONAPI::Errors
|
129
129
|
|
130
130
|
def update
|
131
|
-
raise_error! if params[:id] == 'tada'
|
132
|
-
|
133
131
|
record = Model.find(params[:id])
|
134
132
|
|
135
133
|
if record.update(params.require(:data).require(:attributes).permit!)
|
@@ -160,7 +158,7 @@ class MyController < ActionController::Base
|
|
160
158
|
|
161
159
|
# Overwrite/whitelist the includes
|
162
160
|
def jsonapi_include(resources)
|
163
|
-
super
|
161
|
+
super & ['wanted_attribute']
|
164
162
|
end
|
165
163
|
end
|
166
164
|
```
|
@@ -219,6 +217,17 @@ end
|
|
219
217
|
|
220
218
|
This will generate the relevant pagination _links_.
|
221
219
|
|
220
|
+
If you want to add the pagination information to your meta,
|
221
|
+
use the `jsonapi_pagination_meta` method:
|
222
|
+
|
223
|
+
```ruby
|
224
|
+
def jsonapi_meta(resources)
|
225
|
+
pagination = jsonapi_pagination_meta(resources)
|
226
|
+
|
227
|
+
{ pagination: pagination } if pagination.present?
|
228
|
+
end
|
229
|
+
```
|
230
|
+
|
222
231
|
## Development
|
223
232
|
|
224
233
|
After checking out the repo, run `bundle` to install dependencies.
|
data/jsonapi.rb.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
24
|
spec.add_dependency 'fast_jsonapi', '~> 1.5'
|
25
|
-
spec.add_dependency 'ransack'
|
25
|
+
spec.add_dependency 'ransack'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'bundler'
|
28
28
|
spec.add_development_dependency 'rails'
|
data/lib/jsonapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stas Suscov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fast_jsonapi
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: ransack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|