app/models/maestrano/connector/rails/concerns/entity.rb in maestrano-connector-rails-2.0.0.pre.RC6 vs app/models/maestrano/connector/rails/concerns/entity.rb in maestrano-connector-rails-2.0.0.pre.RC7

- old
+ new

@@ -310,11 +310,11 @@ def push_entities_to_external_to(mapped_connec_entities_with_idmaps, external_entity_name) return unless self.class.can_write_external? Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Sending Connec! #{self.class.connec_entity_name.pluralize} to #{Maestrano::Connector::Rails::External.external_name} #{external_entity_name.pluralize}") - entities_to_send_to_connec = mapped_connec_entities_with_idmaps.map{ |mapped_connec_entity_with_idmap| + entities_to_send_to_connec = mapped_connec_entities_with_idmaps.map { |mapped_connec_entity_with_idmap| push_entity_to_external(mapped_connec_entity_with_idmap, external_entity_name) }.compact # Send the external ids to connec if it was a creation # or if there are some sub entities ids to send (completed_hash) @@ -322,10 +322,10 @@ # Build a batch op from an idmap and a competed hash # with either only the id, or the id + id references proc = lambda do |entity| id = {id: [Maestrano::Connector::Rails::ConnecHelper.id_hash(entity[:idmap].external_id, @organization)]} - body = entity[:completed_hash] ? entity[:completed_hash].merge(id) : id + body = entity[:completed_hash]&.merge(id) || id batch_op('put', body, entity[:idmap].connec_id, self.class.normalized_connec_entity_name) end batch_calls(entities_to_send_to_connec, proc, self.class.connec_entity_name, true) end