standardapi 5.2.0.4 → 5.2.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26b0f747ca7646eec4a556e2cee648cb5f5564bcd971682d068ca79c9f9dcff0
4
- data.tar.gz: ab17c564646b2e9a78a31d62a763edde9be4ee2dbfae7f2d4f0d67d899fb6a8f
3
+ metadata.gz: e091251cb3cfdcaaca2c8779fe6104dbd64e184004e98c8185574103c7fb4ebf
4
+ data.tar.gz: 7f256e0dc1c67018b147ad3b0b3784ed07edd8cea49f2c26d8f9958eb3c0e9db
5
5
  SHA512:
6
- metadata.gz: '0697cd179d8622291b74d4dd1a6530575968852795bb0ac0be8fa2dc23ff1595d2c20b86f35faea9409c6ed28daf38b1f49351339df092ccf70e421e8fe00f8d'
7
- data.tar.gz: 4e0f01d7664ceed04f4451c5ac267e3a209612291d6a3d8a5fefc30f447569bff33b09e40a2a281682448862ef55414190b8de80b915de5c4c044da8f4045379
6
+ metadata.gz: d92f6d09f3559bde47d8d30750e60359c527e6bdbebafaf036971720dfca80be6315a4b64f0c17675bd7bc00b6de45cb59c9f57740e6c38ae269b437df1a226f
7
+ data.tar.gz: 04e267511914cbd3e3bb047ad8287fe43d10587b0e3b08a6579bcdca785dcd45336f9e7497c940ff7ff9b63efdeed8d7a0c6389dcd87b891ea7f55f718f6dae4
@@ -1,3 +1,3 @@
1
1
  module StandardAPI
2
- VERSION = '5.2.0.4'
2
+ VERSION = '5.2.0.5'
3
3
  end
@@ -1,32 +1,51 @@
1
- mapping = {
2
- 'timestamp without time zone' => 'datetime',
3
- 'time without time zone' => 'datetime',
4
- 'text' => 'string',
5
- 'json' => 'hash',
6
- 'integer' => 'integer',
7
- 'character varying(255)' => 'string',
8
- 'character varying(128)' => 'string',
9
- 'character varying(50)' => 'string',
10
- 'character varying' => 'string',
11
- 'jsonb' => 'hash',
12
- 'inet' => 'string', #TODO: should be inet
13
- 'hstore' => 'hash',
14
- 'date' => 'datetime',
15
- 'numeric(16,2)' => 'decimal',
16
- 'numeric' => 'decimal',
17
- 'double precision' => 'decimal',
18
- 'ltree' => 'string',
19
- 'boolean' => 'boolean',
20
- 'geometry' => 'ewkb',
21
- 'uuid' => 'string'
22
- }
1
+ mapping = lambda do |sql_type|
2
+ case sql_type
3
+ when /character varying(\(\d+\))?/
4
+ 'string'
5
+ when 'timestamp without time zone'
6
+ 'datetime'
7
+ when 'time without time zone'
8
+ 'datetime'
9
+ when 'text'
10
+ 'string'
11
+ when 'json'
12
+ 'hash'
13
+ when 'bigint'
14
+ 'integer'
15
+ when 'integer'
16
+ 'integer'
17
+ when 'jsonb'
18
+ 'hash'
19
+ when 'inet'
20
+ 'string' # TODO: should be inet
21
+ when 'hstore'
22
+ 'hash'
23
+ when 'date'
24
+ 'datetime'
25
+ when 'numeric(162)'
26
+ 'decimal'
27
+ when 'numeric'
28
+ 'decimal'
29
+ when 'double precision'
30
+ 'decimal'
31
+ when 'ltree'
32
+ 'string'
33
+ when 'boolean'
34
+ 'boolean'
35
+ when 'geometry'
36
+ 'ewkb'
37
+ when 'uuid' # TODO: should be uuid
38
+ 'string'
39
+ end
40
+ end
41
+
23
42
 
24
43
  json.object! do
25
44
  json.set! 'columns' do
26
45
  json.object! do
27
46
  model.columns.each do |column|
28
47
  json.set! column.name, {
29
- type: mapping[column.sql_type],
48
+ type: mapping.call(column.sql_type),
30
49
  primary_key: column.name == model.primary_key,
31
50
  null: column.null,
32
51
  array: column.array
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standardapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0.4
4
+ version: 5.2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Bracy