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: ba329df1f7ecad86738a145027ba22658a7348ec
4
- data.tar.gz: fc00edf2ea5343e6852cde3b68c5f86fe14d6e1e
3
+ metadata.gz: 46e1b36cd4cc414f0ef60c0ff60e0ffdb95ee298
4
+ data.tar.gz: ebf48d1a5f115d71305fc7805cd0250ff4815d60
5
5
  SHA512:
6
- metadata.gz: 0d5efdd67ea532046364c4874f65c22a487489df46eb12201ddc4c54f8f8fac1a575aa174ae8235d2671c993cdb8dbd9aacc8d90c46c147eb951c386f81804ed
7
- data.tar.gz: 4b3d43796771da851cac0fd815c13f21b6abcc5e8d35f44bc88afca48438b1103fb6be565d8e4125aa31a2508f903b921445e58dca522e35e1d7e3689a804ec8
6
+ metadata.gz: 5738927b681863a85ae3a2b6c8143754e087fc6a5018f3c8d7977e4262274826c72b48931d0c247a36abe19b99554a3b7273e89109ee31ec1597e6bd204a832c
7
+ data.tar.gz: f0a289811afc7a0aea42f5d9984a71df47db617587ac00f6a362e925d8b9b350a50ba0e05c263e2cf8128df72034bee9385c4d390f16da82e172c9e3e3eef392
@@ -1,3 +1,3 @@
1
1
  module Apiotics
2
- VERSION = '0.1.131'
2
+ VERSION = '0.1.132'
3
3
  end
@@ -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.131
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-05 00:00:00.000000000 Z
11
+ date: 2018-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails