forest_liana 2.3.5 → 2.4.0

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: cc640c5bfe27dd6d0e57ea6c18a6d9e0e5337bd0
4
- data.tar.gz: cdd89646c500cf265e714f7cfc0033008eb435fb
3
+ metadata.gz: a488df7bcdc24a9fb36272473b3b81b14a134dd3
4
+ data.tar.gz: b6031a9db5015d4fb2454db567b5bc986f5981f5
5
5
  SHA512:
6
- metadata.gz: 833146d9d93f81ff70a22c65c0fd8e92d1eaeee4add90b8e3222d88159bcbc7e51b20a5682ae2ea49c879bbca5dc9effa08fc64f267b2cfc49657e53668fe099
7
- data.tar.gz: 49c4bea2e809c289575cf5c744f7adda2f74ff57315f640f660c3962891c8da1ffbe8970c74f01c4b5d129a089993e06b9e0774a37c6e0978657069ece2b76cb
6
+ metadata.gz: 2abe6d5a5ebf7e943ff80f36ed1fcb20a72df5d129f482644c88338d67d831201383c13ccc89167edb8af9dfb622b8298a2f73337038de053573a1f4f12bd3c1
7
+ data.tar.gz: 68f3418e4c4cfefbf234cb5e1321d3749f73ab247a415d423deb9ed1588c200252d6d60a9e2cda86c9234161a7879e16f018c14413bd1a416933bfec69d2c436
@@ -128,8 +128,11 @@ module ForestLiana
128
128
  if relation_name == model.name
129
129
  fields[relation_name] = relation_fields
130
130
  else
131
- model_name = model.reflect_on_association(relation_name.to_sym).class_name
132
- fields[model_name] = relation_fields
131
+ model_association = model.reflect_on_association(relation_name.to_sym)
132
+ if model_association
133
+ model_name = model_association.class_name
134
+ fields[model_name] = relation_fields
135
+ end
133
136
  end
134
137
  fields
135
138
  end
@@ -4,8 +4,9 @@ class ForestLiana::Model::Action
4
4
  include ActiveModel::Serialization
5
5
  extend ActiveModel::Naming
6
6
 
7
+ # TODO: Remove :global option when we remove the deprecation warning.
7
8
  attr_accessor :id, :name, :endpoint, :http_method, :fields, :redirect,
8
- :global, :download
9
+ :global, :type, :download
9
10
 
10
11
  def initialize(attributes = {})
11
12
  attributes.each do |name, value|
@@ -8,7 +8,7 @@ class ForestLiana::ActionSerializer
8
8
  attribute :endpoint
9
9
  attribute :fields
10
10
  attribute :redirect
11
- attribute :global
11
+ attribute :type
12
12
  attribute :download
13
13
 
14
14
  def relationship_related_link(attribute_name)
@@ -26,7 +26,7 @@ module ForestLiana
26
26
  if ForestLiana.env_secret
27
27
  create_apimap
28
28
  require_lib_forest_liana
29
- set_smart_actions_fields_position
29
+ format_and_validate_smart_actions
30
30
 
31
31
  send_apimap
32
32
  end
@@ -158,10 +158,22 @@ module ForestLiana
158
158
  end
159
159
  end
160
160
 
161
- def set_smart_actions_fields_position
161
+ def format_and_validate_smart_actions
162
162
  ForestLiana.apimap.each do |collection|
163
163
  collection.actions.each do |action|
164
+ if action.global
165
+ FOREST_LOGGER.warn "DEPRECATION WARNING: Smart Action \"global\" option is now " \
166
+ "deprecated. Please set \"type: 'global'\" instead of \"global: true\" for the " \
167
+ "\"#{action.name}\" Smart Action."
168
+ end
169
+
170
+ if action.type && !['bulk', 'global', 'single'].include?(action.type)
171
+ FOREST_LOGGER.warn "Please set a valid Smart Action type (\"bulk\", \"global\" or " \
172
+ "\"single\") for the \"#{action.name}\" Smart Action."
173
+ end
174
+
164
175
  if action.fields
176
+ # NOTICE: Set a position to the Smart Actions fields.
165
177
  action.fields.each_with_index do |field, index|
166
178
  field[:position] = index
167
179
  end
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "2.3.5"
2
+ VERSION = "2.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.5
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-28 00:00:00.000000000 Z
11
+ date: 2018-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails