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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c628d369e270f41efcedd26602fee435cd4d7b58b80522e982b842fdac0e2f4c
4
- data.tar.gz: 34ecda61518319d65c0b0a88eb257212dd29f828db15acfd35e39c9af49eff71
3
+ metadata.gz: 46019bd95b04e5330790d39b9b98044ba78d23ebf224f28f7342d26d66c937f7
4
+ data.tar.gz: 395bd84163e97c60d3fe5d9b7a0df1f64b5c3b9157855ba28bd48226ea3f6c09
5
5
  SHA512:
6
- metadata.gz: 4f1739fa09be7bcc2b339d1714fa2f327861e39aa04228a287a16ad94e7aab0b3625173ec012b2f0653c6c0cfcf9c92f7ceaaeaadc5477afc0c7444570a84d3a
7
- data.tar.gz: 8214eeb03cff6d51051e40da9438392b92d1a08a0b09f022f35b9e2028c9c384afbeba7c1975a48ac6e6537d6d3e33aac0c19725ded76c96e18aae85a66ffa8a
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
- selects = [{ count: :id}, { maximum: :id }, { minimum: :id }, { average: :id }]
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(:id), model.maximum(:id), model.minimum(:id), model.average(:id).to_f]], calculations
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
- selects = [{ count: :id}, { maximum: :id }, { minimum: :id }, { average: :id }]
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(:id),
27
- # model.filter(predicate).maximum(:id),
28
- # model.filter(predicate).minimum(:id),
29
- # model.filter(predicate).average(:id).to_f
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
 
@@ -1,3 +1,3 @@
1
1
  module StandardAPI
2
- VERSION = '6.0.0.9'
2
+ VERSION = '6.0.0.11'
3
3
  end
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.9
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-16 00:00:00.000000000 Z
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