standardapi 6.0.0.9 → 6.0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/standard_api/test_case/calculate_tests.rb +10 -7
- data/lib/standard_api/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46019bd95b04e5330790d39b9b98044ba78d23ebf224f28f7342d26d66c937f7
|
4
|
+
data.tar.gz: 395bd84163e97c60d3fe5d9b7a0df1f64b5c3b9157855ba28bd48226ea3f6c09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa2aa74379bd742b03d1af0272b427f31a8614b712e74ef058db03a13bec9e7a2356429964ff9792705bdeac1e753699e6dd5da1bfa852fa4bb2cd55e53da74c
|
7
|
+
data.tar.gz: eb51107d8fb44dc1f46774776ed3f20e85e157599ed0b9458b9cbdd27b079e05f6fc839c21b7a26d5600479c380bcb0c9cbc076f139d31665b649b06aa7119fd
|
@@ -5,28 +5,31 @@ module StandardAPI
|
|
5
5
|
|
6
6
|
test '#calculate.json' do
|
7
7
|
create_model
|
8
|
-
|
8
|
+
column = model.columns.find { |x| [:integer, :decimal, :date, :datetime].include?(x.type) }.name
|
9
|
+
selects = [{ count: column}, { maximum: column }, { minimum: column }, { average: column }]
|
9
10
|
|
10
11
|
get resource_path(:calculate, select: selects, format: :json)
|
11
12
|
assert_response :ok
|
12
13
|
calculations = @controller.instance_variable_get('@calculations')
|
13
|
-
assert_equal [[model.count(
|
14
|
+
assert_equal [[model.count(column), model.maximum(column), model.minimum(column), model.average(column).to_f]], calculations
|
14
15
|
end
|
15
16
|
|
16
17
|
test '#calculate.json params[:where]' do
|
17
18
|
m1 = create_model
|
18
19
|
create_model
|
19
20
|
|
20
|
-
|
21
|
+
column = model.columns.find { |x| ![:uuid].include?(x.type) }.name
|
22
|
+
selects = [{ count: column}, { maximum: column }, { minimum: column }, { average: column }]
|
21
23
|
predicate = { id: { gt: m1.id } }
|
24
|
+
|
22
25
|
get resource_path(:calculate, where: predicate, select: selects, format: :json)
|
23
26
|
|
24
27
|
# assert_response :ok
|
25
28
|
# assert_equal [[
|
26
|
-
# model.filter(predicate).count(
|
27
|
-
# model.filter(predicate).maximum(
|
28
|
-
# model.filter(predicate).minimum(
|
29
|
-
# model.filter(predicate).average(
|
29
|
+
# model.filter(predicate).count(column),
|
30
|
+
# model.filter(predicate).maximum(column),
|
31
|
+
# model.filter(predicate).minimum(column),
|
32
|
+
# model.filter(predicate).average(column).to_f
|
30
33
|
# ]], @controller.instance_variable_get('@calculations')
|
31
34
|
end
|
32
35
|
|
data/lib/standard_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standardapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.0.
|
4
|
+
version: 6.0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Bracy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 6.0.0
|
75
|
+
version: 6.0.0.2
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 6.0.0
|
82
|
+
version: 6.0.0.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pg
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|