filterable-by 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/{ruby.yml → test.yml} +3 -3
- data/.rubocop.yml +1 -1
- data/Gemfile.lock +41 -50
- data/README.md +2 -0
- data/filterable-by.gemspec +3 -2
- data/lib/filterable_by.rb +2 -2
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7df6ffda90f61fe76374ea6f338c2857a262f7a824620719fb36df05ba22fa0e
|
4
|
+
data.tar.gz: 31cec22f5a8c62759ca8b5155ea9060ff84a85f5dc702baf9237bc3aa3219baa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3e36d0fb257cb048470825bc2669b050759fec897588a0bdad51e2f5b9a7f4702d68abf32fad5412f718ef233d9a6ca5a5c4a8c64c2a6768a1140a09cb57a88
|
7
|
+
data.tar.gz: 6a488f6969ab64b3dad1091966a5da7aa072da42b973f714fdb85934a4fbfe555a9543d2d25bfad2a035b5d542033fb1411dbdb324faa921a70e41520653e3c3
|
@@ -1,4 +1,4 @@
|
|
1
|
-
name:
|
1
|
+
name: Test
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
@@ -7,11 +7,11 @@ on:
|
|
7
7
|
branches: [main]
|
8
8
|
|
9
9
|
jobs:
|
10
|
-
|
10
|
+
ruby:
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
|
-
ruby-version: ["2.
|
14
|
+
ruby-version: ["2.7", "3.0", "3.1"]
|
15
15
|
steps:
|
16
16
|
- uses: actions/checkout@v2
|
17
17
|
- uses: ruby/setup-ruby@v1
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,86 +1,77 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
filterable-by (0.5.
|
4
|
+
filterable-by (0.5.3)
|
5
5
|
activerecord
|
6
6
|
activesupport
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (
|
12
|
-
activesupport (=
|
13
|
-
activerecord (
|
14
|
-
activemodel (=
|
15
|
-
activesupport (=
|
16
|
-
activesupport (
|
11
|
+
activemodel (7.0.2.2)
|
12
|
+
activesupport (= 7.0.2.2)
|
13
|
+
activerecord (7.0.2.2)
|
14
|
+
activemodel (= 7.0.2.2)
|
15
|
+
activesupport (= 7.0.2.2)
|
16
|
+
activesupport (7.0.2.2)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
18
|
i18n (>= 1.6, < 2)
|
19
19
|
minitest (>= 5.1)
|
20
20
|
tzinfo (~> 2.0)
|
21
|
-
zeitwerk (~> 2.3)
|
22
21
|
ast (2.4.2)
|
23
|
-
concurrent-ruby (1.1.
|
24
|
-
diff-lcs (1.
|
25
|
-
i18n (1.
|
22
|
+
concurrent-ruby (1.1.9)
|
23
|
+
diff-lcs (1.5.0)
|
24
|
+
i18n (1.10.0)
|
26
25
|
concurrent-ruby (~> 1.0)
|
27
|
-
minitest (5.
|
28
|
-
parallel (1.
|
29
|
-
parser (3.
|
26
|
+
minitest (5.15.0)
|
27
|
+
parallel (1.21.0)
|
28
|
+
parser (3.1.1.0)
|
30
29
|
ast (~> 2.4.1)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
rspec-
|
38
|
-
rspec-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
rspec-expectations (3.10.1)
|
30
|
+
rainbow (3.1.1)
|
31
|
+
rake (13.0.6)
|
32
|
+
regexp_parser (2.2.1)
|
33
|
+
rexml (3.2.5)
|
34
|
+
rspec (3.11.0)
|
35
|
+
rspec-core (~> 3.11.0)
|
36
|
+
rspec-expectations (~> 3.11.0)
|
37
|
+
rspec-mocks (~> 3.11.0)
|
38
|
+
rspec-core (3.11.0)
|
39
|
+
rspec-support (~> 3.11.0)
|
40
|
+
rspec-expectations (3.11.0)
|
43
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
-
rspec-support (~> 3.
|
45
|
-
rspec-mocks (3.
|
42
|
+
rspec-support (~> 3.11.0)
|
43
|
+
rspec-mocks (3.11.0)
|
46
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
-
rspec-support (~> 3.
|
48
|
-
rspec-support (3.
|
49
|
-
rubocop (1.
|
45
|
+
rspec-support (~> 3.11.0)
|
46
|
+
rspec-support (3.11.0)
|
47
|
+
rubocop (1.25.1)
|
50
48
|
parallel (~> 1.10)
|
51
|
-
parser (>= 3.
|
49
|
+
parser (>= 3.1.0.0)
|
52
50
|
rainbow (>= 2.2.2, < 4.0)
|
53
51
|
regexp_parser (>= 1.8, < 3.0)
|
54
52
|
rexml
|
55
|
-
rubocop-ast (>= 1.
|
53
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
56
54
|
ruby-progressbar (~> 1.7)
|
57
55
|
unicode-display_width (>= 1.4.0, < 3.0)
|
58
|
-
rubocop-ast (1.
|
59
|
-
parser (>=
|
60
|
-
rubocop-bsm (0.
|
56
|
+
rubocop-ast (1.16.0)
|
57
|
+
parser (>= 3.1.1.0)
|
58
|
+
rubocop-bsm (0.6.0)
|
61
59
|
rubocop (~> 1.0)
|
62
60
|
rubocop-performance
|
63
|
-
rubocop-rails
|
64
61
|
rubocop-rake
|
65
62
|
rubocop-rspec
|
66
|
-
rubocop-performance (1.
|
67
|
-
rubocop (>=
|
63
|
+
rubocop-performance (1.13.3)
|
64
|
+
rubocop (>= 1.7.0, < 2.0)
|
68
65
|
rubocop-ast (>= 0.4.0)
|
69
|
-
rubocop-
|
70
|
-
activesupport (>= 4.2.0)
|
71
|
-
rack (>= 1.1)
|
72
|
-
rubocop (>= 0.90.0, < 2.0)
|
73
|
-
rubocop-rake (0.5.1)
|
74
|
-
rubocop
|
75
|
-
rubocop-rspec (2.2.0)
|
66
|
+
rubocop-rake (0.6.0)
|
76
67
|
rubocop (~> 1.0)
|
77
|
-
|
68
|
+
rubocop-rspec (2.9.0)
|
69
|
+
rubocop (~> 1.19)
|
78
70
|
ruby-progressbar (1.11.0)
|
79
71
|
sqlite3 (1.4.2)
|
80
72
|
tzinfo (2.0.4)
|
81
73
|
concurrent-ruby (~> 1.0)
|
82
|
-
unicode-display_width (2.
|
83
|
-
zeitwerk (2.4.2)
|
74
|
+
unicode-display_width (2.1.0)
|
84
75
|
|
85
76
|
PLATFORMS
|
86
77
|
ruby
|
@@ -94,4 +85,4 @@ DEPENDENCIES
|
|
94
85
|
sqlite3
|
95
86
|
|
96
87
|
BUNDLED WITH
|
97
|
-
2.
|
88
|
+
2.3.6
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Filterable By
|
2
2
|
|
3
|
+
[![Test](https://github.com/bsm/filterable-by/actions/workflows/test.yml/badge.svg)](https://github.com/bsm/filterable-by/actions/workflows/test.yml)
|
4
|
+
|
3
5
|
ActiveRecord plugin to parse e.g. a `filter` query parameter apply scopes. Useful for [JSON-API][jsonapi] compatibility.
|
4
6
|
|
5
7
|
[jsonapi]: http://jsonapi.org/format/#fetching-filtering
|
data/filterable-by.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'filterable-by'
|
3
|
-
s.version = '0.5.
|
3
|
+
s.version = '0.5.3'
|
4
4
|
s.authors = ['Dimitrij Denissenko']
|
5
5
|
s.email = ['dimitrij@blacksquaremedia.com']
|
6
6
|
s.summary = 'Generate white-listed filter scopes from URL parameter values'
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^spec/}) }
|
12
12
|
s.test_files = `git ls-files -z -- spec/*`.split("\x0")
|
13
13
|
s.require_paths = ['lib']
|
14
|
-
s.required_ruby_version = '>= 2.
|
14
|
+
s.required_ruby_version = '>= 2.7'
|
15
15
|
|
16
16
|
s.add_dependency 'activerecord'
|
17
17
|
s.add_dependency 'activesupport'
|
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_development_dependency 'rspec'
|
22
22
|
s.add_development_dependency 'rubocop-bsm'
|
23
23
|
s.add_development_dependency 'sqlite3'
|
24
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
24
25
|
end
|
data/lib/filterable_by.rb
CHANGED
@@ -31,7 +31,7 @@ module ActiveRecord
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
# @param [Hash]
|
34
|
+
# @param [Hash|ActionController::Parameters] the filter params
|
35
35
|
# @return [ActiveRecord::Relation] the scoped relation
|
36
36
|
def filter_by(hash = nil, **opts)
|
37
37
|
if hash.nil?
|
@@ -39,7 +39,7 @@ module ActiveRecord
|
|
39
39
|
opts = {}
|
40
40
|
end
|
41
41
|
scope = all
|
42
|
-
return scope unless hash.
|
42
|
+
return scope unless hash.respond_to?(:key?) && hash.respond_to?(:[])
|
43
43
|
|
44
44
|
_filterable_by_config.each do |name, block|
|
45
45
|
next unless hash.key?(name)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filterable-by
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitrij Denissenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -115,7 +115,7 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
- ".github/workflows/
|
118
|
+
- ".github/workflows/test.yml"
|
119
119
|
- ".gitignore"
|
120
120
|
- ".rubocop.yml"
|
121
121
|
- Gemfile
|
@@ -131,7 +131,8 @@ files:
|
|
131
131
|
homepage: https://github.com/bsm/filterable-by
|
132
132
|
licenses:
|
133
133
|
- MIT
|
134
|
-
metadata:
|
134
|
+
metadata:
|
135
|
+
rubygems_mfa_required: 'true'
|
135
136
|
post_install_message:
|
136
137
|
rdoc_options: []
|
137
138
|
require_paths:
|
@@ -140,14 +141,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
141
|
requirements:
|
141
142
|
- - ">="
|
142
143
|
- !ruby/object:Gem::Version
|
143
|
-
version: '2.
|
144
|
+
version: '2.7'
|
144
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
146
|
requirements:
|
146
147
|
- - ">="
|
147
148
|
- !ruby/object:Gem::Version
|
148
149
|
version: '0'
|
149
150
|
requirements: []
|
150
|
-
rubygems_version: 3.
|
151
|
+
rubygems_version: 3.3.3
|
151
152
|
signing_key:
|
152
153
|
specification_version: 4
|
153
154
|
summary: Generate white-listed filter scopes from URL parameter values
|