interage-query 0.1.0 → 0.1.1

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: 635408157836d195392fe9af6fc25cef12dbc9af290bf9b7e7dca2e31daba904
4
- data.tar.gz: 58afcab84392f1a16f296859312195887f479a93cc5ad35d0d827001f3fd8f42
3
+ metadata.gz: 362c471f51d374df3450313d4da9492ae6e6d614e52aa6c267c48ecae46a6779
4
+ data.tar.gz: 5b7f09feb2690652a6cfaf02e92edaf6b09ce843afeb10f036c31a905b98abec
5
5
  SHA512:
6
- metadata.gz: 37ebb5f4e8cbab5b11a55aea7642b5aff47cd44bd2d00cf57cf5d19e84adb81679c5402443733c2f6acdecae15c8d8b02bdf3f99b1a68e1282c4729782579904
7
- data.tar.gz: 61e710399d859b2a5e30400138d9e2899cd7dbf1508e9c7c013a66298a747c79e3dcf46287ac1671bb19fbbf48d41d6881b8f3471f64d6b75f1ab009980e9026
6
+ metadata.gz: 4a69f4e080ffedb00471cc8b22f687d1b0dafa67ed0398db47ab69ce8d59a5e1a1b3abbe31807ae6e76542437f67f1ea7e91a06b864689c11add8e82bf03543a
7
+ data.tar.gz: 6af69c038d96273012d899ca46733f401b886d1bde2df907f1ebc86751a61b199ffebc438cd6aab8fbd2dc82b900a1477a279b19891317f18953d15f92f557ad
data/CHANGES ADDED
@@ -0,0 +1,8 @@
1
+ Version 0.1.0
2
+ - Cria build da gem
3
+ - Remove arquivos de template do check do rubocop
4
+ - Adiciona comando dos geradores na documentação
5
+ - Implementa geradores de classes query
6
+ - Implementar classe application query
7
+ - Cria gem application query
8
+
data/Gemfile CHANGED
@@ -4,6 +4,9 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
+ # https://github.com/kaminari/kaminari#installation
8
+ gem 'kaminari', '~> 1.1.1'
9
+
7
10
  group :development, :test do
8
11
  # https://github.com/rubocop-hq/rubocop#quickstart
9
12
  gem 'rubocop', '~> 0.67.2'
data/Gemfile.lock CHANGED
@@ -6,21 +6,55 @@ PATH
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ actionview (5.2.3)
10
+ activesupport (= 5.2.3)
11
+ builder (~> 3.1)
12
+ erubi (~> 1.4)
13
+ rails-dom-testing (~> 2.0)
14
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
15
+ activemodel (5.2.3)
16
+ activesupport (= 5.2.3)
17
+ activerecord (5.2.3)
18
+ activemodel (= 5.2.3)
19
+ activesupport (= 5.2.3)
20
+ arel (>= 9.0)
9
21
  activesupport (5.2.3)
10
22
  concurrent-ruby (~> 1.0, >= 1.0.2)
11
23
  i18n (>= 0.7, < 2)
12
24
  minitest (~> 5.1)
13
25
  tzinfo (~> 1.1)
26
+ arel (9.0.0)
14
27
  ast (2.4.0)
15
28
  brakeman (4.5.0)
29
+ builder (3.2.3)
16
30
  coderay (1.1.2)
17
31
  concurrent-ruby (1.1.5)
32
+ crass (1.0.4)
18
33
  diff-lcs (1.3)
34
+ erubi (1.8.0)
19
35
  i18n (1.6.0)
20
36
  concurrent-ruby (~> 1.0)
21
37
  jaro_winkler (1.5.2)
38
+ kaminari (1.1.1)
39
+ activesupport (>= 4.1.0)
40
+ kaminari-actionview (= 1.1.1)
41
+ kaminari-activerecord (= 1.1.1)
42
+ kaminari-core (= 1.1.1)
43
+ kaminari-actionview (1.1.1)
44
+ actionview
45
+ kaminari-core (= 1.1.1)
46
+ kaminari-activerecord (1.1.1)
47
+ activerecord
48
+ kaminari-core (= 1.1.1)
49
+ kaminari-core (1.1.1)
50
+ loofah (2.2.3)
51
+ crass (~> 1.0.2)
52
+ nokogiri (>= 1.5.9)
22
53
  method_source (0.9.2)
54
+ mini_portile2 (2.4.0)
23
55
  minitest (5.11.3)
56
+ nokogiri (1.10.3)
57
+ mini_portile2 (~> 2.4.0)
24
58
  parallel (1.17.0)
25
59
  parser (2.6.2.1)
26
60
  ast (~> 2.4.0)
@@ -28,6 +62,11 @@ GEM
28
62
  coderay (~> 1.1.0)
29
63
  method_source (~> 0.9.0)
30
64
  psych (3.1.0)
65
+ rails-dom-testing (2.0.3)
66
+ activesupport (>= 4.2.0)
67
+ nokogiri (>= 1.6)
68
+ rails-html-sanitizer (1.0.4)
69
+ loofah (~> 2.2, >= 2.2.2)
31
70
  rainbow (3.0.0)
32
71
  rake (10.5.0)
33
72
  rspec (3.8.0)
@@ -69,6 +108,7 @@ DEPENDENCIES
69
108
  brakeman (~> 4.3, >= 4.3.1)
70
109
  bundler (~> 2.0)
71
110
  interage-query!
111
+ kaminari (~> 1.1.1)
72
112
  pry (~> 0.12.2)
73
113
  rake (~> 10.0)
74
114
  rspec (~> 3.8)
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -4,7 +4,7 @@ module Interage
4
4
  class ApplicationQuery
5
5
  PER_PAGE = 50
6
6
 
7
- delegate :first, :find_by, :last, :count, :any?, to: :relation
7
+ delegate :first, :find_by, :last, :count, :limit, :any?, to: :relation
8
8
 
9
9
  def all
10
10
  includes.relation
@@ -22,12 +22,6 @@ module Interage
22
22
  all.page(page).per(PER_PAGE)
23
23
  end
24
24
 
25
- def by_id(id)
26
- @relation = relation.where(id: id) if id.present?
27
-
28
- self
29
- end
30
-
31
25
  def search_ilike_for(colums, term)
32
26
  return self unless term
33
27
 
@@ -39,7 +33,7 @@ module Interage
39
33
  end
40
34
 
41
35
  def between_dates(column, start_date, finish_date = nil)
42
- start_date = Time.current if start_date.blank?
36
+ start_date = Date.current if start_date.blank?
43
37
  finish_date = start_date if finish_date.blank?
44
38
  range_date =
45
39
  start_date.to_date.beginning_of_day..finish_date.to_date.end_of_day
@@ -49,6 +43,12 @@ module Interage
49
43
  self
50
44
  end
51
45
 
46
+ def by_id(id)
47
+ @relation = relation.where(id: id) if id.present?
48
+
49
+ self
50
+ end
51
+
52
52
  def includes
53
53
  self
54
54
  end
@@ -56,5 +56,11 @@ module Interage
56
56
  protected
57
57
 
58
58
  attr_accessor :relation
59
+
60
+ def empty_relation
61
+ @relation = relation.none
62
+
63
+ self
64
+ end
59
65
  end
60
66
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Interage
4
4
  module Query
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Walmir Neto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-23 00:00:00.000000000 Z
11
+ date: 2019-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -63,10 +63,12 @@ files:
63
63
  - ".rspec"
64
64
  - ".rubocop.yml"
65
65
  - ".travis.yml"
66
+ - CHANGES
66
67
  - Gemfile
67
68
  - Gemfile.lock
68
69
  - README.md
69
70
  - Rakefile
71
+ - VERSION
70
72
  - bin/brakeman
71
73
  - bin/bundle
72
74
  - bin/ci
@@ -107,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
109
  - !ruby/object:Gem::Version
108
110
  version: '0'
109
111
  requirements: []
110
- rubygems_version: 3.0.1
112
+ rubygems_version: 3.0.3
111
113
  signing_key:
112
114
  specification_version: 4
113
115
  summary: Application Query for Interage