jsonapi_compliable 0.11.17 → 0.11.18

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
  SHA1:
3
- metadata.gz: 649f0580f8ec8efbfbb9cec9a190390fa7b99cb9
4
- data.tar.gz: fd775c165ecee97fc424ac0b4f9ab9196b6e8f9b
3
+ metadata.gz: 8ae4537ec81c633eb467154e5652f75ec7c67616
4
+ data.tar.gz: c6c9b4a8920411b3fb493a021c768ebaead6702f
5
5
  SHA512:
6
- metadata.gz: b35775bc5eb4c3bd7b7b0812fe8b42e60cf8a1f5c55b0b272df64f6243ab8a2a260fa325c0d4bdebcf5f173b4d530666b659858c361d586ac72675b6634f2103
7
- data.tar.gz: 96cfc2f2b74d39fce6a746b1e5e61ef67a943d6ad234f103b78796fbc9a9ccd4e1d52a73fdd865b3d4fe68be4d62bbc553b563f678c49d6e7b72b2ce63ffbe45
6
+ metadata.gz: 9289db353d5542c7cd347ecaa875c3794d89ab1f49e67eea3b49ca8c176ba229c00834b16253644690a46c6f2580b2387c74961ad8039913c8e2aa67ce4c85ef
7
+ data.tar.gz: fa52bb8ced3115a8037ef8e9d97ab7180d373fde955c1aa5d812d7a5c4479586b217092cb164a21f30178df5792f2c0ebb4de8ebc622b5e40433eb81388c274b
@@ -118,13 +118,17 @@ module JsonapiCompliable
118
118
  end
119
119
  end
120
120
 
121
- def apply_scoping(opts)
122
- @object = JsonapiCompliable::Scoping::DefaultFilter.new(@resource, query_hash, @object).apply
123
- @object = JsonapiCompliable::Scoping::Filter.new(@resource, query_hash, @object).apply unless opts[:filter] == false
124
- @object = JsonapiCompliable::Scoping::ExtraFields.new(@resource, query_hash, @object).apply unless opts[:extra_fields] == false
125
- @object = JsonapiCompliable::Scoping::Sort.new(@resource, query_hash, @object).apply unless opts[:sort] == false
126
- @unpaginated_object = @object
127
- @object = JsonapiCompliable::Scoping::Paginate.new(@resource, query_hash, @object, default: opts[:default_paginate]).apply unless opts[:paginate] == false
121
+ def apply_scoping(opts)
122
+ add_scoping(nil, JsonapiCompliable::Scoping::DefaultFilter, opts)
123
+ add_scoping(:filter, JsonapiCompliable::Scoping::Filter, opts)
124
+ add_scoping(:extra_fields, JsonapiCompliable::Scoping::ExtraFields, opts)
125
+ add_scoping(:sort, JsonapiCompliable::Scoping::Sort, opts)
126
+ add_scoping(:paginate, JsonapiCompliable::Scoping::Paginate, opts, default: opts[:default_paginate])
127
+ end
128
+
129
+ def add_scoping(key, scoping_class, opts, default = {})
130
+ @object = scoping_class.new(@resource, query_hash, @object, default).apply unless opts[key] == false
131
+ @unpaginated_object = @object unless key == :paginate
128
132
  end
129
133
  end
130
134
  end
@@ -1,3 +1,3 @@
1
1
  module JsonapiCompliable
2
- VERSION = "0.11.17"
2
+ VERSION = "0.11.18"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi_compliable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.17
4
+ version: 0.11.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-06-02 00:00:00.000000000 Z
12
+ date: 2018-06-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jsonapi-serializable