quiz_api_client 4.2.0 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/quiz_api_client/services/courses_service.rb +26 -0
- data/lib/quiz_api_client/services/items_service.rb +11 -0
- data/lib/quiz_api_client/services/quiz_clone_jobs_service.rb +11 -0
- data/lib/quiz_api_client/services/quiz_sync_job_service.rb +17 -0
- data/lib/quiz_api_client/services/quiz_sync_jobs_service.rb +16 -0
- data/lib/quiz_api_client/version.rb +1 -1
- data/lib/quiz_api_client.rb +15 -0
- data/spec/config_spec.rb +66 -0
- data/spec/contracts/interaction_types_service_spec.rb +22 -0
- data/spec/contracts/item_analyses_service_spec.rb +59 -0
- data/spec/contracts/items_service_spec.rb +59 -0
- data/spec/contracts/qti_imports_service_spec.rb +34 -0
- data/spec/contracts/quiz_clone_job_service_spec.rb +20 -0
- data/spec/contracts/quiz_clone_jobs_service_spec.rb +21 -0
- data/spec/contracts/quiz_entries_service_spec.rb +125 -0
- data/spec/contracts/quiz_service_spec.rb +68 -0
- data/spec/contracts/quiz_session_events_service_spec.rb +30 -0
- data/spec/contracts/quiz_session_result_service_spec.rb +42 -0
- data/spec/contracts/quiz_session_service_spec.rb +56 -0
- data/spec/contracts/quiz_sessions_service_spec.rb +28 -0
- data/spec/contracts/quiz_sync_job_service_spec.rb +21 -0
- data/spec/contracts/quiz_sync_jobs_service_spec.rb +21 -0
- data/spec/contracts/quizzes_service_spec.rb +80 -0
- data/spec/contracts/session_item_results_service_spec.rb +60 -0
- data/spec/contracts/session_items_service_spec.rb +21 -0
- data/spec/contracts/shared_banks_spec.rb +366 -0
- data/spec/contracts/shared_examples/http_delete_example.rb +56 -0
- data/spec/contracts/shared_examples/http_get_example.rb +139 -0
- data/spec/contracts/shared_examples/http_patch_example.rb +60 -0
- data/spec/contracts/shared_examples/http_post_example.rb +68 -0
- data/spec/contracts/shared_examples/http_put_example.rb +60 -0
- data/spec/http_client_spec.rb +347 -0
- data/spec/json_formatter_spec.rb +32 -0
- data/spec/quiz_api_client/http_request/failure_spec.rb +100 -0
- data/spec/quiz_api_client/http_request/metrics_spec.rb +75 -0
- data/spec/quiz_api_client_spec.rb +124 -0
- data/spec/services/base_api_service_spec.rb +50 -0
- data/spec/services/courses_service_spec.rb +59 -0
- data/spec/services/interaction_types_service_spec.rb +25 -0
- data/spec/services/item_analyses_service_spec.rb +76 -0
- data/spec/services/items_service_spec.rb +56 -0
- data/spec/services/jwt_service_spec.rb +66 -0
- data/spec/services/qti_imports_service_spec.rb +114 -0
- data/spec/services/quiz_analyses_service_spec.rb +44 -0
- data/spec/services/quiz_clone_job_service_spec.rb +41 -0
- data/spec/services/quiz_clone_jobs_service_spec.rb +77 -0
- data/spec/services/quiz_entries_service_spec.rb +71 -0
- data/spec/services/quiz_service_spec.rb +49 -0
- data/spec/services/quiz_session_events_service_spec.rb +42 -0
- data/spec/services/quiz_session_result_service_spec.rb +26 -0
- data/spec/services/quiz_session_service_spec.rb +49 -0
- data/spec/services/quiz_sessions_service_spec.rb +42 -0
- data/spec/services/quiz_sync_job_service_spec.rb +41 -0
- data/spec/services/quiz_sync_jobs_service_spec.rb +77 -0
- data/spec/services/quizzes_service_spec.rb +71 -0
- data/spec/services/session_item_results_service_spec.rb +33 -0
- data/spec/services/session_items_service_spec.rb +26 -0
- data/spec/spec_helper.rb +42 -0
- data/spec/support/pact_config.rb +64 -0
- data/spec/support/pact_helper.rb +19 -0
- metadata +121 -39
- data/.dockerignore +0 -7
- data/.editorconfig +0 -16
- data/.gitignore +0 -13
- data/.rspec +0 -3
- data/.rubocop.yml +0 -72
- data/CHANGELOG.md +0 -35
- data/Dockerfile +0 -12
- data/Gemfile +0 -5
- data/Jenkinsfile +0 -86
- data/bin/console +0 -7
- data/bin/contracts-generate +0 -26
- data/bin/setup +0 -65
- data/docker-compose.dev.override.yml +0 -11
- data/docker-compose.yml +0 -10
- data/quiz_api_client.gemspec +0 -60
@@ -0,0 +1,64 @@
|
|
1
|
+
module PactConfig
|
2
|
+
# These constants ensure we use the correct strings and thus help avoid our
|
3
|
+
# accidentally breaking the contract tests
|
4
|
+
QUIZ_API_CLIENT_RUBY = 'Quiz API Client Ruby'.freeze
|
5
|
+
|
6
|
+
# Add new API and LiveEvents providers to this Providers module
|
7
|
+
module Providers
|
8
|
+
QUIZ_API = 'Quiz API'.freeze
|
9
|
+
ALL = Providers.constants.map { |c| Providers.const_get(c) }.freeze
|
10
|
+
end
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def pact_uri(pact_path:)
|
14
|
+
URI::HTTP.build(
|
15
|
+
scheme: protocol,
|
16
|
+
userinfo: "#{broker_username}:#{broker_password}",
|
17
|
+
host: broker_host,
|
18
|
+
path: "/#{pact_path}/#{consumer_tag}"
|
19
|
+
).to_s
|
20
|
+
end
|
21
|
+
|
22
|
+
def broker_uri
|
23
|
+
URI::HTTP.build(
|
24
|
+
scheme: protocol,
|
25
|
+
userinfo: "#{broker_username}:#{broker_password}",
|
26
|
+
host: broker_host
|
27
|
+
).to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
def broker_host
|
31
|
+
ENV.fetch('PACT_BROKER_HOST', 'pact-broker.docker')
|
32
|
+
end
|
33
|
+
|
34
|
+
def consumer_tag
|
35
|
+
ENV.fetch('PACT_CONSUMER_TAG', 'local')
|
36
|
+
end
|
37
|
+
|
38
|
+
def consumer_version
|
39
|
+
version = QuizApiClient::VERSION
|
40
|
+
sha = ENV['SHA']
|
41
|
+
version = "#{version}+#{sha}" if sha
|
42
|
+
version
|
43
|
+
end
|
44
|
+
|
45
|
+
def broker_password
|
46
|
+
ENV.fetch('PACT_BROKER_PASSWORD', 'broker')
|
47
|
+
end
|
48
|
+
|
49
|
+
def broker_username
|
50
|
+
ENV.fetch('PACT_BROKER_USERNAME', 'pact')
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def jenkins_build?
|
56
|
+
!ENV['JENKINS_URL'].nil?
|
57
|
+
end
|
58
|
+
|
59
|
+
def protocol
|
60
|
+
protocol = jenkins_build? ? 'https' : 'http'
|
61
|
+
ENV.fetch('PACT_BROKER_PROTOCOL', protocol)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PactHelper
|
2
|
+
def token_expiration_one_year
|
3
|
+
token_expiration_seconds_from_now(seconds: 31_536_000)
|
4
|
+
end
|
5
|
+
|
6
|
+
def token_expiration_seconds_from_now(seconds:)
|
7
|
+
Time.now.utc.to_i + seconds
|
8
|
+
end
|
9
|
+
|
10
|
+
def headers(token)
|
11
|
+
{
|
12
|
+
'Content-Type' => 'application/json',
|
13
|
+
'AuthType' => 'Signature',
|
14
|
+
'Accept' => 'application/json',
|
15
|
+
'Authorization' => token.to_s,
|
16
|
+
'HOST' => 'localhost:1234'
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,26 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quiz_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Augusto Callejas
|
9
|
-
- Bryan Petty
|
10
|
-
- Christian Prescott
|
11
|
-
- Han Yan
|
7
|
+
- Alex Slaughter
|
12
8
|
- Jayce Higgins
|
13
|
-
-
|
9
|
+
- Jorge Arteaga
|
14
10
|
- Mark Starkman
|
15
|
-
- Michael Brewer-Davis
|
16
11
|
- Michael Hargiss
|
17
|
-
- Omar Khan
|
18
12
|
- Robin Kuss
|
19
13
|
- Ryan Taylor
|
20
|
-
autorequire:
|
14
|
+
autorequire:
|
21
15
|
bindir: exe
|
22
16
|
cert_chain: []
|
23
|
-
date:
|
17
|
+
date: 2022-06-23 00:00:00.000000000 Z
|
24
18
|
dependencies:
|
25
19
|
- !ruby/object:Gem::Dependency
|
26
20
|
name: httparty
|
@@ -190,41 +184,21 @@ dependencies:
|
|
190
184
|
- - ">="
|
191
185
|
- !ruby/object:Gem::Version
|
192
186
|
version: '0'
|
193
|
-
description:
|
187
|
+
description:
|
194
188
|
email:
|
195
|
-
-
|
196
|
-
- bpetty@instructure.com
|
197
|
-
- cprescott@instructure.com
|
198
|
-
- hyan@instructure.com
|
189
|
+
- aslaughter@instructure.com
|
199
190
|
- jhiggins@instructure.com
|
200
|
-
-
|
191
|
+
- jorge.arteaga@instructure.com
|
201
192
|
- mark.starkman@instructure.com
|
202
|
-
- mbd@instructure.com
|
203
193
|
- mhargiss@instructure.com
|
204
|
-
- okhan@instructure.com
|
205
194
|
- rkuss@instructure.com
|
206
195
|
- rtaylor@instructure.com
|
207
|
-
- cwang@instructure.com
|
208
196
|
executables: []
|
209
197
|
extensions: []
|
210
198
|
extra_rdoc_files: []
|
211
199
|
files:
|
212
|
-
- ".dockerignore"
|
213
|
-
- ".editorconfig"
|
214
|
-
- ".gitignore"
|
215
|
-
- ".rspec"
|
216
|
-
- ".rubocop.yml"
|
217
|
-
- CHANGELOG.md
|
218
|
-
- Dockerfile
|
219
|
-
- Gemfile
|
220
|
-
- Jenkinsfile
|
221
200
|
- README.md
|
222
201
|
- Rakefile
|
223
|
-
- bin/console
|
224
|
-
- bin/contracts-generate
|
225
|
-
- bin/setup
|
226
|
-
- docker-compose.dev.override.yml
|
227
|
-
- docker-compose.yml
|
228
202
|
- lib/quiz_api_client.rb
|
229
203
|
- lib/quiz_api_client/config.rb
|
230
204
|
- lib/quiz_api_client/http_client.rb
|
@@ -232,6 +206,7 @@ files:
|
|
232
206
|
- lib/quiz_api_client/http_request/metrics.rb
|
233
207
|
- lib/quiz_api_client/json_formatter.rb
|
234
208
|
- lib/quiz_api_client/services/base_api_service.rb
|
209
|
+
- lib/quiz_api_client/services/courses_service.rb
|
235
210
|
- lib/quiz_api_client/services/interaction_types_service.rb
|
236
211
|
- lib/quiz_api_client/services/item_analyses_service.rb
|
237
212
|
- lib/quiz_api_client/services/items_service.rb
|
@@ -246,16 +221,70 @@ files:
|
|
246
221
|
- lib/quiz_api_client/services/quiz_session_result_service.rb
|
247
222
|
- lib/quiz_api_client/services/quiz_session_service.rb
|
248
223
|
- lib/quiz_api_client/services/quiz_sessions_service.rb
|
224
|
+
- lib/quiz_api_client/services/quiz_sync_job_service.rb
|
225
|
+
- lib/quiz_api_client/services/quiz_sync_jobs_service.rb
|
249
226
|
- lib/quiz_api_client/services/quizzes_service.rb
|
250
227
|
- lib/quiz_api_client/services/session_item_results_service.rb
|
251
228
|
- lib/quiz_api_client/services/session_items_service.rb
|
252
229
|
- lib/quiz_api_client/services/shared_banks.rb
|
253
230
|
- lib/quiz_api_client/version.rb
|
254
|
-
-
|
255
|
-
|
231
|
+
- spec/config_spec.rb
|
232
|
+
- spec/contracts/interaction_types_service_spec.rb
|
233
|
+
- spec/contracts/item_analyses_service_spec.rb
|
234
|
+
- spec/contracts/items_service_spec.rb
|
235
|
+
- spec/contracts/qti_imports_service_spec.rb
|
236
|
+
- spec/contracts/quiz_clone_job_service_spec.rb
|
237
|
+
- spec/contracts/quiz_clone_jobs_service_spec.rb
|
238
|
+
- spec/contracts/quiz_entries_service_spec.rb
|
239
|
+
- spec/contracts/quiz_service_spec.rb
|
240
|
+
- spec/contracts/quiz_session_events_service_spec.rb
|
241
|
+
- spec/contracts/quiz_session_result_service_spec.rb
|
242
|
+
- spec/contracts/quiz_session_service_spec.rb
|
243
|
+
- spec/contracts/quiz_sessions_service_spec.rb
|
244
|
+
- spec/contracts/quiz_sync_job_service_spec.rb
|
245
|
+
- spec/contracts/quiz_sync_jobs_service_spec.rb
|
246
|
+
- spec/contracts/quizzes_service_spec.rb
|
247
|
+
- spec/contracts/session_item_results_service_spec.rb
|
248
|
+
- spec/contracts/session_items_service_spec.rb
|
249
|
+
- spec/contracts/shared_banks_spec.rb
|
250
|
+
- spec/contracts/shared_examples/http_delete_example.rb
|
251
|
+
- spec/contracts/shared_examples/http_get_example.rb
|
252
|
+
- spec/contracts/shared_examples/http_patch_example.rb
|
253
|
+
- spec/contracts/shared_examples/http_post_example.rb
|
254
|
+
- spec/contracts/shared_examples/http_put_example.rb
|
255
|
+
- spec/http_client_spec.rb
|
256
|
+
- spec/json_formatter_spec.rb
|
257
|
+
- spec/quiz_api_client/http_request/failure_spec.rb
|
258
|
+
- spec/quiz_api_client/http_request/metrics_spec.rb
|
259
|
+
- spec/quiz_api_client_spec.rb
|
260
|
+
- spec/services/base_api_service_spec.rb
|
261
|
+
- spec/services/courses_service_spec.rb
|
262
|
+
- spec/services/interaction_types_service_spec.rb
|
263
|
+
- spec/services/item_analyses_service_spec.rb
|
264
|
+
- spec/services/items_service_spec.rb
|
265
|
+
- spec/services/jwt_service_spec.rb
|
266
|
+
- spec/services/qti_imports_service_spec.rb
|
267
|
+
- spec/services/quiz_analyses_service_spec.rb
|
268
|
+
- spec/services/quiz_clone_job_service_spec.rb
|
269
|
+
- spec/services/quiz_clone_jobs_service_spec.rb
|
270
|
+
- spec/services/quiz_entries_service_spec.rb
|
271
|
+
- spec/services/quiz_service_spec.rb
|
272
|
+
- spec/services/quiz_session_events_service_spec.rb
|
273
|
+
- spec/services/quiz_session_result_service_spec.rb
|
274
|
+
- spec/services/quiz_session_service_spec.rb
|
275
|
+
- spec/services/quiz_sessions_service_spec.rb
|
276
|
+
- spec/services/quiz_sync_job_service_spec.rb
|
277
|
+
- spec/services/quiz_sync_jobs_service_spec.rb
|
278
|
+
- spec/services/quizzes_service_spec.rb
|
279
|
+
- spec/services/session_item_results_service_spec.rb
|
280
|
+
- spec/services/session_items_service_spec.rb
|
281
|
+
- spec/spec_helper.rb
|
282
|
+
- spec/support/pact_config.rb
|
283
|
+
- spec/support/pact_helper.rb
|
284
|
+
homepage:
|
256
285
|
licenses: []
|
257
286
|
metadata: {}
|
258
|
-
post_install_message:
|
287
|
+
post_install_message:
|
259
288
|
rdoc_options: []
|
260
289
|
require_paths:
|
261
290
|
- lib
|
@@ -271,7 +300,60 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
271
300
|
version: '0'
|
272
301
|
requirements: []
|
273
302
|
rubygems_version: 3.1.6
|
274
|
-
signing_key:
|
303
|
+
signing_key:
|
275
304
|
specification_version: 4
|
276
305
|
summary: Ruby client for quiz_api
|
277
|
-
test_files:
|
306
|
+
test_files:
|
307
|
+
- spec/config_spec.rb
|
308
|
+
- spec/contracts/interaction_types_service_spec.rb
|
309
|
+
- spec/contracts/item_analyses_service_spec.rb
|
310
|
+
- spec/contracts/items_service_spec.rb
|
311
|
+
- spec/contracts/qti_imports_service_spec.rb
|
312
|
+
- spec/contracts/quiz_clone_job_service_spec.rb
|
313
|
+
- spec/contracts/quiz_clone_jobs_service_spec.rb
|
314
|
+
- spec/contracts/quiz_entries_service_spec.rb
|
315
|
+
- spec/contracts/quiz_service_spec.rb
|
316
|
+
- spec/contracts/quiz_session_events_service_spec.rb
|
317
|
+
- spec/contracts/quiz_session_result_service_spec.rb
|
318
|
+
- spec/contracts/quiz_session_service_spec.rb
|
319
|
+
- spec/contracts/quiz_sessions_service_spec.rb
|
320
|
+
- spec/contracts/quiz_sync_job_service_spec.rb
|
321
|
+
- spec/contracts/quiz_sync_jobs_service_spec.rb
|
322
|
+
- spec/contracts/quizzes_service_spec.rb
|
323
|
+
- spec/contracts/session_item_results_service_spec.rb
|
324
|
+
- spec/contracts/session_items_service_spec.rb
|
325
|
+
- spec/contracts/shared_banks_spec.rb
|
326
|
+
- spec/contracts/shared_examples/http_delete_example.rb
|
327
|
+
- spec/contracts/shared_examples/http_get_example.rb
|
328
|
+
- spec/contracts/shared_examples/http_patch_example.rb
|
329
|
+
- spec/contracts/shared_examples/http_post_example.rb
|
330
|
+
- spec/contracts/shared_examples/http_put_example.rb
|
331
|
+
- spec/http_client_spec.rb
|
332
|
+
- spec/json_formatter_spec.rb
|
333
|
+
- spec/quiz_api_client/http_request/failure_spec.rb
|
334
|
+
- spec/quiz_api_client/http_request/metrics_spec.rb
|
335
|
+
- spec/quiz_api_client_spec.rb
|
336
|
+
- spec/services/base_api_service_spec.rb
|
337
|
+
- spec/services/courses_service_spec.rb
|
338
|
+
- spec/services/interaction_types_service_spec.rb
|
339
|
+
- spec/services/item_analyses_service_spec.rb
|
340
|
+
- spec/services/items_service_spec.rb
|
341
|
+
- spec/services/jwt_service_spec.rb
|
342
|
+
- spec/services/qti_imports_service_spec.rb
|
343
|
+
- spec/services/quiz_analyses_service_spec.rb
|
344
|
+
- spec/services/quiz_clone_job_service_spec.rb
|
345
|
+
- spec/services/quiz_clone_jobs_service_spec.rb
|
346
|
+
- spec/services/quiz_entries_service_spec.rb
|
347
|
+
- spec/services/quiz_service_spec.rb
|
348
|
+
- spec/services/quiz_session_events_service_spec.rb
|
349
|
+
- spec/services/quiz_session_result_service_spec.rb
|
350
|
+
- spec/services/quiz_session_service_spec.rb
|
351
|
+
- spec/services/quiz_sessions_service_spec.rb
|
352
|
+
- spec/services/quiz_sync_job_service_spec.rb
|
353
|
+
- spec/services/quiz_sync_jobs_service_spec.rb
|
354
|
+
- spec/services/quizzes_service_spec.rb
|
355
|
+
- spec/services/session_item_results_service_spec.rb
|
356
|
+
- spec/services/session_items_service_spec.rb
|
357
|
+
- spec/spec_helper.rb
|
358
|
+
- spec/support/pact_config.rb
|
359
|
+
- spec/support/pact_helper.rb
|
data/.dockerignore
DELETED
data/.editorconfig
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# .editorconfig
|
2
|
-
# Please install EditorConfig plugin for your editor or IDE
|
3
|
-
# Usage and plugin list can be found here: http://EditorConfig.org
|
4
|
-
|
5
|
-
# top-most EditorConfig file
|
6
|
-
root = true
|
7
|
-
|
8
|
-
[*]
|
9
|
-
end_of_line = lf
|
10
|
-
indent_style = space
|
11
|
-
indent_size = 2
|
12
|
-
insert_final_newline = true
|
13
|
-
trim_trailing_whitespace = true
|
14
|
-
|
15
|
-
[*.md]
|
16
|
-
indent_size = 4
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: 2.6
|
3
|
-
|
4
|
-
Metrics/ClassLength:
|
5
|
-
Max: 200 # Default: 100
|
6
|
-
|
7
|
-
Metrics/LineLength:
|
8
|
-
Max: 120 # Default: 80
|
9
|
-
|
10
|
-
Metrics/MethodLength:
|
11
|
-
Max: 20 # Default: 10
|
12
|
-
|
13
|
-
Metrics/BlockLength:
|
14
|
-
Max: 30
|
15
|
-
Exclude:
|
16
|
-
- quiz_api_client.gemspec
|
17
|
-
- spec/**/*.rb
|
18
|
-
|
19
|
-
Naming/MemoizedInstanceVariableName:
|
20
|
-
EnforcedStyleForLeadingUnderscores: required
|
21
|
-
|
22
|
-
Layout/AlignParameters:
|
23
|
-
# Alignment of parameters in multi-line method calls.
|
24
|
-
#
|
25
|
-
# The `with_fixed_indentation` style aligns the following lines with one
|
26
|
-
# level of indentation relative to the start of the line with the method call.
|
27
|
-
#
|
28
|
-
# method_call(a,
|
29
|
-
# b)
|
30
|
-
EnforcedStyle: with_fixed_indentation
|
31
|
-
|
32
|
-
Layout/CaseIndentation:
|
33
|
-
EnforcedStyle: end
|
34
|
-
|
35
|
-
Layout/EndAlignment:
|
36
|
-
EnforcedStyleAlignWith: variable
|
37
|
-
|
38
|
-
Style/ClassAndModuleChildren:
|
39
|
-
# Checks the style of children definitions at classes and modules.
|
40
|
-
#
|
41
|
-
# Basically there are two different styles:
|
42
|
-
#
|
43
|
-
# `nested` - have each child on a separate line
|
44
|
-
# class Foo
|
45
|
-
# class Bar
|
46
|
-
# end
|
47
|
-
# end
|
48
|
-
#
|
49
|
-
# `compact` - combine definitions as much as possible
|
50
|
-
# class Foo::Bar
|
51
|
-
# end
|
52
|
-
#
|
53
|
-
# The compact style is only forced, for classes / modules with one child.
|
54
|
-
EnforcedStyle: nested
|
55
|
-
Enabled: false
|
56
|
-
|
57
|
-
Style/Documentation:
|
58
|
-
# This cop checks for missing top-level documentation of classes and modules.
|
59
|
-
# Classes with no body and namespace modules are exempt from the check.
|
60
|
-
# Namespace modules are modules that have nothing in their bodies except
|
61
|
-
# classes or other modules.
|
62
|
-
Enabled: false
|
63
|
-
|
64
|
-
Style/FrozenStringLiteralComment:
|
65
|
-
# `always` will always add the frozen string literal comment to a file
|
66
|
-
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
67
|
-
# string literal. If you run code against multiple versions of Ruby, it is
|
68
|
-
# possible that this will create errors in Ruby 2.3.0+.
|
69
|
-
#
|
70
|
-
# See: https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3
|
71
|
-
EnforcedStyle: always
|
72
|
-
Enabled: false
|
data/CHANGELOG.md
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
CHANGELOG
|
2
|
-
=========
|
3
|
-
|
4
|
-
All notable changes to this project will be documented in this file. This
|
5
|
-
project adheres to [Semantic Versioning](http://semver.org/).
|
6
|
-
|
7
|
-
[TOC]
|
8
|
-
|
9
|
-
#TODO: Enter the date
|
10
|
-
## 4.2.0 ()
|
11
|
-
|
12
|
-
### Changed
|
13
|
-
* Internal refactor of request error handling
|
14
|
-
* Added `metric_handler` and `metrics_namespace` to work with InstStatsd gem
|
15
|
-
|
16
|
-
## 4.1.0 (2021-10-27)
|
17
|
-
|
18
|
-
### Breaking changes (potentially)
|
19
|
-
|
20
|
-
* All non-successful (2xx) responses will raise `QuizApiClient::HttpClient::RequestFailed` error except for 401 and 422
|
21
|
-
* Can be overridden in `allowable_response_codes` config
|
22
|
-
|
23
|
-
## 4.0.0 (2021-10-18)
|
24
|
-
|
25
|
-
### Breaking changes
|
26
|
-
|
27
|
-
* Ruby 2.4.x is no longer supported
|
28
|
-
* Ruby 2.5.x is no longer supported
|
29
|
-
|
30
|
-
### Changed
|
31
|
-
* Minimum Ruby version to 2.6.x
|
32
|
-
* Internal classes use a configuration object instead parameters on instantiation
|
33
|
-
* Instantiating `QuizApiClient::Client` remains the same
|
34
|
-
* Added `error_handler` configuration to work with Sentry Raven gem
|
35
|
-
|
data/Dockerfile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
FROM instructure/rvm
|
2
|
-
|
3
|
-
RUN mkdir -p coverage log pacts
|
4
|
-
|
5
|
-
COPY --chown=docker:docker quiz_api_client.gemspec Gemfile ./
|
6
|
-
COPY --chown=docker:docker lib/quiz_api_client/version.rb lib/quiz_api_client/version.rb
|
7
|
-
RUN /bin/bash -l -c "rvm-exec 2.6 gem install bundler -v 2.1.4"
|
8
|
-
RUN /bin/bash -l -c "rvm-exec 2.6 bundle install --jobs 5"
|
9
|
-
|
10
|
-
COPY --chown=docker:docker . .
|
11
|
-
|
12
|
-
CMD /bin/bash -l -c "rvm-exec 2.6 bundle exec rspec"
|
data/Gemfile
DELETED
data/Jenkinsfile
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
def buildMatrix = ['2.6', '2.7'].collectEntries { ruby ->
|
2
|
-
["Ruby ${ruby}": {
|
3
|
-
sh """
|
4
|
-
docker-compose run --name "${env.BUILD_ID}-ruby-${ruby}" \
|
5
|
-
app /bin/bash -lc "rvm-exec ${ruby} bundle install --jobs 5 && rvm-exec ${ruby} bundle exec rspec"
|
6
|
-
"""
|
7
|
-
}]
|
8
|
-
}
|
9
|
-
|
10
|
-
pipeline {
|
11
|
-
agent {
|
12
|
-
label 'docker'
|
13
|
-
}
|
14
|
-
options {
|
15
|
-
buildDiscarder(logRotator(numToKeepStr: '50'))
|
16
|
-
timeout(time: 20, unit: 'MINUTES')
|
17
|
-
}
|
18
|
-
stages {
|
19
|
-
stage('Build') {
|
20
|
-
steps {
|
21
|
-
sh 'docker-compose build --pull'
|
22
|
-
}
|
23
|
-
}
|
24
|
-
stage('Lint') {
|
25
|
-
steps {
|
26
|
-
sh '''
|
27
|
-
docker-compose run --rm app /bin/bash -lc \
|
28
|
-
"rvm-exec 2.6 bundle exec rubocop --fail-level autocorrect"
|
29
|
-
'''
|
30
|
-
}
|
31
|
-
}
|
32
|
-
stage('Unit Tests') {
|
33
|
-
steps { script { parallel buildMatrix } }
|
34
|
-
}
|
35
|
-
stage('Contract Tests') {
|
36
|
-
steps {
|
37
|
-
sh 'docker-compose run app /bin/bash -l -c "rvm-exec 2.6 bundle exec rspec -t pact"'
|
38
|
-
}
|
39
|
-
}
|
40
|
-
stage ('Publish') {
|
41
|
-
when { environment name: "GERRIT_EVENT_TYPE", value: "change-merged"}
|
42
|
-
environment {
|
43
|
-
PACT_BROKER_PASSWORD = credentials('pact_broker_password')
|
44
|
-
JENKINS_URL = "${env.JENKINS_URL}"
|
45
|
-
PACT_CONSUMER_TAG = 'master'
|
46
|
-
PACT_BROKER_USERNAME = 'quizzes'
|
47
|
-
PACT_BROKER_HOST = 'inst-pact-broker.inseng.net'
|
48
|
-
}
|
49
|
-
steps {
|
50
|
-
script {
|
51
|
-
sh '''
|
52
|
-
sha="$(git rev-parse --short HEAD)"
|
53
|
-
|
54
|
-
docker-compose run --rm \
|
55
|
-
-e JENKINS_URL="${JENKINS_URL}" \
|
56
|
-
-e PACT_BROKER_HOST="${PACT_BROKER_HOST}" \
|
57
|
-
-e PACT_BROKER_USERNAME="${PACT_BROKER_USERNAME}" \
|
58
|
-
-e PACT_BROKER_PASSWORD="${PACT_BROKER_PASSWORD}" \
|
59
|
-
-e PACT_CONSUMER_TAG="${PACT_CONSUMER_TAG}" \
|
60
|
-
-e SHA="${sha}" \
|
61
|
-
app /bin/bash -l -c "rvm-exec 2.6 bundle exec rake broker:pact:publish:jenkins_post_merge"
|
62
|
-
'''
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
post {
|
69
|
-
success {
|
70
|
-
sh "docker cp \"${env.BUILD_ID}-ruby-2.6:/usr/src/app/coverage\" ."
|
71
|
-
publishHTML target: [
|
72
|
-
allowMissing: false,
|
73
|
-
alwaysLinkToLastBuild: false,
|
74
|
-
keepAll: true,
|
75
|
-
reportDir: "coverage",
|
76
|
-
reportFiles: 'index.html',
|
77
|
-
reportName: 'Coverage Report'
|
78
|
-
]
|
79
|
-
}
|
80
|
-
cleanup { // Always runs after all other post conditions=
|
81
|
-
sh 'docker-compose kill'
|
82
|
-
sh 'docker-compose rm -f'
|
83
|
-
sh 'docker images -qf "dangling=true" | xargs docker rmi -f &>/dev/null'
|
84
|
-
}
|
85
|
-
}
|
86
|
-
}
|
data/bin/console
DELETED
data/bin/contracts-generate
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
function print_results() {
|
4
|
-
exit_code=$?
|
5
|
-
set +e
|
6
|
-
|
7
|
-
if [[ "$exit_code" == "0" ]]; then
|
8
|
-
echo "Success! Open http://pact-broker.docker to view your published pact file."
|
9
|
-
else
|
10
|
-
echo "Oops! Something went wrong."
|
11
|
-
fi
|
12
|
-
|
13
|
-
docker cp contracts:/usr/src/app/log . &> /dev/null
|
14
|
-
docker cp contracts:/usr/src/app/pacts . &> /dev/null
|
15
|
-
docker rm -f contracts &> /dev/null
|
16
|
-
|
17
|
-
docker-compose rm -fv app &> /dev/null
|
18
|
-
}
|
19
|
-
trap print_results INT TERM EXIT
|
20
|
-
set -e
|
21
|
-
|
22
|
-
rm -rf pacts
|
23
|
-
sha="$(git rev-parse --short HEAD)"
|
24
|
-
|
25
|
-
docker-compose run --name contracts -e SHA="${sha}" app bash -l -c \
|
26
|
-
"bundle && bundle exec rspec --tag pact && bundle exec rake broker:pact:publish:local"
|
data/bin/setup
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
function print_results() {
|
4
|
-
exit_code=$?
|
5
|
-
set +e
|
6
|
-
|
7
|
-
echo ""
|
8
|
-
|
9
|
-
if [[ "$exit_code" == "0" ]]; then
|
10
|
-
echo "Success!"
|
11
|
-
else
|
12
|
-
echo "Something went wrong! Check the output above for details."
|
13
|
-
fi
|
14
|
-
}
|
15
|
-
trap print_results INT TERM EXIT
|
16
|
-
set -e
|
17
|
-
|
18
|
-
OSNAME=$(uname | tr "[:upper:]" "[:lower:]")
|
19
|
-
|
20
|
-
function generate_docker_override_os () {
|
21
|
-
sed -E "s/#(.*# ${OSNAME}$)/\1/"
|
22
|
-
}
|
23
|
-
|
24
|
-
function generate_docker_override_filesystem () {
|
25
|
-
if [ -z "${IGNORE_FILESYSTEM_OVERRIDE}" ]; then
|
26
|
-
sed -E "s/#(.*# ${OSNAME}:fs)/\1/"
|
27
|
-
else
|
28
|
-
cat
|
29
|
-
fi
|
30
|
-
}
|
31
|
-
|
32
|
-
function generate_docker_override() {
|
33
|
-
if [ -e docker-compose.override.yml ]; then
|
34
|
-
echo "We found an existing docker-compose.override.yml"
|
35
|
-
echo ""
|
36
|
-
echo "You'll want to merge that file with the version controlled
|
37
|
-
docker-compose.dev.override.yml file to make sure you've got
|
38
|
-
the most recent changes"
|
39
|
-
echo ""
|
40
|
-
else
|
41
|
-
echo "we are building the development example override file to docker-compose.override.yml for you"
|
42
|
-
generate_docker_override_os < docker-compose.dev.override.yml | \
|
43
|
-
generate_docker_override_filesystem > docker-compose.override.yml
|
44
|
-
fi
|
45
|
-
}
|
46
|
-
|
47
|
-
function os_linux_specific_setup() {
|
48
|
-
mkdir -p log pacts
|
49
|
-
}
|
50
|
-
|
51
|
-
os_specific_setup() {
|
52
|
-
echo Configuring for "${OSNAME}"
|
53
|
-
case ${OSNAME} in
|
54
|
-
linux)
|
55
|
-
os_linux_specific_setup
|
56
|
-
;;
|
57
|
-
esac
|
58
|
-
}
|
59
|
-
|
60
|
-
os_specific_setup
|
61
|
-
generate_docker_override
|
62
|
-
|
63
|
-
echo ""
|
64
|
-
echo "Preparing environment for native development..."
|
65
|
-
bundle install
|
@@ -1,11 +0,0 @@
|
|
1
|
-
version: '3.5'
|
2
|
-
|
3
|
-
services:
|
4
|
-
app:
|
5
|
-
# This port doesn't exist, but doing this tricks Dory proxy into hooking up
|
6
|
-
# the container so it can actually talk to the Pact Broker.
|
7
|
-
expose: [8080]
|
8
|
-
external_links:
|
9
|
-
- ${PROXY_CONTAINER:-dinghy_http_proxy}:pact-broker.docker
|
10
|
-
volumes:
|
11
|
-
- .:/usr/src/app
|