quiz_api_client 4.19.0 → 4.20.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 790a9d7b1622cf0d9d98e9eb3f62c1e481178223ee8e8f32f2461be744c2577a
|
4
|
+
data.tar.gz: 36c83c014b77e91890c91e6f3081c38ef2d81965d274196dd5559eb9f644a556
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0a74a8ea7236a4778eaeb13dd1d1e98d3f18d766260ca6151fbab889b7e036e3dc588282f587342fce1b2c867a690c8d6d091df8e2c04c117dcd164dd46d2d6
|
7
|
+
data.tar.gz: c00de63348f7bf03c024ff5eb5f81d379139168a8e22faeedecacd7aa17692959a77a23e0ecefcc46c722ab0ce93a1ae0fd15536754a6ae0882dc746951d9d76
|
@@ -8,6 +8,10 @@ module QuizApiClient::Services
|
|
8
8
|
get_from_quiz_api(params: params, token: token, all: all)
|
9
9
|
end
|
10
10
|
|
11
|
+
def quiz_question_counts(params:, token: nil, all: false)
|
12
|
+
get_quiz_question_counts(params: params, token: token, all: all)
|
13
|
+
end
|
14
|
+
|
11
15
|
private
|
12
16
|
|
13
17
|
def post_to_quiz_api(params:, token:)
|
@@ -24,5 +28,13 @@ module QuizApiClient::Services
|
|
24
28
|
query: params
|
25
29
|
)
|
26
30
|
end
|
31
|
+
|
32
|
+
def get_quiz_question_counts(params:, token:, all:)
|
33
|
+
client(token: token).get(
|
34
|
+
'/api/quizzes/question_count',
|
35
|
+
all: all,
|
36
|
+
query: params
|
37
|
+
)
|
38
|
+
end
|
27
39
|
end
|
28
40
|
end
|
@@ -68,4 +68,42 @@ describe QuizApiClient::Services::QuizzesService do
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
71
|
+
|
72
|
+
describe '#quiz_question_counts' do
|
73
|
+
let(:quiz_ids) { [1, 2, 3] }
|
74
|
+
let(:params) { { quiz_ids: quiz_ids } }
|
75
|
+
let(:stubbed_response) { { 'quiz_id' => '1', 'question_count' => 10 } }
|
76
|
+
|
77
|
+
context 'on success' do
|
78
|
+
before do
|
79
|
+
query_params = URI.encode_www_form(quiz_ids.map { |id| ['quiz_ids[]', id] })
|
80
|
+
expected_url = "https://#{host}/api/quizzes/question_count?#{query_params}"
|
81
|
+
stub_request(:get, expected_url)
|
82
|
+
.to_return(
|
83
|
+
status: 200,
|
84
|
+
body: [stubbed_response].to_json,
|
85
|
+
headers: { 'Content-Type' => 'application/json' }
|
86
|
+
)
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'gets quiz_api/api/quizzes/question_count and returns the response' do
|
90
|
+
result = subject.quiz_question_counts(params: params, token: 'token')
|
91
|
+
expect(result.parsed_response[0]).to eql(stubbed_response)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context 'on failure' do
|
96
|
+
let(:status_code) { 401 }
|
97
|
+
before do
|
98
|
+
expected_url = "https://#{host}/api/quizzes/question_count"
|
99
|
+
stub_request(:get, expected_url)
|
100
|
+
.to_return(status: status_code)
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'returns the response with the correct code' do
|
104
|
+
response = subject.quiz_question_counts(params: nil, token: 'token')
|
105
|
+
expect(response.code).to eq(status_code)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
71
109
|
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.20.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: 2025-
|
18
|
+
date: 2025-04-15 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: httparty
|