quiz_api_client 3.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +28 -0
- data/Dockerfile +3 -2
- data/Jenkinsfile +21 -6
- data/README.md +4 -0
- data/bin/contracts-generate +2 -3
- data/lib/quiz_api_client/config.rb +43 -0
- data/lib/quiz_api_client/http_client.rb +67 -10
- data/lib/quiz_api_client/services/base_api_service.rb +5 -11
- data/lib/quiz_api_client/services/jwt_service.rb +7 -8
- data/lib/quiz_api_client/services/qti_imports_service.rb +14 -5
- data/lib/quiz_api_client/version.rb +1 -1
- data/lib/quiz_api_client.rb +33 -36
- data/quiz_api_client.gemspec +4 -2
- metadata +27 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f901bb687e405ab11127e8cbbe476f38c3578d122d838b25438cc106287b4d83
|
4
|
+
data.tar.gz: 6bae389bad7c912f709747a00a562e42cd10e4b85d1d72f5a7c5ffff6564ae61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 519030cead9c1d820cf40bb489029433f751ce41e6488dcddfd7a8520ea2c47c5fa7a8a96e0aaea59640793f0efcc7fcd825c3d5e2fbe026533cb9d18208fd18
|
7
|
+
data.tar.gz: b906985f27f6e78e734f248685ae071efde9414cc3198d5a214caf9d54d8c1d2f29e6cc7d9e53677eac2c1c1d4d9bbd3016f3cea210173c1cf00628784d18507
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,28 @@
|
|
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
|
+
## 4.1.0 (2021-10-27)
|
10
|
+
|
11
|
+
### Breaking changes (potentially)
|
12
|
+
|
13
|
+
* All non-successful (2xx) responses will raise `QuizApiClient::HttpClient::RequestFailed` error except for 401 and 422
|
14
|
+
* Can be overridden in `allowable_response_codes` config
|
15
|
+
|
16
|
+
## 4.0.0 (2021-10-18)
|
17
|
+
|
18
|
+
### Breaking changes
|
19
|
+
|
20
|
+
* Ruby 2.4.x is no longer supported
|
21
|
+
* Ruby 2.5.x is no longer supported
|
22
|
+
|
23
|
+
### Changed
|
24
|
+
* Minimum Ruby version to 2.6.x
|
25
|
+
* Internal classes use a configuration object instead parameters on instantiation
|
26
|
+
* Instantiating `QuizApiClient::Client` remains the same
|
27
|
+
* Added `error_handler` configuration to work with Sentry Raven gem
|
28
|
+
|
data/Dockerfile
CHANGED
@@ -4,8 +4,9 @@ RUN mkdir -p coverage log pacts
|
|
4
4
|
|
5
5
|
COPY --chown=docker:docker quiz_api_client.gemspec Gemfile ./
|
6
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.
|
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"
|
8
9
|
|
9
10
|
COPY --chown=docker:docker . .
|
10
11
|
|
11
|
-
CMD /bin/bash -l -c "rvm-exec 2.
|
12
|
+
CMD /bin/bash -l -c "rvm-exec 2.6 bundle exec rspec"
|
data/Jenkinsfile
CHANGED
@@ -1,7 +1,20 @@
|
|
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
|
+
|
1
10
|
pipeline {
|
2
11
|
agent {
|
3
12
|
label 'docker'
|
4
13
|
}
|
14
|
+
options {
|
15
|
+
buildDiscarder(logRotator(numToKeepStr: '50'))
|
16
|
+
timeout(time: 20, unit: 'MINUTES')
|
17
|
+
}
|
5
18
|
stages {
|
6
19
|
stage('Build') {
|
7
20
|
steps {
|
@@ -12,14 +25,16 @@ pipeline {
|
|
12
25
|
steps {
|
13
26
|
sh '''
|
14
27
|
docker-compose run --rm app /bin/bash -lc \
|
15
|
-
"rvm-exec 2.
|
28
|
+
"rvm-exec 2.6 bundle exec rubocop --fail-level autocorrect"
|
16
29
|
'''
|
17
30
|
}
|
18
31
|
}
|
19
|
-
stage('
|
32
|
+
stage('Unit Tests') {
|
33
|
+
steps { script { parallel buildMatrix } }
|
34
|
+
}
|
35
|
+
stage('Contract Tests') {
|
20
36
|
steps {
|
21
|
-
sh 'docker-compose run
|
22
|
-
sh 'docker-compose run app /bin/bash -l -c "rvm-exec 2.4 bundle exec rspec -t pact"'
|
37
|
+
sh 'docker-compose run app /bin/bash -l -c "rvm-exec 2.6 bundle exec rspec -t pact"'
|
23
38
|
}
|
24
39
|
}
|
25
40
|
stage ('Publish') {
|
@@ -43,7 +58,7 @@ pipeline {
|
|
43
58
|
-e PACT_BROKER_PASSWORD="${PACT_BROKER_PASSWORD}" \
|
44
59
|
-e PACT_CONSUMER_TAG="${PACT_CONSUMER_TAG}" \
|
45
60
|
-e SHA="${sha}" \
|
46
|
-
app /bin/bash -l -c "rvm-exec 2.
|
61
|
+
app /bin/bash -l -c "rvm-exec 2.6 bundle exec rake broker:pact:publish:jenkins_post_merge"
|
47
62
|
'''
|
48
63
|
}
|
49
64
|
}
|
@@ -52,7 +67,7 @@ pipeline {
|
|
52
67
|
|
53
68
|
post {
|
54
69
|
success {
|
55
|
-
sh
|
70
|
+
sh "docker cp \"${env.BUILD_ID}-ruby-2.6:/usr/src/app/coverage\" ."
|
56
71
|
publishHTML target: [
|
57
72
|
allowMissing: false,
|
58
73
|
alwaysLinkToLastBuild: false,
|
data/README.md
CHANGED
@@ -37,6 +37,10 @@ client = QuizApiClient::Client.new(
|
|
37
37
|
)
|
38
38
|
```
|
39
39
|
|
40
|
+
### Error Handler
|
41
|
+
|
42
|
+
In order to set addition error information in your error handling system, you can set the `error_hander` property of the config. The list of valid values can be found in the `QuizApiClient::Config::ERROR_HANDLERS` constant.
|
43
|
+
|
40
44
|
### Creation of Tokens
|
41
45
|
|
42
46
|
JWTs are created without hitting quiz_api and and they are validated on quiz_api. Tokens are created for a given scope, expiration, and an optional resource_id.
|
data/bin/contracts-generate
CHANGED
@@ -22,6 +22,5 @@ set -e
|
|
22
22
|
rm -rf pacts
|
23
23
|
sha="$(git rev-parse --short HEAD)"
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
"bundle && bundle exec rspec spec/contracts && bundle exec rake broker:pact:publish:local"
|
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"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module QuizApiClient
|
2
|
+
class Config
|
3
|
+
DEFAULT_ALLOWABLE_RESPONSE_CODES = [401, 422].freeze
|
4
|
+
DEFAULT_PROTOCOL = 'https'.freeze
|
5
|
+
ERROR_HANDLERS = %i[sentry_raven].freeze
|
6
|
+
|
7
|
+
class InvalidErrorHandler < StandardError; end
|
8
|
+
|
9
|
+
attr_reader :error_handler
|
10
|
+
attr_writer :protocol, :allowable_response_codes
|
11
|
+
attr_accessor :consumer_key, :consumer_request_id, :host, :shared_secret
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
yield(self) if block_given?
|
15
|
+
end
|
16
|
+
|
17
|
+
def protocol
|
18
|
+
@protocol || DEFAULT_PROTOCOL
|
19
|
+
end
|
20
|
+
|
21
|
+
def error_handler=(handler)
|
22
|
+
validate_error_hander!(handler)
|
23
|
+
|
24
|
+
@error_handler = handler
|
25
|
+
end
|
26
|
+
|
27
|
+
def allowable_response_codes
|
28
|
+
@allowable_response_codes || DEFAULT_ALLOWABLE_RESPONSE_CODES
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def validate_error_hander!(handler)
|
34
|
+
return unless handler
|
35
|
+
|
36
|
+
unless ERROR_HANDLERS.include?(handler)
|
37
|
+
raise InvalidErrorHandler, "It must be one of the following: #{ERROR_HANDLERS.inspect}"
|
38
|
+
end
|
39
|
+
|
40
|
+
@error_handler = handler.to_sym
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -4,14 +4,21 @@ module QuizApiClient
|
|
4
4
|
class HttpClient
|
5
5
|
include HTTParty
|
6
6
|
|
7
|
-
class RequestFailed < StandardError
|
7
|
+
class RequestFailed < StandardError
|
8
|
+
attr_reader :context
|
8
9
|
|
9
|
-
|
10
|
+
def initialize(context)
|
11
|
+
@context = context
|
12
|
+
super(context)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_reader :jwt, :uri, :config
|
10
17
|
|
11
|
-
def initialize(uri:, jwt:,
|
18
|
+
def initialize(uri:, jwt:, config:, logging: true, log_level: :info)
|
12
19
|
@uri = uri
|
13
20
|
@jwt = jwt
|
14
|
-
@
|
21
|
+
@config = config
|
15
22
|
initialize_logger(log_level) if logging
|
16
23
|
end
|
17
24
|
|
@@ -49,7 +56,7 @@ module QuizApiClient
|
|
49
56
|
HTTParty::Logger.add_formatter('quiz_api_client_json_formatter', QuizApiClient::JSONFormatter)
|
50
57
|
@logger = ::Logger.new(
|
51
58
|
STDOUT,
|
52
|
-
formatter: proc { |_, _, _, msg| msg.merge(consumer_request_id:
|
59
|
+
formatter: proc { |_, _, _, msg| msg.merge(consumer_request_id: config.consumer_request_id).to_json },
|
53
60
|
level: unfriendly_logger_level(log_level)
|
54
61
|
)
|
55
62
|
@logger_config = {
|
@@ -75,13 +82,15 @@ module QuizApiClient
|
|
75
82
|
end
|
76
83
|
|
77
84
|
def make_request(method, url, request_options = {})
|
78
|
-
self.class.send(
|
85
|
+
resp = self.class.send(
|
79
86
|
method,
|
80
87
|
url,
|
81
88
|
default_request_data.merge(request_options)
|
82
89
|
)
|
90
|
+
raise_error(method, url, response: resp) unless successful_response?(resp)
|
91
|
+
resp
|
83
92
|
rescue HTTParty::Error, Errno::ECONNREFUSED, Net::ReadTimeout => e
|
84
|
-
|
93
|
+
raise_error(method, url, current_error: e)
|
85
94
|
end
|
86
95
|
|
87
96
|
def make_paginated_request(method, url, options)
|
@@ -91,8 +100,6 @@ module QuizApiClient
|
|
91
100
|
|
92
101
|
until request_url.nil?
|
93
102
|
resp = make_request(method, request_url, request_options)
|
94
|
-
raise RequestFailed, "#{url} responded #{resp.body} (#{resp.code})" unless resp.code == 200
|
95
|
-
|
96
103
|
entities.concat(resp.parsed_response)
|
97
104
|
request_url, request_options = next_page(resp, url, options)
|
98
105
|
end
|
@@ -109,7 +116,7 @@ module QuizApiClient
|
|
109
116
|
}
|
110
117
|
}
|
111
118
|
|
112
|
-
initial_hash[:headers]['X-Consumer-Request-Id'] =
|
119
|
+
initial_hash[:headers]['X-Consumer-Request-Id'] = config.consumer_request_id if config.consumer_request_id
|
113
120
|
|
114
121
|
initial_hash.merge!(@logger_config) if @logger_config
|
115
122
|
initial_hash
|
@@ -138,5 +145,55 @@ module QuizApiClient
|
|
138
145
|
)
|
139
146
|
[url, options.merge(query: query)]
|
140
147
|
end
|
148
|
+
|
149
|
+
def generate_error_context(method, url, response = nil)
|
150
|
+
context = {
|
151
|
+
quiz_api_client: {
|
152
|
+
request: {
|
153
|
+
method: method,
|
154
|
+
url: url
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
if response
|
160
|
+
context[:quiz_api_client][:response] = {
|
161
|
+
body: response.body,
|
162
|
+
code: response.code
|
163
|
+
}
|
164
|
+
end
|
165
|
+
|
166
|
+
context
|
167
|
+
end
|
168
|
+
|
169
|
+
def record_error_context(context)
|
170
|
+
case config.error_handler
|
171
|
+
when :sentry_raven
|
172
|
+
require 'sentry-raven'
|
173
|
+
Raven.extra_context(context)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def error_message(current_error, url, response)
|
178
|
+
if current_error && response
|
179
|
+
"#{current_error.message}: #{url} responded #{response.body} (#{response.code})"
|
180
|
+
elsif current_error
|
181
|
+
current_error.message
|
182
|
+
elsif response
|
183
|
+
"#{url} responded #{response.body} (#{response.code})"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
def raise_error(method, url, response: nil, current_error: nil, error_class: RequestFailed)
|
188
|
+
context = generate_error_context(method, url, response)
|
189
|
+
|
190
|
+
record_error_context(context)
|
191
|
+
|
192
|
+
raise error_class.new(context), error_message(current_error, url, response)
|
193
|
+
end
|
194
|
+
|
195
|
+
def successful_response?(resp)
|
196
|
+
resp.success? || config.allowable_response_codes.include?(resp.code)
|
197
|
+
end
|
141
198
|
end
|
142
199
|
end
|
@@ -1,29 +1,23 @@
|
|
1
1
|
module QuizApiClient::Services
|
2
2
|
class BaseApiService
|
3
|
-
attr_reader :
|
3
|
+
attr_reader :config
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
|
7
|
-
)
|
8
|
-
@consumer_key = consumer_key
|
9
|
-
@consumer_request_id = consumer_request_id
|
10
|
-
@host = host
|
11
|
-
@protocol = protocol
|
12
|
-
@shared_secret = shared_secret
|
5
|
+
def initialize(config)
|
6
|
+
@config = config
|
13
7
|
@errors = []
|
14
8
|
end
|
15
9
|
|
16
10
|
private
|
17
11
|
|
18
12
|
def uri
|
19
|
-
URI.parse("#{protocol}://#{host}").to_s
|
13
|
+
URI.parse("#{config.protocol}://#{config.host}").to_s
|
20
14
|
end
|
21
15
|
|
22
16
|
def client(token:)
|
23
17
|
QuizApiClient::HttpClient.new(
|
24
18
|
uri: uri,
|
25
19
|
jwt: token,
|
26
|
-
|
20
|
+
config: config
|
27
21
|
)
|
28
22
|
end
|
29
23
|
end
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module QuizApiClient::Services
|
2
2
|
class JwtService
|
3
|
+
extend Forwardable
|
4
|
+
|
3
5
|
HASHING_ALGORITHM = 'HS512'.freeze
|
4
6
|
|
5
|
-
attr_reader :
|
7
|
+
attr_reader :config
|
8
|
+
def_delegators :config, :host, :protocol, :consumer_key
|
6
9
|
|
7
|
-
def initialize(
|
8
|
-
@
|
9
|
-
@host = host
|
10
|
-
@shared_secret = shared_secret
|
11
|
-
@protocol = protocol
|
12
|
-
@consumer_request_id = consumer_request_id
|
10
|
+
def initialize(config)
|
11
|
+
@config = config
|
13
12
|
end
|
14
13
|
|
15
14
|
def grant_permission(scope:, exp: nil, uuid: nil, **additional_fields)
|
@@ -26,7 +25,7 @@ module QuizApiClient::Services
|
|
26
25
|
payload[:user][:uuid] = uuid
|
27
26
|
end
|
28
27
|
|
29
|
-
JWT.encode(payload, shared_secret, HASHING_ALGORITHM)
|
28
|
+
JWT.encode(payload, config.shared_secret, HASHING_ALGORITHM)
|
30
29
|
end
|
31
30
|
end
|
32
31
|
end
|
@@ -3,16 +3,25 @@ module QuizApiClient::Services
|
|
3
3
|
def create(params:, token: nil)
|
4
4
|
raise 'Quiz Id Required' unless params && params[:quiz_id]
|
5
5
|
|
6
|
-
|
6
|
+
client(token: token).post(
|
7
|
+
"/api/quizzes/#{params[:quiz_id]}/qti_imports",
|
8
|
+
qti_import: params
|
9
|
+
)
|
7
10
|
end
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
def post_to_quiz_api(params:, token:)
|
12
|
+
def banks(params:, token: nil)
|
12
13
|
client(token: token).post(
|
13
|
-
|
14
|
+
'/api/qti_imports/banks',
|
14
15
|
qti_import: params
|
15
16
|
)
|
16
17
|
end
|
18
|
+
|
19
|
+
def get_imported_consumer_settings(params:, token: nil)
|
20
|
+
raise 'Quiz Id Required' unless params && params[:quiz_id]
|
21
|
+
|
22
|
+
client(token: token).get(
|
23
|
+
"/api/quizzes/#{params[:quiz_id]}/qti_imports/imported_consumer_settings"
|
24
|
+
)
|
25
|
+
end
|
17
26
|
end
|
18
27
|
end
|
data/lib/quiz_api_client.rb
CHANGED
@@ -4,104 +4,101 @@ require 'link_header'
|
|
4
4
|
|
5
5
|
module QuizApiClient
|
6
6
|
class Client
|
7
|
-
|
7
|
+
extend Forwardable
|
8
|
+
|
9
|
+
def_delegators :config, :consumer_key, :consumer_request_id, :host, :protocol, :shared_secret
|
8
10
|
|
9
11
|
def initialize(consumer_key:, host:, shared_secret:, protocol: 'https', consumer_request_id: nil)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
config.consumer_key = consumer_key
|
13
|
+
config.host = host
|
14
|
+
config.shared_secret = shared_secret
|
15
|
+
config.protocol = protocol
|
16
|
+
config.consumer_request_id = consumer_request_id
|
17
|
+
|
18
|
+
yield(config) if block_given?
|
19
|
+
end
|
20
|
+
|
21
|
+
def config
|
22
|
+
@_config ||= QuizApiClient::Config.new
|
15
23
|
end
|
16
24
|
|
17
25
|
def jwt_service
|
18
|
-
@_jwt_service ||= QuizApiClient::Services::JwtService.new(
|
26
|
+
@_jwt_service ||= QuizApiClient::Services::JwtService.new(config)
|
19
27
|
end
|
20
28
|
|
21
29
|
def quiz_service
|
22
|
-
@_quiz_service ||= Services::QuizService.new(
|
30
|
+
@_quiz_service ||= Services::QuizService.new(config)
|
23
31
|
end
|
24
32
|
|
25
33
|
def quizzes_service
|
26
|
-
@_quizzes_service ||= Services::QuizzesService.new(
|
34
|
+
@_quizzes_service ||= Services::QuizzesService.new(config)
|
27
35
|
end
|
28
36
|
|
29
37
|
def quiz_session_service
|
30
|
-
@_quiz_session_service ||= Services::QuizSessionService.new(
|
38
|
+
@_quiz_session_service ||= Services::QuizSessionService.new(config)
|
31
39
|
end
|
32
40
|
|
33
41
|
def quiz_sessions_service
|
34
|
-
@_quiz_sessions_service ||= Services::QuizSessionsService.new(
|
42
|
+
@_quiz_sessions_service ||= Services::QuizSessionsService.new(config)
|
35
43
|
end
|
36
44
|
|
37
45
|
def quiz_clone_job_service
|
38
|
-
@_quiz_clone_job_service ||= Services::QuizCloneJobService.new(
|
46
|
+
@_quiz_clone_job_service ||= Services::QuizCloneJobService.new(config)
|
39
47
|
end
|
40
48
|
|
41
49
|
def quiz_clone_jobs_service
|
42
|
-
@_quiz_clone_jobs_service ||= Services::QuizCloneJobsService.new(
|
50
|
+
@_quiz_clone_jobs_service ||= Services::QuizCloneJobsService.new(config)
|
43
51
|
end
|
44
52
|
|
45
53
|
def qti_imports_service
|
46
|
-
@_qti_imports_service ||= Services::QtiImportsService.new(
|
54
|
+
@_qti_imports_service ||= Services::QtiImportsService.new(config)
|
47
55
|
end
|
48
56
|
|
49
57
|
def item_analyses_service
|
50
|
-
@_item_analyses_service ||= Services::ItemAnalysesService.new(
|
58
|
+
@_item_analyses_service ||= Services::ItemAnalysesService.new(config)
|
51
59
|
end
|
52
60
|
|
53
61
|
def quiz_analyses_service
|
54
|
-
@_quiz_analyses_service ||= Services::QuizAnalysesService.new(
|
62
|
+
@_quiz_analyses_service ||= Services::QuizAnalysesService.new(config)
|
55
63
|
end
|
56
64
|
|
57
65
|
def quiz_session_events_service
|
58
|
-
@_quiz_session_events_service ||= Services::QuizSessionEventsService.new(
|
66
|
+
@_quiz_session_events_service ||= Services::QuizSessionEventsService.new(config)
|
59
67
|
end
|
60
68
|
|
61
69
|
def quiz_session_result_service
|
62
|
-
@_quiz_session_result_service ||= Services::QuizSessionResultService.new(
|
70
|
+
@_quiz_session_result_service ||= Services::QuizSessionResultService.new(config)
|
63
71
|
end
|
64
72
|
|
65
73
|
def quiz_entries_service
|
66
|
-
@_quiz_entries_service ||= Services::QuizEntriesService.new(
|
74
|
+
@_quiz_entries_service ||= Services::QuizEntriesService.new(config)
|
67
75
|
end
|
68
76
|
|
69
77
|
def session_items_service
|
70
|
-
@_session_items_service ||= Services::SessionItemsService.new(
|
78
|
+
@_session_items_service ||= Services::SessionItemsService.new(config)
|
71
79
|
end
|
72
80
|
|
73
81
|
def session_item_results_service
|
74
|
-
@_session_item_results_service ||= Services::SessionItemResultsService.new(
|
82
|
+
@_session_item_results_service ||= Services::SessionItemResultsService.new(config)
|
75
83
|
end
|
76
84
|
|
77
85
|
def items_service
|
78
|
-
@_items_service ||= QuizApiClient::Services::ItemsService.new(
|
86
|
+
@_items_service ||= QuizApiClient::Services::ItemsService.new(config)
|
79
87
|
end
|
80
88
|
|
81
89
|
def interaction_types_service
|
82
|
-
@_interaction_types_service ||= QuizApiClient::Services::InteractionTypesService.new(
|
90
|
+
@_interaction_types_service ||= QuizApiClient::Services::InteractionTypesService.new(config)
|
83
91
|
end
|
84
92
|
|
85
93
|
def shared_banks
|
86
|
-
@_shared_banks ||= QuizApiClient::Services::SharedBanks.new(
|
87
|
-
end
|
88
|
-
|
89
|
-
private
|
90
|
-
|
91
|
-
def service_params
|
92
|
-
{
|
93
|
-
consumer_key: consumer_key,
|
94
|
-
consumer_request_id: consumer_request_id,
|
95
|
-
host: host,
|
96
|
-
protocol: protocol,
|
97
|
-
shared_secret: shared_secret
|
98
|
-
}
|
94
|
+
@_shared_banks ||= QuizApiClient::Services::SharedBanks.new(config)
|
99
95
|
end
|
100
96
|
end
|
101
97
|
end
|
102
98
|
|
103
99
|
require 'quiz_api_client/version'
|
104
100
|
|
101
|
+
require 'quiz_api_client/config'
|
105
102
|
require 'quiz_api_client/http_client'
|
106
103
|
require 'quiz_api_client/json_formatter'
|
107
104
|
require 'quiz_api_client/services/jwt_service'
|
data/quiz_api_client.gemspec
CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
'Han Yan',
|
14
14
|
'Jayce Higgins',
|
15
15
|
'Marc Alan Phillips',
|
16
|
+
'Mark Starkman',
|
16
17
|
'Michael Brewer-Davis',
|
17
18
|
'Michael Hargiss',
|
18
19
|
'Omar Khan',
|
@@ -26,6 +27,7 @@ Gem::Specification.new do |spec|
|
|
26
27
|
'hyan@instructure.com',
|
27
28
|
'jhiggins@instructure.com',
|
28
29
|
'mphillips@instructure.com',
|
30
|
+
'mark.starkman@instructure.com',
|
29
31
|
'mbd@instructure.com',
|
30
32
|
'mhargiss@instructure.com',
|
31
33
|
'okhan@instructure.com',
|
@@ -40,18 +42,18 @@ Gem::Specification.new do |spec|
|
|
40
42
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
41
43
|
spec.require_paths = ['lib']
|
42
44
|
|
43
|
-
spec.required_ruby_version = '>= 2.
|
45
|
+
spec.required_ruby_version = '>= 2.6'
|
44
46
|
|
45
47
|
spec.add_dependency 'httparty', '~> 0.17'
|
46
48
|
spec.add_dependency 'jwt', '~> 2.2'
|
47
49
|
spec.add_dependency 'link_header', '~> 0.0'
|
48
50
|
|
49
|
-
spec.add_development_dependency 'bundler', '~> 1.17'
|
50
51
|
spec.add_development_dependency 'pact', '~> 1.41'
|
51
52
|
spec.add_development_dependency 'pact_broker-client', '~> 1.19'
|
52
53
|
spec.add_development_dependency 'rake', '~> 12.3'
|
53
54
|
spec.add_development_dependency 'rspec', '~> 3.8'
|
54
55
|
spec.add_development_dependency 'rubocop', '~> 0.74.0'
|
56
|
+
spec.add_development_dependency 'sentry-raven', '~> 3.1'
|
55
57
|
spec.add_development_dependency 'simplecov'
|
56
58
|
spec.add_development_dependency 'webmock'
|
57
59
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quiz_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wang
|
@@ -11,15 +11,16 @@ authors:
|
|
11
11
|
- Han Yan
|
12
12
|
- Jayce Higgins
|
13
13
|
- Marc Alan Phillips
|
14
|
+
- Mark Starkman
|
14
15
|
- Michael Brewer-Davis
|
15
16
|
- Michael Hargiss
|
16
17
|
- Omar Khan
|
17
18
|
- Robin Kuss
|
18
19
|
- Ryan Taylor
|
19
|
-
autorequire:
|
20
|
+
autorequire:
|
20
21
|
bindir: exe
|
21
22
|
cert_chain: []
|
22
|
-
date:
|
23
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
23
24
|
dependencies:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: httparty
|
@@ -63,20 +64,6 @@ dependencies:
|
|
63
64
|
- - "~>"
|
64
65
|
- !ruby/object:Gem::Version
|
65
66
|
version: '0.0'
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: bundler
|
68
|
-
requirement: !ruby/object:Gem::Requirement
|
69
|
-
requirements:
|
70
|
-
- - "~>"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '1.17'
|
73
|
-
type: :development
|
74
|
-
prerelease: false
|
75
|
-
version_requirements: !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
77
|
-
- - "~>"
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: '1.17'
|
80
67
|
- !ruby/object:Gem::Dependency
|
81
68
|
name: pact
|
82
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,6 +134,20 @@ dependencies:
|
|
147
134
|
- - "~>"
|
148
135
|
- !ruby/object:Gem::Version
|
149
136
|
version: 0.74.0
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: sentry-raven
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '3.1'
|
144
|
+
type: :development
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - "~>"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '3.1'
|
150
151
|
- !ruby/object:Gem::Dependency
|
151
152
|
name: simplecov
|
152
153
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,7 +176,7 @@ dependencies:
|
|
175
176
|
- - ">="
|
176
177
|
- !ruby/object:Gem::Version
|
177
178
|
version: '0'
|
178
|
-
description:
|
179
|
+
description:
|
179
180
|
email:
|
180
181
|
- acallejas@instructure.com
|
181
182
|
- bpetty@instructure.com
|
@@ -183,6 +184,7 @@ email:
|
|
183
184
|
- hyan@instructure.com
|
184
185
|
- jhiggins@instructure.com
|
185
186
|
- mphillips@instructure.com
|
187
|
+
- mark.starkman@instructure.com
|
186
188
|
- mbd@instructure.com
|
187
189
|
- mhargiss@instructure.com
|
188
190
|
- okhan@instructure.com
|
@@ -198,6 +200,7 @@ files:
|
|
198
200
|
- ".gitignore"
|
199
201
|
- ".rspec"
|
200
202
|
- ".rubocop.yml"
|
203
|
+
- CHANGELOG.md
|
201
204
|
- Dockerfile
|
202
205
|
- Gemfile
|
203
206
|
- Jenkinsfile
|
@@ -209,6 +212,7 @@ files:
|
|
209
212
|
- docker-compose.dev.override.yml
|
210
213
|
- docker-compose.yml
|
211
214
|
- lib/quiz_api_client.rb
|
215
|
+
- lib/quiz_api_client/config.rb
|
212
216
|
- lib/quiz_api_client/http_client.rb
|
213
217
|
- lib/quiz_api_client/json_formatter.rb
|
214
218
|
- lib/quiz_api_client/services/base_api_service.rb
|
@@ -232,10 +236,10 @@ files:
|
|
232
236
|
- lib/quiz_api_client/services/shared_banks.rb
|
233
237
|
- lib/quiz_api_client/version.rb
|
234
238
|
- quiz_api_client.gemspec
|
235
|
-
homepage:
|
239
|
+
homepage:
|
236
240
|
licenses: []
|
237
241
|
metadata: {}
|
238
|
-
post_install_message:
|
242
|
+
post_install_message:
|
239
243
|
rdoc_options: []
|
240
244
|
require_paths:
|
241
245
|
- lib
|
@@ -243,16 +247,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
243
247
|
requirements:
|
244
248
|
- - ">="
|
245
249
|
- !ruby/object:Gem::Version
|
246
|
-
version: '2.
|
250
|
+
version: '2.6'
|
247
251
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
252
|
requirements:
|
249
253
|
- - ">="
|
250
254
|
- !ruby/object:Gem::Version
|
251
255
|
version: '0'
|
252
256
|
requirements: []
|
253
|
-
|
254
|
-
|
255
|
-
signing_key:
|
257
|
+
rubygems_version: 3.1.6
|
258
|
+
signing_key:
|
256
259
|
specification_version: 4
|
257
260
|
summary: Ruby client for quiz_api
|
258
261
|
test_files: []
|