maestrano-connector-rails 1.2.0 → 1.2.1

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: 48d5cff94c3992312d69f4ae46493d883e9c752f
4
- data.tar.gz: c9fb97913e6f032198ec72fc69bb2351aa220546
3
+ metadata.gz: 95e92f2381cc4ebc9478d3b71f683c6befeb10aa
4
+ data.tar.gz: 54d7c193e363d6c1897dde5232e995c6a782a0a3
5
5
  SHA512:
6
- metadata.gz: 9635d73732f2d8e40e545049ddf45d752b2c725d2660fc03bbbda23fc158fbab0d4445b0721736a96f4596970e9f740fd98b7f3be2efb0bc4296f3a9c68bc40b
7
- data.tar.gz: 94486ead1d56581183097dfb52f08498bf0fe093b5b220bfe91b83803007baf6a01a0b80d5d18b71cb5be9ccb075a916681e3f396be09f5adf1494be6e5117b0
6
+ metadata.gz: 4d274d460bb4c47ef71745754e91ead09874cdeca8f654f83c8e164bbf6fc3766a8a176e1c3fe917782dd410ae59ce43a254fe833c7039ee5f2312ab09e99d66
7
+ data.tar.gz: 55381a11bdf457004c6e82b6097edc9c4b3f1bc4f8326203e1018cc4628e67cf987f466cd0ed26de292f36c6177f8cc4b59f01d7f813cb3af460aa378238dd98
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.3.1@maestrano-connector-rails
data/CODESHIP.md ADDED
@@ -0,0 +1,11 @@
1
+ # Setup
2
+ ```
3
+ rvm install ruby-2.3.1
4
+ gem install bundler
5
+ bundle install
6
+ ```
7
+
8
+ # Test commands
9
+ ```
10
+ bundle exec rake
11
+ ```
data/Gemfile CHANGED
@@ -1,9 +1,12 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  # Add dependencies required to use your gem here.
4
+ gem 'rails', '~> 4.0'
4
5
  gem 'maestrano-rails'
5
6
  gem 'hash_mapper'
6
7
  gem 'sidekiq'
8
+ # The missing unique jobs for sidekiq
9
+ gem 'sidekiq-unique-jobs'
7
10
  gem 'haml-rails'
8
11
  gem 'bootstrap-sass'
9
12
  gem 'autoprefixer-rails'
@@ -15,7 +18,7 @@ group :development do
15
18
  gem "shoulda", ">= 0"
16
19
  gem "rdoc", "~> 3.12"
17
20
  gem "bundler", "~> 1.0"
18
- gem "jeweler", "~> 2.0.1"
21
+ gem "jeweler", "~> 2.1.1"
19
22
  gem "simplecov", ">= 0"
20
23
  gem 'rspec-rails'
21
24
  gem 'factory_girl_rails'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
@@ -0,0 +1,19 @@
1
+ module Maestrano::Connector::Rails
2
+
3
+ # This class process the push to Connec, it use PushToConnecJob for retrocompatibility
4
+ # By using sidekiq-unique-jobs, it makes sure that 2 calls on the same entity, are processed in order
5
+ class PushToConnecWorker
6
+ include Sidekiq::Worker
7
+ sidekiq_options unique: :while_executing, unique_args: :unique_args
8
+
9
+ def self.unique_args(args)
10
+ organization = args[0]
11
+ entities_hash = args[1]
12
+ return[organization.id, entities_hash.keys.sort]
13
+ end
14
+
15
+ def perform(organization, entities_hash, opts={})
16
+ PushToConnecJob.new.perform(organization, entities_hash, opts)
17
+ end
18
+ end
19
+ 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 1.2.0 ruby lib
5
+ # stub: maestrano-connector-rails 1.2.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "maestrano-connector-rails"
9
- s.version = "1.2.0"
9
+ s.version = "1.2.1"
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-01"
14
+ s.date = "2016-07-04"
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"]
@@ -21,6 +21,8 @@ Gem::Specification.new do |s|
21
21
  ]
22
22
  s.files = [
23
23
  ".rspec",
24
+ ".ruby-version",
25
+ "CODESHIP.md",
24
26
  "DEVELOPER.md",
25
27
  "Gemfile",
26
28
  "LICENSE",
@@ -38,6 +40,7 @@ Gem::Specification.new do |s|
38
40
  "app/helpers/maestrano/connector/rails/session_helper.rb",
39
41
  "app/jobs/maestrano/connector/rails/all_synchronizations_job.rb",
40
42
  "app/jobs/maestrano/connector/rails/push_to_connec_job.rb",
43
+ "app/jobs/maestrano/connector/rails/push_to_connec_worker.rb",
41
44
  "app/jobs/maestrano/connector/rails/synchronization_job.rb",
42
45
  "app/models/maestrano/connector/rails/complex_entity.rb",
43
46
  "app/models/maestrano/connector/rails/concerns/complex_entity.rb",
@@ -170,6 +173,7 @@ Gem::Specification.new do |s|
170
173
  "spec/integration/singleton_spec.rb",
171
174
  "spec/jobs/all_synchronizations_job_spec.rb",
172
175
  "spec/jobs/push_to_connec_job_spec.rb",
176
+ "spec/jobs/push_to_connec_worker_spec.rb",
173
177
  "spec/jobs/synchronization_job_spec.rb",
174
178
  "spec/models/complex_entity_spec.rb",
175
179
  "spec/models/connec_helper_spec.rb",
@@ -204,16 +208,18 @@ Gem::Specification.new do |s|
204
208
  ]
205
209
  s.homepage = "http://github.com/maestrano/maestrano-connector-rails"
206
210
  s.licenses = ["MIT"]
207
- s.rubygems_version = "2.4.6"
211
+ s.rubygems_version = "2.5.1"
208
212
  s.summary = "Rails framework to build connector with Maestrano"
209
213
 
210
214
  if s.respond_to? :specification_version then
211
215
  s.specification_version = 4
212
216
 
213
217
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
218
+ s.add_runtime_dependency(%q<rails>, ["~> 4.0"])
214
219
  s.add_runtime_dependency(%q<maestrano-rails>, [">= 0"])
215
220
  s.add_runtime_dependency(%q<hash_mapper>, [">= 0"])
216
221
  s.add_runtime_dependency(%q<sidekiq>, [">= 0"])
222
+ s.add_runtime_dependency(%q<sidekiq-unique-jobs>, [">= 0"])
217
223
  s.add_runtime_dependency(%q<haml-rails>, [">= 0"])
218
224
  s.add_runtime_dependency(%q<bootstrap-sass>, [">= 0"])
219
225
  s.add_runtime_dependency(%q<autoprefixer-rails>, [">= 0"])
@@ -222,7 +228,7 @@ Gem::Specification.new do |s|
222
228
  s.add_development_dependency(%q<shoulda>, [">= 0"])
223
229
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
224
230
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
225
- s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
231
+ s.add_development_dependency(%q<jeweler>, ["~> 2.1.1"])
226
232
  s.add_development_dependency(%q<simplecov>, [">= 0"])
227
233
  s.add_development_dependency(%q<rspec-rails>, [">= 0"])
228
234
  s.add_development_dependency(%q<factory_girl_rails>, [">= 0"])
@@ -230,9 +236,11 @@ Gem::Specification.new do |s|
230
236
  s.add_development_dependency(%q<shoulda-matchers>, [">= 0"])
231
237
  s.add_development_dependency(%q<timecop>, [">= 0"])
232
238
  else
239
+ s.add_dependency(%q<rails>, ["~> 4.0"])
233
240
  s.add_dependency(%q<maestrano-rails>, [">= 0"])
234
241
  s.add_dependency(%q<hash_mapper>, [">= 0"])
235
242
  s.add_dependency(%q<sidekiq>, [">= 0"])
243
+ s.add_dependency(%q<sidekiq-unique-jobs>, [">= 0"])
236
244
  s.add_dependency(%q<haml-rails>, [">= 0"])
237
245
  s.add_dependency(%q<bootstrap-sass>, [">= 0"])
238
246
  s.add_dependency(%q<autoprefixer-rails>, [">= 0"])
@@ -241,7 +249,7 @@ Gem::Specification.new do |s|
241
249
  s.add_dependency(%q<shoulda>, [">= 0"])
242
250
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
243
251
  s.add_dependency(%q<bundler>, ["~> 1.0"])
244
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
252
+ s.add_dependency(%q<jeweler>, ["~> 2.1.1"])
245
253
  s.add_dependency(%q<simplecov>, [">= 0"])
246
254
  s.add_dependency(%q<rspec-rails>, [">= 0"])
247
255
  s.add_dependency(%q<factory_girl_rails>, [">= 0"])
@@ -250,9 +258,11 @@ Gem::Specification.new do |s|
250
258
  s.add_dependency(%q<timecop>, [">= 0"])
251
259
  end
252
260
  else
261
+ s.add_dependency(%q<rails>, ["~> 4.0"])
253
262
  s.add_dependency(%q<maestrano-rails>, [">= 0"])
254
263
  s.add_dependency(%q<hash_mapper>, [">= 0"])
255
264
  s.add_dependency(%q<sidekiq>, [">= 0"])
265
+ s.add_dependency(%q<sidekiq-unique-jobs>, [">= 0"])
256
266
  s.add_dependency(%q<haml-rails>, [">= 0"])
257
267
  s.add_dependency(%q<bootstrap-sass>, [">= 0"])
258
268
  s.add_dependency(%q<autoprefixer-rails>, [">= 0"])
@@ -261,7 +271,7 @@ Gem::Specification.new do |s|
261
271
  s.add_dependency(%q<shoulda>, [">= 0"])
262
272
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
263
273
  s.add_dependency(%q<bundler>, ["~> 1.0"])
264
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
274
+ s.add_dependency(%q<jeweler>, ["~> 2.1.1"])
265
275
  s.add_dependency(%q<simplecov>, [">= 0"])
266
276
  s.add_dependency(%q<rspec-rails>, [">= 0"])
267
277
  s.add_dependency(%q<factory_girl_rails>, [">= 0"])
data/release_notes.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## 1.2.0
2
+ /!\ For this version to work, you'll need to add `< Maestrano::Connector::Rails::EntityBase` to your `entity.rb` class
3
+
4
+ ### Features
5
+ * Custom synchronization process for first sync. (For this feature to work, you'll need to implement handling of additionnal options in your `get_external_entities` method. The connector will still work as before if you don't).
6
+ * Administrations endpoints to get the synchronizations status, start a synchronization, toggle `sync_enabled` and get the connector dependancies (depenancies are declared in ConnecHelper. You'll need to overload the dependancies method if you have specific dependancies)
7
+
8
+ ### Improvments
9
+ * Entity and ComplexEntity now inherits from EntityBase
10
+
11
+ ## 1.1.2
12
+ /!\ This version need a migration (`bundle exec rake railties:install:migrations; bundle exec rake db:migrate`). It also requires the running of a manual script to encrypt existing oauth_keys
13
+ You'll also need to change some methods as the framework is not sending the `last_synchronization` anymore but directly the `last_synchronization_date` (`get_external_entities`, `before_sync`, `after_sync`)
14
+
15
+ ### Features
16
+ * Encryption of oauth keys (you'll need to add `gem 'attr_encrypted', '~> 1.4.0'` to your Gemfile)
17
+ * No historical data option: only data created after the link to the connector will be sync. For this option to be available, you'll need to implement a `creation_date_from_external_entity_hash` method. It also requires a front end update (view, controller, js)
18
+
19
+ ### Fixes
20
+ * Fix synchronization cleaning
21
+ * Minor fixes
22
+
1
23
  ## 1.0.4
2
24
 
3
25
  ### Fixes
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+ require 'sidekiq/testing'
3
+
4
+ describe Maestrano::Connector::Rails::PushToConnecWorker do
5
+ describe 'class method' do
6
+ let(:organization) { create(:organization) }
7
+ subject { Maestrano::Connector::Rails::PushToConnecWorker }
8
+
9
+ Sidekiq::Testing.fake!
10
+ it 'perform_async add a new job' do
11
+ expect {
12
+ subject.perform_async(1, 2, 3)
13
+ }.to change(subject.jobs, :size).by(1)
14
+ end
15
+
16
+ describe 'unique_args' do
17
+ it do
18
+ entities_hash = {entity_2: [{'id': 'id2'}, {'id': 'id1'}], entity_1: [{'id': 'id4'}, {'id': nil}, {'id': 'id3'}, {'id': 'id3'}]}
19
+ expect(subject.unique_args([organization, entities_hash])).to eq([organization.id, [:entity_1, :entity_2]])
20
+ end
21
+ end
22
+ end
23
+
24
+
25
+ end
26
+
@@ -53,6 +53,8 @@ gem 'attr_encrypted', '~> 1.4.0'
53
53
  gem 'sinatra', :require => nil
54
54
  gem 'sidekiq'
55
55
  gem 'sidekiq-cron'
56
+ # The missing unique jobs for sidekiq
57
+ gem 'sidekiq-unique-jobs'
56
58
  gem 'slim'
57
59
 
58
60
  gem_group :production, :uat do
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maestrano-connector-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Berard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-01 00:00:00.000000000 Z
11
+ date: 2016-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: maestrano-rails
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sidekiq-unique-jobs
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: haml-rails
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +198,14 @@ dependencies:
170
198
  requirements:
171
199
  - - "~>"
172
200
  - !ruby/object:Gem::Version
173
- version: 2.0.1
201
+ version: 2.1.1
174
202
  type: :development
175
203
  prerelease: false
176
204
  version_requirements: !ruby/object:Gem::Requirement
177
205
  requirements:
178
206
  - - "~>"
179
207
  - !ruby/object:Gem::Version
180
- version: 2.0.1
208
+ version: 2.1.1
181
209
  - !ruby/object:Gem::Dependency
182
210
  name: simplecov
183
211
  requirement: !ruby/object:Gem::Requirement
@@ -273,6 +301,8 @@ extra_rdoc_files:
273
301
  - README.md
274
302
  files:
275
303
  - ".rspec"
304
+ - ".ruby-version"
305
+ - CODESHIP.md
276
306
  - DEVELOPER.md
277
307
  - Gemfile
278
308
  - LICENSE
@@ -290,6 +320,7 @@ files:
290
320
  - app/helpers/maestrano/connector/rails/session_helper.rb
291
321
  - app/jobs/maestrano/connector/rails/all_synchronizations_job.rb
292
322
  - app/jobs/maestrano/connector/rails/push_to_connec_job.rb
323
+ - app/jobs/maestrano/connector/rails/push_to_connec_worker.rb
293
324
  - app/jobs/maestrano/connector/rails/synchronization_job.rb
294
325
  - app/models/maestrano/connector/rails/complex_entity.rb
295
326
  - app/models/maestrano/connector/rails/concerns/complex_entity.rb
@@ -422,6 +453,7 @@ files:
422
453
  - spec/integration/singleton_spec.rb
423
454
  - spec/jobs/all_synchronizations_job_spec.rb
424
455
  - spec/jobs/push_to_connec_job_spec.rb
456
+ - spec/jobs/push_to_connec_worker_spec.rb
425
457
  - spec/jobs/synchronization_job_spec.rb
426
458
  - spec/models/complex_entity_spec.rb
427
459
  - spec/models/connec_helper_spec.rb
@@ -473,7 +505,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
473
505
  version: '0'
474
506
  requirements: []
475
507
  rubyforge_project:
476
- rubygems_version: 2.4.6
508
+ rubygems_version: 2.5.1
477
509
  signing_key:
478
510
  specification_version: 4
479
511
  summary: Rails framework to build connector with Maestrano