services 6.0.5 → 7.0.0
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/lib/services/query.rb +15 -6
- data/lib/services/version.rb +1 -1
- data/spec/services/logger/redis_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dff8b6c800a3b2ddd63f70e6f532f67bc96b6ad84433f82dddc38af9e3d5c8ca
|
4
|
+
data.tar.gz: d55ac6170d97a46766ca49184469496f8e50e3c79f651cb35becf33ca312dfc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30794a6468fb2d966a73690336230fb49f5ce33ef42cc70c18a04e30dddd8efc71c85d9eb07a0f52775c04baa6f2c5216bc290b7fa03d0373748e5549560aad6
|
7
|
+
data.tar.gz: d61ca8f78c4d902bbb5b0ee7f697a3236e4526f6fc9b249fb24c1abf7bb052e429c59cf7f981f5c66509bcfba8d9501555226cb1652438b898513ae0fbd1db6b
|
data/lib/services/query.rb
CHANGED
@@ -29,8 +29,9 @@ module Services
|
|
29
29
|
|
30
30
|
object_table_id = "#{object_class.table_name}.id"
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
unless conditions.key?(:order)
|
33
|
+
conditions[:order] = object_table_id
|
34
|
+
end
|
34
35
|
|
35
36
|
scope = conditions.delete(:scope).try(:dup) || object_class.public_send(ActiveRecord::VERSION::MAJOR == 3 ? :scoped : :all)
|
36
37
|
scope = scope.where(object_table_id => ids) unless ids.empty?
|
@@ -50,18 +51,26 @@ module Services
|
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
53
|
-
|
54
|
+
conditions.each do |k, v|
|
55
|
+
if new_scope = process(scope, k, v)
|
56
|
+
conditions.delete k
|
57
|
+
scope = new_scope
|
58
|
+
end
|
59
|
+
end
|
54
60
|
|
55
|
-
# If a JOIN is involved, use a subquery to make sure we
|
61
|
+
# If a JOIN is involved, use a subquery to make sure we get DISTINCT records.
|
56
62
|
if scope.to_sql =~ / join /i
|
57
63
|
scope = object_class.where(id: scope.select("DISTINCT #{object_table_id}"))
|
58
64
|
end
|
59
65
|
end
|
60
66
|
|
61
|
-
|
67
|
+
conditions.each do |k, v|
|
62
68
|
case k
|
63
69
|
when :id_not
|
64
70
|
scope = scope.where.not(id: v)
|
71
|
+
when /\Acreated_(before|after)\z/
|
72
|
+
operator = $1 == 'before' ? '<' : '>'
|
73
|
+
scope = scope.where("created_at #{operator} ?", v)
|
65
74
|
when :order
|
66
75
|
next unless v
|
67
76
|
case v
|
@@ -93,7 +102,7 @@ module Services
|
|
93
102
|
when :per_page
|
94
103
|
scope = scope.per(v)
|
95
104
|
else
|
96
|
-
raise ArgumentError, "Unexpected
|
105
|
+
raise ArgumentError, "Unexpected condition: #{k}"
|
97
106
|
end
|
98
107
|
end
|
99
108
|
|
data/lib/services/version.rb
CHANGED
@@ -45,7 +45,7 @@ describe Services::Logger::Redis do
|
|
45
45
|
%i(message severity).each do |k|
|
46
46
|
log[k] = log[k].try(:to_s) || ''
|
47
47
|
end
|
48
|
-
log[:meta] = if log.
|
48
|
+
log[:meta] = if log.key?(:meta)
|
49
49
|
log[:meta].stringify_keys
|
50
50
|
else
|
51
51
|
{}
|
@@ -59,7 +59,7 @@ describe Services::Logger::Redis do
|
|
59
59
|
Timecop.freeze log[:time] do
|
60
60
|
args = [log[:message]]
|
61
61
|
args.push log[:meta] || {}
|
62
|
-
args.push log[:severity] if log.
|
62
|
+
args.push log[:severity] if log.key?(:severity)
|
63
63
|
logger.log *args
|
64
64
|
end
|
65
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Meurer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|