jsonapi-scopes 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d8dcfdd30f2bb38520c1e76e10c0e12207d73b1188d0840ff263927ba5704db
4
- data.tar.gz: d6ffe6987e5008b220406ce208514437df20ed7aab6e2163ab3ba40bcc35c7db
3
+ metadata.gz: dbd3c67cc76780a390bc9c1e7208cc1d5bc034dcc0f59805837214fe43a3cd6d
4
+ data.tar.gz: 606d6ac99828abca9b7a8e0a47f7933b52920ca7782733f9cff9a8f5c06dc116
5
5
  SHA512:
6
- metadata.gz: e5fc34b5769bc7b4d07d036d6a5b61d8ec0ba5d8b4051233c40fecb8024b4b11e080f5946fada23b695e279baef5995f03b706f45853700f923fc8323500c029
7
- data.tar.gz: 17b004c7009f009e27a54f711e92becd4773bb4bcd73321f924facc1a9738e0c5332a65dc53c22139d84184e9eff9e3ebc2e4c535425b6fa21ba072870d2e1ff
6
+ metadata.gz: 9107728d745f6621bf75723bf72eb6888384545c2e81b905c4eff00139f372c6695ec7f944b13fee3df149387902729ed616161592980b3d1c5eac17aa6a2b51
7
+ data.tar.gz: ff19b9dc96b11ec88fe902cc0861a3fd387623820c49c85251727ec74a38c2c94d18459bb178adae222e247408ff6c8410f45c25421d86511df4541fd7bbcb9d
data/README.md CHANGED
@@ -50,7 +50,9 @@ class ContactsController < ApplicationController
50
50
  end
51
51
  ```
52
52
 
53
- Then you can hit `/contacts?filter[first_name]=Bruce` to filter contacts where the last name exactly match `Bruce`.
53
+ Then you can hit `/contacts?filter[first_name]=Bruce` to filter contacts where the first name exactly match `Bruce`.
54
+
55
+ You can specify multiple matching filter values by passing a comma separated list of values: `/contacts?filter[first_name]=Bruce,Peter` will returns contacts where the first name exactly match `Bruce` or `Peter`.
54
56
 
55
57
  But `/contacts?filter[last_name]=Wayne` will be completely ignored.
56
58
 
@@ -96,5 +98,12 @@ You can even combine multiple sort `/contacts?sort=lastname,-firstname`
96
98
  ## Contributing
97
99
  Do not hesitate to contribute to the project by adapting or adding features ! Bug reports or pull requests are welcome.
98
100
 
101
+ ## Credits
102
+
103
+ Inspired by:
104
+
105
+ + [https://github.com/stefatkins/rails-starter-api](https://github.com/stefatkins/rails-starter-api)
106
+ + [https://github.com/cerebris/jsonapi-resources](https://github.com/cerebris/jsonapi-resources)
107
+
99
108
  ## License
100
109
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -19,6 +19,8 @@ module Jsonapi
19
19
  filtering_params = params.dig(:filter) || {}
20
20
 
21
21
  filtering_params.each do |key, value|
22
+ value = value.to_s.split(',').reject(&:blank?)
23
+
22
24
  records = records.public_send(key, value) if @filters.include?(key.to_sym)
23
25
  end
24
26
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jsonapi
4
4
  module Scopes
5
- VERSION = '0.1.3'
5
+ VERSION = '0.1.4'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-scopes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Briday
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-22 00:00:00.000000000 Z
11
+ date: 2019-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails