bearcat 1.0.26 → 1.0.27
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/bearcat/client/analytics.rb +15 -0
- data/lib/bearcat/client.rb +2 -0
- data/lib/bearcat/version.rb +1 -1
- data/spec/bearcat/client/analytics_spec.rb +22 -0
- data/spec/bearcat/client/courses_spec.rb +1 -1
- data/spec/fixtures/department_level_participation.json +73 -0
- data/spec/fixtures/department_level_statistics.json +10 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c187b4e26771f46dacbae7718617a9eb317210e4
|
4
|
+
data.tar.gz: ee04c4347bd6b6b6acee14d2294b1aab940dd639
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 225605addffde2f6e5b07282f435a028d38678b0e803642baccb9e4a2c1956f7c0c26f977eb2a4c30869fb611a9f02f5db5ff42001c4321c230690226e465b21
|
7
|
+
data.tar.gz: 7c9d0bcf33284d2e23c32c617c685594b9485d36c0fa3b56c2f884985ffd761846dc2c3e62fcc0dba8d52bf2645e604809fce6f740f3c598529af24d49804409
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Bearcat
|
2
|
+
class Client < Footrest::Client
|
3
|
+
module Analytics
|
4
|
+
|
5
|
+
def department_level_participation(account, term)
|
6
|
+
get("/api/v1/accounts/#{account}/analytics/terms/#{term}/activity")
|
7
|
+
end
|
8
|
+
|
9
|
+
def department_level_statistics(account, term)
|
10
|
+
get("/api/v1/accounts/#{account}/analytics/terms/#{term}/statistics")
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/bearcat/client.rb
CHANGED
@@ -29,9 +29,11 @@ module Bearcat
|
|
29
29
|
require 'bearcat/client/pages'
|
30
30
|
require 'bearcat/client/files'
|
31
31
|
require 'bearcat/client/folders'
|
32
|
+
require 'bearcat/client/analytics'
|
32
33
|
|
33
34
|
include Assignments
|
34
35
|
include Accounts
|
36
|
+
include Analytics
|
35
37
|
include Courses
|
36
38
|
include Enrollments
|
37
39
|
include OutcomeGroups
|
data/lib/bearcat/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Bearcat::Client::Analytics do
|
4
|
+
before do
|
5
|
+
@client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'returns page view data' do
|
9
|
+
stub_get(@client, "/api/v1/accounts/1/analytics/terms/1/activity").to_return(json_response("department_level_participation.json"))
|
10
|
+
result = @client.department_level_participation(1, 1)
|
11
|
+
result['by_date'].count.should == 3
|
12
|
+
result['by_category'].count.should == 13
|
13
|
+
result['by_category'].any? {|h| h['category'] == 'assignments'}.should be_truthy
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns department level statistics' do
|
17
|
+
stub_get(@client, "/api/v1/accounts/1/analytics/terms/1/statistics").to_return(json_response("department_level_statistics.json"))
|
18
|
+
result = @client.department_level_statistics(1, 1)
|
19
|
+
result.count.should == 8
|
20
|
+
result['subaccounts'].should == 8
|
21
|
+
end
|
22
|
+
end
|
@@ -98,7 +98,7 @@ describe Bearcat::Client::Sections do
|
|
98
98
|
|
99
99
|
it 'gets course belonging to user' do
|
100
100
|
stub_get(@client, '/api/v1/courses?enrollment_type=teacher').to_return(json_response("course.json"))
|
101
|
-
response = @client.list_users_courses({
|
101
|
+
response = @client.list_users_courses({enrollment_type: 'teacher'})
|
102
102
|
expect(response['id']).to eql 3
|
103
103
|
expect(response['workflow_state']).to eql 'available'
|
104
104
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
{
|
2
|
+
"by_date": [
|
3
|
+
{
|
4
|
+
"date": "2015-09-14",
|
5
|
+
"participations": 0,
|
6
|
+
"views": 10
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"date": "2015-06-02",
|
10
|
+
"participations": 0,
|
11
|
+
"views": 7
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"date": "2015-02-02",
|
15
|
+
"participations": 0,
|
16
|
+
"views": 38
|
17
|
+
}
|
18
|
+
],
|
19
|
+
"by_category": [
|
20
|
+
{
|
21
|
+
"category": "announcements",
|
22
|
+
"views": 3
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"category": "assignments",
|
26
|
+
"views": 112
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"category": "collaborations",
|
30
|
+
"views": 2
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"category": "conferences",
|
34
|
+
"views": 1
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"category": "discussions",
|
38
|
+
"views": 56
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"category": "files",
|
42
|
+
"views": 26
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"category": "general",
|
46
|
+
"views": 328
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"category": "grades",
|
50
|
+
"views": 57
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"category": "groups",
|
54
|
+
"views": 1
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"category": "modules",
|
58
|
+
"views": 100
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"category": "other",
|
62
|
+
"views": 197
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"category": "pages",
|
66
|
+
"views": 21
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"category": "quizzes",
|
70
|
+
"views": 43
|
71
|
+
}
|
72
|
+
]
|
73
|
+
}
|
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: 1.0.
|
4
|
+
version: 1.0.27
|
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: 2015-
|
11
|
+
date: 2015-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- lib/bearcat/client.rb
|
109
109
|
- lib/bearcat/client/account_reports.rb
|
110
110
|
- lib/bearcat/client/accounts.rb
|
111
|
+
- lib/bearcat/client/analytics.rb
|
111
112
|
- lib/bearcat/client/assignment_groups.rb
|
112
113
|
- lib/bearcat/client/assignments.rb
|
113
114
|
- lib/bearcat/client/calendar_events.rb
|
@@ -136,6 +137,7 @@ files:
|
|
136
137
|
- lib/bearcat/client/users.rb
|
137
138
|
- lib/bearcat/version.rb
|
138
139
|
- spec/bearcat/client/accounts_spec.rb
|
140
|
+
- spec/bearcat/client/analytics_spec.rb
|
139
141
|
- spec/bearcat/client/assignment_groups_spec.rb
|
140
142
|
- spec/bearcat/client/assignments_spec.rb
|
141
143
|
- spec/bearcat/client/calendar_events_spec.rb
|
@@ -209,6 +211,8 @@ files:
|
|
209
211
|
- spec/fixtures/delete_custom_data_scope.json
|
210
212
|
- spec/fixtures/delete_section.json
|
211
213
|
- spec/fixtures/deleted_conversation.json
|
214
|
+
- spec/fixtures/department_level_participation.json
|
215
|
+
- spec/fixtures/department_level_statistics.json
|
212
216
|
- spec/fixtures/enroll_student.json
|
213
217
|
- spec/fixtures/enrollment_terms.json
|
214
218
|
- spec/fixtures/group_categories.json
|
@@ -266,12 +270,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
270
|
version: '0'
|
267
271
|
requirements: []
|
268
272
|
rubyforge_project:
|
269
|
-
rubygems_version: 2.
|
273
|
+
rubygems_version: 2.4.8
|
270
274
|
signing_key:
|
271
275
|
specification_version: 4
|
272
276
|
summary: Canvas API
|
273
277
|
test_files:
|
274
278
|
- spec/bearcat/client/accounts_spec.rb
|
279
|
+
- spec/bearcat/client/analytics_spec.rb
|
275
280
|
- spec/bearcat/client/assignment_groups_spec.rb
|
276
281
|
- spec/bearcat/client/assignments_spec.rb
|
277
282
|
- spec/bearcat/client/calendar_events_spec.rb
|
@@ -345,6 +350,8 @@ test_files:
|
|
345
350
|
- spec/fixtures/delete_custom_data_scope.json
|
346
351
|
- spec/fixtures/delete_section.json
|
347
352
|
- spec/fixtures/deleted_conversation.json
|
353
|
+
- spec/fixtures/department_level_participation.json
|
354
|
+
- spec/fixtures/department_level_statistics.json
|
348
355
|
- spec/fixtures/enroll_student.json
|
349
356
|
- spec/fixtures/enrollment_terms.json
|
350
357
|
- spec/fixtures/group_categories.json
|