maestrano-connector-rails 2.0.2.pre.RC10 → 2.0.2.pre.RC11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +14 -45
- data/app/controllers/maestrano/connec_controller.rb +12 -11
- data/app/controllers/maestrano/synchronizations_controller.rb +1 -1
- data/app/models/maestrano/connector/rails/concerns/organization.rb +3 -2
- data/app/models/maestrano/connector/rails/services/data_consolidator.rb +6 -1
- data/lib/maestrano/connector/rails/version.rb +1 -1
- data/maestrano-connector-rails.gemspec +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f6eccd1fce609864badd6c4b166a0ceaf7136a6
|
4
|
+
data.tar.gz: cef4d3385f5a31ee1c352b9d8f0ed91aa2238ef9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bdc954bfcd99c4378ca1fa82207f0638736805d0f73696eafbdfee0d033cea632452522ac907860834a715be83421e1abb008b0d537d976625003a40c6db2d3
|
7
|
+
data.tar.gz: c470342c8026c2ad466cab90fab9ee52c87c23f352d0f5cd4439b972a139373ac8f21c2c30dbfdb7c7e3290bd5930ad428af9f5dcce92d4d9e44c31cf8aec40b
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2017-06-06 10:23:17 +0100 using RuboCop version 0.45.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -12,34 +12,30 @@ Lint/AssignmentInCondition:
|
|
12
12
|
Exclude:
|
13
13
|
- 'app/jobs/maestrano/connector/rails/push_to_connec_job.rb'
|
14
14
|
|
15
|
+
# Offense count: 28
|
16
|
+
Metrics/AbcSize:
|
17
|
+
Max: 69
|
18
|
+
|
15
19
|
# Offense count: 1
|
20
|
+
# Configuration parameters: CountComments.
|
16
21
|
Metrics/ClassLength:
|
17
|
-
Max:
|
22
|
+
Max: 110
|
18
23
|
|
19
|
-
# Offense count:
|
20
|
-
Metrics/AbcSize:
|
21
|
-
Max: 70
|
22
|
-
|
23
|
-
# Offense count: 10
|
24
|
+
# Offense count: 9
|
24
25
|
Metrics/CyclomaticComplexity:
|
25
26
|
Max: 14
|
26
27
|
|
27
|
-
# Offense count:
|
28
|
-
# Configuration parameters: CountComments.
|
29
|
-
Metrics/MethodLength:
|
30
|
-
Max: 42
|
31
|
-
|
32
|
-
# Offense count: 2
|
28
|
+
# Offense count: 3
|
33
29
|
# Configuration parameters: CountComments.
|
34
30
|
Metrics/ModuleLength:
|
35
|
-
Max:
|
31
|
+
Max: 206
|
36
32
|
|
37
33
|
# Offense count: 2
|
38
34
|
# Configuration parameters: CountKeywordArgs.
|
39
35
|
Metrics/ParameterLists:
|
40
36
|
Max: 7
|
41
37
|
|
42
|
-
# Offense count:
|
38
|
+
# Offense count: 9
|
43
39
|
Metrics/PerceivedComplexity:
|
44
40
|
Max: 15
|
45
41
|
|
@@ -55,15 +51,9 @@ Performance/FlatMap:
|
|
55
51
|
# SupportedStyles: strict, flexible
|
56
52
|
Rails/TimeZone:
|
57
53
|
Exclude:
|
58
|
-
- 'app/jobs/maestrano/connector/rails/synchronization_job.rb'
|
59
54
|
- 'app/models/maestrano/connector/rails/concerns/entity.rb'
|
60
55
|
|
61
56
|
# Offense count: 1
|
62
|
-
Style/AccessorMethodName:
|
63
|
-
Exclude:
|
64
|
-
- 'app/models/maestrano/connector/rails/synchronization.rb'
|
65
|
-
|
66
|
-
# Offense count: 3
|
67
57
|
# Cop supports --auto-correct.
|
68
58
|
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
|
69
59
|
# SupportedStyles: line_count_based, semantic, braces_for_chaining
|
@@ -94,19 +84,19 @@ Style/DoubleNegation:
|
|
94
84
|
# Offense count: 1
|
95
85
|
# Cop supports --auto-correct.
|
96
86
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
97
|
-
# SupportedStyles: empty_lines, no_empty_lines
|
87
|
+
# SupportedStyles: empty_lines, empty_lines_except_namespace, no_empty_lines
|
98
88
|
Style/EmptyLinesAroundModuleBody:
|
99
89
|
Exclude:
|
100
90
|
- 'app/jobs/maestrano/connector/rails/push_to_connec_worker.rb'
|
101
91
|
|
102
|
-
# Offense count:
|
92
|
+
# Offense count: 52
|
103
93
|
# Cop supports --auto-correct.
|
104
94
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
105
95
|
# SupportedStyles: when_needed, always
|
106
96
|
Style/FrozenStringLiteralComment:
|
107
97
|
Enabled: false
|
108
98
|
|
109
|
-
# Offense count:
|
99
|
+
# Offense count: 2
|
110
100
|
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
|
111
101
|
# NamePrefix: is_, has_, have_
|
112
102
|
# NamePrefixBlacklist: is_, has_, have_
|
@@ -115,13 +105,6 @@ Style/PredicateName:
|
|
115
105
|
Exclude:
|
116
106
|
- 'spec/**/*'
|
117
107
|
- 'app/helpers/maestrano/connector/rails/session_helper.rb'
|
118
|
-
- 'app/models/maestrano/connector/rails/concerns/entity.rb'
|
119
|
-
|
120
|
-
# Offense count: 1
|
121
|
-
# Cop supports --auto-correct.
|
122
|
-
Style/RedundantSelf:
|
123
|
-
Exclude:
|
124
|
-
- 'app/models/maestrano/connector/rails/organization.rb'
|
125
108
|
|
126
109
|
# Offense count: 1
|
127
110
|
# Cop supports --auto-correct.
|
@@ -131,14 +114,6 @@ Style/RegexpLiteral:
|
|
131
114
|
Exclude:
|
132
115
|
- 'app/models/maestrano/connector/rails/concerns/entity.rb'
|
133
116
|
|
134
|
-
# Offense count: 3
|
135
|
-
# Cop supports --auto-correct.
|
136
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
137
|
-
# SupportedStyles: single_quotes, double_quotes
|
138
|
-
Style/StringLiterals:
|
139
|
-
Exclude:
|
140
|
-
- 'app/controllers/maestrano/synchronizations_controller.rb'
|
141
|
-
|
142
117
|
# Offense count: 1
|
143
118
|
# Cop supports --auto-correct.
|
144
119
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
@@ -146,9 +121,3 @@ Style/StringLiterals:
|
|
146
121
|
Style/TrailingBlankLines:
|
147
122
|
Exclude:
|
148
123
|
- 'app/helpers/maestrano/connector/rails/session_helper.rb'
|
149
|
-
|
150
|
-
# Offense count: 1
|
151
|
-
# Cop supports --auto-correct.
|
152
|
-
Style/TrailingWhitespace:
|
153
|
-
Exclude:
|
154
|
-
- 'app/jobs/maestrano/connector/rails/synchronization_job.rb'
|
@@ -6,10 +6,9 @@ class Maestrano::ConnecController < Maestrano::Rails::WebHookController
|
|
6
6
|
next Maestrano::Connector::Rails::ConnectorLogger.log('info', nil, "Received notification from Connec! for unknow entity: #{entity_name}") unless entity_class_hash
|
7
7
|
|
8
8
|
entities.each do |entity|
|
9
|
-
organization = Maestrano::Connector::Rails::Organization.find_by(uid: entity[:group_id], tenant: params[:tenant])
|
10
|
-
|
11
9
|
begin
|
12
|
-
|
10
|
+
organization = find_valid_organization(entity[:group_id], params[:tenant], entity_class_hash)
|
11
|
+
next if organization.blank?
|
13
12
|
Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Processing entity from Connec! webhook, entity_name=\"#{entity_name}\", data=\"#{entity}\"")
|
14
13
|
|
15
14
|
connec_client = Maestrano::Connector::Rails::ConnecHelper.get_client(organization)
|
@@ -38,23 +37,25 @@ class Maestrano::ConnecController < Maestrano::Rails::WebHookController
|
|
38
37
|
|
39
38
|
private
|
40
39
|
|
41
|
-
def
|
40
|
+
def find_valid_organization(uid, tenant, entity_class_hash)
|
41
|
+
organization = Maestrano::Connector::Rails::Organization.find_by(uid: uid, tenant: tenant)
|
42
|
+
|
42
43
|
if organization.nil?
|
43
|
-
Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Received notification from Connec! for an unknown organization, organization_uid=\"#{
|
44
|
-
return
|
44
|
+
Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Received notification from Connec! for an unknown organization, organization_uid=\"#{uid}\", tenant=\"#{tenant}\"")
|
45
|
+
return nil
|
45
46
|
end
|
46
47
|
|
47
48
|
if organization.oauth_uid.blank?
|
48
|
-
Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Received notification from Connec! for an organization not linked, organization_uid=\"#{
|
49
|
-
return
|
49
|
+
Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Received notification from Connec! for an organization not linked, organization_uid=\"#{uid}\", tenant=\"#{tenant}\"")
|
50
|
+
return nil
|
50
51
|
end
|
51
52
|
|
52
53
|
unless organization.sync_enabled && organization.synchronized_entities[entity_class_hash[:name].to_sym][:can_push_to_external]
|
53
|
-
Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Skipping notification from Connec! webhook, entity_name=\"#{
|
54
|
-
return
|
54
|
+
Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "Skipping notification from Connec! webhook, entity_name=\"#{entity_class_hash[:name]}\"")
|
55
|
+
return nil
|
55
56
|
end
|
56
57
|
|
57
|
-
|
58
|
+
organization
|
58
59
|
end
|
59
60
|
|
60
61
|
def find_entity_class(entity_name)
|
@@ -19,7 +19,7 @@ class Maestrano::SynchronizationsController < Maestrano::Rails::WebHookControlle
|
|
19
19
|
|
20
20
|
status = organization_status(organization)
|
21
21
|
|
22
|
-
unless
|
22
|
+
unless %w[RUNNING ENQUEUED].include?(status)
|
23
23
|
Maestrano::Connector::Rails::SynchronizationJob.perform_later(organization.id, opts.with_indifferent_access)
|
24
24
|
status = 'ENQUEUED'
|
25
25
|
end
|
@@ -48,8 +48,9 @@ module Maestrano::Connector::Rails::Concerns::Organization
|
|
48
48
|
module ClassMethods
|
49
49
|
end
|
50
50
|
|
51
|
-
def initialize
|
52
|
-
super
|
51
|
+
def initialize(attributes = nil, options = {})
|
52
|
+
super(attributes, options)
|
53
|
+
|
53
54
|
self.synchronized_entities = {}
|
54
55
|
Maestrano::Connector::Rails::External.entities_list.each do |entity|
|
55
56
|
synchronized_entities[entity.to_sym] = {can_push_to_connec: !pull_disabled, can_push_to_external: !push_disabled}
|
@@ -46,8 +46,13 @@ module Maestrano::Connector::Rails::Services
|
|
46
46
|
# Unfold the id arrays
|
47
47
|
# From that point on, the connec_entity contains only string of external ids
|
48
48
|
unfold_hash = Maestrano::Connector::Rails::ConnecHelper.unfold_references(entity, references, @organization)
|
49
|
+
unfolded_entity = entity
|
49
50
|
entity = unfold_hash[:entity]
|
50
|
-
|
51
|
+
|
52
|
+
unless entity # discard if at least one record reference is missing
|
53
|
+
Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, "Record discarded - missing external reference in #{unfolded_entity}")
|
54
|
+
next
|
55
|
+
end
|
51
56
|
connec_id = unfold_hash[:connec_id]
|
52
57
|
id_refs_only_connec_entity = unfold_hash[:id_refs_only_connec_entity]
|
53
58
|
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_runtime_dependency('bootstrap-sass')
|
32
32
|
s.add_runtime_dependency('config')
|
33
33
|
s.add_runtime_dependency('figaro')
|
34
|
-
s.add_runtime_dependency('jquery-rails')
|
34
|
+
s.add_runtime_dependency('jquery-rails', '>= 1.4.0')
|
35
35
|
s.add_runtime_dependency('haml-rails')
|
36
36
|
s.add_runtime_dependency('hash_mapper', '>= 0.2.2')
|
37
37
|
|
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
s.add_development_dependency('github_changelog_generator')
|
47
47
|
s.add_development_dependency('rdoc')
|
48
48
|
s.add_development_dependency('rspec-rails')
|
49
|
-
s.add_development_dependency('rubocop', '~> 0.
|
49
|
+
s.add_development_dependency('rubocop', '~> 0.49.1')
|
50
50
|
s.add_development_dependency('shoulda')
|
51
51
|
s.add_development_dependency('shoulda-matchers')
|
52
52
|
s.add_development_dependency('simplecov', '>= 0')
|
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: 2.0.2.pre.
|
4
|
+
version: 2.0.2.pre.RC11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maestrano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 1.4.0
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 1.4.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: haml-rails
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -296,14 +296,14 @@ dependencies:
|
|
296
296
|
requirements:
|
297
297
|
- - "~>"
|
298
298
|
- !ruby/object:Gem::Version
|
299
|
-
version:
|
299
|
+
version: 0.49.1
|
300
300
|
type: :development
|
301
301
|
prerelease: false
|
302
302
|
version_requirements: !ruby/object:Gem::Requirement
|
303
303
|
requirements:
|
304
304
|
- - "~>"
|
305
305
|
- !ruby/object:Gem::Version
|
306
|
-
version:
|
306
|
+
version: 0.49.1
|
307
307
|
- !ruby/object:Gem::Dependency
|
308
308
|
name: shoulda
|
309
309
|
requirement: !ruby/object:Gem::Requirement
|
@@ -511,7 +511,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
511
511
|
version: 1.3.1
|
512
512
|
requirements: []
|
513
513
|
rubyforge_project:
|
514
|
-
rubygems_version: 2.
|
514
|
+
rubygems_version: 2.6.8
|
515
515
|
signing_key:
|
516
516
|
specification_version: 4
|
517
517
|
summary: Rails framework to build connector with Maestrano
|