maestrano-connector-rails 1.2.3 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +7 -20
- data/VERSION +1 -1
- data/app/controllers/maestrano/synchronizations_controller.rb +3 -3
- data/app/models/maestrano/connector/rails/concerns/complex_entity.rb +50 -22
- data/app/models/maestrano/connector/rails/concerns/connec_helper.rb +157 -19
- data/app/models/maestrano/connector/rails/concerns/entity.rb +63 -42
- data/app/models/maestrano/connector/rails/concerns/external.rb +4 -0
- data/app/models/maestrano/connector/rails/concerns/sub_entity_base.rb +18 -5
- data/app/models/maestrano/connector/rails/organization.rb +1 -1
- data/lib/generators/connector/templates/complex_entity_example/contact_and_lead.rb +5 -5
- data/lib/generators/connector/templates/entity.rb +4 -5
- data/lib/generators/connector/templates/external.rb +6 -0
- data/lib/generators/connector/templates/home_index.haml +7 -4
- data/maestrano-connector-rails.gemspec +7 -4
- data/release_notes.md +5 -0
- data/spec/factories.rb +2 -2
- data/spec/integration/complex_id_references_spec.rb +248 -0
- data/spec/integration/complex_naming_spec.rb +191 -0
- data/spec/integration/{integration_complex_spec.rb → complex_spec.rb} +9 -9
- data/spec/integration/connec_to_external_spec.rb +7 -3
- data/spec/integration/id_references_spec.rb +581 -0
- data/spec/integration/singleton_spec.rb +3 -3
- data/spec/models/complex_entity_spec.rb +42 -27
- data/spec/models/connec_helper_spec.rb +399 -31
- data/spec/models/entity_spec.rb +76 -21
- data/spec/models/external_spec.rb +4 -0
- data/spec/models/sub_entity_base_spec.rb +11 -4
- metadata +6 -3
@@ -15,7 +15,7 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
15
15
|
# organization_and_id can be either:
|
16
16
|
# * {connec_id: 'id', organization_id: 'id'}
|
17
17
|
# * {external_id: 'id', organization_id: 'id'}
|
18
|
-
# Needs to include either connec_entity or external_entity for
|
18
|
+
# Needs to include either connec_entity or external_entity for sub entities
|
19
19
|
def find_or_create_idmap(organization_and_id)
|
20
20
|
Maestrano::Connector::Rails::IdMap.find_or_create_by(names_hash.merge(organization_and_id))
|
21
21
|
end
|
@@ -36,11 +36,7 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def normalize_connec_entity_name(name)
|
39
|
-
|
40
|
-
name.parameterize('_')
|
41
|
-
else
|
42
|
-
name.parameterize('_').pluralize
|
43
|
-
end
|
39
|
+
singleton? ? name.parameterize('_') : name.parameterize('_').pluralize
|
44
40
|
end
|
45
41
|
|
46
42
|
# ----------------------------------------------
|
@@ -116,6 +112,10 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
116
112
|
can_write_connec?
|
117
113
|
end
|
118
114
|
|
115
|
+
def can_update_connec?
|
116
|
+
true
|
117
|
+
end
|
118
|
+
|
119
119
|
def can_write_connec?
|
120
120
|
true
|
121
121
|
end
|
@@ -147,9 +147,7 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
147
147
|
# ----------------------------------------------
|
148
148
|
# Map a Connec! entity to the external model
|
149
149
|
def map_to_external(entity)
|
150
|
-
|
151
|
-
mapped_entity = self.class.mapper_class.normalize(entity)
|
152
|
-
(connec_id ? mapped_entity.merge(__connec_id: connec_id) : mapped_entity).with_indifferent_access
|
150
|
+
self.class.mapper_class.normalize(entity).with_indifferent_access
|
153
151
|
end
|
154
152
|
|
155
153
|
# Map an external entity to Connec! model
|
@@ -223,6 +221,10 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
223
221
|
|
224
222
|
Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Sending #{Maestrano::Connector::Rails::External.external_name} #{self.class.external_entity_name.pluralize} to Connec! #{connec_entity_name.pluralize}")
|
225
223
|
|
224
|
+
unless self.class.can_update_connec?
|
225
|
+
mapped_external_entities_with_idmaps.select! { |mapped_external_entity_with_idmap| !mapped_external_entity_with_idmap[:idmap].connec_id }
|
226
|
+
end
|
227
|
+
|
226
228
|
proc = ->(mapped_external_entity_with_idmap) { batch_op('post', mapped_external_entity_with_idmap[:entity], nil, self.class.normalize_connec_entity_name(connec_entity_name)) }
|
227
229
|
batch_calls(mapped_external_entities_with_idmaps, proc, connec_entity_name)
|
228
230
|
end
|
@@ -241,13 +243,13 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
241
243
|
# ----------------------------------------------
|
242
244
|
# External methods
|
243
245
|
# ----------------------------------------------
|
244
|
-
def get_external_entities_wrapper(last_synchronization_date = nil)
|
246
|
+
def get_external_entities_wrapper(last_synchronization_date = nil, entity_name = self.class.external_entity_name)
|
245
247
|
return [] if @opts[:__skip_external] || !self.class.can_read_external?
|
246
|
-
get_external_entities(last_synchronization_date)
|
248
|
+
get_external_entities(entity_name, last_synchronization_date)
|
247
249
|
end
|
248
250
|
|
249
|
-
def get_external_entities(last_synchronization_date = nil)
|
250
|
-
Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Fetching #{Maestrano::Connector::Rails::External.external_name} #{
|
251
|
+
def get_external_entities(external_entity_name, last_synchronization_date = nil)
|
252
|
+
Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Fetching #{Maestrano::Connector::Rails::External.external_name} #{external_entity_name.pluralize}")
|
251
253
|
raise 'Not implemented'
|
252
254
|
end
|
253
255
|
|
@@ -259,42 +261,48 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
259
261
|
return unless self.class.can_write_external?
|
260
262
|
|
261
263
|
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}")
|
262
|
-
|
263
|
-
|
264
|
-
idmap ? {idmap: idmap} : nil
|
264
|
+
entities_to_send_to_connec = mapped_connec_entities_with_idmaps.map{ |mapped_connec_entity_with_idmap|
|
265
|
+
push_entity_to_external(mapped_connec_entity_with_idmap, external_entity_name)
|
265
266
|
}.compact
|
266
267
|
|
267
|
-
return if
|
268
|
+
return if entities_to_send_to_connec.empty?
|
268
269
|
|
269
270
|
# Send the external ids to connec if it was a creation
|
270
|
-
|
271
|
-
|
271
|
+
# or if there are some sub entities ids to send (completed_hash)
|
272
|
+
proc = lambda do |entity|
|
273
|
+
id = {id: [Maestrano::Connector::Rails::ConnecHelper.id_hash(entity[:idmap].external_id, @organization)]}
|
274
|
+
body = entity[:completed_hash] ? entity[:completed_hash].merge(id) : id
|
275
|
+
batch_op('put', body, entity[:idmap].connec_id, self.class.normalized_connec_entity_name)
|
276
|
+
end
|
277
|
+
batch_calls(entities_to_send_to_connec, proc, self.class.connec_entity_name, true)
|
272
278
|
end
|
273
279
|
|
274
280
|
def push_entity_to_external(mapped_connec_entity_with_idmap, external_entity_name)
|
275
281
|
idmap = mapped_connec_entity_with_idmap[:idmap]
|
276
282
|
mapped_connec_entity = mapped_connec_entity_with_idmap[:entity]
|
283
|
+
id_refs_only_connec_entity = mapped_connec_entity_with_idmap[:id_refs_only_connec_entity]
|
277
284
|
|
278
285
|
begin
|
279
286
|
# Create and return id to send to connec!
|
280
287
|
if idmap.external_id.blank?
|
281
|
-
|
282
|
-
idmap.update(external_id:
|
283
|
-
return idmap
|
288
|
+
external_hash = create_external_entity(mapped_connec_entity, external_entity_name)
|
289
|
+
idmap.update(external_id: self.class.id_from_external_entity_hash(external_hash), last_push_to_external: Time.now, message: nil)
|
284
290
|
|
291
|
+
return {idmap: idmap, completed_hash: map_and_complete_hash_with_connec_ids(external_hash, external_entity_name, id_refs_only_connec_entity)}
|
285
292
|
# Update
|
286
293
|
else
|
287
|
-
return unless self.class.can_update_external?
|
288
|
-
update_external_entity(mapped_connec_entity, idmap.external_id, external_entity_name)
|
294
|
+
return nil unless self.class.can_update_external?
|
295
|
+
external_hash = update_external_entity(mapped_connec_entity, idmap.external_id, external_entity_name)
|
289
296
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
297
|
+
completed_hash = map_and_complete_hash_with_connec_ids(external_hash, external_entity_name, id_refs_only_connec_entity)
|
298
|
+
|
299
|
+
# Return the idmap to send it to connec! only if it's the first push of a singleton
|
300
|
+
# or if there is a completed hash to send
|
301
|
+
if (self.class.singleton? && idmap.last_push_to_external.nil?) || completed_hash
|
295
302
|
idmap.update(last_push_to_external: Time.now, message: nil)
|
303
|
+
return {idmap: idmap, completed_hash: completed_hash}
|
296
304
|
end
|
297
|
-
|
305
|
+
idmap.update(last_push_to_external: Time.now, message: nil)
|
298
306
|
end
|
299
307
|
rescue => e
|
300
308
|
# Store External error
|
@@ -314,6 +322,16 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
314
322
|
raise 'Not implemented'
|
315
323
|
end
|
316
324
|
|
325
|
+
# Maps the entity received from external after a creation or an update and complete the received ids with the connec ones
|
326
|
+
def map_and_complete_hash_with_connec_ids(external_hash, external_entity_name, connec_hash)
|
327
|
+
return nil if connec_hash.empty?
|
328
|
+
|
329
|
+
mapped_external_hash = map_to_connec(external_hash)
|
330
|
+
id_references = Maestrano::Connector::Rails::ConnecHelper.format_references(self.class.references)
|
331
|
+
|
332
|
+
Maestrano::Connector::Rails::ConnecHelper.merge_id_hashes(connec_hash, mapped_external_hash, id_references[:id_references])
|
333
|
+
end
|
334
|
+
|
317
335
|
# ----------------------------------------------
|
318
336
|
# General methods
|
319
337
|
# ----------------------------------------------
|
@@ -336,13 +354,15 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
336
354
|
# Entity has been created before date filtering limit
|
337
355
|
next nil if before_date_filtering_limit?(entity, false) && !@opts[:full_sync]
|
338
356
|
|
339
|
-
|
357
|
+
unfold_hash = Maestrano::Connector::Rails::ConnecHelper.unfold_references(entity, references, @organization)
|
358
|
+
entity = unfold_hash[:entity]
|
340
359
|
next nil unless entity
|
341
|
-
connec_id =
|
360
|
+
connec_id = unfold_hash[:connec_id]
|
361
|
+
id_refs_only_connec_entity = unfold_hash[:id_refs_only_connec_entity]
|
342
362
|
|
343
363
|
if entity['id'].blank?
|
344
364
|
idmap = self.class.find_or_create_idmap(organization_id: @organization.id, name: self.class.object_name_from_connec_entity_hash(entity), external_entity: external_entity_name.downcase, connec_id: connec_id)
|
345
|
-
next map_connec_entity_with_idmap(entity, external_entity_name, idmap)
|
365
|
+
next map_connec_entity_with_idmap(entity, external_entity_name, idmap, id_refs_only_connec_entity)
|
346
366
|
end
|
347
367
|
|
348
368
|
idmap = self.class.find_or_create_idmap(external_id: entity['id'], organization_id: @organization.id, external_entity: external_entity_name.downcase, connec_id: connec_id)
|
@@ -350,7 +370,7 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
350
370
|
|
351
371
|
next nil if idmap.external_inactive || !idmap.to_external || (!@opts[:full_sync] && not_modified_since_last_push_to_external?(idmap, entity))
|
352
372
|
# Check for conflict with entities from external
|
353
|
-
solve_conflict(entity, external_entities, external_entity_name, idmap)
|
373
|
+
solve_conflict(entity, external_entities, external_entity_name, idmap, id_refs_only_connec_entity)
|
354
374
|
}.compact
|
355
375
|
end
|
356
376
|
|
@@ -397,10 +417,11 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
397
417
|
idmap.update(external_id: self.class.id_from_external_entity_hash(external_entities.first), name: self.class.object_name_from_external_entity_hash(external_entities.first))
|
398
418
|
return {connec_entities: [], external_entities: [{entity: map_to_connec(external_entities.first), idmap: idmap}]}
|
399
419
|
else
|
400
|
-
|
401
|
-
|
420
|
+
unfold_hash = Maestrano::Connector::Rails::ConnecHelper.unfold_references(connec_entities.first, self.class.references, @organization)
|
421
|
+
entity = unfold_hash[:entity]
|
422
|
+
idmap.update(name: self.class.object_name_from_connec_entity_hash(entity), connec_id: unfold_hash[:connec_id])
|
402
423
|
idmap.update(external_id: self.class.id_from_external_entity_hash(external_entities.first)) unless external_entities.empty?
|
403
|
-
return {connec_entities: [{entity: map_to_external(entity), idmap: idmap}], external_entities: []}
|
424
|
+
return {connec_entities: [{entity: map_to_external(entity), idmap: idmap, id_refs_only_connec_entity: {}}], external_entities: []}
|
404
425
|
end
|
405
426
|
end
|
406
427
|
|
@@ -466,10 +487,10 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
466
487
|
connec_entity['updated_at'] > self.class.last_update_date_from_external_entity_hash(external_entity)
|
467
488
|
end
|
468
489
|
|
469
|
-
def solve_conflict(connec_entity, external_entities, external_entity_name, idmap)
|
490
|
+
def solve_conflict(connec_entity, external_entities, external_entity_name, idmap, id_refs_only_connec_entity)
|
470
491
|
external_entity = external_entities.find { |entity| connec_entity['id'] == self.class.id_from_external_entity_hash(entity) }
|
471
492
|
# No conflict
|
472
|
-
return map_connec_entity_with_idmap(connec_entity, external_entity_name, idmap) unless external_entity
|
493
|
+
return map_connec_entity_with_idmap(connec_entity, external_entity_name, idmap, id_refs_only_connec_entity) unless external_entity
|
473
494
|
|
474
495
|
# Conflict
|
475
496
|
# We keep the most recently updated entity
|
@@ -478,15 +499,15 @@ module Maestrano::Connector::Rails::Concerns::Entity
|
|
478
499
|
if keep_connec
|
479
500
|
Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Conflict between #{Maestrano::Connector::Rails::External.external_name} #{external_entity_name} #{external_entity} and Connec! #{self.class.connec_entity_name} #{connec_entity}. Entity from Connec! kept")
|
480
501
|
external_entities.delete(external_entity)
|
481
|
-
map_connec_entity_with_idmap(connec_entity, external_entity_name, idmap)
|
502
|
+
map_connec_entity_with_idmap(connec_entity, external_entity_name, idmap, id_refs_only_connec_entity)
|
482
503
|
else
|
483
504
|
Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Conflict between #{Maestrano::Connector::Rails::External.external_name} #{external_entity_name} #{external_entity} and Connec! #{self.class.connec_entity_name} #{connec_entity}. Entity from external kept")
|
484
505
|
nil
|
485
506
|
end
|
486
507
|
end
|
487
508
|
|
488
|
-
def map_connec_entity_with_idmap(connec_entity, external_entity_name, idmap)
|
489
|
-
{entity: map_to_external(connec_entity), idmap: idmap}
|
509
|
+
def map_connec_entity_with_idmap(connec_entity, external_entity_name, idmap, id_refs_only_connec_entity)
|
510
|
+
{entity: map_to_external(connec_entity), idmap: idmap, id_refs_only_connec_entity: id_refs_only_connec_entity}
|
490
511
|
end
|
491
512
|
|
492
513
|
def map_external_entity_with_idmap(external_entity, connec_entity_name, idmap)
|
@@ -10,6 +10,10 @@ module Maestrano::Connector::Rails::Concerns::External
|
|
10
10
|
raise 'Not implemented'
|
11
11
|
end
|
12
12
|
|
13
|
+
def create_account_link(organization = nil)
|
14
|
+
raise 'Not implemented'
|
15
|
+
end
|
16
|
+
|
13
17
|
# Return an array of all the entities that the connector can synchronize
|
14
18
|
# If you add new entities, you need to generate
|
15
19
|
# a migration to add them to existing organizations
|
@@ -58,17 +58,30 @@ module Maestrano::Connector::Rails::Concerns::SubEntityBase
|
|
58
58
|
|
59
59
|
folded_entity
|
60
60
|
else
|
61
|
-
|
62
|
-
mapped_entity = mapper.normalize(entity)
|
63
|
-
(connec_id ? mapped_entity.merge(__connec_id: connec_id) : mapped_entity).with_indifferent_access
|
61
|
+
mapper.normalize(entity).with_indifferent_access
|
64
62
|
end
|
65
63
|
end
|
66
64
|
|
67
|
-
def map_connec_entity_with_idmap(connec_entity, external_entity_name, idmap)
|
68
|
-
{entity: map_to(external_entity_name, connec_entity), idmap: idmap}
|
65
|
+
def map_connec_entity_with_idmap(connec_entity, external_entity_name, idmap, id_refs_only_connec_entity)
|
66
|
+
{entity: map_to(external_entity_name, connec_entity), idmap: idmap, id_refs_only_connec_entity: id_refs_only_connec_entity}
|
69
67
|
end
|
70
68
|
|
71
69
|
def map_external_entity_with_idmap(external_entity, connec_entity_name, idmap)
|
72
70
|
{entity: map_to(connec_entity_name, external_entity), idmap: idmap}
|
73
71
|
end
|
72
|
+
|
73
|
+
# Maps the entity received from external after a creation or an update and complete the received ids with the connec ones
|
74
|
+
def map_and_complete_hash_with_connec_ids(external_hash, external_entity_name, connec_hash)
|
75
|
+
return nil if connec_hash.empty?
|
76
|
+
|
77
|
+
# As we don't know to which complex entity this sub entity is related to, we have to do a full scan of the entities to find the right one
|
78
|
+
# Because we need the external_entities_names
|
79
|
+
external_entity_instance = Maestrano::Connector::Rails::ComplexEntity.find_complex_entity_and_instantiate_external_sub_entity_instance(external_entity_name, @organization, @connec_client, @external_client, @opts)
|
80
|
+
return nil unless external_entity_instance
|
81
|
+
|
82
|
+
mapped_external_hash = external_entity_instance.map_to(self.class.connec_entity_name, external_hash)
|
83
|
+
id_references = Maestrano::Connector::Rails::ConnecHelper.format_references(self.class.references[external_entity_name])
|
84
|
+
|
85
|
+
Maestrano::Connector::Rails::ConnecHelper.merge_id_hashes(connec_hash, mapped_external_hash, id_references[:id_references])
|
86
|
+
end
|
74
87
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# TODO
|
2
2
|
# This file is provided as an example and should be removed
|
3
|
-
# See
|
3
|
+
# See documentation (https://maestrano.atlassian.net/wiki/display/DEV/Mapping+and+synchronization) for explanation
|
4
4
|
# class Entities::ContactAndLead < Maestrano::Connector::Rails::ComplexEntity
|
5
5
|
# def self.connec_entities_names
|
6
6
|
# %w(person)
|
@@ -25,16 +25,16 @@
|
|
25
25
|
# # }
|
26
26
|
# def connec_model_to_external_model(connec_hash_of_entities)
|
27
27
|
# people = connec_hash_of_entities['person']
|
28
|
-
#
|
28
|
+
# modelled_connec_entities = {'person' => { 'lead' => [], 'contact' => [] }}
|
29
29
|
|
30
30
|
# people.each do |person|
|
31
31
|
# if person['is_lead']
|
32
|
-
#
|
32
|
+
# modelled_connec_entities['person']['lead'] << person
|
33
33
|
# else
|
34
|
-
#
|
34
|
+
# modelled_connec_entities['person']['contact'] << person
|
35
35
|
# end
|
36
36
|
# end
|
37
|
-
# return
|
37
|
+
# return modelled_connec_entities
|
38
38
|
# end
|
39
39
|
|
40
40
|
# # input : {
|
@@ -8,7 +8,7 @@ class Maestrano::Connector::Rails::Entity < Maestrano::Connector::Rails::EntityB
|
|
8
8
|
# * @opts
|
9
9
|
|
10
10
|
# Return an array of entities from the external app
|
11
|
-
def get_external_entities(last_synchronization_date=nil)
|
11
|
+
def get_external_entities(external_entity_name, last_synchronization_date = nil)
|
12
12
|
Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Fetching #{Maestrano::Connector::Rails::External.external_name} #{self.class.external_entity_name.pluralize}")
|
13
13
|
# TODO
|
14
14
|
# This method should return only entities that have been updated since the last_synchronization_date
|
@@ -20,13 +20,13 @@ class Maestrano::Connector::Rails::Entity < Maestrano::Connector::Rails::EntityB
|
|
20
20
|
def create_external_entity(mapped_connec_entity, external_entity_name)
|
21
21
|
Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Sending create #{external_entity_name}: #{mapped_connec_entity} to #{Maestrano::Connector::Rails::External.external_name}")
|
22
22
|
# TODO
|
23
|
-
# This method creates the entity in the external app and returns the external
|
23
|
+
# This method creates the entity in the external app and returns the created external entity
|
24
24
|
end
|
25
25
|
|
26
26
|
def update_external_entity(mapped_connec_entity, external_id, external_entity_name)
|
27
27
|
Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Sending update #{external_entity_name} (id=#{external_id}): #{mapped_connec_entity} to #{Maestrano::Connector::Rails::External.external_name}")
|
28
28
|
# TODO
|
29
|
-
# This method updates the entity with the given id in the external app
|
29
|
+
# This method updates the entity with the given id in the external app and returns the created external entity
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.id_from_external_entity_hash(entity)
|
@@ -52,5 +52,4 @@ class Maestrano::Connector::Rails::Entity < Maestrano::Connector::Rails::EntityB
|
|
52
52
|
# This method return true is entity is inactive in the external application
|
53
53
|
# e.g entity['status'] == 'INACTIVE'
|
54
54
|
end
|
55
|
-
|
56
|
-
end
|
55
|
+
end
|
@@ -17,6 +17,12 @@ class Maestrano::Connector::Rails::External
|
|
17
17
|
# client_secret: ENV['']
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.create_account_link(organization = nil)
|
21
|
+
# TODO
|
22
|
+
# Returns a link to the sign up page of the external application
|
23
|
+
'#'
|
24
|
+
end
|
25
|
+
|
20
26
|
# Return an array of all the entities that the connector can synchronize
|
21
27
|
# If you add new entities, you need to generate
|
22
28
|
# a migration to add them to existing organizations
|
@@ -32,7 +32,10 @@
|
|
32
32
|
- if @organization.oauth_uid
|
33
33
|
= link_to "Disconnect", signout_omniauth_path(organization_id: @organization.id), class: "btn btn-warning btn-lg #{is_admin ? '' : 'disabled'}"
|
34
34
|
- else
|
35
|
-
|
35
|
+
- if is_admin
|
36
|
+
= link_to "Link to ApplicationName", "/auth/ApplicationName/request?org_uid=#{@organization.uid}", class: 'btn btn-warning btn-lg'
|
37
|
+
%br
|
38
|
+
%small If you don’t have an account #{link_to 'create yours here', Maestrano::Connector::Rails::External.create_account_link(current_organization || nil)}
|
36
39
|
|
37
40
|
.spacer1
|
38
41
|
|
@@ -53,10 +56,10 @@
|
|
53
56
|
%input{type: "checkbox", id: "#{k}", name: "#{k}", checked: v}
|
54
57
|
.col-md-6{style: 'padding-top: 5px;'}
|
55
58
|
%label{:for => "#{k}"} #{k.to_s.humanize.pluralize}
|
56
|
-
-if is_admin
|
59
|
+
- if is_admin
|
57
60
|
.col-md-5.text-right
|
58
61
|
- if v && @organization.oauth_uid && @organization.sync_enabled
|
59
|
-
= link_to "Force a synchronization for #{k.to_s.humanize.pluralize} only", home_synchronize_path(opts: {only_entities: [k.to_s]}), method: :post, class:
|
62
|
+
= link_to "Force a synchronization for #{k.to_s.humanize.pluralize} only", home_synchronize_path(opts: {only_entities: [k.to_s]}), method: :post, class: 'btn btn-warning btn-sm'
|
60
63
|
.spacer1
|
61
64
|
.row
|
62
65
|
.col-md-4
|
@@ -82,5 +85,5 @@
|
|
82
85
|
- else
|
83
86
|
.row
|
84
87
|
.col-md-4.col-md-offset-4.center
|
85
|
-
= link_to
|
88
|
+
= link_to 'Link your Maestrano account', Maestrano::Connector::Rails::Engine.routes.url_helpers.default_maestrano_auth_saml_index_path(tenant: :default), class: 'btn btn-warning'
|
86
89
|
|
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: maestrano-connector-rails 1.
|
5
|
+
# stub: maestrano-connector-rails 1.3.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "maestrano-connector-rails"
|
9
|
-
s.version = "1.
|
9
|
+
s.version = "1.3.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Pierre Berard"]
|
14
|
-
s.date = "2016-07-
|
14
|
+
s.date = "2016-07-26"
|
15
15
|
s.description = "Maestrano is the next generation marketplace for SME applications. See https://maestrano.com for details."
|
16
16
|
s.email = "pierre.berard@maestrano.com"
|
17
17
|
s.executables = ["rails"]
|
@@ -172,9 +172,12 @@ Gem::Specification.new do |s|
|
|
172
172
|
"spec/dummy/public/favicon.ico",
|
173
173
|
"spec/dummy/tmp/cache/.keep",
|
174
174
|
"spec/factories.rb",
|
175
|
+
"spec/integration/complex_id_references_spec.rb",
|
176
|
+
"spec/integration/complex_naming_spec.rb",
|
177
|
+
"spec/integration/complex_spec.rb",
|
175
178
|
"spec/integration/connec_to_external_spec.rb",
|
176
179
|
"spec/integration/external_to_connec_spec.rb",
|
177
|
-
"spec/integration/
|
180
|
+
"spec/integration/id_references_spec.rb",
|
178
181
|
"spec/integration/singleton_spec.rb",
|
179
182
|
"spec/jobs/all_synchronizations_job_spec.rb",
|
180
183
|
"spec/jobs/push_to_connec_job_spec.rb",
|
data/release_notes.md
CHANGED
data/spec/factories.rb
CHANGED
@@ -19,9 +19,9 @@ FactoryGirl.define do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
factory :idmap, class: Maestrano::Connector::Rails::IdMap do
|
22
|
-
connec_id
|
22
|
+
sequence(:connec_id) { |n| "#{n}6798-ada6-te43#{n}" }
|
23
23
|
connec_entity 'person'
|
24
|
-
external_id
|
24
|
+
sequence(:external_id) { |n| "#{n}4567ada66#{n}" }
|
25
25
|
external_entity 'contact'
|
26
26
|
last_push_to_external 2.day.ago
|
27
27
|
last_push_to_connec 1.day.ago
|