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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a45bdeb246550581221e6a721af41f27e355b9d87d1fd8dd791731142bba9cd
4
- data.tar.gz: 06f4640997ef9fbfc88b6cedb943cf0840c0e643c7012ffd441700e52495113e
3
+ metadata.gz: 7df6ffda90f61fe76374ea6f338c2857a262f7a824620719fb36df05ba22fa0e
4
+ data.tar.gz: 31cec22f5a8c62759ca8b5155ea9060ff84a85f5dc702baf9237bc3aa3219baa
5
5
  SHA512:
6
- metadata.gz: c292090ad77af10f1729f4ad652fb84595fe20d866bf4ab221d642465fc56fa4073dc7cc2ed2469b9a92169e418f2860f44ea4702bbf4cbf34e1591b07645077
7
- data.tar.gz: '08a1ec2870b5da50e5b41b35a06e8adf5b72f375c50fb2bc3009d9a4c17f5140b4f44f44ffc764aa8f73703a9f041610b37075ebbedabfd84db362690562b9a2'
6
+ metadata.gz: c3e36d0fb257cb048470825bc2669b050759fec897588a0bdad51e2f5b9a7f4702d68abf32fad5412f718ef233d9a6ca5a5c4a8c64c2a6768a1140a09cb57a88
7
+ data.tar.gz: 6a488f6969ab64b3dad1091966a5da7aa072da42b973f714fdb85934a4fbfe555a9543d2d25bfad2a035b5d542033fb1411dbdb324faa921a70e41520653e3c3
@@ -1,4 +1,4 @@
1
- name: Ruby
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
- test:
10
+ ruby:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: ["2.6", "2.7", "3.0"]
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
@@ -6,6 +6,6 @@ inherit_mode:
6
6
  - Exclude
7
7
 
8
8
  AllCops:
9
- TargetRubyVersion: "2.6"
9
+ TargetRubyVersion: "2.7"
10
10
  Naming/FileName:
11
11
  Exclude: [lib/filterable-by.rb]
data/Gemfile.lock CHANGED
@@ -1,86 +1,77 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- filterable-by (0.5.2)
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 (6.1.3)
12
- activesupport (= 6.1.3)
13
- activerecord (6.1.3)
14
- activemodel (= 6.1.3)
15
- activesupport (= 6.1.3)
16
- activesupport (6.1.3)
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.8)
24
- diff-lcs (1.4.4)
25
- i18n (1.8.9)
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.14.4)
28
- parallel (1.20.1)
29
- parser (3.0.0.0)
26
+ minitest (5.15.0)
27
+ parallel (1.21.0)
28
+ parser (3.1.1.0)
30
29
  ast (~> 2.4.1)
31
- rack (2.2.3)
32
- rainbow (3.0.0)
33
- rake (13.0.3)
34
- regexp_parser (2.1.1)
35
- rexml (3.2.4)
36
- rspec (3.10.0)
37
- rspec-core (~> 3.10.0)
38
- rspec-expectations (~> 3.10.0)
39
- rspec-mocks (~> 3.10.0)
40
- rspec-core (3.10.1)
41
- rspec-support (~> 3.10.0)
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.10.0)
45
- rspec-mocks (3.10.2)
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.10.0)
48
- rspec-support (3.10.2)
49
- rubocop (1.11.0)
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.0.0.0)
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.2.0, < 2.0)
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.4.1)
59
- parser (>= 2.7.1.5)
60
- rubocop-bsm (0.5.4)
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.10.1)
67
- rubocop (>= 0.90.0, < 2.0)
63
+ rubocop-performance (1.13.3)
64
+ rubocop (>= 1.7.0, < 2.0)
68
65
  rubocop-ast (>= 0.4.0)
69
- rubocop-rails (2.9.1)
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
- rubocop-ast (>= 1.1.0)
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.0.0)
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.1.4
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'filterable-by'
3
- s.version = '0.5.2'
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.6'
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] hash the filter params
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.is_a?(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.2
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: 2021-03-02 00:00:00.000000000 Z
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/ruby.yml"
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.6'
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.1.4
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