interage-query 0.1.0 → 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 +4 -4
- data/.editorconfig +9 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +2 -1
- data/.ruby-version +1 -0
- data/CHANGES +15 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +78 -37
- data/VERSION +1 -0
- data/interage-query.gemspec +6 -2
- data/lib/interage/application_query.rb +36 -9
- data/lib/interage/query/version.rb +1 -1
- data/lib/interage/query.rb +2 -0
- metadata +31 -14
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30a0358bdba0e60794e8deb864566d916c3caf93efc3ed56ffc1560ed28561e7
|
|
4
|
+
data.tar.gz: 1f10baa3cba6fe562d83f9e5ed49e33e8b467d0fef1701799b60b71a9ce4d0c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 897682a56a2d369020a21b9d3d5e904525b08ec180b334fe2e903acefbaf745e35ba9f467acbb00d59491f3c05cb535ae6df367efe739bb3eafb26dd87d04b5b
|
|
7
|
+
data.tar.gz: 44902d930a911f7e6d0b96c46ceaac3bab94a5f1fe2aeeced670f18b46a9685a03938a8633314415b0264a86ba01831556aec6ea4645d4130f3732967e3edc49
|
data/.editorconfig
ADDED
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.7.4
|
data/CHANGES
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Version 0.1.2:
|
|
2
|
+
- Remove gem kaminari
|
|
3
|
+
|
|
4
|
+
Version 0.1.1:
|
|
5
|
+
- Adiciona metodo empty_relation
|
|
6
|
+
- Adiciona gem kaminari
|
|
7
|
+
|
|
8
|
+
Version 0.1.0
|
|
9
|
+
- Cria build da gem
|
|
10
|
+
- Remove arquivos de template do check do rubocop
|
|
11
|
+
- Adiciona comando dos geradores na documentação
|
|
12
|
+
- Implementa geradores de classes query
|
|
13
|
+
- Implementar classe application query
|
|
14
|
+
- Cria gem application query
|
|
15
|
+
|
data/Gemfile
CHANGED
|
@@ -18,5 +18,5 @@ group :development, :test do
|
|
|
18
18
|
# https://github.com/presidentbeef/brakeman
|
|
19
19
|
gem 'brakeman', '~> 4.3', '>= 4.3.1', require: false
|
|
20
20
|
# https://github.com/rails/rails/tree/master/activesupport#download-and-installation
|
|
21
|
-
gem 'activesupport', '~>
|
|
21
|
+
gem 'activesupport', '~> 6.0'
|
|
22
22
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,48 +1,89 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
interage-query (0.1.
|
|
4
|
+
interage-query (0.1.3)
|
|
5
|
+
kaminari
|
|
5
6
|
|
|
6
7
|
GEM
|
|
7
8
|
remote: https://rubygems.org/
|
|
8
9
|
specs:
|
|
9
|
-
|
|
10
|
+
actionview (6.1.4.1)
|
|
11
|
+
activesupport (= 6.1.4.1)
|
|
12
|
+
builder (~> 3.1)
|
|
13
|
+
erubi (~> 1.4)
|
|
14
|
+
rails-dom-testing (~> 2.0)
|
|
15
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
16
|
+
activemodel (6.1.4.1)
|
|
17
|
+
activesupport (= 6.1.4.1)
|
|
18
|
+
activerecord (6.1.4.1)
|
|
19
|
+
activemodel (= 6.1.4.1)
|
|
20
|
+
activesupport (= 6.1.4.1)
|
|
21
|
+
activesupport (6.1.4.1)
|
|
10
22
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
11
|
-
i18n (>=
|
|
12
|
-
minitest (
|
|
13
|
-
tzinfo (~>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
i18n (>= 1.6, < 2)
|
|
24
|
+
minitest (>= 5.1)
|
|
25
|
+
tzinfo (~> 2.0)
|
|
26
|
+
zeitwerk (~> 2.3)
|
|
27
|
+
ast (2.4.2)
|
|
28
|
+
brakeman (4.10.1)
|
|
29
|
+
builder (3.2.4)
|
|
30
|
+
coderay (1.1.3)
|
|
31
|
+
concurrent-ruby (1.1.9)
|
|
32
|
+
crass (1.0.6)
|
|
33
|
+
diff-lcs (1.4.4)
|
|
34
|
+
erubi (1.10.0)
|
|
35
|
+
i18n (1.8.10)
|
|
20
36
|
concurrent-ruby (~> 1.0)
|
|
21
|
-
jaro_winkler (1.5.
|
|
37
|
+
jaro_winkler (1.5.4)
|
|
38
|
+
kaminari (1.2.1)
|
|
39
|
+
activesupport (>= 4.1.0)
|
|
40
|
+
kaminari-actionview (= 1.2.1)
|
|
41
|
+
kaminari-activerecord (= 1.2.1)
|
|
42
|
+
kaminari-core (= 1.2.1)
|
|
43
|
+
kaminari-actionview (1.2.1)
|
|
44
|
+
actionview
|
|
45
|
+
kaminari-core (= 1.2.1)
|
|
46
|
+
kaminari-activerecord (1.2.1)
|
|
47
|
+
activerecord
|
|
48
|
+
kaminari-core (= 1.2.1)
|
|
49
|
+
kaminari-core (1.2.1)
|
|
50
|
+
loofah (2.12.0)
|
|
51
|
+
crass (~> 1.0.2)
|
|
52
|
+
nokogiri (>= 1.5.9)
|
|
22
53
|
method_source (0.9.2)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
54
|
+
mini_portile2 (2.6.1)
|
|
55
|
+
minitest (5.14.4)
|
|
56
|
+
nokogiri (1.12.5)
|
|
57
|
+
mini_portile2 (~> 2.6.1)
|
|
58
|
+
racc (~> 1.4)
|
|
59
|
+
parallel (1.21.0)
|
|
60
|
+
parser (3.0.2.0)
|
|
61
|
+
ast (~> 2.4.1)
|
|
27
62
|
pry (0.12.2)
|
|
28
63
|
coderay (~> 1.1.0)
|
|
29
64
|
method_source (~> 0.9.0)
|
|
30
|
-
psych (
|
|
65
|
+
psych (4.0.2)
|
|
66
|
+
racc (1.6.0)
|
|
67
|
+
rails-dom-testing (2.0.3)
|
|
68
|
+
activesupport (>= 4.2.0)
|
|
69
|
+
nokogiri (>= 1.6)
|
|
70
|
+
rails-html-sanitizer (1.4.2)
|
|
71
|
+
loofah (~> 2.3)
|
|
31
72
|
rainbow (3.0.0)
|
|
32
|
-
rake (
|
|
33
|
-
rspec (3.
|
|
34
|
-
rspec-core (~> 3.
|
|
35
|
-
rspec-expectations (~> 3.
|
|
36
|
-
rspec-mocks (~> 3.
|
|
37
|
-
rspec-core (3.
|
|
38
|
-
rspec-support (~> 3.
|
|
39
|
-
rspec-expectations (3.
|
|
73
|
+
rake (13.0.6)
|
|
74
|
+
rspec (3.10.0)
|
|
75
|
+
rspec-core (~> 3.10.0)
|
|
76
|
+
rspec-expectations (~> 3.10.0)
|
|
77
|
+
rspec-mocks (~> 3.10.0)
|
|
78
|
+
rspec-core (3.10.1)
|
|
79
|
+
rspec-support (~> 3.10.0)
|
|
80
|
+
rspec-expectations (3.10.1)
|
|
40
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
41
|
-
rspec-support (~> 3.
|
|
42
|
-
rspec-mocks (3.
|
|
82
|
+
rspec-support (~> 3.10.0)
|
|
83
|
+
rspec-mocks (3.10.2)
|
|
43
84
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
44
|
-
rspec-support (~> 3.
|
|
45
|
-
rspec-support (3.
|
|
85
|
+
rspec-support (~> 3.10.0)
|
|
86
|
+
rspec-support (3.10.2)
|
|
46
87
|
rubocop (0.67.2)
|
|
47
88
|
jaro_winkler (~> 1.5.1)
|
|
48
89
|
parallel (~> 1.10)
|
|
@@ -53,28 +94,28 @@ GEM
|
|
|
53
94
|
unicode-display_width (>= 1.4.0, < 1.6)
|
|
54
95
|
rubocop-performance (1.1.0)
|
|
55
96
|
rubocop (>= 0.67.0)
|
|
56
|
-
rubocop-rspec (1.
|
|
97
|
+
rubocop-rspec (1.35.0)
|
|
57
98
|
rubocop (>= 0.60.0)
|
|
58
|
-
ruby-progressbar (1.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
thread_safe (~> 0.1)
|
|
99
|
+
ruby-progressbar (1.11.0)
|
|
100
|
+
tzinfo (2.0.4)
|
|
101
|
+
concurrent-ruby (~> 1.0)
|
|
62
102
|
unicode-display_width (1.5.0)
|
|
103
|
+
zeitwerk (2.5.1)
|
|
63
104
|
|
|
64
105
|
PLATFORMS
|
|
65
106
|
ruby
|
|
66
107
|
|
|
67
108
|
DEPENDENCIES
|
|
68
|
-
activesupport (~>
|
|
109
|
+
activesupport (~> 6.0)
|
|
69
110
|
brakeman (~> 4.3, >= 4.3.1)
|
|
70
111
|
bundler (~> 2.0)
|
|
71
112
|
interage-query!
|
|
72
113
|
pry (~> 0.12.2)
|
|
73
|
-
rake (~>
|
|
114
|
+
rake (~> 13.0)
|
|
74
115
|
rspec (~> 3.8)
|
|
75
116
|
rubocop (~> 0.67.2)
|
|
76
117
|
rubocop-performance (~> 1.1)
|
|
77
118
|
rubocop-rspec (~> 1.32)
|
|
78
119
|
|
|
79
120
|
BUNDLED WITH
|
|
80
|
-
2.
|
|
121
|
+
2.2.28
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.2
|
data/interage-query.gemspec
CHANGED
|
@@ -12,9 +12,11 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
|
|
13
13
|
spec.summary = 'Application Query for Interage'
|
|
14
14
|
spec.description = 'Classes to encapsulate queries'
|
|
15
|
-
spec.homepage = 'https://
|
|
15
|
+
spec.homepage = 'https://github.com/InterageASH/application-query'
|
|
16
16
|
spec.licenses = ['MIT']
|
|
17
17
|
|
|
18
|
+
spec.required_ruby_version = '>= 2.7'
|
|
19
|
+
|
|
18
20
|
if spec.respond_to?(:metadata)
|
|
19
21
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
20
22
|
|
|
@@ -36,6 +38,8 @@ Gem::Specification.new do |spec|
|
|
|
36
38
|
spec.require_paths = ['lib']
|
|
37
39
|
|
|
38
40
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
39
|
-
spec.add_development_dependency 'rake', '~>
|
|
41
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
40
42
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
43
|
+
|
|
44
|
+
spec.add_dependency 'kaminari', '>= 0'
|
|
41
45
|
end
|
|
@@ -4,30 +4,39 @@ module Interage
|
|
|
4
4
|
class ApplicationQuery
|
|
5
5
|
PER_PAGE = 50
|
|
6
6
|
|
|
7
|
-
delegate :first, :
|
|
7
|
+
delegate :first, :last, :find, :find_by, :find_by!, :pluck, :count, :limit,
|
|
8
|
+
:any?, :exists?, to: :relation
|
|
9
|
+
|
|
10
|
+
def initialize
|
|
11
|
+
init_relation
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def init_relation
|
|
15
|
+
raise NotImplementedError, 'subclass did not define #init_relation'
|
|
16
|
+
end
|
|
8
17
|
|
|
9
18
|
def all
|
|
10
19
|
includes.relation
|
|
11
20
|
end
|
|
12
21
|
|
|
22
|
+
def distinct
|
|
23
|
+
@relation = relation.distinct
|
|
24
|
+
|
|
25
|
+
self
|
|
26
|
+
end
|
|
27
|
+
|
|
13
28
|
def build(attributes = {})
|
|
14
29
|
all.new(attributes)
|
|
15
30
|
end
|
|
16
31
|
|
|
17
32
|
def find(id)
|
|
18
|
-
|
|
33
|
+
all.find_by(id: id)
|
|
19
34
|
end
|
|
20
35
|
|
|
21
36
|
def paginate(page = 1)
|
|
22
37
|
all.page(page).per(PER_PAGE)
|
|
23
38
|
end
|
|
24
39
|
|
|
25
|
-
def by_id(id)
|
|
26
|
-
@relation = relation.where(id: id) if id.present?
|
|
27
|
-
|
|
28
|
-
self
|
|
29
|
-
end
|
|
30
|
-
|
|
31
40
|
def search_ilike_for(colums, term)
|
|
32
41
|
return self unless term
|
|
33
42
|
|
|
@@ -39,7 +48,7 @@ module Interage
|
|
|
39
48
|
end
|
|
40
49
|
|
|
41
50
|
def between_dates(column, start_date, finish_date = nil)
|
|
42
|
-
start_date =
|
|
51
|
+
start_date = Date.current if start_date.blank?
|
|
43
52
|
finish_date = start_date if finish_date.blank?
|
|
44
53
|
range_date =
|
|
45
54
|
start_date.to_date.beginning_of_day..finish_date.to_date.end_of_day
|
|
@@ -49,12 +58,30 @@ module Interage
|
|
|
49
58
|
self
|
|
50
59
|
end
|
|
51
60
|
|
|
61
|
+
def by_id(id)
|
|
62
|
+
@relation = relation.where(id: id) if id.present?
|
|
63
|
+
|
|
64
|
+
self
|
|
65
|
+
end
|
|
66
|
+
|
|
52
67
|
def includes
|
|
53
68
|
self
|
|
54
69
|
end
|
|
55
70
|
|
|
71
|
+
def decorate
|
|
72
|
+
@relation = ActiveDecorator::Decorator.instance.decorate(relation)
|
|
73
|
+
|
|
74
|
+
self
|
|
75
|
+
end
|
|
76
|
+
|
|
56
77
|
protected
|
|
57
78
|
|
|
58
79
|
attr_accessor :relation
|
|
80
|
+
|
|
81
|
+
def empty_relation
|
|
82
|
+
@relation = relation.none
|
|
83
|
+
|
|
84
|
+
self
|
|
85
|
+
end
|
|
59
86
|
end
|
|
60
87
|
end
|
data/lib/interage/query.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: interage-query
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Walmir Neto
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-10-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '13.0'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '13.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rspec
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '3.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: kaminari
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
55
69
|
description: Classes to encapsulate queries
|
|
56
70
|
email:
|
|
57
71
|
- owalmirneto@gmail.com
|
|
@@ -59,14 +73,17 @@ executables: []
|
|
|
59
73
|
extensions: []
|
|
60
74
|
extra_rdoc_files: []
|
|
61
75
|
files:
|
|
76
|
+
- ".editorconfig"
|
|
62
77
|
- ".gitignore"
|
|
63
78
|
- ".rspec"
|
|
64
79
|
- ".rubocop.yml"
|
|
65
|
-
- ".
|
|
80
|
+
- ".ruby-version"
|
|
81
|
+
- CHANGES
|
|
66
82
|
- Gemfile
|
|
67
83
|
- Gemfile.lock
|
|
68
84
|
- README.md
|
|
69
85
|
- Rakefile
|
|
86
|
+
- VERSION
|
|
70
87
|
- bin/brakeman
|
|
71
88
|
- bin/bundle
|
|
72
89
|
- bin/ci
|
|
@@ -84,15 +101,15 @@ files:
|
|
|
84
101
|
- lib/interage/application_query.rb
|
|
85
102
|
- lib/interage/query.rb
|
|
86
103
|
- lib/interage/query/version.rb
|
|
87
|
-
homepage: https://
|
|
104
|
+
homepage: https://github.com/InterageASH/application-query
|
|
88
105
|
licenses:
|
|
89
106
|
- MIT
|
|
90
107
|
metadata:
|
|
91
108
|
allowed_push_host: https://rubygems.org
|
|
92
|
-
homepage_uri: https://
|
|
93
|
-
source_code_uri: https://
|
|
94
|
-
changelog_uri: https://
|
|
95
|
-
post_install_message:
|
|
109
|
+
homepage_uri: https://github.com/InterageASH/application-query
|
|
110
|
+
source_code_uri: https://github.com/InterageASH/application-query
|
|
111
|
+
changelog_uri: https://github.com/InterageASH/application-query/blob/master/CHANGES
|
|
112
|
+
post_install_message:
|
|
96
113
|
rdoc_options: []
|
|
97
114
|
require_paths:
|
|
98
115
|
- lib
|
|
@@ -100,15 +117,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
100
117
|
requirements:
|
|
101
118
|
- - ">="
|
|
102
119
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
120
|
+
version: '2.7'
|
|
104
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
122
|
requirements:
|
|
106
123
|
- - ">="
|
|
107
124
|
- !ruby/object:Gem::Version
|
|
108
125
|
version: '0'
|
|
109
126
|
requirements: []
|
|
110
|
-
rubygems_version: 3.
|
|
111
|
-
signing_key:
|
|
127
|
+
rubygems_version: 3.2.28
|
|
128
|
+
signing_key:
|
|
112
129
|
specification_version: 4
|
|
113
130
|
summary: Application Query for Interage
|
|
114
131
|
test_files: []
|