external_services 0.5.2 → 0.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 775d9bffa419443c5e619e42251efc2f4630c38dab5cc529bc32ddc9e0b5a31b
4
- data.tar.gz: 5523b20fe8762beaa1ad171af70813bb6121a85a0e084d6bc7ffcb8ea21954bf
3
+ metadata.gz: 50ae130fd4d89f6230416819d0d07441348c127965597638182b17212a54bc88
4
+ data.tar.gz: ae072008e02902ea405120769030d97edbd21c2d3411b75a4b5ccf1fe13538e8
5
5
  SHA512:
6
- metadata.gz: 18324cc039c27f5d40e2a1c495d6f16aba12796a0aecfb0de24aaffe7cd6c29cba8df075bb9287441dbd826ef51b6b47307aafef937ad267dcee9afbfa987e16
7
- data.tar.gz: 716d55932c3091c8f47df1e2643485d53da409e39f5d22b729be535b51da20dd08ebbc8fb7a53bc7ac05a80bc4c71e8e02e02076ae91abcefc2bca9db1c7de98
6
+ metadata.gz: ef6ad5c6e3d26da498f25b9252defd2af9fa7488f5feebacdb79555fba26a15ae9f98a3935387a2bad231e431e262dd76ffab4a4a232a11a19aa919a8a4273d2
7
+ data.tar.gz: 416cf1be6535af279afc0f1acf413fc41ceb10ef2c4807d7392ec0f07df74791fd0d84094cbeb0cc78d256db18f0763e4f264ab7d0007d0da0a4829c7e910350
@@ -8,7 +8,7 @@ jobs:
8
8
  name: Build + Publish
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
- - uses: actions/checkout@v1
11
+ - uses: actions/checkout@v4
12
12
 
13
13
  - name: Release Gem
14
14
  if: contains(github.ref, 'refs/tags/v')
@@ -10,6 +10,9 @@ name: Test
10
10
  on:
11
11
  push:
12
12
  branches: [ '*' ]
13
+ pull_request:
14
+ branches: [ '*' ]
15
+
13
16
 
14
17
  permissions:
15
18
  contents: read
@@ -20,10 +23,10 @@ jobs:
20
23
  strategy:
21
24
  matrix:
22
25
  os: [ubuntu, macos]
23
- ruby-version: ['2.6', '2.7', '3.0', '3.1']
26
+ ruby-version: ['3.2', '3.3']
24
27
 
25
28
  steps:
26
- - uses: actions/checkout@v3
29
+ - uses: actions/checkout@v4
27
30
  - name: Set up Ruby
28
31
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
29
32
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
@@ -33,5 +36,7 @@ jobs:
33
36
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
37
  - name: Prepare DB
35
38
  run: bundle exec rake db:create --trace && bundle exec rake db:migrate --trace
39
+ - name: Run rubocop
40
+ run: bundle exec rubocop
36
41
  - name: Run tests
37
42
  run: bundle exec rake
data/.gitignore CHANGED
@@ -3,12 +3,13 @@
3
3
  /_yardoc/
4
4
  /coverage/
5
5
  /doc/
6
+ /vendor/
6
7
  /pkg/
7
8
  /spec/reports/
8
9
  /tmp/
9
10
  /spec/dummy/log/
10
11
  /spec/dummy/tmp/
11
- /spec/dummy/db/*.sqlite3
12
+ /spec/dummy/db/*.sqlite3*
12
13
  /spec/dummy/db/schema.rb
13
14
 
14
15
  /.history/
data/.rubocop.yml CHANGED
@@ -1,33 +1,40 @@
1
+ plugins:
2
+ - rubocop-factory_bot
3
+ - rubocop-rspec
4
+ - rubocop-rspec_rails
5
+ - rubocop-rake
6
+
1
7
  AllCops:
2
- TargetRubyVersion: 2.2
8
+ TargetRubyVersion: 2.7
9
+ NewCops: disable
3
10
  Exclude:
4
11
  - 'lib/generators/templates/**/*'
5
12
  - 'spec/dummy/**/*'
13
+ - 'vendor/**/*'
6
14
 
7
- Metrics/LineLength:
15
+ Layout/LineLength:
8
16
  Max: 140
9
17
 
10
18
  Metrics/AbcSize:
11
19
  Max: 25
12
20
 
13
21
  Metrics/MethodLength:
14
- Max: 20
22
+ Max: 25
15
23
 
16
24
  Metrics/ModuleLength:
17
- Max: 200
25
+ Max: 250
18
26
 
19
27
  Metrics/ClassLength:
20
28
  Max: 300
21
29
 
22
30
  Metrics/CyclomaticComplexity:
23
- Max: 8
31
+ Max: 10
24
32
 
25
33
  Metrics/PerceivedComplexity:
26
- Max: 8
27
-
34
+ Max: 10
28
35
 
29
36
  Style/Documentation:
30
37
  Enabled: false
31
38
 
32
- Style/PredicateName:
39
+ Naming/PredicateName:
33
40
  Enabled: false
data/Gemfile CHANGED
@@ -1,18 +1,26 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in external_services.gemspec
4
6
  gemspec
5
7
 
6
8
  gem 'rake', '~> 13.0'
7
- gem 'sqlite3'
9
+ gem 'sqlite3', '~> 2.6'
10
+
11
+ gem 'fiddle'
12
+ gem 'net-smtp', require: false # HACK: for pre 7.0.1 rails and 3.1 ruby
13
+ gem 'observer'
8
14
 
9
15
  gem 'overcommit'
10
- gem 'rubocop', '~> 1.0', require: false
11
- gem 'rubocop-rspec'
12
- gem 'net-smtp', require: false # hack for pre 7.0.1 rails and 3.1 ruby
16
+ gem 'rubocop', '~> 1.0'
17
+ gem 'rubocop-factory_bot', '~> 2.27'
18
+ gem 'rubocop-rake', '~> 0.7'
19
+ gem 'rubocop-rspec', '~> 3.5'
20
+ gem 'rubocop-rspec_rails', '~> 2.31'
13
21
 
14
22
  gem 'pry', '>= 0.14'
15
- gem 'pry-rails', '~> 0.3.9'
23
+ gem 'pry-rails', '~> 0.3'
16
24
 
17
25
  gem 'factory_bot_rails'
18
26
  gem 'rspec-rails'
data/Gemfile.lock CHANGED
@@ -1,243 +1,277 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- external_services (0.5.2)
5
- faraday (>= 1.4, < 2)
6
- faraday_middleware (>= 1.0, < 2)
7
- rails (>= 4.2.5, < 7.1)
4
+ external_services (0.6.0)
5
+ faraday (>= 2.0, < 3)
6
+ rails (>= 5.0.7, < 8)
8
7
 
9
8
  GEM
10
9
  remote: https://rubygems.org/
11
10
  specs:
12
- actioncable (6.1.6.1)
13
- actionpack (= 6.1.6.1)
14
- activesupport (= 6.1.6.1)
11
+ actioncable (7.2.2.1)
12
+ actionpack (= 7.2.2.1)
13
+ activesupport (= 7.2.2.1)
15
14
  nio4r (~> 2.0)
16
15
  websocket-driver (>= 0.6.1)
17
- actionmailbox (6.1.6.1)
18
- actionpack (= 6.1.6.1)
19
- activejob (= 6.1.6.1)
20
- activerecord (= 6.1.6.1)
21
- activestorage (= 6.1.6.1)
22
- activesupport (= 6.1.6.1)
23
- mail (>= 2.7.1)
24
- actionmailer (6.1.6.1)
25
- actionpack (= 6.1.6.1)
26
- actionview (= 6.1.6.1)
27
- activejob (= 6.1.6.1)
28
- activesupport (= 6.1.6.1)
29
- mail (~> 2.5, >= 2.5.4)
30
- rails-dom-testing (~> 2.0)
31
- actionpack (6.1.6.1)
32
- actionview (= 6.1.6.1)
33
- activesupport (= 6.1.6.1)
34
- rack (~> 2.0, >= 2.0.9)
16
+ zeitwerk (~> 2.6)
17
+ actionmailbox (7.2.2.1)
18
+ actionpack (= 7.2.2.1)
19
+ activejob (= 7.2.2.1)
20
+ activerecord (= 7.2.2.1)
21
+ activestorage (= 7.2.2.1)
22
+ activesupport (= 7.2.2.1)
23
+ mail (>= 2.8.0)
24
+ actionmailer (7.2.2.1)
25
+ actionpack (= 7.2.2.1)
26
+ actionview (= 7.2.2.1)
27
+ activejob (= 7.2.2.1)
28
+ activesupport (= 7.2.2.1)
29
+ mail (>= 2.8.0)
30
+ rails-dom-testing (~> 2.2)
31
+ actionpack (7.2.2.1)
32
+ actionview (= 7.2.2.1)
33
+ activesupport (= 7.2.2.1)
34
+ nokogiri (>= 1.8.5)
35
+ racc
36
+ rack (>= 2.2.4, < 3.2)
37
+ rack-session (>= 1.0.1)
35
38
  rack-test (>= 0.6.3)
36
- rails-dom-testing (~> 2.0)
37
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
38
- actiontext (6.1.6.1)
39
- actionpack (= 6.1.6.1)
40
- activerecord (= 6.1.6.1)
41
- activestorage (= 6.1.6.1)
42
- activesupport (= 6.1.6.1)
39
+ rails-dom-testing (~> 2.2)
40
+ rails-html-sanitizer (~> 1.6)
41
+ useragent (~> 0.16)
42
+ actiontext (7.2.2.1)
43
+ actionpack (= 7.2.2.1)
44
+ activerecord (= 7.2.2.1)
45
+ activestorage (= 7.2.2.1)
46
+ activesupport (= 7.2.2.1)
47
+ globalid (>= 0.6.0)
43
48
  nokogiri (>= 1.8.5)
44
- actionview (6.1.6.1)
45
- activesupport (= 6.1.6.1)
49
+ actionview (7.2.2.1)
50
+ activesupport (= 7.2.2.1)
46
51
  builder (~> 3.1)
47
- erubi (~> 1.4)
48
- rails-dom-testing (~> 2.0)
49
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
50
- activejob (6.1.6.1)
51
- activesupport (= 6.1.6.1)
52
+ erubi (~> 1.11)
53
+ rails-dom-testing (~> 2.2)
54
+ rails-html-sanitizer (~> 1.6)
55
+ activejob (7.2.2.1)
56
+ activesupport (= 7.2.2.1)
52
57
  globalid (>= 0.3.6)
53
- activemodel (6.1.6.1)
54
- activesupport (= 6.1.6.1)
55
- activerecord (6.1.6.1)
56
- activemodel (= 6.1.6.1)
57
- activesupport (= 6.1.6.1)
58
- activestorage (6.1.6.1)
59
- actionpack (= 6.1.6.1)
60
- activejob (= 6.1.6.1)
61
- activerecord (= 6.1.6.1)
62
- activesupport (= 6.1.6.1)
58
+ activemodel (7.2.2.1)
59
+ activesupport (= 7.2.2.1)
60
+ activerecord (7.2.2.1)
61
+ activemodel (= 7.2.2.1)
62
+ activesupport (= 7.2.2.1)
63
+ timeout (>= 0.4.0)
64
+ activestorage (7.2.2.1)
65
+ actionpack (= 7.2.2.1)
66
+ activejob (= 7.2.2.1)
67
+ activerecord (= 7.2.2.1)
68
+ activesupport (= 7.2.2.1)
63
69
  marcel (~> 1.0)
64
- mini_mime (>= 1.1.0)
65
- activesupport (6.1.6.1)
66
- concurrent-ruby (~> 1.0, >= 1.0.2)
70
+ activesupport (7.2.2.1)
71
+ base64
72
+ benchmark (>= 0.3)
73
+ bigdecimal
74
+ concurrent-ruby (~> 1.0, >= 1.3.1)
75
+ connection_pool (>= 2.2.5)
76
+ drb
67
77
  i18n (>= 1.6, < 2)
78
+ logger (>= 1.4.2)
68
79
  minitest (>= 5.1)
69
- tzinfo (~> 2.0)
70
- zeitwerk (~> 2.3)
71
- ast (2.4.2)
72
- builder (3.2.4)
80
+ securerandom (>= 0.3)
81
+ tzinfo (~> 2.0, >= 2.0.5)
82
+ ast (2.4.3)
83
+ base64 (0.2.0)
84
+ benchmark (0.4.0)
85
+ bigdecimal (3.1.9)
86
+ builder (3.3.0)
73
87
  childprocess (0.9.0)
74
88
  ffi (~> 1.0, >= 1.0.11)
75
89
  coderay (1.1.3)
76
- concurrent-ruby (1.1.10)
90
+ concurrent-ruby (1.3.5)
91
+ connection_pool (2.5.0)
77
92
  crass (1.0.6)
78
- date (3.3.3)
79
- diff-lcs (1.4.4)
80
- digest (3.1.0)
81
- erubi (1.10.0)
93
+ date (3.4.1)
94
+ diff-lcs (1.6.0)
95
+ drb (2.2.1)
96
+ erubi (1.13.1)
82
97
  factory_bot (4.11.1)
83
98
  activesupport (>= 3.0.0)
84
99
  factory_bot_rails (4.11.1)
85
100
  factory_bot (~> 4.11.1)
86
101
  railties (>= 3.0.0)
87
- faraday (1.10.3)
88
- faraday-em_http (~> 1.0)
89
- faraday-em_synchrony (~> 1.0)
90
- faraday-excon (~> 1.1)
91
- faraday-httpclient (~> 1.0)
92
- faraday-multipart (~> 1.0)
93
- faraday-net_http (~> 1.0)
94
- faraday-net_http_persistent (~> 1.0)
95
- faraday-patron (~> 1.0)
96
- faraday-rack (~> 1.0)
97
- faraday-retry (~> 1.0)
102
+ faraday (2.8.1)
103
+ base64
104
+ faraday-net_http (>= 2.0, < 3.1)
98
105
  ruby2_keywords (>= 0.0.4)
99
- faraday-em_http (1.0.0)
100
- faraday-em_synchrony (1.0.0)
101
- faraday-excon (1.1.0)
102
- faraday-httpclient (1.0.1)
103
- faraday-multipart (1.0.4)
104
- multipart-post (~> 2)
105
- faraday-net_http (1.0.1)
106
- faraday-net_http_persistent (1.2.0)
107
- faraday-patron (1.0.0)
108
- faraday-rack (1.0.0)
109
- faraday-retry (1.0.3)
110
- faraday_middleware (1.2.0)
111
- faraday (~> 1.0)
106
+ faraday-net_http (3.0.2)
112
107
  ffi (1.15.5)
113
- globalid (1.1.0)
114
- activesupport (>= 5.0)
115
- i18n (1.11.0)
108
+ fiddle (1.1.6)
109
+ globalid (1.2.1)
110
+ activesupport (>= 6.1)
111
+ i18n (1.14.7)
116
112
  concurrent-ruby (~> 1.0)
117
113
  iniparse (1.4.4)
118
- loofah (2.18.0)
114
+ io-console (0.8.0)
115
+ irb (1.15.1)
116
+ pp (>= 0.6.0)
117
+ rdoc (>= 4.0.0)
118
+ reline (>= 0.4.2)
119
+ json (2.10.2)
120
+ language_server-protocol (3.17.0.4)
121
+ lint_roller (1.1.0)
122
+ logger (1.6.6)
123
+ loofah (2.24.0)
119
124
  crass (~> 1.0.2)
120
- nokogiri (>= 1.5.9)
125
+ nokogiri (>= 1.12.0)
121
126
  mail (2.8.1)
122
127
  mini_mime (>= 0.1.1)
123
128
  net-imap
124
129
  net-pop
125
130
  net-smtp
126
- marcel (1.0.2)
127
- method_source (1.0.0)
128
- mini_mime (1.1.2)
129
- mini_portile2 (2.8.0)
130
- minitest (5.16.2)
131
- multipart-post (2.3.0)
132
- net-imap (0.3.7)
131
+ marcel (1.0.4)
132
+ method_source (1.1.0)
133
+ mini_mime (1.1.5)
134
+ mini_portile2 (2.8.8)
135
+ minitest (5.25.5)
136
+ net-imap (0.5.6)
133
137
  date
134
138
  net-protocol
135
139
  net-pop (0.1.2)
136
140
  net-protocol
137
- net-protocol (0.1.3)
141
+ net-protocol (0.2.2)
138
142
  timeout
139
- net-smtp (0.3.1)
140
- digest
143
+ net-smtp (0.5.1)
141
144
  net-protocol
142
- timeout
143
- nio4r (2.5.9)
144
- nokogiri (1.13.7)
145
- mini_portile2 (~> 2.8.0)
145
+ nio4r (2.7.4)
146
+ nokogiri (1.18.5)
147
+ mini_portile2 (~> 2.8.2)
146
148
  racc (~> 1.4)
149
+ observer (0.1.2)
147
150
  overcommit (0.46.0)
148
151
  childprocess (~> 0.6, >= 0.6.3)
149
152
  iniparse (~> 1.4)
150
- parallel (1.22.1)
151
- parser (3.1.2.0)
153
+ parallel (1.26.3)
154
+ parser (3.3.7.2)
152
155
  ast (~> 2.4.1)
153
- pry (0.14.2)
156
+ racc
157
+ pp (0.6.2)
158
+ prettyprint
159
+ prettyprint (0.2.0)
160
+ pry (0.15.2)
154
161
  coderay (~> 1.1)
155
162
  method_source (~> 1.0)
156
- pry-rails (0.3.9)
157
- pry (>= 0.10.4)
158
- racc (1.6.0)
159
- rack (2.2.6.3)
160
- rack-test (2.0.2)
163
+ pry-rails (0.3.11)
164
+ pry (>= 0.13.0)
165
+ psych (5.2.3)
166
+ date
167
+ stringio
168
+ racc (1.8.1)
169
+ rack (3.1.12)
170
+ rack-session (2.1.0)
171
+ base64 (>= 0.1.0)
172
+ rack (>= 3.0.0)
173
+ rack-test (2.2.0)
161
174
  rack (>= 1.3)
162
- rails (6.1.6.1)
163
- actioncable (= 6.1.6.1)
164
- actionmailbox (= 6.1.6.1)
165
- actionmailer (= 6.1.6.1)
166
- actionpack (= 6.1.6.1)
167
- actiontext (= 6.1.6.1)
168
- actionview (= 6.1.6.1)
169
- activejob (= 6.1.6.1)
170
- activemodel (= 6.1.6.1)
171
- activerecord (= 6.1.6.1)
172
- activestorage (= 6.1.6.1)
173
- activesupport (= 6.1.6.1)
175
+ rackup (2.2.1)
176
+ rack (>= 3)
177
+ rails (7.2.2.1)
178
+ actioncable (= 7.2.2.1)
179
+ actionmailbox (= 7.2.2.1)
180
+ actionmailer (= 7.2.2.1)
181
+ actionpack (= 7.2.2.1)
182
+ actiontext (= 7.2.2.1)
183
+ actionview (= 7.2.2.1)
184
+ activejob (= 7.2.2.1)
185
+ activemodel (= 7.2.2.1)
186
+ activerecord (= 7.2.2.1)
187
+ activestorage (= 7.2.2.1)
188
+ activesupport (= 7.2.2.1)
174
189
  bundler (>= 1.15.0)
175
- railties (= 6.1.6.1)
176
- sprockets-rails (>= 2.0.0)
177
- rails-dom-testing (2.0.3)
178
- activesupport (>= 4.2.0)
190
+ railties (= 7.2.2.1)
191
+ rails-dom-testing (2.2.0)
192
+ activesupport (>= 5.0.0)
193
+ minitest
179
194
  nokogiri (>= 1.6)
180
- rails-html-sanitizer (1.4.3)
181
- loofah (~> 2.3)
182
- railties (6.1.6.1)
183
- actionpack (= 6.1.6.1)
184
- activesupport (= 6.1.6.1)
185
- method_source
195
+ rails-html-sanitizer (1.6.2)
196
+ loofah (~> 2.21)
197
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
198
+ railties (7.2.2.1)
199
+ actionpack (= 7.2.2.1)
200
+ activesupport (= 7.2.2.1)
201
+ irb (~> 1.13)
202
+ rackup (>= 1.0.0)
186
203
  rake (>= 12.2)
187
- thor (~> 1.0)
204
+ thor (~> 1.0, >= 1.2.2)
205
+ zeitwerk (~> 2.6)
188
206
  rainbow (3.1.1)
189
- rake (13.0.3)
190
- regexp_parser (2.4.0)
191
- rexml (3.2.5)
192
- rspec-core (3.10.1)
193
- rspec-support (~> 3.10.0)
194
- rspec-expectations (3.10.1)
207
+ rake (13.2.1)
208
+ rdoc (6.12.0)
209
+ psych (>= 4.0.0)
210
+ regexp_parser (2.10.0)
211
+ reline (0.6.0)
212
+ io-console (~> 0.5)
213
+ rspec-core (3.13.3)
214
+ rspec-support (~> 3.13.0)
215
+ rspec-expectations (3.13.3)
195
216
  diff-lcs (>= 1.2.0, < 2.0)
196
- rspec-support (~> 3.10.0)
197
- rspec-mocks (3.10.2)
217
+ rspec-support (~> 3.13.0)
218
+ rspec-mocks (3.13.2)
198
219
  diff-lcs (>= 1.2.0, < 2.0)
199
- rspec-support (~> 3.10.0)
200
- rspec-rails (5.0.1)
201
- actionpack (>= 5.2)
202
- activesupport (>= 5.2)
203
- railties (>= 5.2)
204
- rspec-core (~> 3.10)
205
- rspec-expectations (~> 3.10)
206
- rspec-mocks (~> 3.10)
207
- rspec-support (~> 3.10)
208
- rspec-support (3.10.2)
209
- rubocop (1.29.1)
220
+ rspec-support (~> 3.13.0)
221
+ rspec-rails (7.1.1)
222
+ actionpack (>= 7.0)
223
+ activesupport (>= 7.0)
224
+ railties (>= 7.0)
225
+ rspec-core (~> 3.13)
226
+ rspec-expectations (~> 3.13)
227
+ rspec-mocks (~> 3.13)
228
+ rspec-support (~> 3.13)
229
+ rspec-support (3.13.2)
230
+ rubocop (1.74.0)
231
+ json (~> 2.3)
232
+ language_server-protocol (~> 3.17.0.2)
233
+ lint_roller (~> 1.1.0)
210
234
  parallel (~> 1.10)
211
- parser (>= 3.1.0.0)
235
+ parser (>= 3.3.0.2)
212
236
  rainbow (>= 2.2.2, < 4.0)
213
- regexp_parser (>= 1.8, < 3.0)
214
- rexml (>= 3.2.5, < 4.0)
215
- rubocop-ast (>= 1.17.0, < 2.0)
237
+ regexp_parser (>= 2.9.3, < 3.0)
238
+ rubocop-ast (>= 1.38.0, < 2.0)
216
239
  ruby-progressbar (~> 1.7)
217
- unicode-display_width (>= 1.4.0, < 3.0)
218
- rubocop-ast (1.18.0)
219
- parser (>= 3.1.1.0)
220
- rubocop-rspec (1.30.0)
221
- rubocop (>= 0.58.0)
222
- ruby-progressbar (1.11.0)
240
+ unicode-display_width (>= 2.4.0, < 4.0)
241
+ rubocop-ast (1.41.0)
242
+ parser (>= 3.3.7.2)
243
+ rubocop-factory_bot (2.27.1)
244
+ lint_roller (~> 1.1)
245
+ rubocop (~> 1.72, >= 1.72.1)
246
+ rubocop-rake (0.7.1)
247
+ lint_roller (~> 1.1)
248
+ rubocop (>= 1.72.1)
249
+ rubocop-rspec (3.5.0)
250
+ lint_roller (~> 1.1)
251
+ rubocop (~> 1.72, >= 1.72.1)
252
+ rubocop-rspec_rails (2.31.0)
253
+ lint_roller (~> 1.1)
254
+ rubocop (~> 1.72, >= 1.72.1)
255
+ rubocop-rspec (~> 3.5)
256
+ ruby-progressbar (1.13.0)
223
257
  ruby2_keywords (0.0.5)
224
- sprockets (4.2.0)
225
- concurrent-ruby (~> 1.0)
226
- rack (>= 2.2.4, < 4)
227
- sprockets-rails (3.4.2)
228
- actionpack (>= 5.2)
229
- activesupport (>= 5.2)
230
- sprockets (>= 3.0.0)
231
- sqlite3 (1.4.2)
232
- thor (1.2.1)
233
- timeout (0.2.0)
234
- tzinfo (2.0.4)
258
+ securerandom (0.4.1)
259
+ sqlite3 (2.6.0)
260
+ mini_portile2 (~> 2.8.0)
261
+ stringio (3.1.5)
262
+ thor (1.3.2)
263
+ timeout (0.4.3)
264
+ tzinfo (2.0.6)
235
265
  concurrent-ruby (~> 1.0)
236
- unicode-display_width (2.1.0)
237
- websocket-driver (0.7.6)
266
+ unicode-display_width (3.1.4)
267
+ unicode-emoji (~> 4.0, >= 4.0.4)
268
+ unicode-emoji (4.0.4)
269
+ useragent (0.16.11)
270
+ websocket-driver (0.7.7)
271
+ base64
238
272
  websocket-extensions (>= 0.1.0)
239
273
  websocket-extensions (0.1.5)
240
- zeitwerk (2.6.0)
274
+ zeitwerk (2.7.2)
241
275
 
242
276
  PLATFORMS
243
277
  ruby
@@ -245,15 +279,20 @@ PLATFORMS
245
279
  DEPENDENCIES
246
280
  external_services!
247
281
  factory_bot_rails
282
+ fiddle
248
283
  net-smtp
284
+ observer
249
285
  overcommit
250
286
  pry (>= 0.14)
251
- pry-rails (~> 0.3.9)
287
+ pry-rails (~> 0.3)
252
288
  rake (~> 13.0)
253
289
  rspec-rails
254
290
  rubocop (~> 1.0)
255
- rubocop-rspec
256
- sqlite3
291
+ rubocop-factory_bot (~> 2.27)
292
+ rubocop-rake (~> 0.7)
293
+ rubocop-rspec (~> 3.5)
294
+ rubocop-rspec_rails (~> 2.31)
295
+ sqlite3 (~> 2.6)
257
296
 
258
297
  BUNDLED WITH
259
- 2.3.14
298
+ 2.6.6
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  begin
2
4
  require 'bundler/setup'
3
5
  rescue LoadError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ExternalServices
2
4
  class ApiJob < ActiveJob::Base
3
5
  queue_as :default
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ExternalServices
2
4
  module Action
3
5
  extend ActiveSupport::Concern
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ExternalServices
2
4
  class ApiAction < ::ActiveRecord::Base
3
5
  include ExternalServices::Action
4
6
 
5
- MAX_ACTION_AGE = ENV.fetch('EXTERNAL_SERVICES_MAX_ACTION_AGE') { '90' }.to_i.days
7
+ MAX_ACTION_AGE = ENV.fetch('EXTERNAL_SERVICES_MAX_ACTION_AGE', '90').to_i.days
6
8
 
7
- attr_accessor :async
9
+ attr_writer :async
8
10
 
9
11
  self.table_name = :external_services_api_actions
10
12
 
@@ -13,8 +15,8 @@ module ExternalServices
13
15
  validates :initiator_id, :initiator_type, :method, :path, :queue, presence: true
14
16
  validate :path_format_correctness
15
17
 
16
- serialize :data, JSON
17
- serialize :options, JSON
18
+ serialize :data, coder: JSON
19
+ serialize :options, coder: JSON
18
20
 
19
21
  scope :to_create, ->(obj) { where(initiator: obj, method: :post) }
20
22
 
@@ -83,13 +85,14 @@ module ExternalServices
83
85
  end
84
86
 
85
87
  def async
86
- @async.nil? ? true : @async
88
+ @async.nil? || @async
87
89
  end
88
90
 
89
91
  private
90
92
 
91
93
  def create_or_update(*args)
92
94
  return true unless async
95
+
93
96
  super
94
97
  end
95
98
  end
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ExternalServices
2
4
  class Service < ::ActiveRecord::Base
3
5
  self.table_name = :external_services
4
6
 
5
7
  belongs_to :subject, polymorphic: true
6
- serialize :extra_data, JSON
8
+ serialize :extra_data, coder: JSON
7
9
 
8
10
  after_update :on_first_sync, if: proc { # Rails 5.1+ support
9
- (respond_to?(:saved_change_to_external_id?) ? saved_change_to_external_id? : external_id_changed? ) &&
10
- (respond_to?(:external_id_before_last_save) ? external_id_before_last_save : external_id_was).nil?
11
+ (respond_to?(:saved_change_to_external_id?) ? saved_change_to_external_id? : external_id_changed?) &&
12
+ (respond_to?(:external_id_before_last_save) ? external_id_before_last_save : external_id_was).nil?
11
13
  }
12
14
 
13
15
  def self.to_sym
@@ -22,6 +24,7 @@ module ExternalServices
22
24
  def on_subject_update(subj)
23
25
  method = subj.send("#{api_name}_id").present? ? :put : :post
24
26
  return true if (subj.respond_to?(:became_archived?) && subj.became_archived?) && method == :post
27
+
25
28
  subj.send("#{api_name}_api_action", method)
26
29
  end
27
30
 
data/bin/rails CHANGED
@@ -1,12 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  # This command will automatically be run when you run "rails" with Rails gems
3
5
  # installed from the root of your application.
4
6
 
5
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
6
- ENGINE_PATH = File.expand_path('../../lib/external_services/engine', __FILE__)
7
+ ENGINE_ROOT = File.expand_path('..', __dir__)
8
+ ENGINE_PATH = File.expand_path('../lib/external_services/engine', __dir__)
9
+ APP_PATH = File.expand_path('../spec/dummy/config/application', __dir__)
7
10
 
8
11
  # Set up gems listed in the Gemfile.
9
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
10
13
  require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
11
14
 
12
15
  require 'rails/all'
@@ -1,6 +1,6 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'external_services/version'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/external_services/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'external_services'
@@ -17,12 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.post_install_message = <<-MSG
21
- WARNING: since v0.4 active_job queues are prefixed, so you should check sidekiq config.
22
- And there is a sidekiq queue clean function, you should use it on Sidekiq start instead of cleaning all Redis db.
23
- MSG
20
+ spec.required_ruby_version = '>= 2.7'
24
21
 
25
- spec.add_dependency 'faraday', '>= 1.4', '< 2'
26
- spec.add_dependency 'faraday_middleware', '>= 1.0', '< 2'
27
- spec.add_dependency 'rails', ['>= 4.2.5', '< 7.1']
22
+ spec.add_dependency 'faraday', '>= 2.0', '< 3'
23
+ spec.add_dependency 'rails', '>= 5.0.7', '< 8'
28
24
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ExternalServices
2
4
  module ActiveRecord
3
5
  module HasExternalService
@@ -24,13 +26,11 @@ module ExternalServices
24
26
  extend service_class::SubjectClassMethods if defined? service_class::SubjectClassMethods
25
27
  include service_class::SubjectMethods if defined? service_class::SubjectMethods
26
28
 
27
- # rubocop:disable Lint/HandleExceptions
28
29
  begin
29
30
  service_module = const_get(name.to_s.camelize, false)
30
31
  include service_module
31
- rescue NameError
32
+ rescue NameError # rubocop:disable Lint/SuppressedException
32
33
  end
33
- # rubocop:enable Lint/HandleExceptions
34
34
  end
35
35
 
36
36
  def includes_external_services
@@ -88,7 +88,7 @@ module ExternalServices
88
88
  end
89
89
  end
90
90
 
91
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
91
+ # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
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)
@@ -106,7 +106,7 @@ module ExternalServices
106
106
  before_destroy :halt_on_external_services_syncing
107
107
  end
108
108
 
109
- after_save :"#{name}_on_create", if: proc { # Rails 5.1+ support
109
+ after_save :"#{name}_on_create", if: proc { # Rails 5.1+ support
110
110
  respond_to?(:saved_change_to_id?) ? saved_change_to_id? : id_changed?
111
111
  }
112
112
 
@@ -120,7 +120,6 @@ module ExternalServices
120
120
  define_method :"#{name}_on_create" do
121
121
  public_send(service_assoc).on_subject_create(self) unless only_api_actions
122
122
  end
123
- protected :"#{name}_on_create"
124
123
 
125
124
  define_method :"#{name}_on_update" do
126
125
  public_send(service_assoc).on_subject_update(self) unless only_api_actions
@@ -129,20 +128,19 @@ module ExternalServices
129
128
  define_method :"#{name}_on_destroy" do
130
129
  public_send(service_assoc).on_subject_destroy(self) unless only_api_actions
131
130
  end
132
- protected :"#{name}_on_destroy"
133
-
134
- protected def halt_on_external_services_syncing
135
- if external_services_syncing?
136
- errors.add :base, :external_services_sync_in_process
137
- if ::ActiveRecord::VERSION::MAJOR < 5
138
- return false
139
- else
140
- throw :abort
141
- end
142
- end
131
+
132
+ protected
133
+
134
+ def halt_on_external_services_syncing
135
+ return unless external_services_syncing?
136
+
137
+ errors.add :base, :external_services_sync_in_process
138
+ return false if ::ActiveRecord::VERSION::MAJOR < 5
139
+
140
+ throw :abort
143
141
  end
144
142
  end
145
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
143
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
146
144
 
147
145
  include callbacks_module
148
146
  end
@@ -166,13 +164,13 @@ module ExternalServices
166
164
  end
167
165
 
168
166
  define_method :external_services_synced? do
169
- result = (!defined?(super) || super())
167
+ result = !defined?(super) || super()
170
168
  result &&= public_send(synced_method) unless public_send(disabled_method)
171
169
  result
172
170
  end
173
171
 
174
172
  define_method :external_services_syncing? do
175
- result = (defined?(super) && super())
173
+ result = defined?(super) && super()
176
174
  result ||= public_send(syncing_method) unless public_send(disabled_method)
177
175
  result
178
176
  end
@@ -217,14 +215,12 @@ module ExternalServices
217
215
  end
218
216
 
219
217
  define_method :"without_#{name}_api" do |&blk|
220
- begin
221
- old = send :"#{name}_api_disabled"
222
- send :"#{name}_api_disabled=", true
218
+ old = send :"#{name}_api_disabled"
219
+ send :"#{name}_api_disabled=", true
223
220
 
224
- blk.call
225
- ensure
226
- send :"#{name}_api_disabled=", old
227
- end
221
+ blk.call
222
+ ensure
223
+ send :"#{name}_api_disabled=", old
228
224
  end
229
225
 
230
226
  define_method :"find_all_by_#{name}_ids" do |ids|
@@ -266,19 +262,19 @@ module ExternalServices
266
262
  path = args[:path] || send(:"#{name}_api_path")
267
263
  data = args[:data] || send(:"#{name}_api_data")
268
264
  options = args[:options] || {}
269
- async = args[:async].nil? ? true : args[:async]
265
+ async = args[:async].nil? || args[:async]
270
266
 
271
267
  options[:change_external_id] = true if options[:change_external_id].nil?
272
268
 
273
269
  action = "ExternalServices::ApiActions::#{name.to_s.camelize}".constantize.new(
274
270
  initiator: self,
275
- name: args[:name] || self.class.send(:"#{name}_api_name"),
276
- method: method,
277
- path: path,
278
- data: data,
279
- queue: args[:queue],
280
- options: options,
281
- async: async
271
+ name: args[:name] || self.class.send(:"#{name}_api_name"),
272
+ method: method,
273
+ path: path,
274
+ data: data,
275
+ queue: args[:queue],
276
+ options: options,
277
+ async: async
282
278
  )
283
279
 
284
280
  if async
@@ -299,5 +295,5 @@ module ExternalServices
299
295
  end
300
296
 
301
297
  ActiveSupport.on_load :active_record do
302
- ActiveRecord::Base.send :include, ExternalServices::ActiveRecord::HasExternalService
298
+ ActiveRecord::Base.include ExternalServices::ActiveRecord::HasExternalService
303
299
  end
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'faraday'
2
- require 'faraday_middleware'
3
4
 
4
5
  module ExternalServices
5
6
  module Api
@@ -8,6 +9,8 @@ module ExternalServices
8
9
 
9
10
  def initialize(response)
10
11
  @response = response
12
+
13
+ super
11
14
  end
12
15
 
13
16
  def message
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails'
2
4
  module ExternalServices
3
5
  class Engine < ::Rails::Engine
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ExternalServices
2
- VERSION = '0.5.2'.freeze
4
+ VERSION = '0.6.0'
3
5
  end
@@ -1,18 +1,20 @@
1
- require 'external_services/engine'
2
- require 'external_services/version'
1
+ # frozen_string_literal: true
3
2
 
4
- require 'external_services/active_record'
5
- require 'external_services/api'
6
- require 'generators/install_generator'
7
- require 'generators/service_generator'
3
+ require_relative 'external_services/engine'
4
+ require_relative 'external_services/version'
5
+
6
+ require_relative 'external_services/active_record'
7
+ require_relative 'external_services/api'
8
+ require_relative 'generators/install_generator'
9
+ require_relative 'generators/service_generator'
8
10
 
9
11
  if defined?(::RSpec::Core)
10
- require 'rspec/configuration'
11
- require 'rspec/helpers'
12
+ require_relative 'rspec/configuration'
13
+ require_relative 'rspec/helpers'
12
14
  end
13
15
 
14
- Dir[File.join(File.expand_path('lib/external_services'), 'api', '*.rb')].each do |api|
15
- require api
16
+ Dir[File.join(File.expand_path('lib/external_services'), 'api', '*.rb')].sort.each do |api|
17
+ require_relative api
16
18
  end
17
19
 
18
20
  module ExternalServices
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators'
2
4
  require 'rails/generators/active_record'
3
5
 
@@ -15,7 +17,7 @@ module ExternalServices
15
17
  return unless Rails::VERSION::MAJOR >= 5
16
18
 
17
19
  "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
18
- end
20
+ end
19
21
 
20
22
  def create_migration_files
21
23
  add_migration('create_external_services')
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators'
2
4
  require 'rails/generators/active_record'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ExternalServices
2
4
  module RSpec
3
5
  module Configuration
@@ -18,4 +20,4 @@ module ExternalServices
18
20
  end
19
21
  end
20
22
 
21
- RSpec::Core::Configuration.send(:include, ExternalServices::RSpec::Configuration)
23
+ RSpec::Core::Configuration.include ExternalServices::RSpec::Configuration
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ExternalServices
2
4
  module RSpec
3
5
  module Disabler
data/lib/rspec/helpers.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec/disabler'
2
4
 
3
5
  module ExternalServices
@@ -16,8 +18,7 @@ module ExternalServices
16
18
  end
17
19
  end
18
20
 
19
- # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
20
-
21
+ # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/BlockLength
21
22
  def describe_external_service_api(object:, api_name:, **kwargs, &blk)
22
23
  action_class = kwargs[:action_class] || "ExternalServices::ApiActions::#{api_name.to_s.camelize}".constantize
23
24
  methods = %i[create update destroy]
@@ -86,9 +87,8 @@ module ExternalServices
86
87
 
87
88
  instance_exec(&blk) if block_given?
88
89
  end
89
-
90
- # rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
91
90
  end
91
+ # rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/BlockLength
92
92
  end
93
93
 
94
94
  def remove_api_actions(api_name)
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: external_services
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Gnuskov
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-08-03 00:00:00.000000000 Z
10
+ date: 2025-03-21 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: faraday
@@ -16,61 +15,40 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '1.4'
18
+ version: '2.0'
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
- version: '2'
21
+ version: '3'
23
22
  type: :runtime
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- version: '1.4'
28
+ version: '2.0'
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
- version: '2'
33
- - !ruby/object:Gem::Dependency
34
- name: faraday_middleware
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '1.0'
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '2'
43
- type: :runtime
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: '1.0'
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '2'
31
+ version: '3'
53
32
  - !ruby/object:Gem::Dependency
54
33
  name: rails
55
34
  requirement: !ruby/object:Gem::Requirement
56
35
  requirements:
57
36
  - - ">="
58
37
  - !ruby/object:Gem::Version
59
- version: 4.2.5
38
+ version: 5.0.7
60
39
  - - "<"
61
40
  - !ruby/object:Gem::Version
62
- version: '7.1'
41
+ version: '8'
63
42
  type: :runtime
64
43
  prerelease: false
65
44
  version_requirements: !ruby/object:Gem::Requirement
66
45
  requirements:
67
46
  - - ">="
68
47
  - !ruby/object:Gem::Version
69
- version: 4.2.5
48
+ version: 5.0.7
70
49
  - - "<"
71
50
  - !ruby/object:Gem::Version
72
- version: '7.1'
73
- description:
51
+ version: '8'
74
52
  email:
75
53
  - sergey.gnuskov@flant.com
76
54
  executables: []
@@ -115,9 +93,6 @@ homepage: https://github.com/flant/external_services
115
93
  licenses:
116
94
  - MIT
117
95
  metadata: {}
118
- post_install_message: |2
119
- WARNING: since v0.4 active_job queues are prefixed, so you should check sidekiq config.
120
- And there is a sidekiq queue clean function, you should use it on Sidekiq start instead of cleaning all Redis db.
121
96
  rdoc_options: []
122
97
  require_paths:
123
98
  - lib
@@ -125,15 +100,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
125
100
  requirements:
126
101
  - - ">="
127
102
  - !ruby/object:Gem::Version
128
- version: '0'
103
+ version: '2.7'
129
104
  required_rubygems_version: !ruby/object:Gem::Requirement
130
105
  requirements:
131
106
  - - ">="
132
107
  - !ruby/object:Gem::Version
133
108
  version: '0'
134
109
  requirements: []
135
- rubygems_version: 3.4.10
136
- signing_key:
110
+ rubygems_version: 3.6.2
137
111
  specification_version: 4
138
112
  summary: Gem helps syncronizing objects to different external services like Gitlab,
139
113
  Redmine and any other.