standardapi 5.2.0.2 → 5.2.0.3

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: 07e04cf1267208519f3837a0b7881786d55a053f3e3304e5e7599d01fb72102d
4
- data.tar.gz: 7bf8e046a0ef987a912001df5075537961651d9ddcc6cccab31fb2a690b1e1cc
3
+ metadata.gz: bed2d365e455efd7b10470b8c6fb2254cdda2f4ea38f3f821f868db6927da2bf
4
+ data.tar.gz: 9d6baea8ba6b153385e08bea5627c0e92b9408e1b4c44ebd730c1f5789a29865
5
5
  SHA512:
6
- metadata.gz: 949c1c8abf9098956e5ceca14978b725b157fa604eeb8e4c60213e0eb84e841fd551088097bcedc8e39106442cd5ea4fd9f779f41fb05b41531556b7007bc3f5
7
- data.tar.gz: 6c381c38daca817c906d11eda4f67c77d8bb2353f3c454f783da7a6d1fde3938335e4159e50f8c358ae46b33fd4492c2cfd6b1127cdfefd4ff8d2f1de9ab7697
6
+ metadata.gz: 610394e5483d37878c0ad00305f42f19d3cd30226cfb647a70c4fa3b6419cb1eae8d74eeb59fee5079ad9d111c04b29380d78d99d7faaeb3c24293838d31d786
7
+ data.tar.gz: f2ee74383eb29528dd8c99f6f7c10787870397ee7784235c9e74362b6c08b3a191803afcc4e4aab320fc03375d5477a7161ebb367220f24f9563538c7c9d52d5
@@ -1,3 +1,3 @@
1
1
  module StandardAPI
2
- VERSION = '5.2.0.2'
2
+ VERSION = '5.2.0.3'
3
3
  end
@@ -1,31 +1,48 @@
1
- mapping = {
2
- 'timestamp without time zone' => 'datetime',
3
- 'time without time zone' => 'datetime',
4
- 'text' => 'string',
5
- 'json' => 'hash',
6
- 'bigint' => 'integer',
7
- 'integer' => 'integer',
8
- 'character varying(255)' => 'string',
9
- 'character varying(128)' => 'string',
10
- 'character varying(50)' => 'string',
11
- 'character varying' => 'string',
12
- 'jsonb' => 'hash',
13
- 'inet' => 'string', #TODO: should be inet
14
- 'hstore' => 'hash',
15
- 'date' => 'datetime',
16
- 'numeric(16,2)' => 'decimal',
17
- 'numeric' => 'decimal',
18
- 'double precision' => 'decimal',
19
- 'ltree' => 'string',
20
- 'boolean' => 'boolean',
21
- 'geometry' => 'ewkb',
22
- 'uuid' => 'string'
23
- }
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
24
41
 
25
42
  json.set! 'columns' do
26
43
  model.columns.each do |column|
27
44
  json.set! column.name, {
28
- type: mapping[column.sql_type],
45
+ type: mapping.call(column.sql_type),
29
46
  primary_key: column.name == model.primary_key,
30
47
  null: column.null,
31
48
  array: column.array
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: 5.2.0.2
4
+ version: 5.2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Bracy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-05 00:00:00.000000000 Z
11
+ date: 2018-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails