external_services 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +74 -71
- data/app/models/external_services/api_action.rb +1 -2
- data/external_services.gemspec +1 -1
- data/lib/external_services/active_record.rb +1 -2
- data/lib/external_services/version.rb +1 -1
- data/lib/rspec/helpers.rb +3 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bb6cfd9b9015c02de0f4a4cbde0c8e998370079bbcea2c76dbaeb006c3c19d6
|
4
|
+
data.tar.gz: c6a2719336d34b5a5731bcba73529e40547c725a1aaa236dde2b226aa14d4938
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0efa87a106b4bba92f953a4ce5e8416885892cc7e16f035bb688e4e736470548fdb71ffa567a51034e5ea885cac387fac70af6a35396537d8c151940ae70a4bf
|
7
|
+
data.tar.gz: d118e1daf478352dde4a919f98c3fe3869ac70223ef888451946a330729ec3066a40928f9d3bdbc3ca935466b9ad0968ed9d71a8f8f8c2f84464e5edd0369934
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -3,13 +3,13 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in external_services.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem 'sqlite3'
|
7
6
|
gem 'bundler', '~> 1.12'
|
8
7
|
gem 'rake', '~> 10.0'
|
8
|
+
gem 'sqlite3'
|
9
9
|
gem 'travis', '~> 1.8', '>= 1.8.2'
|
10
10
|
|
11
|
-
gem 'rubocop', '~> 0.42', require: false
|
12
11
|
gem 'overcommit'
|
12
|
+
gem 'rubocop', '~> 0.48', require: false
|
13
13
|
|
14
14
|
gem 'pry-rails'
|
15
15
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
external_services (0.2.
|
4
|
+
external_services (0.2.4)
|
5
5
|
faraday (>= 0.9)
|
6
6
|
faraday_middleware (>= 0.10)
|
7
7
|
rails (>= 4.2.5, < 6.0)
|
@@ -9,54 +9,55 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actioncable (5.
|
13
|
-
actionpack (= 5.
|
14
|
-
nio4r (~>
|
12
|
+
actioncable (5.1.5)
|
13
|
+
actionpack (= 5.1.5)
|
14
|
+
nio4r (~> 2.0)
|
15
15
|
websocket-driver (~> 0.6.1)
|
16
|
-
actionmailer (5.
|
17
|
-
actionpack (= 5.
|
18
|
-
actionview (= 5.
|
19
|
-
activejob (= 5.
|
16
|
+
actionmailer (5.1.5)
|
17
|
+
actionpack (= 5.1.5)
|
18
|
+
actionview (= 5.1.5)
|
19
|
+
activejob (= 5.1.5)
|
20
20
|
mail (~> 2.5, >= 2.5.4)
|
21
21
|
rails-dom-testing (~> 2.0)
|
22
|
-
actionpack (5.
|
23
|
-
actionview (= 5.
|
24
|
-
activesupport (= 5.
|
22
|
+
actionpack (5.1.5)
|
23
|
+
actionview (= 5.1.5)
|
24
|
+
activesupport (= 5.1.5)
|
25
25
|
rack (~> 2.0)
|
26
|
-
rack-test (
|
26
|
+
rack-test (>= 0.6.3)
|
27
27
|
rails-dom-testing (~> 2.0)
|
28
28
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
29
|
-
actionview (5.
|
30
|
-
activesupport (= 5.
|
29
|
+
actionview (5.1.5)
|
30
|
+
activesupport (= 5.1.5)
|
31
31
|
builder (~> 3.1)
|
32
|
-
|
32
|
+
erubi (~> 1.4)
|
33
33
|
rails-dom-testing (~> 2.0)
|
34
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
35
|
-
activejob (5.
|
36
|
-
activesupport (= 5.
|
34
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
35
|
+
activejob (5.1.5)
|
36
|
+
activesupport (= 5.1.5)
|
37
37
|
globalid (>= 0.3.6)
|
38
|
-
activemodel (5.
|
39
|
-
activesupport (= 5.
|
40
|
-
activerecord (5.
|
41
|
-
activemodel (= 5.
|
42
|
-
activesupport (= 5.
|
43
|
-
arel (~>
|
44
|
-
activesupport (5.
|
38
|
+
activemodel (5.1.5)
|
39
|
+
activesupport (= 5.1.5)
|
40
|
+
activerecord (5.1.5)
|
41
|
+
activemodel (= 5.1.5)
|
42
|
+
activesupport (= 5.1.5)
|
43
|
+
arel (~> 8.0)
|
44
|
+
activesupport (5.1.5)
|
45
45
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
46
46
|
i18n (~> 0.7)
|
47
47
|
minitest (~> 5.1)
|
48
48
|
tzinfo (~> 1.1)
|
49
49
|
addressable (2.4.0)
|
50
|
-
arel (
|
51
|
-
ast (2.
|
50
|
+
arel (8.0.0)
|
51
|
+
ast (2.4.0)
|
52
52
|
backports (3.6.8)
|
53
|
-
builder (3.2.
|
53
|
+
builder (3.2.3)
|
54
54
|
childprocess (0.8.0)
|
55
55
|
ffi (~> 1.0, >= 1.0.11)
|
56
56
|
coderay (1.1.1)
|
57
|
-
concurrent-ruby (1.0.
|
57
|
+
concurrent-ruby (1.0.5)
|
58
|
+
crass (1.0.3)
|
58
59
|
diff-lcs (1.2.5)
|
59
|
-
|
60
|
+
erubi (1.7.0)
|
60
61
|
ethon (0.9.0)
|
61
62
|
ffi (>= 1.3.0)
|
62
63
|
factory_girl (4.7.0)
|
@@ -79,33 +80,34 @@ GEM
|
|
79
80
|
globalid (0.4.1)
|
80
81
|
activesupport (>= 4.2.0)
|
81
82
|
highline (1.7.8)
|
82
|
-
i18n (0.
|
83
|
+
i18n (0.9.5)
|
84
|
+
concurrent-ruby (~> 1.0)
|
83
85
|
iniparse (1.4.4)
|
84
86
|
json (2.0.2)
|
85
87
|
launchy (2.4.3)
|
86
88
|
addressable (~> 2.3)
|
87
|
-
loofah (2.0
|
89
|
+
loofah (2.2.0)
|
90
|
+
crass (~> 1.0.2)
|
88
91
|
nokogiri (>= 1.5.9)
|
89
92
|
mail (2.7.0)
|
90
93
|
mini_mime (>= 0.1.1)
|
91
94
|
method_source (0.8.2)
|
92
95
|
mini_mime (1.0.0)
|
93
|
-
mini_portile2 (2.
|
94
|
-
minitest (5.
|
96
|
+
mini_portile2 (2.3.0)
|
97
|
+
minitest (5.11.3)
|
95
98
|
multi_json (1.12.1)
|
96
99
|
multipart-post (2.0.0)
|
97
100
|
net-http-persistent (2.9.4)
|
98
101
|
net-http-pipeline (1.0.1)
|
99
|
-
nio4r (
|
100
|
-
nokogiri (1.
|
101
|
-
mini_portile2 (~> 2.
|
102
|
-
pkg-config (~> 1.1.7)
|
102
|
+
nio4r (2.2.0)
|
103
|
+
nokogiri (1.8.2)
|
104
|
+
mini_portile2 (~> 2.3.0)
|
103
105
|
overcommit (0.41.0)
|
104
106
|
childprocess (~> 0.6, >= 0.6.3)
|
105
107
|
iniparse (~> 1.4)
|
106
|
-
|
107
|
-
|
108
|
-
|
108
|
+
parallel (1.12.1)
|
109
|
+
parser (2.5.0.2)
|
110
|
+
ast (~> 2.4.0)
|
109
111
|
powerpack (0.1.1)
|
110
112
|
pry (0.10.4)
|
111
113
|
coderay (~> 1.1.0)
|
@@ -116,33 +118,33 @@ GEM
|
|
116
118
|
pusher-client (0.6.2)
|
117
119
|
json
|
118
120
|
websocket (~> 1.0)
|
119
|
-
rack (2.0.
|
120
|
-
rack-test (0.
|
121
|
-
rack (>= 1.0)
|
122
|
-
rails (5.
|
123
|
-
actioncable (= 5.
|
124
|
-
actionmailer (= 5.
|
125
|
-
actionpack (= 5.
|
126
|
-
actionview (= 5.
|
127
|
-
activejob (= 5.
|
128
|
-
activemodel (= 5.
|
129
|
-
activerecord (= 5.
|
130
|
-
activesupport (= 5.
|
131
|
-
bundler (>= 1.3.0
|
132
|
-
railties (= 5.
|
121
|
+
rack (2.0.4)
|
122
|
+
rack-test (0.8.2)
|
123
|
+
rack (>= 1.0, < 3)
|
124
|
+
rails (5.1.5)
|
125
|
+
actioncable (= 5.1.5)
|
126
|
+
actionmailer (= 5.1.5)
|
127
|
+
actionpack (= 5.1.5)
|
128
|
+
actionview (= 5.1.5)
|
129
|
+
activejob (= 5.1.5)
|
130
|
+
activemodel (= 5.1.5)
|
131
|
+
activerecord (= 5.1.5)
|
132
|
+
activesupport (= 5.1.5)
|
133
|
+
bundler (>= 1.3.0)
|
134
|
+
railties (= 5.1.5)
|
133
135
|
sprockets-rails (>= 2.0.0)
|
134
|
-
rails-dom-testing (2.0.
|
135
|
-
activesupport (>= 4.2.0
|
136
|
-
nokogiri (
|
136
|
+
rails-dom-testing (2.0.3)
|
137
|
+
activesupport (>= 4.2.0)
|
138
|
+
nokogiri (>= 1.6)
|
137
139
|
rails-html-sanitizer (1.0.3)
|
138
140
|
loofah (~> 2.0)
|
139
|
-
railties (5.
|
140
|
-
actionpack (= 5.
|
141
|
-
activesupport (= 5.
|
141
|
+
railties (5.1.5)
|
142
|
+
actionpack (= 5.1.5)
|
143
|
+
activesupport (= 5.1.5)
|
142
144
|
method_source
|
143
145
|
rake (>= 0.8.7)
|
144
146
|
thor (>= 0.18.1, < 2.0)
|
145
|
-
rainbow (
|
147
|
+
rainbow (3.0.0)
|
146
148
|
rake (10.5.0)
|
147
149
|
rspec-core (3.5.2)
|
148
150
|
rspec-support (~> 3.5.0)
|
@@ -161,13 +163,14 @@ GEM
|
|
161
163
|
rspec-mocks (~> 3.5.0)
|
162
164
|
rspec-support (~> 3.5.0)
|
163
165
|
rspec-support (3.5.0)
|
164
|
-
rubocop (0.
|
165
|
-
|
166
|
+
rubocop (0.52.1)
|
167
|
+
parallel (~> 1.10)
|
168
|
+
parser (>= 2.4.0.2, < 3.0)
|
166
169
|
powerpack (~> 0.1)
|
167
|
-
rainbow (>=
|
170
|
+
rainbow (>= 2.2.2, < 4.0)
|
168
171
|
ruby-progressbar (~> 1.7)
|
169
172
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
170
|
-
ruby-progressbar (1.
|
173
|
+
ruby-progressbar (1.9.0)
|
171
174
|
slop (3.6.0)
|
172
175
|
sprockets (3.7.1)
|
173
176
|
concurrent-ruby (~> 1.0)
|
@@ -177,8 +180,8 @@ GEM
|
|
177
180
|
activesupport (>= 4.0)
|
178
181
|
sprockets (>= 3.0.0)
|
179
182
|
sqlite3 (1.3.11)
|
180
|
-
thor (0.
|
181
|
-
thread_safe (0.3.
|
183
|
+
thor (0.20.0)
|
184
|
+
thread_safe (0.3.6)
|
182
185
|
travis (1.8.2)
|
183
186
|
backports
|
184
187
|
faraday (~> 0.9)
|
@@ -190,9 +193,9 @@ GEM
|
|
190
193
|
typhoeus (~> 0.6, >= 0.6.8)
|
191
194
|
typhoeus (0.8.0)
|
192
195
|
ethon (>= 0.8.0)
|
193
|
-
tzinfo (1.2.
|
196
|
+
tzinfo (1.2.5)
|
194
197
|
thread_safe (~> 0.1)
|
195
|
-
unicode-display_width (1.
|
198
|
+
unicode-display_width (1.3.0)
|
196
199
|
websocket (1.2.3)
|
197
200
|
websocket-driver (0.6.5)
|
198
201
|
websocket-extensions (>= 0.1.0)
|
@@ -209,7 +212,7 @@ DEPENDENCIES
|
|
209
212
|
pry-rails
|
210
213
|
rake (~> 10.0)
|
211
214
|
rspec-rails
|
212
|
-
rubocop (~> 0.
|
215
|
+
rubocop (~> 0.48)
|
213
216
|
sqlite3
|
214
217
|
travis (~> 1.8, >= 1.8.2)
|
215
218
|
|
data/external_services.gemspec
CHANGED
@@ -88,7 +88,7 @@ module ExternalServices
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/
|
91
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
|
92
92
|
def define_external_service_callbacks(name, options = {})
|
93
93
|
service_assoc = :"#{name}_service"
|
94
94
|
only_api_actions = (options[:only_api_actions] == true)
|
@@ -183,7 +183,6 @@ module ExternalServices
|
|
183
183
|
def define_external_service_helper_methods(name, _options = {})
|
184
184
|
## subject class methods
|
185
185
|
helpers_class_module = Module.new do
|
186
|
-
|
187
186
|
define_method :"with_#{name}_api_for" do |synced: [], for_syncing: [], &b|
|
188
187
|
(synced + for_syncing).map(&:class).uniq.each do |k|
|
189
188
|
return true if k.send("#{name}_api_disabled")
|
data/lib/rspec/helpers.rb
CHANGED
@@ -20,7 +20,7 @@ module ExternalServices
|
|
20
20
|
|
21
21
|
def describe_external_service_api(object:, api_name:, **kwargs, &blk)
|
22
22
|
action_class = kwargs[:action_class] || "ExternalServices::ApiActions::#{api_name.to_s.camelize}".constantize
|
23
|
-
methods = [
|
23
|
+
methods = %i[create update destroy]
|
24
24
|
methods -= [kwargs[:except]].flatten if kwargs[:except]
|
25
25
|
methods &= [kwargs[:only]].flatten if kwargs[:only]
|
26
26
|
|
@@ -68,9 +68,7 @@ module ExternalServices
|
|
68
68
|
@api_object.send("#{@id_key}=", SecureRandom.hex)
|
69
69
|
@api_object.save
|
70
70
|
|
71
|
-
if @api_object.respond_to?(:descendants)
|
72
|
-
@api_object.reload.descendants.each(&:delete)
|
73
|
-
end
|
71
|
+
@api_object.reload.descendants.each(&:delete) if @api_object.respond_to?(:descendants)
|
74
72
|
@api_object.destroy
|
75
73
|
expect_api_action_on_destroy(@api_object)
|
76
74
|
end
|
@@ -117,7 +115,7 @@ module ExternalServices
|
|
117
115
|
data = params.delete(:data) || {}
|
118
116
|
|
119
117
|
actions = @action_class.where(params).select do |a|
|
120
|
-
data.
|
118
|
+
data.reject { |k, v| a.data[k.to_s] == v }.empty?
|
121
119
|
end
|
122
120
|
|
123
121
|
if count
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: external_services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Gnuskov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.7.
|
121
|
+
rubygems_version: 2.7.6
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: Gem helps syncronizing objects to different external services like Gitlab,
|