api_queries 0.1.6 → 0.1.7
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/.gitignore +2 -1
- data/.rspec_status +14 -11
- data/.rubocop_todo.yml +5 -5
- data/Gemfile.lock +1 -1
- data/Guardfile +70 -0
- data/builds/api_queries-0.1.6.gem +0 -0
- data/lib/api_queries/version.rb +1 -1
- data/lib/api_queries.rb +29 -27
- metadata +4 -4
- data/builds/api_queries-0.1.4.gem.bad_release +0 -0
- data/builds/api_queries-0.1.5.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1958a30567b647aa2bc495824621610186e7c5b44b20dd9608910ef36c255b7
|
4
|
+
data.tar.gz: 852282cd93676f3bd1aa6049e040ed9be527516b902f13c2751f8a9153e47f64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3e3c14fe9ebdbf0963cd38464840a8b2b7f3aed9b1455eb12220e54a7d286c09a181d0fe80ea5f238bed9afdc6c78b45a78baaffe725c1672067d9baa8c02dd
|
7
|
+
data.tar.gz: a72bc82ee0d9b79ccc3d7d333d1a8efbd7c6601c850cf4e78a4629f10c0893b399448481c56a4958cc8353e987be90e9bb6dd2599b20eb1465872d012b681d7c
|
data/.gitignore
CHANGED
data/.rspec_status
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
-
example_id
|
2
|
-
|
3
|
-
./spec/api_queries_spec.rb[1:1:1] | passed | 0.
|
4
|
-
./spec/api_queries_spec.rb[1:1:2] | passed | 0.
|
5
|
-
./spec/api_queries_spec.rb[1:1:3] | passed | 0.
|
6
|
-
./spec/api_queries_spec.rb[1:1:4] | passed | 0.
|
7
|
-
./spec/api_queries_spec.rb[1:1:5] | passed | 0.
|
8
|
-
./spec/api_queries_spec.rb[1:1:6] | passed | 0.
|
9
|
-
./spec/api_queries_spec.rb[1:1:7] | passed | 0.
|
10
|
-
./spec/api_queries_spec.rb[1:1:8] | passed | 0.
|
11
|
-
./spec/api_queries_spec.rb[1:1:9] | passed | 0.
|
1
|
+
example_id | status | run_time |
|
2
|
+
----------------------------------- | ------ | --------------- |
|
3
|
+
./spec/api_queries_spec.rb[1:1:1:1] | passed | 0.00361 seconds |
|
4
|
+
./spec/api_queries_spec.rb[1:1:1:2] | passed | 0.00971 seconds |
|
5
|
+
./spec/api_queries_spec.rb[1:1:1:3] | passed | 0.00057 seconds |
|
6
|
+
./spec/api_queries_spec.rb[1:1:1:4] | passed | 0.00761 seconds |
|
7
|
+
./spec/api_queries_spec.rb[1:1:1:5] | passed | 0.00393 seconds |
|
8
|
+
./spec/api_queries_spec.rb[1:1:1:6] | passed | 0.00675 seconds |
|
9
|
+
./spec/api_queries_spec.rb[1:1:1:7] | passed | 0.00654 seconds |
|
10
|
+
./spec/api_queries_spec.rb[1:1:1:8] | passed | 0.00291 seconds |
|
11
|
+
./spec/api_queries_spec.rb[1:1:1:9] | passed | 0.00149 seconds |
|
12
|
+
./spec/api_queries_spec.rb[1:1:2:1] | passed | 0.01001 seconds |
|
13
|
+
./spec/api_queries_spec.rb[1:1:2:2] | passed | 0.00015 seconds |
|
14
|
+
./spec/api_queries_spec.rb[1:1:2:3] | passed | 0.00234 seconds |
|
data/.rubocop_todo.yml
CHANGED
@@ -20,17 +20,17 @@ Lint/UnreachableCode:
|
|
20
20
|
|
21
21
|
# Offense count: 1
|
22
22
|
Metrics/AbcSize:
|
23
|
-
Max:
|
23
|
+
Max: 65
|
24
24
|
|
25
25
|
# Offense count: 2
|
26
26
|
# Configuration parameters: CountComments, ExcludedMethods.
|
27
27
|
# ExcludedMethods: refine
|
28
28
|
Metrics/BlockLength:
|
29
|
-
Max:
|
29
|
+
Max: 80
|
30
30
|
|
31
31
|
# Offense count: 1
|
32
32
|
Metrics/CyclomaticComplexity:
|
33
|
-
Max:
|
33
|
+
Max: 20
|
34
34
|
|
35
35
|
# Offense count: 1
|
36
36
|
# Configuration parameters: CountComments.
|
@@ -39,7 +39,7 @@ Metrics/MethodLength:
|
|
39
39
|
|
40
40
|
# Offense count: 1
|
41
41
|
Metrics/PerceivedComplexity:
|
42
|
-
Max:
|
42
|
+
Max: 20
|
43
43
|
|
44
44
|
# Offense count: 1
|
45
45
|
Style/MixinUsage:
|
@@ -56,4 +56,4 @@ Style/RescueModifier:
|
|
56
56
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
57
57
|
# URISchemes: http, https
|
58
58
|
Metrics/LineLength:
|
59
|
-
Max:
|
59
|
+
Max: 135
|
data/Gemfile.lock
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
19
|
+
# rspec may be run, below are examples of the most common uses.
|
20
|
+
# * bundler: 'bundle exec rspec'
|
21
|
+
# * bundler binstubs: 'bin/rspec'
|
22
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
23
|
+
# installed the spring binstubs per the docs)
|
24
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
25
|
+
# * 'just' rspec: 'rspec'
|
26
|
+
|
27
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
28
|
+
require 'guard/rspec/dsl'
|
29
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
30
|
+
|
31
|
+
# Feel free to open issues for suggestions and improvements
|
32
|
+
|
33
|
+
# RSpec files
|
34
|
+
rspec = dsl.rspec
|
35
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
36
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
37
|
+
watch(rspec.spec_files)
|
38
|
+
|
39
|
+
# Ruby files
|
40
|
+
ruby = dsl.ruby
|
41
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
42
|
+
|
43
|
+
# Rails files
|
44
|
+
rails = dsl.rails(view_extensions: %w[erb haml slim])
|
45
|
+
dsl.watch_spec_files_for(rails.app_files)
|
46
|
+
dsl.watch_spec_files_for(rails.views)
|
47
|
+
|
48
|
+
watch(rails.controllers) do |m|
|
49
|
+
[
|
50
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
51
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
52
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
# Rails config changes
|
57
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
58
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
59
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
60
|
+
|
61
|
+
# Capybara features specs
|
62
|
+
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
63
|
+
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
64
|
+
|
65
|
+
# Turnip features and steps
|
66
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
67
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
68
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
|
69
|
+
end
|
70
|
+
end
|
Binary file
|
data/lib/api_queries/version.rb
CHANGED
data/lib/api_queries.rb
CHANGED
@@ -11,36 +11,38 @@ module ApiQueries
|
|
11
11
|
# add default value
|
12
12
|
opts[:column_date] = 'updated_at' unless opts[:column_date].present?
|
13
13
|
|
14
|
-
# check if specified column exists
|
15
|
-
raise Errors::UnknownColumn, 'Invalid value for column_date.' if column_names.exclude?(opts[:column_date])
|
16
|
-
|
17
|
-
# last updated at q
|
18
|
-
if opts[:q] == 'last_updated_at'
|
19
|
-
return { last_updated_at: (begin
|
20
|
-
order(opts[:column_date] => :desc).limit(1).first.updated_at.strftime('%Y-%m-%dT%H:%M:%SZ')
|
21
|
-
rescue StandardError
|
22
|
-
nil
|
23
|
-
end) }
|
24
|
-
end
|
25
|
-
|
26
14
|
# condition hash
|
27
15
|
conditions = {}
|
28
16
|
|
29
|
-
#
|
30
|
-
if opts[:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
17
|
+
# check if specified column exists
|
18
|
+
if column_names.include?(opts[:column_date])
|
19
|
+
# last updated at q
|
20
|
+
if opts[:q] == 'last_updated_at'
|
21
|
+
return { last_updated_at: (begin
|
22
|
+
order(opts[:column_date] => :desc).limit(1).first.updated_at.strftime('%Y-%m-%dT%H:%M:%SZ')
|
23
|
+
rescue StandardError
|
24
|
+
nil
|
25
|
+
end) }
|
26
|
+
end
|
27
|
+
|
28
|
+
# AFTER: updated_at > given_date
|
29
|
+
if opts[:after].present?
|
30
|
+
conditions = ["#{opts[:column_date]} > ?", fdate(opts[:after])]
|
31
|
+
# BEFORE: updated_at < given_date
|
32
|
+
elsif opts[:before].present?
|
33
|
+
conditions = ["#{opts[:column_date]} < ?", fdate(opts[:before])]
|
34
|
+
# FROM & TO: between "from date" to "to date"
|
35
|
+
elsif opts[:from].present? && opts[:to].present?
|
36
|
+
conditions[opts[:column_date].to_sym] = (fdate(opts[:from])..fdate(opts[:to]))
|
37
|
+
# FROM: updated_at >= given_date
|
38
|
+
elsif opts[:from].present?
|
39
|
+
conditions = ["#{opts[:column_date]} >= ?", fdate(opts[:from])]
|
40
|
+
# TO: updated_at <= given_date
|
41
|
+
elsif opts[:to].present?
|
42
|
+
conditions = ["#{opts[:column_date]} <= ?", fdate(opts[:to])]
|
43
|
+
end
|
44
|
+
else
|
45
|
+
raise Errors::UnknownColumn, 'Invalid value for column_date.' unless opts[:column_date] == 'updated_at'
|
44
46
|
end
|
45
47
|
|
46
48
|
# get by status
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_queries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nujian Den Mark Meralpis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: will_paginate
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- CODE_OF_CONDUCT.md
|
97
97
|
- Gemfile
|
98
98
|
- Gemfile.lock
|
99
|
+
- Guardfile
|
99
100
|
- LICENSE.txt
|
100
101
|
- README.md
|
101
102
|
- Rakefile
|
@@ -104,8 +105,7 @@ files:
|
|
104
105
|
- bin/setup
|
105
106
|
- builds/api_queries-0.1.2.gem
|
106
107
|
- builds/api_queries-0.1.3.gem
|
107
|
-
- builds/api_queries-0.1.
|
108
|
-
- builds/api_queries-0.1.5.gem
|
108
|
+
- builds/api_queries-0.1.6.gem
|
109
109
|
- lib/api_queries.rb
|
110
110
|
- lib/api_queries/errors/unknown_column.rb
|
111
111
|
- lib/api_queries/version.rb
|
Binary file
|
Binary file
|