quiz_api_client 0.1.10 → 0.2.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 +13 -118
- data/lib/quiz_api_client.rb +2 -8
- data/lib/quiz_api_client/services/base_api_service.rb +0 -18
- data/lib/quiz_api_client/services/item_analyses_service.rb +4 -19
- data/lib/quiz_api_client/services/qti_imports_service.rb +2 -15
- data/lib/quiz_api_client/services/quiz_analyses_service.rb +2 -15
- data/lib/quiz_api_client/services/quiz_session_events_service.rb +2 -15
- data/lib/quiz_api_client/services/quiz_session_result_service.rb +2 -15
- data/lib/quiz_api_client/services/quiz_session_service.rb +4 -34
- data/lib/quiz_api_client/services/quiz_sessions_service.rb +2 -19
- data/lib/quiz_api_client/services/quizzes_service.rb +4 -21
- data/lib/quiz_api_client/version.rb +1 -1
- metadata +3 -5
- data/lib/quiz_api_client/services/banks_service.rb +0 -18
- data/lib/quiz_api_client/services/quiz_service.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed3490344641f0e0df9d58e273898318046a844a
|
4
|
+
data.tar.gz: 4236414000e6d07afb262f9373868af3b01bfc78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77d1d3fc2d9551f3b8fb1e0797e50fddabb061de4a6accee921be7a6001e150e05a96a5ea3b0f69028d5435059443b0d4651162900e3a9a27460a51307ee2a9c
|
7
|
+
data.tar.gz: fc94ceeb363da8a649e5aeab0d60f1e782f4ab2f03508fe3dfa12c30ed638adccd38988ea3903e812ba24c24c6c875cb46782de1e13f642a00bfc4bb88f25f36
|
data/README.md
CHANGED
@@ -43,7 +43,7 @@ JWTs are created without hitting quiz_api and and they are validated on quiz_api
|
|
43
43
|
|
44
44
|
Example, generate a token for building:
|
45
45
|
```ruby
|
46
|
-
client.
|
46
|
+
client.jwt_service.grant_permission(
|
47
47
|
scope: client.quiz_service.scope_build,
|
48
48
|
exp: Time.now.utc.to_i + 60, # some reasonable time, obviously longer is more a security risk
|
49
49
|
resource_id: 1)
|
@@ -52,95 +52,34 @@ client.quiz_service.token(
|
|
52
52
|
### Calling the API
|
53
53
|
|
54
54
|
Example, create a Quiz:
|
55
|
+
|
55
56
|
```ruby
|
56
57
|
client.quizzes_service.create(
|
57
58
|
params: {
|
58
59
|
title: 'My quiz'
|
59
|
-
}
|
60
|
+
},
|
61
|
+
token: my_scoped_token
|
60
62
|
)
|
61
63
|
```
|
62
64
|
|
63
65
|
### Currently Supported Functionality
|
64
66
|
|
65
|
-
#### Banks Service
|
66
|
-
|
67
|
-
**Tokens**
|
68
|
-
```ruby
|
69
|
-
# Generate Build token
|
70
|
-
client.banks_service.token(
|
71
|
-
scope: client.banks_service.scope_build,
|
72
|
-
exp: some_expiration
|
73
|
-
)
|
74
|
-
```
|
75
|
-
|
76
|
-
#### Quiz Service
|
77
|
-
|
78
|
-
**Tokens**
|
79
|
-
```ruby
|
80
|
-
# Generate Build token
|
81
|
-
client.quiz_service.token(
|
82
|
-
scope: client.quiz_service.scope_build,
|
83
|
-
exp: some_expiration,
|
84
|
-
resource_id: quiz_id_here
|
85
|
-
)
|
86
|
-
```
|
87
|
-
|
88
67
|
#### Quizzes Service
|
89
68
|
|
90
|
-
**Tokens**
|
91
|
-
```ruby
|
92
|
-
# Generate token: Create Quiz
|
93
|
-
client.quizzes_service.token(
|
94
|
-
scope: client.quizzes_service.scope_create,
|
95
|
-
exp: some_expiration
|
96
|
-
)
|
97
|
-
|
98
|
-
# List Quizzes
|
99
|
-
client.quizzes_service.token(
|
100
|
-
scope: client.quizzes_service.scope_list,
|
101
|
-
exp: some_expiration
|
102
|
-
)
|
103
|
-
```
|
104
|
-
|
105
|
-
**API Calls**
|
106
69
|
```ruby
|
107
70
|
# Create Quiz
|
108
|
-
client.quizzes_service.create(params:)
|
71
|
+
client.quizzes_service.create(token:, params:)
|
109
72
|
|
110
73
|
# List Quizzes
|
111
|
-
client.quizzes_service.list(params:)
|
74
|
+
client.quizzes_service.list(token:, params:)
|
112
75
|
```
|
113
76
|
|
114
77
|
#### Quiz Session Service
|
115
78
|
|
116
|
-
**Tokens**
|
117
|
-
```ruby
|
118
|
-
# Generate token: Grade Quiz Session
|
119
|
-
client.quiz_session_service.token(
|
120
|
-
scope: client.quiz_session_service.scope_grade,
|
121
|
-
exp: some_expiration,
|
122
|
-
resource_id: quiz_session_id
|
123
|
-
)
|
124
|
-
|
125
|
-
# Generate token: Take Quiz Session
|
126
|
-
client.quiz_session_service.token(
|
127
|
-
scope: client.quiz_session_service.scope_take,
|
128
|
-
exp: some_expiration,
|
129
|
-
resource_id: quiz_session_id
|
130
|
-
)
|
131
|
-
|
132
|
-
# Generate token: Update Quiz Session
|
133
|
-
client.quiz_session_service.token(
|
134
|
-
scope: client.quiz_session_service.scope_update,
|
135
|
-
exp: some_expiration,
|
136
|
-
resource_id: quiz_session_id
|
137
|
-
)
|
138
|
-
```
|
139
|
-
|
140
|
-
**API Calls**
|
141
79
|
```ruby
|
142
80
|
# Update Quiz Session
|
143
81
|
client.quiz_session_service.update(
|
82
|
+
token: my_scoped_token,
|
144
83
|
params: {
|
145
84
|
id: quiz_session_id,
|
146
85
|
# Other params here
|
@@ -150,19 +89,10 @@ client.quiz_session_service.update(
|
|
150
89
|
|
151
90
|
#### Quiz Sessions Service
|
152
91
|
|
153
|
-
**Tokens**
|
154
|
-
```ruby
|
155
|
-
# Generate token: Create Quiz Session
|
156
|
-
client.quiz_sessions_service.token(
|
157
|
-
scope: client.quiz_sessions_service.scope_create,
|
158
|
-
exp: some_expiration
|
159
|
-
)
|
160
|
-
```
|
161
|
-
|
162
|
-
**API Calls**
|
163
92
|
```ruby
|
164
93
|
# Create Quiz Session
|
165
94
|
client.quiz_sessions_service.create(
|
95
|
+
token: my_scoped_token,
|
166
96
|
params: {
|
167
97
|
quiz_id: quiz_id_to_create_session_under
|
168
98
|
}
|
@@ -171,19 +101,10 @@ client.quiz_sessions_service.create(
|
|
171
101
|
|
172
102
|
#### QTI Imports Service
|
173
103
|
|
174
|
-
**Tokens**
|
175
|
-
```ruby
|
176
|
-
# Generate token: Create Qti Import
|
177
|
-
client.qti_imports_service.token(
|
178
|
-
scope: client.quizzes_service.scope_create,
|
179
|
-
exp: some_expiration
|
180
|
-
)
|
181
|
-
```
|
182
|
-
|
183
|
-
**API Calls**
|
184
104
|
```ruby
|
185
105
|
# Create QTI Import
|
186
106
|
client.qti_imports_service.create(
|
107
|
+
token: my_scoped_token,
|
187
108
|
params: {
|
188
109
|
quiz_id: quiz_id_to_create_import_under,
|
189
110
|
qti_import: {
|
@@ -195,25 +116,17 @@ client.qti_imports_service.create(
|
|
195
116
|
|
196
117
|
#### Item Analyses Service
|
197
118
|
|
198
|
-
**Tokens**
|
199
|
-
```ruby
|
200
|
-
# Generate token: Fetch Item Analyses
|
201
|
-
client.item_analyses_service.token(
|
202
|
-
scope: client.item_analyses_service.scope_analysis,
|
203
|
-
exp: some_expiration
|
204
|
-
)
|
205
|
-
```
|
206
|
-
|
207
|
-
**API Calls**
|
208
119
|
```ruby
|
209
120
|
# List item analyses
|
210
121
|
client.item_analyses_service.list(
|
122
|
+
token: my_scoped_token,
|
211
123
|
params: {
|
212
124
|
quiz_id: quiz_id_to_list_items_under
|
213
125
|
}
|
214
126
|
)
|
215
127
|
# get specific item analysis
|
216
128
|
client.item_analyses_service.get(
|
129
|
+
token: my_scoped_token,
|
217
130
|
params: {
|
218
131
|
quiz_id: quiz_id_to_list_items_under,
|
219
132
|
id: item_id_to_get_under
|
@@ -223,19 +136,10 @@ client.item_analyses_service.get(
|
|
223
136
|
|
224
137
|
#### Quiz Analyses Service
|
225
138
|
|
226
|
-
**Tokens**
|
227
|
-
```ruby
|
228
|
-
# Generate token: Fetch Quiz Analyses
|
229
|
-
client.quiz_analyses_service.token(
|
230
|
-
scope: client.quiz_analyses_service.scope_analysis,
|
231
|
-
exp: some_expiration
|
232
|
-
)
|
233
|
-
```
|
234
|
-
|
235
|
-
**API Calls**
|
236
139
|
```ruby
|
237
140
|
# get specific item analysis
|
238
141
|
client.quiz_analyses_service.get(
|
142
|
+
token: my_scoped_token,
|
239
143
|
params: {
|
240
144
|
quiz_id: quiz_id_to_get_analysis
|
241
145
|
}
|
@@ -244,19 +148,10 @@ client.quiz_analyses_service.get(
|
|
244
148
|
|
245
149
|
#### Quiz Session Events Service
|
246
150
|
|
247
|
-
**Tokens**
|
248
|
-
```ruby
|
249
|
-
# Generate token: Fetch Quiz Session Events
|
250
|
-
client.quiz_session_events_service.token(
|
251
|
-
scope: client.quiz_session_events_service.scope_list,
|
252
|
-
exp: some_expiration
|
253
|
-
)
|
254
|
-
```
|
255
|
-
|
256
|
-
**API Calls**
|
257
151
|
```ruby
|
258
152
|
# list quiz session events
|
259
153
|
client.quiz_session_events_service.list(
|
154
|
+
token: my_scoped_token,
|
260
155
|
params: {
|
261
156
|
quiz_session_id: quiz_session_id_to_get_events_under
|
262
157
|
}
|
data/lib/quiz_api_client.rb
CHANGED
@@ -12,12 +12,8 @@ module QuizApiClient
|
|
12
12
|
@protocol = protocol
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
@
|
17
|
-
end
|
18
|
-
|
19
|
-
def quiz_service
|
20
|
-
@_quiz_service ||= Services::QuizService.new(service_params)
|
15
|
+
def jwt_service
|
16
|
+
@_jwt_service ||= QuizApiClient::Services::JwtService.new(service_params)
|
21
17
|
end
|
22
18
|
|
23
19
|
def quizzes_service
|
@@ -69,11 +65,9 @@ require 'quiz_api_client/http_client'
|
|
69
65
|
require 'quiz_api_client/services/jwt_service'
|
70
66
|
require 'quiz_api_client/services/base_api_service'
|
71
67
|
|
72
|
-
require 'quiz_api_client/services/banks_service'
|
73
68
|
require 'quiz_api_client/services/item_analyses_service'
|
74
69
|
require 'quiz_api_client/services/qti_imports_service'
|
75
70
|
require 'quiz_api_client/services/quiz_analyses_service'
|
76
|
-
require 'quiz_api_client/services/quiz_service'
|
77
71
|
require 'quiz_api_client/services/quiz_session_events_service'
|
78
72
|
require 'quiz_api_client/services/quiz_session_service'
|
79
73
|
require 'quiz_api_client/services/quiz_sessions_service'
|
@@ -14,28 +14,10 @@ module QuizApiClient::Services
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def token_for_api(default_token = nil, scope = nil, resource_id = nil)
|
18
|
-
return default_token unless default_token.nil?
|
19
|
-
generate_token(scope: scope, resource_id: resource_id)
|
20
|
-
end
|
21
|
-
|
22
17
|
def uri
|
23
18
|
URI.parse("#{protocol}://#{host}").to_s
|
24
19
|
end
|
25
20
|
|
26
|
-
def generate_token(scope:, exp: nil, resource_id: nil)
|
27
|
-
jwt_service.grant_permission(scope: scope, exp: exp, resource_id: resource_id)
|
28
|
-
end
|
29
|
-
|
30
|
-
def jwt_service
|
31
|
-
QuizApiClient::Services::JwtService.new(
|
32
|
-
consumer_key: consumer_key,
|
33
|
-
host: URI.parse("#{protocol}://#{host}").host,
|
34
|
-
shared_secret: shared_secret,
|
35
|
-
protocol: protocol
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
21
|
def client(token:)
|
40
22
|
QuizApiClient::HttpClient.new(
|
41
23
|
uri: uri,
|
@@ -1,34 +1,19 @@
|
|
1
1
|
module QuizApiClient::Services
|
2
2
|
class ItemAnalysesService < BaseApiService
|
3
|
-
def
|
4
|
-
return unless allowed_scopes.include?(scope)
|
5
|
-
generate_token(scope: scope, exp: exp, resource_id: resource_id)
|
6
|
-
end
|
7
|
-
|
8
|
-
def list(params:, default_token: nil)
|
3
|
+
def list(params:, token: nil)
|
9
4
|
raise 'Quiz Id Required' unless params.key?(:quiz_id)
|
10
|
-
client(token:
|
5
|
+
client(token: token).get(
|
11
6
|
"/api/quizzes/#{params[:quiz_id]}/stats/item_analyses",
|
12
7
|
{}
|
13
8
|
)
|
14
9
|
end
|
15
10
|
|
16
|
-
def get(params:,
|
11
|
+
def get(params:, token: nil)
|
17
12
|
raise 'Quiz Id and Item Id are Required' unless params.key?(:id) && params.key?(:quiz_id)
|
18
|
-
client(token:
|
13
|
+
client(token: token).get(
|
19
14
|
"/api/quizzes/#{params[:quiz_id]}/stats/item_analyses/#{params[:id]}",
|
20
15
|
{}
|
21
16
|
)
|
22
17
|
end
|
23
|
-
|
24
|
-
def scope_analysis
|
25
|
-
'quiz.analysis'
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def allowed_scopes
|
31
|
-
[scope_analysis]
|
32
|
-
end
|
33
18
|
end
|
34
19
|
end
|
@@ -1,17 +1,8 @@
|
|
1
1
|
module QuizApiClient::Services
|
2
2
|
class QtiImportsService < BaseApiService
|
3
|
-
def
|
4
|
-
return unless allowed_scopes.include?(scope)
|
5
|
-
generate_token(scope: scope, exp: exp, resource_id: resource_id)
|
6
|
-
end
|
7
|
-
|
8
|
-
def create(params:, default_token: nil)
|
3
|
+
def create(params:, token: nil)
|
9
4
|
raise 'Quiz Id Required' unless params && params[:quiz_id]
|
10
|
-
post_to_quiz_api(params: params, token:
|
11
|
-
end
|
12
|
-
|
13
|
-
def scope_create
|
14
|
-
'qti_import.create'
|
5
|
+
post_to_quiz_api(params: params, token: token)
|
15
6
|
end
|
16
7
|
|
17
8
|
private
|
@@ -22,9 +13,5 @@ module QuizApiClient::Services
|
|
22
13
|
qti_import: params
|
23
14
|
)
|
24
15
|
end
|
25
|
-
|
26
|
-
def allowed_scopes
|
27
|
-
[scope_create]
|
28
|
-
end
|
29
16
|
end
|
30
17
|
end
|
@@ -1,17 +1,8 @@
|
|
1
1
|
module QuizApiClient::Services
|
2
2
|
class QuizAnalysesService < BaseApiService
|
3
|
-
def
|
4
|
-
return unless allowed_scopes.include?(scope)
|
5
|
-
generate_token(scope: scope, exp: exp, resource_id: resource_id)
|
6
|
-
end
|
7
|
-
|
8
|
-
def get(params:, default_token: nil)
|
3
|
+
def get(params:, token: nil)
|
9
4
|
raise 'Quiz Id Required' unless params.key?(:quiz_id)
|
10
|
-
get_from_quiz_api(params: params, token:
|
11
|
-
end
|
12
|
-
|
13
|
-
def scope_analysis
|
14
|
-
'quiz.analysis'
|
5
|
+
get_from_quiz_api(params: params, token: token)
|
15
6
|
end
|
16
7
|
|
17
8
|
private
|
@@ -22,9 +13,5 @@ module QuizApiClient::Services
|
|
22
13
|
{}
|
23
14
|
)
|
24
15
|
end
|
25
|
-
|
26
|
-
def allowed_scopes
|
27
|
-
[scope_analysis]
|
28
|
-
end
|
29
16
|
end
|
30
17
|
end
|
@@ -1,17 +1,8 @@
|
|
1
1
|
module QuizApiClient::Services
|
2
2
|
class QuizSessionEventsService < BaseApiService
|
3
|
-
def
|
4
|
-
return unless allowed_scopes.include?(scope)
|
5
|
-
generate_token(scope: scope, exp: exp, resource_id: resource_id)
|
6
|
-
end
|
7
|
-
|
8
|
-
def list(params:, default_token: nil)
|
3
|
+
def list(params:, token: nil)
|
9
4
|
raise 'Quiz Session Id Required' unless params.key?(:quiz_session_id)
|
10
|
-
get_from_quiz_api(params: params, token:
|
11
|
-
end
|
12
|
-
|
13
|
-
def scope_list
|
14
|
-
'quiz_sessions.log'
|
5
|
+
get_from_quiz_api(params: params, token: token)
|
15
6
|
end
|
16
7
|
|
17
8
|
private
|
@@ -22,9 +13,5 @@ module QuizApiClient::Services
|
|
22
13
|
{}
|
23
14
|
)
|
24
15
|
end
|
25
|
-
|
26
|
-
def allowed_scopes
|
27
|
-
[scope_list]
|
28
|
-
end
|
29
16
|
end
|
30
17
|
end
|
@@ -1,17 +1,8 @@
|
|
1
1
|
module QuizApiClient::Services
|
2
2
|
class QuizSessionResultService < BaseApiService
|
3
|
-
def
|
4
|
-
return unless allowed_scopes.include?(scope)
|
5
|
-
generate_token(scope: scope, exp: exp, resource_id: resource_id)
|
6
|
-
end
|
7
|
-
|
8
|
-
def show(params:, default_token: nil)
|
3
|
+
def show(params:, token: nil)
|
9
4
|
raise 'Quiz Session Result Id Required' unless params && params[:id]
|
10
|
-
get_from_quiz_api(params: params, token:
|
11
|
-
end
|
12
|
-
|
13
|
-
def scope_show
|
14
|
-
'quiz_session_result.show'
|
5
|
+
get_from_quiz_api(params: params, token: token)
|
15
6
|
end
|
16
7
|
|
17
8
|
private
|
@@ -21,9 +12,5 @@ module QuizApiClient::Services
|
|
21
12
|
"/api/results/#{params[:id]}"
|
22
13
|
)
|
23
14
|
end
|
24
|
-
|
25
|
-
def allowed_scopes
|
26
|
-
[scope_show]
|
27
|
-
end
|
28
15
|
end
|
29
16
|
end
|
@@ -1,33 +1,12 @@
|
|
1
1
|
module QuizApiClient::Services
|
2
2
|
class QuizSessionService < BaseApiService
|
3
|
-
def
|
4
|
-
|
5
|
-
generate_token(scope: scope, exp: exp, resource_id: resource_id)
|
3
|
+
def update(params:, token: nil)
|
4
|
+
patch_to_quiz_api(params: params, token: token)
|
6
5
|
end
|
7
6
|
|
8
|
-
def
|
9
|
-
patch_to_quiz_api(params: params, token: token_for_api(default_token, scope_update, params[:id]))
|
10
|
-
end
|
11
|
-
|
12
|
-
def show(params:, default_token: nil)
|
7
|
+
def show(params:, token: nil)
|
13
8
|
raise 'Quiz Session Id Required' unless params && params[:id]
|
14
|
-
get_from_quiz_api(params: params, token:
|
15
|
-
end
|
16
|
-
|
17
|
-
def scope_update
|
18
|
-
'quiz_session.update'
|
19
|
-
end
|
20
|
-
|
21
|
-
def scope_take
|
22
|
-
'quiz_session.take'
|
23
|
-
end
|
24
|
-
|
25
|
-
def scope_grade
|
26
|
-
'quiz_session.grade'
|
27
|
-
end
|
28
|
-
|
29
|
-
def scope_show
|
30
|
-
'quiz_session.show'
|
9
|
+
get_from_quiz_api(params: params, token: token)
|
31
10
|
end
|
32
11
|
|
33
12
|
private
|
@@ -44,14 +23,5 @@ module QuizApiClient::Services
|
|
44
23
|
"/api/quiz_sessions/#{params[:id]}"
|
45
24
|
)
|
46
25
|
end
|
47
|
-
|
48
|
-
def allowed_scopes
|
49
|
-
[
|
50
|
-
scope_grade,
|
51
|
-
scope_take,
|
52
|
-
scope_update,
|
53
|
-
scope_show
|
54
|
-
]
|
55
|
-
end
|
56
26
|
end
|
57
27
|
end
|
@@ -1,21 +1,8 @@
|
|
1
1
|
module QuizApiClient::Services
|
2
2
|
class QuizSessionsService < BaseApiService
|
3
|
-
def
|
4
|
-
return unless allowed_scopes.include?(scope)
|
5
|
-
generate_token(scope: scope, exp: exp, resource_id: resource_id)
|
6
|
-
end
|
7
|
-
|
8
|
-
def create(params:, default_token: nil)
|
3
|
+
def create(params:, token: nil)
|
9
4
|
raise 'Quiz Id Required' unless params && params[:quiz_id]
|
10
|
-
post_to_quiz_api(params: params, token:
|
11
|
-
end
|
12
|
-
|
13
|
-
def scope_create
|
14
|
-
'quiz_session.create'
|
15
|
-
end
|
16
|
-
|
17
|
-
def scope_list
|
18
|
-
'quiz_sessions.list'
|
5
|
+
post_to_quiz_api(params: params, token: token)
|
19
6
|
end
|
20
7
|
|
21
8
|
private
|
@@ -26,9 +13,5 @@ module QuizApiClient::Services
|
|
26
13
|
quiz_session: params
|
27
14
|
)
|
28
15
|
end
|
29
|
-
|
30
|
-
def allowed_scopes
|
31
|
-
[scope_create, scope_list]
|
32
|
-
end
|
33
16
|
end
|
34
17
|
end
|
@@ -1,24 +1,11 @@
|
|
1
1
|
module QuizApiClient::Services
|
2
2
|
class QuizzesService < BaseApiService
|
3
|
-
def
|
4
|
-
|
5
|
-
generate_token(scope: scope, exp: exp, resource_id: resource_id)
|
3
|
+
def create(params:, token: nil)
|
4
|
+
post_to_quiz_api(params: params, token: token)
|
6
5
|
end
|
7
6
|
|
8
|
-
def
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
def list(params:, default_token: nil)
|
13
|
-
get_from_quiz_api(params: params, token: token_for_api(default_token, scope_list))
|
14
|
-
end
|
15
|
-
|
16
|
-
def scope_create
|
17
|
-
'quiz.create'
|
18
|
-
end
|
19
|
-
|
20
|
-
def scope_list
|
21
|
-
'quiz.list'
|
7
|
+
def list(params:, token: nil)
|
8
|
+
get_from_quiz_api(params: params, token: token)
|
22
9
|
end
|
23
10
|
|
24
11
|
private
|
@@ -36,9 +23,5 @@ module QuizApiClient::Services
|
|
36
23
|
params
|
37
24
|
)
|
38
25
|
end
|
39
|
-
|
40
|
-
def allowed_scopes
|
41
|
-
[scope_create, scope_list]
|
42
|
-
end
|
43
26
|
end
|
44
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quiz_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -130,13 +130,11 @@ files:
|
|
130
130
|
- docker-compose.yml
|
131
131
|
- lib/quiz_api_client.rb
|
132
132
|
- lib/quiz_api_client/http_client.rb
|
133
|
-
- lib/quiz_api_client/services/banks_service.rb
|
134
133
|
- lib/quiz_api_client/services/base_api_service.rb
|
135
134
|
- lib/quiz_api_client/services/item_analyses_service.rb
|
136
135
|
- lib/quiz_api_client/services/jwt_service.rb
|
137
136
|
- lib/quiz_api_client/services/qti_imports_service.rb
|
138
137
|
- lib/quiz_api_client/services/quiz_analyses_service.rb
|
139
|
-
- lib/quiz_api_client/services/quiz_service.rb
|
140
138
|
- lib/quiz_api_client/services/quiz_session_events_service.rb
|
141
139
|
- lib/quiz_api_client/services/quiz_session_result_service.rb
|
142
140
|
- lib/quiz_api_client/services/quiz_session_service.rb
|
@@ -163,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
161
|
version: '0'
|
164
162
|
requirements: []
|
165
163
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.5.
|
164
|
+
rubygems_version: 2.5.1
|
167
165
|
signing_key:
|
168
166
|
specification_version: 4
|
169
167
|
summary: Ruby client for quiz_api
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module QuizApiClient::Services
|
2
|
-
class BanksService < BaseApiService
|
3
|
-
def token(scope:, exp: nil, resource_id: nil)
|
4
|
-
return unless allowed_scopes.include?(scope)
|
5
|
-
generate_token(scope: scope, exp: exp, resource_id: resource_id)
|
6
|
-
end
|
7
|
-
|
8
|
-
def scope_build
|
9
|
-
'banks.build'
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
def allowed_scopes
|
15
|
-
[scope_build]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module QuizApiClient::Services
|
2
|
-
class QuizService < BaseApiService
|
3
|
-
def token(scope:, exp: nil, resource_id: nil)
|
4
|
-
return unless allowed_scopes.include?(scope)
|
5
|
-
generate_token(scope: scope, exp: exp, resource_id: resource_id)
|
6
|
-
end
|
7
|
-
|
8
|
-
private
|
9
|
-
|
10
|
-
def allowed_scopes
|
11
|
-
['quiz.build', 'quiz.analysis']
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|