maestrano-connector-rails 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/VERSION +1 -1
- data/app/jobs/maestrano/connector/rails/all_synchronizations_job.rb +13 -0
- data/maestrano-connector-rails.gemspec +6 -3
- data/pkg/maestrano-connector-rails-0.2.4.gem +0 -0
- data/spec/jobs/all_syncrhonizations_job_spec.rb +19 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d3047d294b997ceac24b7cfff460c9483e09b91
|
4
|
+
data.tar.gz: 314c34f8692fbc6f1cabd32d61f45b05391e77e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf044115267564146f57414d8f770f336c23ac116637a2bd2f6f0ce22a8a8723b7e704ec81692c4e29cc35bb83f5502e3125e7810f41841b4b9ce57f4ab69721
|
7
|
+
data.tar.gz: f2d3c89e67f199a75fbd333701b22efbe742dd0b6dfe79dc3cee0e486f9090a56be69078a57ff06b5f7b4a2c8c92427d52f1759730434a7f4c0ce02c5a256c63
|
data/README.md
CHANGED
@@ -124,6 +124,17 @@ def map_to_connec(entity, organization)
|
|
124
124
|
end
|
125
125
|
```
|
126
126
|
|
127
|
+
### Triggering synchronizations
|
128
|
+
Performing the synchronization of all the linked organizations can be triggered by executing
|
129
|
+
```ruby
|
130
|
+
Maestrano::Connector::Rails::AllSynchronizationsJob
|
131
|
+
```
|
132
|
+
|
133
|
+
The synchronization of a specific organization can be performed by executing
|
134
|
+
```ruby
|
135
|
+
Maestrano::Connector::Rails::SynchronizationJob.perform_later(o, {})
|
136
|
+
```
|
137
|
+
|
127
138
|
## Pages controllers and views
|
128
139
|
|
129
140
|
The home and admin pages views and controllers are provided as example, but you are free to customize them and the styling is left for you to do.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.5
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Maestrano::Connector::Rails
|
2
|
+
class AllSynchronizationsJob < ::ActiveJob::Base
|
3
|
+
queue_as :default
|
4
|
+
|
5
|
+
# Trigger synchronization of all active organizations
|
6
|
+
def perform
|
7
|
+
Maestrano::Connector::Rails::Organization.where("oauth_provider IS NOT NULL AND oauth_token IS NOT NULL").each do |o|
|
8
|
+
next unless [true, 1].include?(o.sync_enabled)
|
9
|
+
Maestrano::Connector::Rails::SynchronizationJob.perform_later(o, {})
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
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.2.
|
5
|
+
# stub: maestrano-connector-rails 0.2.5 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "maestrano-connector-rails"
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.5"
|
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-02-
|
14
|
+
s.date = "2016-02-11"
|
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"]
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"app/controllers/maestrano/connec_controller.rb",
|
36
36
|
"app/controllers/maestrano/sessions_controller.rb",
|
37
37
|
"app/helpers/maestrano/connector/rails/session_helper.rb",
|
38
|
+
"app/jobs/maestrano/connector/rails/all_synchronizations_job.rb",
|
38
39
|
"app/jobs/maestrano/connector/rails/synchronization_job.rb",
|
39
40
|
"app/models/maestrano/connector/rails/complex_entity.rb",
|
40
41
|
"app/models/maestrano/connector/rails/concerns/entity.rb",
|
@@ -79,6 +80,7 @@ Gem::Specification.new do |s|
|
|
79
80
|
"maestrano-connector-rails.gemspec",
|
80
81
|
"maestrano.png",
|
81
82
|
"pkg/maestrano-connector-rails-0.0.1.gem",
|
83
|
+
"pkg/maestrano-connector-rails-0.2.4.gem",
|
82
84
|
"spec/controllers/connec_controller_spec.rb",
|
83
85
|
"spec/dummy/README.md",
|
84
86
|
"spec/dummy/Rakefile",
|
@@ -140,6 +142,7 @@ Gem::Specification.new do |s|
|
|
140
142
|
"spec/dummy/public/500.html",
|
141
143
|
"spec/dummy/public/favicon.ico",
|
142
144
|
"spec/factories.rb",
|
145
|
+
"spec/jobs/all_syncrhonizations_job_spec.rb",
|
143
146
|
"spec/jobs/syncrhonization_job_spec.rb",
|
144
147
|
"spec/models/complex_entity_spec.rb",
|
145
148
|
"spec/models/connector_logger_spec.rb",
|
Binary file
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Maestrano::Connector::Rails::AllSynchronizationsJob do
|
4
|
+
let(:organization_not_linked) { create(:organization, oauth_provider: 'salesforce', oauth_token: nil, sync_enabled: true) }
|
5
|
+
let(:organization_not_active) { create(:organization, oauth_provider: 'salesforce', oauth_token: '123', sync_enabled: 0) }
|
6
|
+
let(:organization_to_process) { create(:organization, oauth_provider: 'salesforce', oauth_token: '123', sync_enabled: true) }
|
7
|
+
|
8
|
+
subject { Maestrano::Connector::Rails::AllSynchronizationsJob.perform_now() }
|
9
|
+
|
10
|
+
describe 'perform' do
|
11
|
+
it 'does not calls sync entity' do
|
12
|
+
expect(Maestrano::Connector::Rails::SynchronizationJob).to_not receive(:perform_later).with(organization_not_linked, anything)
|
13
|
+
expect(Maestrano::Connector::Rails::SynchronizationJob).to_not receive(:perform_later).with(organization_not_active, anything)
|
14
|
+
expect(Maestrano::Connector::Rails::SynchronizationJob).to receive(:perform_later).with(organization_to_process, anything)
|
15
|
+
|
16
|
+
subject
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maestrano-connector-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
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-02-
|
11
|
+
date: 2016-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maestrano-rails
|
@@ -203,6 +203,7 @@ files:
|
|
203
203
|
- app/controllers/maestrano/connec_controller.rb
|
204
204
|
- app/controllers/maestrano/sessions_controller.rb
|
205
205
|
- app/helpers/maestrano/connector/rails/session_helper.rb
|
206
|
+
- app/jobs/maestrano/connector/rails/all_synchronizations_job.rb
|
206
207
|
- app/jobs/maestrano/connector/rails/synchronization_job.rb
|
207
208
|
- app/models/maestrano/connector/rails/complex_entity.rb
|
208
209
|
- app/models/maestrano/connector/rails/concerns/entity.rb
|
@@ -247,6 +248,7 @@ files:
|
|
247
248
|
- maestrano-connector-rails.gemspec
|
248
249
|
- maestrano.png
|
249
250
|
- pkg/maestrano-connector-rails-0.0.1.gem
|
251
|
+
- pkg/maestrano-connector-rails-0.2.4.gem
|
250
252
|
- spec/controllers/connec_controller_spec.rb
|
251
253
|
- spec/dummy/README.md
|
252
254
|
- spec/dummy/Rakefile
|
@@ -308,6 +310,7 @@ files:
|
|
308
310
|
- spec/dummy/public/500.html
|
309
311
|
- spec/dummy/public/favicon.ico
|
310
312
|
- spec/factories.rb
|
313
|
+
- spec/jobs/all_syncrhonizations_job_spec.rb
|
311
314
|
- spec/jobs/syncrhonization_job_spec.rb
|
312
315
|
- spec/models/complex_entity_spec.rb
|
313
316
|
- spec/models/connector_logger_spec.rb
|