procore-sift 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/procore-sift.rb +13 -2
- data/lib/sift/filter_validator.rb +1 -1
- data/lib/sift/value_parser.rb +1 -1
- data/lib/sift/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f18552ca0480672282156cc7664312b98dbad772
|
4
|
+
data.tar.gz: 81612b0c72fa8827496fe23af9e804993d4d1484
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dc882e598295f080ead00b2b791ecbd5a86722ac7108ce37d00835b7c47790d4dc90d70140cc0bfd8d0b9f66b8b0861072b24e7c84f5ac69170365aedf82572
|
7
|
+
data.tar.gz: 753c9f44ea32b532bc1fb99d5d1b840255c3132eaf5bcfab5842eec2778439b2069e0c631d4a17aba4b41dec583b17f243e341c9f7557ea4aae1ae30ab785403
|
data/lib/procore-sift.rb
CHANGED
@@ -39,20 +39,31 @@ module Sift
|
|
39
39
|
def filter_validator
|
40
40
|
@_filter_validator ||= FilterValidator.build(
|
41
41
|
filters: filters,
|
42
|
-
sort_fields:
|
42
|
+
sort_fields: sort_fields,
|
43
43
|
filter_params: filter_params,
|
44
44
|
sort_params: sort_params,
|
45
45
|
)
|
46
46
|
end
|
47
47
|
|
48
48
|
def filters
|
49
|
-
self.class.
|
49
|
+
self.class.ancestors
|
50
|
+
.take_while { |klass| klass.name != "Sift" }
|
51
|
+
.flat_map { |klass| klass.try(:filters) }
|
52
|
+
.compact
|
53
|
+
.uniq { |f| [f.param, f.class] }
|
50
54
|
end
|
51
55
|
|
52
56
|
def sorts_exist?
|
53
57
|
filters.any? { |filter| filter.is_a?(Sort) }
|
54
58
|
end
|
55
59
|
|
60
|
+
def sort_fields
|
61
|
+
self.class.ancestors
|
62
|
+
.take_while { |klass| klass.name != "Sift" }
|
63
|
+
.flat_map { |klass| klass.try(:sort_fields) }
|
64
|
+
.compact
|
65
|
+
end
|
66
|
+
|
56
67
|
class_methods do
|
57
68
|
def filter_on(parameter, type:, internal_name: parameter, default: nil, validate: nil, scope_params: [])
|
58
69
|
filters << Filter.new(parameter, type, internal_name, default, validate, scope_params)
|
@@ -52,7 +52,7 @@ module Sift
|
|
52
52
|
|
53
53
|
def to_type(filter)
|
54
54
|
if filter.type == :boolean
|
55
|
-
if Rails.version.starts_with?(
|
55
|
+
if Rails.version.starts_with?('5') || Rails.version.starts_with?('6')
|
56
56
|
ActiveRecord::Type::Boolean.new.cast(filter_params[filter.param])
|
57
57
|
else
|
58
58
|
ActiveRecord::Type::Boolean.new.type_cast_from_user(filter_params[filter.param])
|
data/lib/sift/value_parser.rb
CHANGED
data/lib/sift/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: procore-sift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Procore Technologies
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.71.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 0.71.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: sqlite3
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|