apiotics 0.1.131 → 0.1.132
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46e1b36cd4cc414f0ef60c0ff60e0ffdb95ee298
|
4
|
+
data.tar.gz: ebf48d1a5f115d71305fc7805cd0250ff4815d60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5738927b681863a85ae3a2b6c8143754e087fc6a5018f3c8d7977e4262274826c72b48931d0c247a36abe19b99554a3b7273e89109ee31ec1597e6bd204a832c
|
7
|
+
data.tar.gz: f0a289811afc7a0aea42f5d9984a71df47db617587ac00f6a362e925d8b9b350a50ba0e05c263e2cf8128df72034bee9385c4d390f16da82e172c9e3e3eef392
|
data/lib/apiotics/version.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
module Apiotics
|
2
2
|
class CreateModelGenerator < Rails::Generators::Base
|
3
|
+
|
4
|
+
require 'json'
|
5
|
+
|
3
6
|
source_root File.expand_path('../templates', __FILE__)
|
4
7
|
argument :parent, :type => :string
|
5
8
|
argument :name, :type => :string
|
@@ -15,6 +18,12 @@ module Apiotics
|
|
15
18
|
template "create_module_model_table.rb.erb", "db/migrate/#{date_string}_create_#{plural_name}.rb"
|
16
19
|
end
|
17
20
|
template "apiotics_module_model.rb.erb", "app/models/#{module_file_name}/#{module_file_name}.rb"
|
21
|
+
@c[:attributes].each do |k,v|
|
22
|
+
unless v[:values] == "" || v[:values] == nil
|
23
|
+
j = JSON.parse(v[:values])
|
24
|
+
@c[:attributes][k][:values] = j
|
25
|
+
end
|
26
|
+
end
|
18
27
|
template "apiotics_model.rb.erb", "app/models/#{module_file_name}/#{file_name}.rb"
|
19
28
|
unless Apiotics.configuration.local_logging == false
|
20
29
|
if portal == "true"
|
@@ -8,7 +8,7 @@ module <%= module_name %>
|
|
8
8
|
attr_accessor :skip_extract
|
9
9
|
after_commit :extract, unless: :skip_extract
|
10
10
|
after_commit :channel_push
|
11
|
-
<% unless @c == nil %><% @c[:attributes].each do |k,v| %><% unless v[:values] == "" || v[:values] == nil %>validates :<%= k.downcase.gsub(" ", "_").underscore %>, inclusion: { in: %w(<%= v[:values].join(" ")
|
11
|
+
<% unless @c == nil %><% @c[:attributes].each do |k,v| %><% unless v[:values] == "" || v[:values] == nil %>validates :<%= k.downcase.gsub(" ", "_").underscore %>, inclusion: { in: %w(<%= v[:values].join(" ") %>),
|
12
12
|
message: "%{value} is not a valid <%= k %>" }<% end %><% unless v[:range] == "" || v[:range] == nil %>
|
13
13
|
validates :<%= k.gsub(" ", "_").underscore %>, inclusion: { in: <%= v[:range] %>,
|
14
14
|
message: "%{value} is not within the range <%= v[:range] %>" }<% end %><% if v[:type] == "enum" %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apiotics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.132
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MicroArx Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|