interage-query 0.1.3 → 0.1.4

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: bd944a447104ccf65281efac5edc8d647fc8eb193edcfecec93f8005272584ff
4
- data.tar.gz: 379233d6e1248a889773845b1b801a93efc39fc264ba40b2ae99743771541e84
3
+ metadata.gz: 30a0358bdba0e60794e8deb864566d916c3caf93efc3ed56ffc1560ed28561e7
4
+ data.tar.gz: 1f10baa3cba6fe562d83f9e5ed49e33e8b467d0fef1701799b60b71a9ce4d0c1
5
5
  SHA512:
6
- metadata.gz: 660dbc47d6c187a2065cbe4c52c24e1f9b6014ac0704a5ef976ad66d458b4adb3356e337dc6e1cd97aaa8d2e75a6da8c8fd168595ebb682bad4d741ec84882a6
7
- data.tar.gz: bcd023a668acbe1963fb277e8f47cf84d58ee9648436fecd86bd72216eae3c7656064eed2dc77e8500502b6ee1c1862107f5a1c4dc2da00c3c78646472334a58
6
+ metadata.gz: 897682a56a2d369020a21b9d3d5e904525b08ec180b334fe2e903acefbaf745e35ba9f467acbb00d59491f3c05cb535ae6df367efe739bb3eafb26dd87d04b5b
7
+ data.tar.gz: 44902d930a911f7e6d0b96c46ceaac3bab94a5f1fe2aeeced670f18b46a9685a03938a8633314415b0264a86ba01831556aec6ea4645d4130f3732967e3edc49
data/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ *.gem
data/.rubocop.yml CHANGED
@@ -15,7 +15,8 @@ Style/WordArray:
15
15
  Enabled: false
16
16
 
17
17
  AllCops:
18
- TargetRubyVersion: 2.6
18
+ NewCops: enable
19
+ TargetRubyVersion: 2.7
19
20
  Exclude:
20
21
  - bin/**/*
21
22
  - vendor/**/*
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.4
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', '~> 5.2', '>= 5.2.3'
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.1)
4
+ interage-query (0.1.3)
5
+ kaminari
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
9
- activesupport (5.2.3)
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 (>= 0.7, < 2)
12
- minitest (~> 5.1)
13
- tzinfo (~> 1.1)
14
- ast (2.4.0)
15
- brakeman (4.5.0)
16
- coderay (1.1.2)
17
- concurrent-ruby (1.1.5)
18
- diff-lcs (1.3)
19
- i18n (1.6.0)
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.2)
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
- minitest (5.11.3)
24
- parallel (1.17.0)
25
- parser (2.6.2.1)
26
- ast (~> 2.4.0)
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 (3.1.0)
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 (10.5.0)
33
- rspec (3.8.0)
34
- rspec-core (~> 3.8.0)
35
- rspec-expectations (~> 3.8.0)
36
- rspec-mocks (~> 3.8.0)
37
- rspec-core (3.8.0)
38
- rspec-support (~> 3.8.0)
39
- rspec-expectations (3.8.2)
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.8.0)
42
- rspec-mocks (3.8.0)
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.8.0)
45
- rspec-support (3.8.0)
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.32.0)
97
+ rubocop-rspec (1.35.0)
57
98
  rubocop (>= 0.60.0)
58
- ruby-progressbar (1.10.0)
59
- thread_safe (0.3.6)
60
- tzinfo (1.2.5)
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 (~> 5.2, >= 5.2.3)
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 (~> 10.0)
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.0.1
121
+ 2.2.28
@@ -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://gitlab.com/interage/patterns/query'
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', '~> 10.0'
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,12 +4,27 @@ module Interage
4
4
  class ApplicationQuery
5
5
  PER_PAGE = 50
6
6
 
7
- delegate :first, :find_by, :last, :count, :limit, :any?, to: :relation
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Interage
4
4
  module Query
5
- VERSION = '0.1.3'
5
+ VERSION = '0.1.4'
6
6
  end
7
7
  end
@@ -3,6 +3,8 @@
3
3
  require 'interage/query/version'
4
4
  require 'active_support/core_ext/module'
5
5
 
6
+ require 'kaminari'
7
+
6
8
  module Interage
7
9
  module Query
8
10
  class Error < StandardError
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.3
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: 2020-03-24 00:00:00.000000000 Z
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: '10.0'
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: '10.0'
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,10 +73,11 @@ 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
- - ".travis.yml"
80
+ - ".ruby-version"
66
81
  - CHANGES
67
82
  - Gemfile
68
83
  - Gemfile.lock
@@ -86,15 +101,15 @@ files:
86
101
  - lib/interage/application_query.rb
87
102
  - lib/interage/query.rb
88
103
  - lib/interage/query/version.rb
89
- homepage: https://gitlab.com/interage/patterns/query
104
+ homepage: https://github.com/InterageASH/application-query
90
105
  licenses:
91
106
  - MIT
92
107
  metadata:
93
108
  allowed_push_host: https://rubygems.org
94
- homepage_uri: https://gitlab.com/interage/patterns/query
95
- source_code_uri: https://gitlab.com/interage/patterns/query
96
- changelog_uri: https://gitlab.com/interage/patterns/query/blob/master/CHANGES
97
- 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:
98
113
  rdoc_options: []
99
114
  require_paths:
100
115
  - lib
@@ -102,15 +117,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
117
  requirements:
103
118
  - - ">="
104
119
  - !ruby/object:Gem::Version
105
- version: '0'
120
+ version: '2.7'
106
121
  required_rubygems_version: !ruby/object:Gem::Requirement
107
122
  requirements:
108
123
  - - ">="
109
124
  - !ruby/object:Gem::Version
110
125
  version: '0'
111
126
  requirements: []
112
- rubygems_version: 3.0.6
113
- signing_key:
127
+ rubygems_version: 3.2.28
128
+ signing_key:
114
129
  specification_version: 4
115
130
  summary: Application Query for Interage
116
131
  test_files: []
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.2
7
- before_install: gem install bundler -v 2.0.1