quiz_api_client 4.25.0 → 4.27.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 +4 -4
- data/README.md +9 -0
- data/lib/quiz_api_client/config.rb +6 -1
- data/lib/quiz_api_client/http_client.rb +2 -1
- data/lib/quiz_api_client/version.rb +1 -1
- data/spec/config_spec.rb +12 -0
- data/spec/http_client_spec.rb +1 -0
- metadata +12 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 10ceea5a7b48cb12714e234faec4cdfc7bc1cf9f21534b3681dd5184869801d6
|
|
4
|
+
data.tar.gz: 86aa04c57d79dfb8604b87632376643cc5a14063bcad654053fd9c47306d8b6b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcd4be13012bc3eed170e292c2d11c63e58a79417fe94f1d81a10a9b665d382f66dd7aadf13ad1c1e0ed497b9499cf4b3b9713174243aed4b37879ba591506c8
|
|
7
|
+
data.tar.gz: 59763294f14c72eba1c9acb0a1ac134592e687b4e7f65ba02164fe4dd1fcbd198c3d7a0850babff21e5367f4f0ad632835dcb4144a10c34b9429699a0391f461
|
data/README.md
CHANGED
|
@@ -188,6 +188,15 @@ You can also run `bundle exec rake console` for an interactive prompt that will
|
|
|
188
188
|
|
|
189
189
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
190
190
|
|
|
191
|
+
# Development with Docker
|
|
192
|
+
|
|
193
|
+
1. Install Docker
|
|
194
|
+
2. Use the following command to start a temporary container and run a bash shell:
|
|
195
|
+
|
|
196
|
+
```shell
|
|
197
|
+
docker compose -f docker-compose.yml -f docker-compose.dev.override.yml run --rm app /bin/bash
|
|
198
|
+
```
|
|
199
|
+
|
|
191
200
|
## Development with Quiz LTI
|
|
192
201
|
|
|
193
202
|
Copy this repo inside the Quiz LTI docker container:
|
|
@@ -2,6 +2,7 @@ module QuizApiClient
|
|
|
2
2
|
class Config
|
|
3
3
|
DEFAULT_ALLOWABLE_RESPONSE_CODES = [401, 422].freeze
|
|
4
4
|
DEFAULT_PROTOCOL = 'https'.freeze
|
|
5
|
+
DEFAULT_USER_AGENT = "QuizApiClient/#{QuizApiClient::VERSION} (Ruby)".freeze
|
|
5
6
|
ERROR_HANDLERS = %i[sentry_raven sentry_rails].freeze
|
|
6
7
|
METRICS_HANDLERS = %i[inststatsd].freeze
|
|
7
8
|
|
|
@@ -10,7 +11,7 @@ module QuizApiClient
|
|
|
10
11
|
class InvalidMetricsNamespace < StandardError; end
|
|
11
12
|
|
|
12
13
|
attr_reader :error_handler, :metrics_handler, :metrics_namespace
|
|
13
|
-
attr_writer :protocol, :allowable_response_codes
|
|
14
|
+
attr_writer :protocol, :allowable_response_codes, :user_agent
|
|
14
15
|
attr_accessor :consumer_key, :consumer_request_id, :host, :shared_secret
|
|
15
16
|
|
|
16
17
|
def initialize
|
|
@@ -39,6 +40,10 @@ module QuizApiClient
|
|
|
39
40
|
@allowable_response_codes || DEFAULT_ALLOWABLE_RESPONSE_CODES
|
|
40
41
|
end
|
|
41
42
|
|
|
43
|
+
def user_agent
|
|
44
|
+
@user_agent || DEFAULT_USER_AGENT
|
|
45
|
+
end
|
|
46
|
+
|
|
42
47
|
private
|
|
43
48
|
|
|
44
49
|
def validate_error_handler!(handler)
|
|
@@ -123,7 +123,8 @@ module QuizApiClient
|
|
|
123
123
|
'Authorization' => jwt,
|
|
124
124
|
'AuthType' => 'Signature',
|
|
125
125
|
'Accept' => 'application/json',
|
|
126
|
-
'Content-Type' => 'application/json'
|
|
126
|
+
'Content-Type' => 'application/json',
|
|
127
|
+
'User-Agent' => config.user_agent
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
|
data/spec/config_spec.rb
CHANGED
|
@@ -30,6 +30,18 @@ describe QuizApiClient::Config do
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
describe '#user_agent' do
|
|
34
|
+
it 'returns the default when not set' do
|
|
35
|
+
config = described_class.new
|
|
36
|
+
expect(config.user_agent).to eq QuizApiClient::Config::DEFAULT_USER_AGENT
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'returns the configured value when set' do
|
|
40
|
+
config = described_class.new { |c| c.user_agent = 'canvas-lms/2026.05.0' }
|
|
41
|
+
expect(config.user_agent).to eq 'canvas-lms/2026.05.0'
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
33
45
|
describe '#setup_metrics' do
|
|
34
46
|
let(:valid_handler) { :inststatsd }
|
|
35
47
|
let(:invalid_handler) { :invalid_handler }
|
data/spec/http_client_spec.rb
CHANGED
|
@@ -188,6 +188,7 @@ describe QuizApiClient::HttpClient do
|
|
|
188
188
|
'AuthType' => 'Signature',
|
|
189
189
|
'Accept' => 'application/json',
|
|
190
190
|
'Content-Type' => 'application/json',
|
|
191
|
+
'User-Agent' => QuizApiClient::Config::DEFAULT_USER_AGENT,
|
|
191
192
|
'X-Consumer-Request-Id' => 'hi'
|
|
192
193
|
)
|
|
193
194
|
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.
|
|
4
|
+
version: 4.27.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Slaughter
|
|
@@ -15,7 +15,7 @@ authors:
|
|
|
15
15
|
autorequire:
|
|
16
16
|
bindir: exe
|
|
17
17
|
cert_chain: []
|
|
18
|
-
date: 2026-
|
|
18
|
+
date: 2026-05-26 00:00:00.000000000 Z
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
21
21
|
name: httparty
|
|
@@ -35,16 +35,22 @@ dependencies:
|
|
|
35
35
|
name: jwt
|
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- - "
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '2'
|
|
41
|
+
- - "<"
|
|
39
42
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
43
|
+
version: '4'
|
|
41
44
|
type: :runtime
|
|
42
45
|
prerelease: false
|
|
43
46
|
version_requirements: !ruby/object:Gem::Requirement
|
|
44
47
|
requirements:
|
|
45
|
-
- - "
|
|
48
|
+
- - ">="
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: '2'
|
|
51
|
+
- - "<"
|
|
46
52
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
53
|
+
version: '4'
|
|
48
54
|
- !ruby/object:Gem::Dependency
|
|
49
55
|
name: link_header
|
|
50
56
|
requirement: !ruby/object:Gem::Requirement
|