maestrano-connector-rails 0.4.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/README.md +1 -1
  4. data/VERSION +1 -1
  5. data/app/controllers/maestrano/connec_controller.rb +17 -19
  6. data/app/jobs/maestrano/connector/rails/all_synchronizations_job.rb +1 -1
  7. data/app/jobs/maestrano/connector/rails/push_to_connec_job.rb +11 -11
  8. data/app/jobs/maestrano/connector/rails/synchronization_job.rb +20 -11
  9. data/app/models/maestrano/connector/rails/concerns/complex_entity.rb +66 -74
  10. data/app/models/maestrano/connector/rails/concerns/connec_helper.rb +102 -0
  11. data/app/models/maestrano/connector/rails/concerns/entity.rb +233 -231
  12. data/app/models/maestrano/connector/rails/concerns/external.rb +7 -0
  13. data/app/models/maestrano/connector/rails/concerns/sub_entity_base.rb +14 -43
  14. data/app/models/maestrano/connector/rails/connec_helper.rb +5 -0
  15. data/app/models/maestrano/connector/rails/organization.rb +8 -2
  16. data/db/20160524112054_add_encryption_on_oauth_keys.rb +8 -0
  17. data/lib/generators/connector/install_generator.rb +1 -0
  18. data/lib/generators/connector/templates/complex_entity_example/contact.rb +1 -1
  19. data/lib/generators/connector/templates/complex_entity_example/contact_and_lead.rb +2 -2
  20. data/lib/generators/connector/templates/entity.rb +13 -19
  21. data/lib/generators/connector/templates/example_entity.rb +2 -2
  22. data/lib/generators/connector/templates/example_entity_spec.rb +73 -0
  23. data/lib/generators/connector/templates/external.rb +11 -0
  24. data/maestrano-connector-rails.gemspec +13 -8
  25. data/release_notes.md +81 -0
  26. data/spec/controllers/connec_controller_spec.rb +19 -6
  27. data/spec/dummy/app/models/maestrano/connector/rails/entity.rb +0 -7
  28. data/spec/dummy/app/models/maestrano/connector/rails/external.rb +7 -0
  29. data/spec/dummy/app/views/home/index.html.erb +1 -36
  30. data/spec/factories.rb +3 -0
  31. data/spec/integration/connec_to_external_spec.rb +188 -0
  32. data/spec/integration/external_to_connec_spec.rb +155 -0
  33. data/spec/integration/integration_complex_spec.rb +281 -0
  34. data/spec/integration/singleton_spec.rb +288 -0
  35. data/spec/jobs/all_synchronizations_job_spec.rb +5 -0
  36. data/spec/jobs/push_to_connec_job_spec.rb +3 -6
  37. data/spec/jobs/synchronization_job_spec.rb +29 -17
  38. data/spec/models/complex_entity_spec.rb +257 -412
  39. data/spec/models/connec_helper_spec.rb +143 -0
  40. data/spec/models/entity_spec.rb +420 -348
  41. data/spec/models/external_spec.rb +4 -0
  42. data/spec/models/organization_spec.rb +2 -1
  43. data/spec/models/sub_entity_base_spec.rb +28 -69
  44. data/template/factories.rb +3 -1
  45. data/template/maestrano-connector-template.rb +11 -13
  46. data/template/maestrano.rb +2 -1
  47. data/template/settings/development.yml +4 -2
  48. data/template/settings/production.yml +1 -11
  49. data/template/settings/settings.yml +8 -0
  50. data/template/settings/test.yml +2 -0
  51. data/template/settings/uat.yml +1 -9
  52. metadata +12 -7
  53. data/Gemfile.lock +0 -256
  54. data/realse_notes.md +0 -16
  55. data/spec/dummy/app/views/admin/index.html.erb +0 -51
  56. data/spec/dummy/db/development.sqlite3 +0 -0
  57. data/spec/dummy/db/test.sqlite3 +0 -0
@@ -9,5 +9,12 @@ module Maestrano::Connector::Rails::Concerns::External
9
9
  def external_name
10
10
  raise 'Not implemented'
11
11
  end
12
+
13
+ # Return an array of all the entities that the connector can synchronize
14
+ # If you add new entities, you need to generate
15
+ # a migration to add them to existing organizations
16
+ def entities_list
17
+ raise "Not implemented"
18
+ end
12
19
  end
13
20
  end
@@ -34,34 +34,6 @@ module Maestrano::Connector::Rails::Concerns::SubEntityBase
34
34
  end
35
35
  end
36
36
 
37
- def create_idmap_from_external_entity(entity, connec_entity_name, organization)
38
- if external?
39
- h = names_hash.merge({
40
- external_id: id_from_external_entity_hash(entity),
41
- name: object_name_from_external_entity_hash(entity),
42
- connec_entity: connec_entity_name.downcase,
43
- organization_id: organization.id
44
- })
45
- Maestrano::Connector::Rails::IdMap.create(h)
46
- else
47
- raise 'Forbidden call: cannot call create_idmap_from_external_entity for a connec entity'
48
- end
49
- end
50
-
51
- def create_idmap_from_connec_entity(entity, external_entity_name, organization)
52
- if external?
53
- raise 'Forbidden call: cannot call create_idmap_from_connec_entity for an external entity'
54
- else
55
- h = names_hash.merge({
56
- connec_id: entity['id'],
57
- name: object_name_from_connec_entity_hash(entity),
58
- external_entity: external_entity_name.downcase,
59
- organization_id: organization.id
60
- })
61
- Maestrano::Connector::Rails::IdMap.create(h)
62
- end
63
- end
64
-
65
37
  # { 'External Entity' => LalaMapper, 'Other external entity' => LiliMapper }
66
38
  # or { 'Connec Entity' => LalaMapper, 'Other connec entity' => LiliMapper }
67
39
  def mapper_classes
@@ -69,8 +41,8 @@ module Maestrano::Connector::Rails::Concerns::SubEntityBase
69
41
  end
70
42
 
71
43
  # {
72
- # 'External Entity' => [{reference_class: Entities::.., connec_field: '', external_field: ''}],
73
- # 'Other external entity' => [{reference_class: Entities::.., connec_field: '', external_field: ''}]
44
+ # 'External Entity' => ['organization_id'],
45
+ # 'Other external entity' => ['an array of the connec reference fields']
74
46
  # }
75
47
  def references
76
48
  {}
@@ -78,28 +50,27 @@ module Maestrano::Connector::Rails::Concerns::SubEntityBase
78
50
  end
79
51
 
80
52
 
81
- def map_to(name, entity, organization)
53
+ def map_to(name, entity)
82
54
  mapper = self.class.mapper_classes[name]
83
55
  raise "Impossible mapping from #{self.class.entity_name} to #{name}" unless mapper
84
56
 
85
- ref_hash = {}
86
- if self.class.references[name]
87
- self.class.references[name].each do |ref|
88
- field = self.class.external? ? ref[:connec_field] : ref[:external_field]
89
- ref_hash.merge! field.split('/').reverse.inject(Maestrano::Connector::Rails::Entity.id_from_ref(entity, ref, self.class.external?, organization)) { |a, n| { n.to_sym => a } }
90
- end
91
- end
92
-
93
57
  if self.class.external?
94
- mapped_entity = mapper.denormalize(entity)
58
+ mapped_entity = mapper.denormalize(entity).merge(id: self.class.id_from_external_entity_hash(entity))
59
+ folded_entity = Maestrano::Connector::Rails::ConnecHelper.fold_references(mapped_entity, self.class.references[name] || [], @organization)
60
+ folded_entity.merge!(opts: (folded_entity[:opts] || {}).merge(matching_fields: self.class.connec_matching_fields)) if self.class.connec_matching_fields
61
+ folded_entity
95
62
  else
63
+ connec_id = entity[:__connec_id]
96
64
  mapped_entity = mapper.normalize(entity)
65
+ (connec_id ? mapped_entity.merge(__connec_id: connec_id) : mapped_entity).with_indifferent_access
97
66
  end
98
- mapped_entity.merge(ref_hash)
99
67
  end
100
68
 
69
+ def map_connec_entity_with_idmap(connec_entity, external_entity_name, idmap)
70
+ {entity: map_to(external_entity_name, connec_entity), idmap: idmap}
71
+ end
101
72
 
102
- def map_external_entity_with_idmap(external_entity, connec_entity_name, idmap, organization)
103
- {entity: map_to(connec_entity_name, external_entity, organization), idmap: idmap}
73
+ def map_external_entity_with_idmap(external_entity, connec_entity_name, idmap)
74
+ {entity: map_to(connec_entity_name, external_entity), idmap: idmap}
104
75
  end
105
76
  end
@@ -0,0 +1,5 @@
1
+ module Maestrano::Connector::Rails
2
+ class ConnecHelper
3
+ include Maestrano::Connector::Rails::Concerns::ConnecHelper
4
+ end
5
+ end
@@ -1,6 +1,5 @@
1
1
  module Maestrano::Connector::Rails
2
2
  class Organization < ActiveRecord::Base
3
-
4
3
  # Enable Maestrano for this group
5
4
  maestrano_group_via :provider, :uid, :tenant do |group, maestrano|
6
5
  group.name = (maestrano.name.blank? ? "Default Group name" : maestrano.name)
@@ -13,11 +12,17 @@ module Maestrano::Connector::Rails
13
12
  def initialize
14
13
  super
15
14
  self.synchronized_entities = {}
16
- Entity.entities_list.each do |entity|
15
+ External.entities_list.each do |entity|
17
16
  self.synchronized_entities[entity.to_sym] = true
18
17
  end
19
18
  end
20
19
 
20
+ #===================================
21
+ # Encryptions
22
+ #===================================
23
+ # attr_encrypted :oauth_token, key: ::Settings.encryption_key
24
+ # attr_encrypted :refresh_token, key: ::Settings.encryption_key
25
+
21
26
  #===================================
22
27
  # Associations
23
28
  #===================================
@@ -31,6 +36,7 @@ module Maestrano::Connector::Rails
31
36
  #===================================
32
37
  validates :name, presence: true
33
38
  validates :tenant, presence: true
39
+ validates :uid, uniqueness: true
34
40
 
35
41
  #===================================
36
42
  # Serialized field
@@ -0,0 +1,8 @@
1
+ class AddEncryptionOnOauthKeys < ActiveRecord::Migration
2
+ def change
3
+ rename_column :organizations, :oauth_token, :encrypted_oauth_token
4
+ add_column :organizations, :encrypted_oauth_token_iv, :string
5
+ rename_column :organizations, :refresh_token, :encrypted_refresh_token
6
+ add_column :organizations, :encrypted_refresh_token_iv, :string
7
+ end
8
+ end
@@ -31,6 +31,7 @@ module Connector
31
31
 
32
32
  def copy_example_entity
33
33
  copy_file 'example_entity.rb', 'app/models/entities/example_entitiy.rb'
34
+ copy_file 'example_entity_spec.rb', 'spec/models/entities/example_entitiy.rb'
34
35
  end
35
36
 
36
37
  def copy_controllers_and_views
@@ -1,6 +1,6 @@
1
1
  # TODO
2
2
  # This file is provided as an example and should be removed
3
- # See README for explanation
3
+ # See doc for explanation
4
4
  # class Entities::SubEntities::Contact < Maestrano::Connector::Rails::SubEntityBase
5
5
 
6
6
  # def self.external?
@@ -23,7 +23,7 @@
23
23
  # # external_entities_names[1]: [unmapped_connec_entitiy4]
24
24
  # # }
25
25
  # # }
26
- # def connec_model_to_external_model(connec_hash_of_entities, organization)
26
+ # def connec_model_to_external_model(connec_hash_of_entities)
27
27
  # people = connec_hash_of_entities['person']
28
28
  # modeled_connec_entities = {'person' => { 'lead' => [], 'contact' => [] }}
29
29
 
@@ -50,7 +50,7 @@
50
50
  # # connec_entity_names[0]: [unmapped_external_entity3, unmapped_external_entity4]
51
51
  # # }
52
52
  # # }
53
- # def external_model_to_connec_model(external_hash_of_entities, organization)
53
+ # def external_model_to_connec_model(external_hash_of_entities)
54
54
  # return {'lead' => {'person' => external_hash_of_entities['lead']}, 'contact' => {'person' => external_hash_of_entities['contact']}}
55
55
  # end
56
56
  # end
@@ -1,35 +1,29 @@
1
1
  class Maestrano::Connector::Rails::Entity
2
2
  include Maestrano::Connector::Rails::Concerns::Entity
3
3
 
4
- # Return an array of all the entities that the connector can synchronize
5
- # If you add new entities, you need to generate
6
- # a migration to add them to existing organizations
7
- def self.entities_list
8
- # TODO
9
- # The names in this list should match the names of your entities class
10
- # e.g %w(person, tasks_list)
11
- # will synchronized Entities::Person and Entities::TasksList
12
- []
13
- end
4
+ # In this class and in all entities which inherit from it, the following instance variables are available:
5
+ # * @organization
6
+ # * @connec_client
7
+ # * @external_client
8
+ # * @opts
14
9
 
15
10
  # Return an array of entities from the external app
16
- def get_external_entities(client, last_synchronization, organization, opts={})
17
- return [] unless self.class.can_read_external?
18
- Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Fetching #{Maestrano::Connector::Rails::External.external_name} #{self.class.external_entity_name.pluralize}")
11
+ def get_external_entities(last_synchronization)
12
+ Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Fetching #{Maestrano::Connector::Rails::External.external_name} #{self.class.external_entity_name.pluralize}")
19
13
  # TODO
20
14
  # This method should return only entities that have been updated since the last_synchronization
21
- # It should also implements an option to do a full synchronization when opts[:full_sync] == true or when there is no last_synchronization
22
- # Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Received data: Source=#{Maestrano::Connector::Rails::External.external_name}, Entity=#{self.class.external_entity_name}, Response=#{entities}")
15
+ # It should also implements an option to do a full synchronization when @opts[:full_sync] == true or when there is no last_synchronization
16
+ # Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Received data: Source=#{Maestrano::Connector::Rails::External.external_name}, Entity=#{self.class.external_entity_name}, Response=#{entities}")
23
17
  end
24
18
 
25
- def create_external_entity(client, mapped_connec_entity, external_entity_name, organization)
26
- Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Sending create #{external_entity_name}: #{mapped_connec_entity} to #{Maestrano::Connector::Rails::External.external_name}")
19
+ def create_external_entity(mapped_connec_entity, external_entity_name)
20
+ Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Sending create #{external_entity_name}: #{mapped_connec_entity} to #{Maestrano::Connector::Rails::External.external_name}")
27
21
  # TODO
28
22
  # This method creates the entity in the external app and returns the external id
29
23
  end
30
24
 
31
- def update_external_entity(client, mapped_connec_entity, external_id, external_entity_name, organization)
32
- 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}")
25
+ def update_external_entity(mapped_connec_entity, external_id, external_entity_name)
26
+ 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}")
33
27
  # TODO
34
28
  # This method updates the entity with the given id in the external app
35
29
  end
@@ -29,7 +29,7 @@
29
29
  # class ExampleEntityMapper
30
30
  # extend HashMapper
31
31
 
32
- # map from('/title'), to('/Salutation')
33
- # map from('/first_name'), to('/FirstName')
32
+ # map from('title'), to('Salutation')
33
+ # map from('first_name'), to('FirstName')
34
34
  # map from('address_work/billing2/city'), to('City')
35
35
  # end
@@ -0,0 +1,73 @@
1
+ # TODO
2
+ # This file is provided as an example and should be removed
3
+ # require 'spec_helper'
4
+
5
+ # describe Entities::ExampleEntity do
6
+
7
+ # describe 'class methods' do
8
+ # subject { Entities::ExampleEntity }
9
+
10
+ # it { expect(subject.connec_entity_name).to eql('ExampleEntity') }
11
+ # it { expect(subject.external_entity_name).to eql('Contact') }
12
+ # it { expect(subject.object_name_from_connec_entity_hash({'first_name' => 'A', 'last_name' => 'contact'})).to eql('A contact') }
13
+ # it { expect(subject.object_name_from_external_entity_hash({'FirstName' => 'A', 'LastName' => 'contact'})).to eql('A contact') }
14
+ # end
15
+
16
+ # describe 'instance methods' do
17
+ # let(:organization) { create(:organization) }
18
+ # let(:connec_client) { Maestrano::Connec::Client[organization.tenant].new(organization.uid) }
19
+ # let(:external_client) { Maestrano::Connector::Rails::External.get_client(organization) }
20
+ # let(:opts) { {} }
21
+ # subject { Entities::ExampleEntity.new(organization, connec_client, external_client, opts) }
22
+
23
+ # describe 'external to connec!' do
24
+ # let(:external_hash) {
25
+ # {
26
+ # "Id" => '2345uoi'
27
+ # "Salutation" => 'Mr',
28
+ # "FirstName" => 'John',
29
+ # "City" => 'London'
30
+ # }
31
+ # }
32
+
33
+ # let (:mapped_external_hash) {
34
+ # {
35
+ # "id" => [{'id' => '2345uoi', 'provider' => organization.oauth_provider, 'realm' => organization.oauth_uid}],
36
+ # "first_name" => "John",
37
+ # "title" => "Mr"
38
+ # "address_work" => {
39
+ # "billing2" => {
40
+ # "city" => 'London'
41
+ # }
42
+ # }
43
+ # }.with_indifferent_access
44
+ # }
45
+
46
+ # it { expect(subject.map_to_connec(external_hash)).to eql(mapped_external_hash) }
47
+ # end
48
+
49
+ # describe 'connec to salesforce' do
50
+ # let(:connec_hash) {
51
+ # {
52
+ # "first_name" => "John",
53
+ # "title" => "Mr"
54
+ # "address_work" => {
55
+ # "billing2" => {
56
+ # "city" => 'London'
57
+ # }
58
+ # }
59
+ # }
60
+ # }
61
+
62
+ # let(:mapped_connec_hash) {
63
+ # {
64
+ # "Salutation" => 'Mr',
65
+ # "FirstName" => 'John',
66
+ # "City" => 'London'
67
+ # }.with_indifferent_access
68
+ # }
69
+
70
+ # it { expect(subject.map_to_external(connec_hash)).to eql(mapped_connec_hash) }
71
+ # end
72
+ # end
73
+ # end
@@ -16,4 +16,15 @@ class Maestrano::Connector::Rails::External
16
16
  # client_id: ENV[''],
17
17
  # client_secret: ENV['']
18
18
  end
19
+
20
+ # Return an array of all the entities that the connector can synchronize
21
+ # If you add new entities, you need to generate
22
+ # a migration to add them to existing organizations
23
+ def self.entities_list
24
+ # TODO
25
+ # The names in this list should match the names of your entities class
26
+ # e.g %w(person, tasks_list)
27
+ # will synchronized Entities::Person and Entities::TasksList
28
+ []
29
+ end
19
30
  end
@@ -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 0.4.4 ruby lib
5
+ # stub: maestrano-connector-rails 1.0.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "maestrano-connector-rails"
9
- s.version = "0.4.4"
9
+ s.version = "1.0.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-05-11"
14
+ s.date = "2016-05-25"
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"]
@@ -23,7 +23,6 @@ Gem::Specification.new do |s|
23
23
  ".rspec",
24
24
  "DEVELOPER.md",
25
25
  "Gemfile",
26
- "Gemfile.lock",
27
26
  "LICENSE",
28
27
  "README.md",
29
28
  "Rakefile",
@@ -40,10 +39,12 @@ Gem::Specification.new do |s|
40
39
  "app/jobs/maestrano/connector/rails/synchronization_job.rb",
41
40
  "app/models/maestrano/connector/rails/complex_entity.rb",
42
41
  "app/models/maestrano/connector/rails/concerns/complex_entity.rb",
42
+ "app/models/maestrano/connector/rails/concerns/connec_helper.rb",
43
43
  "app/models/maestrano/connector/rails/concerns/connector_logger.rb",
44
44
  "app/models/maestrano/connector/rails/concerns/entity.rb",
45
45
  "app/models/maestrano/connector/rails/concerns/external.rb",
46
46
  "app/models/maestrano/connector/rails/concerns/sub_entity_base.rb",
47
+ "app/models/maestrano/connector/rails/connec_helper.rb",
47
48
  "app/models/maestrano/connector/rails/connector_logger.rb",
48
49
  "app/models/maestrano/connector/rails/entity.rb",
49
50
  "app/models/maestrano/connector/rails/external.rb",
@@ -55,6 +56,7 @@ Gem::Specification.new do |s|
55
56
  "app/models/maestrano/connector/rails/user_organization_rel.rb",
56
57
  "bin/rails",
57
58
  "config/routes.rb",
59
+ "db/20160524112054_add_encryption_on_oauth_keys.rb",
58
60
  "db/migrate/20151122162100_create_users.rb",
59
61
  "db/migrate/20151122162414_create_organizations.rb",
60
62
  "db/migrate/20151122162613_create_user_organization_rels.rb",
@@ -74,6 +76,7 @@ Gem::Specification.new do |s|
74
76
  "lib/generators/connector/templates/complex_entity_example/person.rb",
75
77
  "lib/generators/connector/templates/entity.rb",
76
78
  "lib/generators/connector/templates/example_entity.rb",
79
+ "lib/generators/connector/templates/example_entity_spec.rb",
77
80
  "lib/generators/connector/templates/external.rb",
78
81
  "lib/generators/connector/templates/home_controller.rb",
79
82
  "lib/generators/connector/templates/home_controller_spec.rb",
@@ -95,7 +98,7 @@ Gem::Specification.new do |s|
95
98
  "lib/maestrano/connector/rails.rb",
96
99
  "maestrano-connector-rails.gemspec",
97
100
  "maestrano.png",
98
- "realse_notes.md",
101
+ "release_notes.md",
99
102
  "spec/controllers/connec_controller_spec.rb",
100
103
  "spec/controllers/group_users_controller_spec.rb",
101
104
  "spec/controllers/groups_controller_spec.rb",
@@ -116,7 +119,6 @@ Gem::Specification.new do |s|
116
119
  "spec/dummy/app/models/entities/example_entitiy.rb",
117
120
  "spec/dummy/app/models/maestrano/connector/rails/entity.rb",
118
121
  "spec/dummy/app/models/maestrano/connector/rails/external.rb",
119
- "spec/dummy/app/views/admin/index.html.erb",
120
122
  "spec/dummy/app/views/home/index.html.erb",
121
123
  "spec/dummy/app/views/layouts/application.html.erb",
122
124
  "spec/dummy/bin/bundle",
@@ -143,9 +145,7 @@ Gem::Specification.new do |s|
143
145
  "spec/dummy/config/locales/en.yml",
144
146
  "spec/dummy/config/routes.rb",
145
147
  "spec/dummy/config/secrets.yml",
146
- "spec/dummy/db/development.sqlite3",
147
148
  "spec/dummy/db/schema.rb",
148
- "spec/dummy/db/test.sqlite3",
149
149
  "spec/dummy/lib/assets/.keep",
150
150
  "spec/dummy/log/.keep",
151
151
  "spec/dummy/public/404.html",
@@ -153,10 +153,15 @@ Gem::Specification.new do |s|
153
153
  "spec/dummy/public/500.html",
154
154
  "spec/dummy/public/favicon.ico",
155
155
  "spec/factories.rb",
156
+ "spec/integration/connec_to_external_spec.rb",
157
+ "spec/integration/external_to_connec_spec.rb",
158
+ "spec/integration/integration_complex_spec.rb",
159
+ "spec/integration/singleton_spec.rb",
156
160
  "spec/jobs/all_synchronizations_job_spec.rb",
157
161
  "spec/jobs/push_to_connec_job_spec.rb",
158
162
  "spec/jobs/synchronization_job_spec.rb",
159
163
  "spec/models/complex_entity_spec.rb",
164
+ "spec/models/connec_helper_spec.rb",
160
165
  "spec/models/connector_logger_spec.rb",
161
166
  "spec/models/entity_spec.rb",
162
167
  "spec/models/external_spec.rb",
data/release_notes.md ADDED
@@ -0,0 +1,81 @@
1
+ ## 1.0.0
2
+
3
+ ### Features
4
+ * Reference in mapping greatly simplified. See the documentation for an explanation and example: [here](https://maestrano.atlassian.net/wiki/display/DEV/Mapping+and+synchronization#Mappingandsynchronization-References).
5
+ * Smart merging available. You can specifiy field on which Connec! will attempt to merge the record with an existing one. See the framework [documentation](https://maestrano.atlassian.net/wiki/display/DEV/Examples#Examples-Smartmerging) for an example, as well as the Connec! [documentation](http://maestrano.github.io/connec/#api-|-save-data-resource-creation-post)
6
+
7
+ ### Breaking changes
8
+ A major refactoring as lead to some breaking changes:
9
+ * `Entity` and `ComplexEntity` `initialize` method now take 3-4 argument instead of 0: `organization`, `connec_client`, `external_client` and `opts`
10
+ * All the **instance** methods of those classes that previously took one of these arguments have been change to not include them anymore. Full list:
11
+
12
+ **ComplexEntity & Entity:**
13
+ **`connec_model_to_external_model`**
14
+ **`external_model_to_connec_model`**
15
+ `get_connec_entities`
16
+ **`get_external_entities`**
17
+ `consolidate_and_map_data`
18
+ `push_entities_to_connec`
19
+ `push_entities_to_external`
20
+ **`before_sync`**
21
+ **`after_sync`**
22
+ **`filter_connec_entities`**
23
+
24
+
25
+ **Entity:**
26
+ **`map_to_external`**
27
+ **`map_to_connec`**
28
+ `push_entities_to_connec_to`
29
+ `batch_op`
30
+ `push_entities_to_external_to`
31
+ `push_entity_to_external`
32
+ **`create_external_entity`**
33
+ **`update_external_entity`**
34
+ `consolidate_and_map_singleton`
35
+ `map_external_entity_with_idmap`
36
+
37
+ **SubEntityBase:**
38
+ **`map_to`**
39
+
40
+ * The class method `entities_list` has been moved from `Entity` to `External`
41
+ * The `references` method has been changed with the new reference system. The framework now expect it to be an array os strings instead of an array of hashes. Furthermore, it now supports reference fields embedded in hashes and arrays.
42
+ * The following method from `Entity` as been changed from class methods to instance methods (and their arguments have been changed):
43
+ `not_modified_since_last_push_to_connec?`
44
+ `is_external_more_recent?`
45
+ `solve_conflict`
46
+
47
+ * The following methods have been removed
48
+ `map_to_external_with_idmap`
49
+ `create_idmap_from_external_entity`
50
+ `create_idmap_from_connec_entity`
51
+ `can_update_connec?`
52
+ `id_from_ref`
53
+
54
+
55
+ - - - -
56
+ - - - -
57
+
58
+ ## 0.4.4
59
+
60
+ ### Features
61
+ * Add filter_connec_entities method to allow filtering in webhook workflow
62
+
63
+ ### Fixes
64
+ * Truncate idmap message to avoid database errors
65
+
66
+ ## 0.4.3
67
+
68
+ ### Fixes
69
+ * Add `forced` option in home_controller when requesting a manual synchronization.
70
+
71
+
72
+ ## 0.4.2
73
+ /!\ This release contains a new migration that you'll need to fetch and run
74
+
75
+ ### Features
76
+ * Add call to before and after_sync methods during synchronization workflows
77
+ * Add logic for record flagged as inactive in the external application
78
+
79
+ ### Fixes
80
+ * Fix recovery mode: recovery mode was previously on as soon as the organization had three failed synchronizations, even if a synchronization had succeed afterward. Moreover, recovery mode doesn't prevent manual synchronization anymore.
81
+ * Fix a typo in saml controller that prevented deletion of a session param.