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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34da5d6dcd9a125571ba22e88bf08962369e6a78d849f250e756694b1c32dc1b
4
- data.tar.gz: 27cd59c2e576c6ae7ab98ef397e6dca446231c9b61ed97568c63e9a2f1fe8034
3
+ metadata.gz: 8ca17012f7d05bc83011ff1fb014a865320f75bd3b3f7cbb2fdc7a699a4b4808
4
+ data.tar.gz: 85a54f3af32338616644679e2a8655b8c6ce0f9481d7652e82498688170d7556
5
5
  SHA512:
6
- metadata.gz: a89e3160b394aa072a3cefa1c64f6e4f2ab94fdee53242ab97e48a7fc2d38145aada482d0956c8a17278f7b14f07828721e4e00de1be2eff918b81153ef113c5
7
- data.tar.gz: 649b9fd8157a09153ef06d23178fc946453cc6d3d65264fb5d979b4c4ceb9adb8fde26c4ca1bbb6343c8651832ec97f66dcfd22be4539458538b74895bf0dc1e
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 (Fast JSON API)
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 - [:unwanted_attribute]
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.
@@ -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', '~> 2.1'
25
+ spec.add_dependency 'ransack'
26
26
 
27
27
  spec.add_development_dependency 'bundler'
28
28
  spec.add_development_dependency 'rails'
@@ -1,3 +1,3 @@
1
1
  module JSONAPI
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'
3
3
  end
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.2
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-13 00:00:00.000000000 Z
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: '2.1'
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: '2.1'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement