query_helper 0.2.6 → 0.2.7

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: bd74b25ab6dec2f0e3134685cefed049a7159a18e3275e35472492a34549579a
4
- data.tar.gz: 1944a711b68598a1cca8ff26d997173db0b89f649ff2d8c5086b84752016da58
3
+ metadata.gz: 34196dda5d9ed84de34c317c6f9096a87e9b403ca37868f5f087ef565886fe8d
4
+ data.tar.gz: e036203e497d95e1d37ceddd53ec72a3cb794ac3c6675842dfae642e0d9db9ac
5
5
  SHA512:
6
- metadata.gz: 2ba12818f15699010276c02db6c932d61023b97d3ca742c8edd0bef96c1f085a792bae1ec3935a0db1ac3e06d84345bcebf65dcc369a96ea8b4884c41b0746bd
7
- data.tar.gz: f97690b832ab759b8cb2005cd221611bf70bbc619aad66154f8936a875a587559d7c1b72485dd2506f2d2a8372b9fc89fa3e0442eea911e0997fb1797101bd93
6
+ metadata.gz: 71590ca9d1f926b868d44f6170390d6a795dcab47f17dae1fbc7aed8e010d85d095e7322c5e1fbfe491ef614a2d9abf2863ce67baf57ab013f8d4faac7db823f
7
+ data.tar.gz: 3efc246697287100945bd1c247df76ca0db2c5d04df4c44fb711560de9245c5daabe5d73f8a3c9dc4d6c0edf748f8e29b065ad3d30816ddccde0205dcee9c6c2
data/Gemfile.lock CHANGED
@@ -1,38 +1,37 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- query_helper (0.2.6)
5
- activerecord (~> 5.0)
6
- activesupport (~> 5.0)
4
+ query_helper (0.2.7)
5
+ activerecord (> 5)
6
+ activesupport (> 5)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (5.2.4.2)
12
- actionview (= 5.2.4.2)
13
- activesupport (= 5.2.4.2)
11
+ actionpack (6.0.2.2)
12
+ actionview (= 6.0.2.2)
13
+ activesupport (= 6.0.2.2)
14
14
  rack (~> 2.0, >= 2.0.8)
15
15
  rack-test (>= 0.6.3)
16
16
  rails-dom-testing (~> 2.0)
17
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
18
- actionview (5.2.4.2)
19
- activesupport (= 5.2.4.2)
17
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
+ actionview (6.0.2.2)
19
+ activesupport (= 6.0.2.2)
20
20
  builder (~> 3.1)
21
21
  erubi (~> 1.4)
22
22
  rails-dom-testing (~> 2.0)
23
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
24
- activemodel (5.2.4.2)
25
- activesupport (= 5.2.4.2)
26
- activerecord (5.2.4.2)
27
- activemodel (= 5.2.4.2)
28
- activesupport (= 5.2.4.2)
29
- arel (>= 9.0)
30
- activesupport (5.2.4.2)
23
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
+ activemodel (6.0.2.2)
25
+ activesupport (= 6.0.2.2)
26
+ activerecord (6.0.2.2)
27
+ activemodel (= 6.0.2.2)
28
+ activesupport (= 6.0.2.2)
29
+ activesupport (6.0.2.2)
31
30
  concurrent-ruby (~> 1.0, >= 1.0.2)
32
31
  i18n (>= 0.7, < 2)
33
32
  minitest (~> 5.1)
34
33
  tzinfo (~> 1.1)
35
- arel (9.0.0)
34
+ zeitwerk (~> 2.2)
36
35
  builder (3.2.4)
37
36
  byebug (11.1.1)
38
37
  concurrent-ruby (1.1.6)
@@ -59,12 +58,12 @@ GEM
59
58
  nokogiri (>= 1.6)
60
59
  rails-html-sanitizer (1.3.0)
61
60
  loofah (~> 2.3)
62
- railties (5.2.4.2)
63
- actionpack (= 5.2.4.2)
64
- activesupport (= 5.2.4.2)
61
+ railties (6.0.2.2)
62
+ actionpack (= 6.0.2.2)
63
+ activesupport (= 6.0.2.2)
65
64
  method_source
66
65
  rake (>= 0.8.7)
67
- thor (>= 0.19.0, < 2.0)
66
+ thor (>= 0.20.3, < 2.0)
68
67
  rake (13.0.1)
69
68
  rspec (3.9.0)
70
69
  rspec-core (~> 3.9.0)
@@ -92,6 +91,7 @@ GEM
92
91
  thread_safe (0.3.6)
93
92
  tzinfo (1.2.6)
94
93
  thread_safe (~> 0.1)
94
+ zeitwerk (2.3.0)
95
95
 
96
96
  PLATFORMS
97
97
  ruby
data/lib/query_helper.rb CHANGED
@@ -36,8 +36,8 @@ class QueryHelper
36
36
  @bind_variables = bind_variables
37
37
  @sql_filter = sql_filter
38
38
  @sql_sort = sql_sort
39
- @page = (page.to_i if page) || 1
40
- @per_page = (per_page.to_i if per_page) || 100
39
+ @page = determine_page(page: page, per_page: per_page)
40
+ @per_page = determine_per_page(page: page, per_page: per_page)
41
41
  @single_record = single_record
42
42
  @associations = associations
43
43
  @as_json_options = as_json_options
@@ -155,6 +155,18 @@ class QueryHelper
155
155
 
156
156
  private
157
157
 
158
+ def determine_page(page:, per_page:)
159
+ return page.to_i if page
160
+ return 1 if !page && per_page
161
+ return nil
162
+ end
163
+
164
+ def determine_per_page(page:, per_page:)
165
+ return per_page.to_i if per_page
166
+ return 100 if !per_page && page
167
+ return nil
168
+ end
169
+
158
170
  def paginated_results
159
171
  { pagination: pagination_results(),
160
172
  data: @results }
@@ -1,3 +1,3 @@
1
1
  class QueryHelper
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
data/query_helper.gemspec CHANGED
@@ -46,6 +46,6 @@ Gem::Specification.new do |spec|
46
46
  spec.add_development_dependency 'actionpack'
47
47
  spec.add_development_dependency 'activesupport'
48
48
 
49
- spec.add_dependency "activerecord", "~> 5.0"
50
- spec.add_dependency "activesupport", "~> 5.0"
49
+ spec.add_dependency "activerecord", "> 5"
50
+ spec.add_dependency "activesupport", "> 5"
51
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan McDaniel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-30 00:00:00.000000000 Z
11
+ date: 2020-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -140,30 +140,30 @@ dependencies:
140
140
  name: activerecord
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - ">"
144
144
  - !ruby/object:Gem::Version
145
- version: '5.0'
145
+ version: '5'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ">"
151
151
  - !ruby/object:Gem::Version
152
- version: '5.0'
152
+ version: '5'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: activesupport
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - ">"
158
158
  - !ruby/object:Gem::Version
159
- version: '5.0'
159
+ version: '5'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ">"
165
165
  - !ruby/object:Gem::Version
166
- version: '5.0'
166
+ version: '5'
167
167
  description: Ruby gem developed to help with pagination, filtering, sorting, and including
168
168
  associations on both active record queries and custom sql queries
169
169
  email: