bearcat 0.9.20 → 0.9.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bearcat.gemspec +1 -0
- data/lib/bearcat/client.rb +2 -0
- data/lib/bearcat/client/quizzes.rb +18 -0
- data/lib/bearcat/version.rb +1 -1
- data/spec/bearcat/client/quizzes_spec.rb +31 -0
- data/spec/fixtures/quizzes/course_quiz.json +62 -0
- data/spec/fixtures/quizzes/course_quizzes.json +126 -0
- data/spec/fixtures/quizzes/quiz_extension.json +12 -0
- metadata +25 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1f65e93775b144f2e01c51973a63f9ce1d91b39
|
4
|
+
data.tar.gz: 36d57632ebb7d4f9c8cf82587b580f96778c7967
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b2ac0654b168c2cb3118cfeac68be7acaf7c80a931837c947e94d84440ca5253df3fd1c8662f04f2001a747e67e53b9d5526059ff701101df20b7fe6c5ce087
|
7
|
+
data.tar.gz: dde7a8fea817f725f05c765546135d5eb722816a9245fe33ed51190c10a86841c5f7f45ce1fa0d171a50f029f787f036195279ad6f245006f44d0c2e234b1aad
|
data/bearcat.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.add_development_dependency "bundler", ">= 1.0.0"
|
23
23
|
gem.add_development_dependency "rspec", "~> 2.6"
|
24
24
|
gem.add_development_dependency "webmock"
|
25
|
+
gem.add_development_dependency 'pry'
|
25
26
|
|
26
27
|
gem.add_dependency "footrest", ">= 0.2.2"
|
27
28
|
end
|
data/lib/bearcat/client.rb
CHANGED
@@ -21,6 +21,7 @@ module Bearcat
|
|
21
21
|
require 'bearcat/client/canvas_files'
|
22
22
|
require 'bearcat/client/calendar_events'
|
23
23
|
require 'bearcat/client/discussions'
|
24
|
+
require 'bearcat/client/quizzes'
|
24
25
|
|
25
26
|
include Assignments
|
26
27
|
include Accounts
|
@@ -41,6 +42,7 @@ module Bearcat
|
|
41
42
|
include CalendarEvents
|
42
43
|
include Discussions
|
43
44
|
include FileHelper
|
45
|
+
include Quizzes
|
44
46
|
|
45
47
|
|
46
48
|
# Override Footrest request for ApiArray support
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Bearcat
|
2
|
+
class Client < Footrest::Client
|
3
|
+
module Quizzes
|
4
|
+
|
5
|
+
def list_course_quizzes(course, params={})
|
6
|
+
get("/api/v1/courses/#{course}/quizzes", params)
|
7
|
+
end
|
8
|
+
|
9
|
+
def quiz(course, quiz, params={})
|
10
|
+
get("/api/v1/courses/#{course}/quizzes/#{quiz}", params)
|
11
|
+
end
|
12
|
+
|
13
|
+
def quiz_extensions(course, params={})
|
14
|
+
post("/api/v1/courses/#{course}/quiz_extensions", params)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/bearcat/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Bearcat::Client::Quizzes do
|
4
|
+
before do
|
5
|
+
@client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "returns a courses quizzes" do
|
9
|
+
stub_get(@client, "/api/v1/courses/1/quizzes").to_return(json_response("quizzes/course_quizzes.json"))
|
10
|
+
course_quizzes = @client.list_course_quizzes('1')
|
11
|
+
course_quizzes.class.should eq(Bearcat::ApiArray)
|
12
|
+
course_quizzes.count.should == 2
|
13
|
+
course_quizzes.first['id'].should == 37
|
14
|
+
course_quizzes.last['id'].should == 38
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns a single quiz" do
|
18
|
+
stub_get(@client, "/api/v1/courses/1/quizzes/38").to_return(json_response("quizzes/course_quiz.json"))
|
19
|
+
course_quiz = @client.quiz('1', '38')
|
20
|
+
course_quiz.class.should eq(Hash)
|
21
|
+
course_quiz['id'].should == 38
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'sets extensions on a quiz' do
|
25
|
+
stub_post(@client, "/api/v1/courses/1/quiz_extensions").to_return(json_response("quizzes/quiz_extension.json"))
|
26
|
+
quiz_extension = @client.quiz_extensions('1', {quiz_extensions: [{user_id: 1}, {extra_time: 30}]})
|
27
|
+
quiz_extension.class.should eq(Hash)
|
28
|
+
quiz_extension['quiz_extensions'].first['extra_time'].should eq(30)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
{
|
2
|
+
"id":38,
|
3
|
+
"title":"Second Quiz",
|
4
|
+
"html_url":"https://jake.instructure.com/courses/42/quizzes/38",
|
5
|
+
"mobile_url":"https://jake.instructure.com/courses/42/quizzes/38?force_user=1\u0026persist_headless=1",
|
6
|
+
"description":"",
|
7
|
+
"quiz_type":"assignment",
|
8
|
+
"time_limit":5,
|
9
|
+
"shuffle_answers":true,
|
10
|
+
"show_correct_answers":true,
|
11
|
+
"scoring_policy":"keep_highest",
|
12
|
+
"allowed_attempts":12,
|
13
|
+
"one_question_at_a_time":false,
|
14
|
+
"question_count":0,
|
15
|
+
"points_possible":null,
|
16
|
+
"cant_go_back":false,
|
17
|
+
"access_code":null,
|
18
|
+
"ip_filter":null,
|
19
|
+
"due_at":null,
|
20
|
+
"lock_at":null,
|
21
|
+
"unlock_at":null,
|
22
|
+
"published":false,
|
23
|
+
"unpublishable":true,
|
24
|
+
"locked_for_user":false,
|
25
|
+
"hide_results":null,
|
26
|
+
"show_correct_answers_at":null,
|
27
|
+
"hide_correct_answers_at":null,
|
28
|
+
"all_dates":[
|
29
|
+
{
|
30
|
+
"due_at":null,
|
31
|
+
"unlock_at":null,
|
32
|
+
"lock_at":null,
|
33
|
+
"base":true
|
34
|
+
}
|
35
|
+
],
|
36
|
+
"can_unpublish":true,
|
37
|
+
"can_update":true,
|
38
|
+
"require_lockdown_browser":null,
|
39
|
+
"require_lockdown_browser_for_results":null,
|
40
|
+
"require_lockdown_browser_monitor":null,
|
41
|
+
"lockdown_browser_monitor_data":null,
|
42
|
+
"speed_grader_url":null,
|
43
|
+
"permissions":{
|
44
|
+
"read_statistics":true,
|
45
|
+
"manage":true,
|
46
|
+
"read":true,
|
47
|
+
"update":true,
|
48
|
+
"delete":true,
|
49
|
+
"create":true,
|
50
|
+
"submit":true,
|
51
|
+
"grade":true,
|
52
|
+
"review_grades":true
|
53
|
+
},
|
54
|
+
"quiz_reports_url":"https://jake.instructure.com/api/v1/courses/42/quizzes/38/reports",
|
55
|
+
"quiz_statistics_url":"https://jake.instructure.com/api/v1/courses/42/quizzes/38/statistics",
|
56
|
+
"message_students_url":"https://jake.instructure.com/api/v1/courses/42/quizzes/38/submission_users/message",
|
57
|
+
"section_count":1,
|
58
|
+
"quiz_submission_versions_html_url":"https://jake.instructure.com/courses/42/quizzes/38/submission_versions",
|
59
|
+
"assignment_id":56,
|
60
|
+
"one_time_results":false,
|
61
|
+
"assignment_group_id":41
|
62
|
+
}
|
@@ -0,0 +1,126 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id":37,
|
4
|
+
"title":"First Quiz",
|
5
|
+
"html_url":"https://jake.instructure.com/courses/42/quizzes/37",
|
6
|
+
"mobile_url":"https://jake.instructure.com/courses/42/quizzes/37?force_user=1\u0026persist_headless=1",
|
7
|
+
"description":"",
|
8
|
+
"quiz_type":"assignment",
|
9
|
+
"time_limit":10,
|
10
|
+
"shuffle_answers":false,
|
11
|
+
"show_correct_answers":false,
|
12
|
+
"scoring_policy":"keep_highest",
|
13
|
+
"allowed_attempts":5,
|
14
|
+
"one_question_at_a_time":false,
|
15
|
+
"question_count":1,
|
16
|
+
"points_possible":1,
|
17
|
+
"cant_go_back":false,
|
18
|
+
"access_code":null,
|
19
|
+
"ip_filter":null,
|
20
|
+
"due_at":null,
|
21
|
+
"lock_at":null,
|
22
|
+
"unlock_at":null,
|
23
|
+
"published":false,
|
24
|
+
"unpublishable":true,
|
25
|
+
"locked_for_user":false,
|
26
|
+
"hide_results":"always",
|
27
|
+
"show_correct_answers_at":null,
|
28
|
+
"hide_correct_answers_at":null,
|
29
|
+
"all_dates":[
|
30
|
+
{
|
31
|
+
"due_at":null,
|
32
|
+
"unlock_at":null,
|
33
|
+
"lock_at":null,
|
34
|
+
"base":true
|
35
|
+
}
|
36
|
+
],
|
37
|
+
"can_unpublish":true,
|
38
|
+
"can_update":true,
|
39
|
+
"require_lockdown_browser":null,
|
40
|
+
"require_lockdown_browser_for_results":null,
|
41
|
+
"require_lockdown_browser_monitor":null,
|
42
|
+
"lockdown_browser_monitor_data":null,
|
43
|
+
"speed_grader_url":null,
|
44
|
+
"permissions":{
|
45
|
+
"read_statistics":true,
|
46
|
+
"manage":true,
|
47
|
+
"read":true,
|
48
|
+
"update":true,
|
49
|
+
"delete":true,
|
50
|
+
"create":true,
|
51
|
+
"submit":true,
|
52
|
+
"grade":true,
|
53
|
+
"review_grades":true
|
54
|
+
},
|
55
|
+
"quiz_reports_url":"https://jake.instructure.com/api/v1/courses/42/quizzes/37/reports",
|
56
|
+
"quiz_statistics_url":"https://jake.instructure.com/api/v1/courses/42/quizzes/37/statistics",
|
57
|
+
"message_students_url":"https://jake.instructure.com/api/v1/courses/42/quizzes/37/submission_users/message",
|
58
|
+
"section_count":1,
|
59
|
+
"quiz_submission_versions_html_url":"https://jake.instructure.com/courses/42/quizzes/37/submission_versions",
|
60
|
+
"assignment_id":55,
|
61
|
+
"one_time_results":false,
|
62
|
+
"assignment_group_id":41
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"id":38,
|
66
|
+
"title":"Second Quiz",
|
67
|
+
"html_url":"https://jake.instructure.com/courses/42/quizzes/38",
|
68
|
+
"mobile_url":"https://jake.instructure.com/courses/42/quizzes/38?force_user=1\u0026persist_headless=1",
|
69
|
+
"description":"",
|
70
|
+
"quiz_type":"assignment",
|
71
|
+
"time_limit":5,
|
72
|
+
"shuffle_answers":true,
|
73
|
+
"show_correct_answers":true,
|
74
|
+
"scoring_policy":"keep_highest",
|
75
|
+
"allowed_attempts":12,
|
76
|
+
"one_question_at_a_time":false,
|
77
|
+
"question_count":0,
|
78
|
+
"points_possible":null,
|
79
|
+
"cant_go_back":false,
|
80
|
+
"access_code":null,
|
81
|
+
"ip_filter":null,
|
82
|
+
"due_at":null,
|
83
|
+
"lock_at":null,
|
84
|
+
"unlock_at":null,
|
85
|
+
"published":false,
|
86
|
+
"unpublishable":true,
|
87
|
+
"locked_for_user":false,
|
88
|
+
"hide_results":null,
|
89
|
+
"show_correct_answers_at":null,
|
90
|
+
"hide_correct_answers_at":null,
|
91
|
+
"all_dates":[
|
92
|
+
{
|
93
|
+
"due_at":null,
|
94
|
+
"unlock_at":null,
|
95
|
+
"lock_at":null,
|
96
|
+
"base":true
|
97
|
+
}
|
98
|
+
],
|
99
|
+
"can_unpublish":true,
|
100
|
+
"can_update":true,
|
101
|
+
"require_lockdown_browser":null,
|
102
|
+
"require_lockdown_browser_for_results":null,
|
103
|
+
"require_lockdown_browser_monitor":null,
|
104
|
+
"lockdown_browser_monitor_data":null,
|
105
|
+
"speed_grader_url":null,
|
106
|
+
"permissions":{
|
107
|
+
"read_statistics":true,
|
108
|
+
"manage":true,
|
109
|
+
"read":true,
|
110
|
+
"update":true,
|
111
|
+
"delete":true,
|
112
|
+
"create":true,
|
113
|
+
"submit":true,
|
114
|
+
"grade":true,
|
115
|
+
"review_grades":true
|
116
|
+
},
|
117
|
+
"quiz_reports_url":"https://jake.instructure.com/api/v1/courses/42/quizzes/38/reports",
|
118
|
+
"quiz_statistics_url":"https://jake.instructure.com/api/v1/courses/42/quizzes/38/statistics",
|
119
|
+
"message_students_url":"https://jake.instructure.com/api/v1/courses/42/quizzes/38/submission_users/message",
|
120
|
+
"section_count":1,
|
121
|
+
"quiz_submission_versions_html_url":"https://jake.instructure.com/courses/42/quizzes/38/submission_versions",
|
122
|
+
"assignment_id":56,
|
123
|
+
"one_time_results":false,
|
124
|
+
"assignment_group_id":41
|
125
|
+
}
|
126
|
+
]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bearcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Mills, Jake Sorce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: footrest
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,6 +120,7 @@ files:
|
|
106
120
|
- lib/bearcat/client/o_auth2.rb
|
107
121
|
- lib/bearcat/client/outcome_groups.rb
|
108
122
|
- lib/bearcat/client/outcomes.rb
|
123
|
+
- lib/bearcat/client/quizzes.rb
|
109
124
|
- lib/bearcat/client/reports.rb
|
110
125
|
- lib/bearcat/client/sections.rb
|
111
126
|
- lib/bearcat/client/submissions.rb
|
@@ -127,6 +142,7 @@ files:
|
|
127
142
|
- spec/bearcat/client/o_auth2_spec.rb
|
128
143
|
- spec/bearcat/client/outcome_groups_spec.rb
|
129
144
|
- spec/bearcat/client/outcomes_spec.rb
|
145
|
+
- spec/bearcat/client/quizzes_spec.rb
|
130
146
|
- spec/bearcat/client/reports_spec.rb
|
131
147
|
- spec/bearcat/client/sections_spec.rb
|
132
148
|
- spec/bearcat/client/submissions_spec.rb
|
@@ -182,6 +198,9 @@ files:
|
|
182
198
|
- spec/fixtures/outcome_subgroups.json
|
183
199
|
- spec/fixtures/outcomes.json
|
184
200
|
- spec/fixtures/paged_body.json
|
201
|
+
- spec/fixtures/quizzes/course_quiz.json
|
202
|
+
- spec/fixtures/quizzes/course_quizzes.json
|
203
|
+
- spec/fixtures/quizzes/quiz_extension.json
|
185
204
|
- spec/fixtures/report_history.json
|
186
205
|
- spec/fixtures/report_list.json
|
187
206
|
- spec/fixtures/report_status.json
|
@@ -237,6 +256,7 @@ test_files:
|
|
237
256
|
- spec/bearcat/client/o_auth2_spec.rb
|
238
257
|
- spec/bearcat/client/outcome_groups_spec.rb
|
239
258
|
- spec/bearcat/client/outcomes_spec.rb
|
259
|
+
- spec/bearcat/client/quizzes_spec.rb
|
240
260
|
- spec/bearcat/client/reports_spec.rb
|
241
261
|
- spec/bearcat/client/sections_spec.rb
|
242
262
|
- spec/bearcat/client/submissions_spec.rb
|
@@ -292,6 +312,9 @@ test_files:
|
|
292
312
|
- spec/fixtures/outcome_subgroups.json
|
293
313
|
- spec/fixtures/outcomes.json
|
294
314
|
- spec/fixtures/paged_body.json
|
315
|
+
- spec/fixtures/quizzes/course_quiz.json
|
316
|
+
- spec/fixtures/quizzes/course_quizzes.json
|
317
|
+
- spec/fixtures/quizzes/quiz_extension.json
|
295
318
|
- spec/fixtures/report_history.json
|
296
319
|
- spec/fixtures/report_list.json
|
297
320
|
- spec/fixtures/report_status.json
|