quiz_api_client 4.25.0 → 4.26.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/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 +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 182251d8d198f02d1428d74caf6b3216ca7f5a919a6b2eeec7ac2c4c932df208
|
|
4
|
+
data.tar.gz: e8ec9ef5a7b469d01a246417705ffb4cb80bbe82b69786ccd6635a789bc60efe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c5ef1655f96677079f022b6f014a244795702708e3ec48d88b16f7982c72a2d35fe3e755d6e509f0dab7e2e8e50ae71145d93dc5384ef304b5a69f48d4561e6
|
|
7
|
+
data.tar.gz: f700f9a028f4ecbcc7fd34866e6690093a4af5b084cfb999f9873269c56f3d970c76ed380a4d53f5895a46517f8a58a623ffdcc693f2d89784f97d0a314d18b1
|
|
@@ -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.26.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-08 00:00:00.000000000 Z
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
21
21
|
name: httparty
|