bearcat 1.2.9 → 1.2.10
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/group_categories.rb +7 -0
- data/lib/bearcat/client/group_memberships.rb +4 -0
- data/lib/bearcat/client/groups.rb +7 -0
- data/lib/bearcat/version.rb +1 -1
- data/spec/bearcat/client/group_categories_spec.rb +15 -0
- data/spec/bearcat/client/groups_spec.rb +16 -0
- data/spec/bearcat/group_memberships_spec.rb +17 -0
- data/spec/fixtures/created_group.json +37 -0
- data/spec/fixtures/created_group_category.json +15 -0
- data/spec/fixtures/created_group_membership.json +8 -0
- data/spec/fixtures/group.json +15 -0
- data/spec/fixtures/group_category.json +13 -0
- metadata +15 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dd0eba0f8359c89b5593fe041e7410245223dc7
|
4
|
+
data.tar.gz: cc5612e0759bb326464fea939c9e27205d01fe69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 120a6cfa98faf0f14c0c34664a8f12db7fd0a5531aae29013313edc6892edc97faa38deb070e38fa37fd4140e8814370fc87c55a8cafe4a37668d52ffa354540
|
7
|
+
data.tar.gz: 9fc6087b49de5874520b5936f8448a4b465fe8b9c23af162076d395cf56e4e9abfa10c77c255f27382cba3ed694da84c13280a47b9ec24f97719be9a23c71203
|
@@ -6,6 +6,13 @@ module Bearcat
|
|
6
6
|
get("/api/v1/#{context}/#{id}/group_categories")
|
7
7
|
end
|
8
8
|
|
9
|
+
def group_category(id)
|
10
|
+
get("/api/v1/group_categories/#{id}")
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_group_category(context, id, params={})
|
14
|
+
post("/api/v1/#{context}/#{id}/group_categories", params)
|
15
|
+
end
|
9
16
|
end
|
10
17
|
end
|
11
18
|
end
|
@@ -10,6 +10,13 @@ module Bearcat
|
|
10
10
|
get("/api/v1/accounts/#{account_id}/groups")
|
11
11
|
end
|
12
12
|
|
13
|
+
def group(id)
|
14
|
+
get("/api/v1/groups/#{id}")
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_group(group_category_id, params={})
|
18
|
+
post("/api/v1/group_categories/#{group_category_id}/groups", params)
|
19
|
+
end
|
13
20
|
end
|
14
21
|
end
|
15
22
|
end
|
data/lib/bearcat/version.rb
CHANGED
@@ -13,4 +13,19 @@ describe Bearcat::Client::GroupCategories do
|
|
13
13
|
categories.last['name'].should == 'test group'
|
14
14
|
end
|
15
15
|
|
16
|
+
it 'returns a single group category' do
|
17
|
+
stub_get(@client, "/api/v1/group_categories/2").to_return(json_response("group_category.json"))
|
18
|
+
category = @client.group_category(2)
|
19
|
+
category['name'].should == 'mark red'
|
20
|
+
category['id'].should == 5
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'creates a new group category' do
|
24
|
+
name = "new group category"
|
25
|
+
stub_post(@client, "/api/v1/courses/1/group_categories").with(body: {"name" => name}).to_return(json_response("created_group_category.json"))
|
26
|
+
group_category = @client.create_group_category('courses', 1, { name: name })
|
27
|
+
group_category["name"].should == name
|
28
|
+
group_category["id"].should == 1
|
29
|
+
end
|
30
|
+
|
16
31
|
end
|
@@ -20,4 +20,20 @@ describe Bearcat::Client::Groups do
|
|
20
20
|
groups.first['name'].should == '2010'
|
21
21
|
groups.last['id'].should == 3
|
22
22
|
end
|
23
|
+
|
24
|
+
it "returns a single group" do
|
25
|
+
stub_get(@client, "/api/v1/groups/3").to_return(json_response("group.json"))
|
26
|
+
group = @client.group(3)
|
27
|
+
group['name'].should == 'group 1'
|
28
|
+
group['id'].should == 3
|
29
|
+
end
|
30
|
+
|
31
|
+
it "creates a group" do
|
32
|
+
name = 'created group 1'
|
33
|
+
stub_post(@client, "/api/v1/group_categories/2/groups").with(body: { name: name }).to_return(json_response("created_group.json"))
|
34
|
+
created_group = @client.create_group(2, { name: name })
|
35
|
+
created_group['name'] == 'created group 1'
|
36
|
+
created_group['context_type'] == 'Course'
|
37
|
+
created_group['group_category']['id'] == 2
|
38
|
+
end
|
23
39
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Bearcat::Client::GroupMemberships do
|
4
|
+
before do
|
5
|
+
@client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "creates a group membership" do
|
9
|
+
stub_post(@client, "/api/v1/groups/3/memberships").with(:body => {"user_id"=>"6"}).to_return(json_response("created_group_membership.json"))
|
10
|
+
created_group_membership = @client.create_group_membership(3, { user_id: 6 })
|
11
|
+
created_group_membership['id'] == 14
|
12
|
+
created_group_membership['group_id'] == 3
|
13
|
+
created_group_membership['workflow_state'] == 'accepted'
|
14
|
+
created_group_membership['user_id'] == 6
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
{
|
2
|
+
"id": 7,
|
3
|
+
"name": "created group 1",
|
4
|
+
"max_membership": null,
|
5
|
+
"is_public": false,
|
6
|
+
"join_level": "invitation_only",
|
7
|
+
"group_category_id": 2,
|
8
|
+
"description": null,
|
9
|
+
"members_count": 0,
|
10
|
+
"storage_quota_mb": 50,
|
11
|
+
"permissions": {
|
12
|
+
"create_discussion_topic": true,
|
13
|
+
"join": false,
|
14
|
+
"create_announcement": true
|
15
|
+
},
|
16
|
+
"context_type": "Course",
|
17
|
+
"course_id": 14,
|
18
|
+
"avatar_url": null,
|
19
|
+
"role": null,
|
20
|
+
"leader": null,
|
21
|
+
"users": [],
|
22
|
+
"group_category": {
|
23
|
+
"id": 2,
|
24
|
+
"name": "Group Category!!!!!",
|
25
|
+
"role": null,
|
26
|
+
"self_signup": null,
|
27
|
+
"group_limit": null,
|
28
|
+
"auto_leader": null,
|
29
|
+
"context_type": "Course",
|
30
|
+
"course_id": 14,
|
31
|
+
"protected": false,
|
32
|
+
"allows_multiple_memberships": false,
|
33
|
+
"is_member": false
|
34
|
+
},
|
35
|
+
"has_submission": false,
|
36
|
+
"concluded": false
|
37
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"id": 1,
|
3
|
+
"name": "new group category",
|
4
|
+
"role": null,
|
5
|
+
"self_signup": null,
|
6
|
+
"group_limit": null,
|
7
|
+
"auto_leader": null,
|
8
|
+
"context_type": "Course",
|
9
|
+
"course_id": 14,
|
10
|
+
"groups_count": 0,
|
11
|
+
"unassigned_users_count": 13,
|
12
|
+
"protected": false,
|
13
|
+
"allows_multiple_memberships": false,
|
14
|
+
"is_member": false
|
15
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"description": null,
|
3
|
+
"group_category_id": 2,
|
4
|
+
"id": 3,
|
5
|
+
"is_public": false,
|
6
|
+
"join_level": "invitation_only",
|
7
|
+
"name": "group 1",
|
8
|
+
"members_count": 0,
|
9
|
+
"storage_quota_mb": 50,
|
10
|
+
"context_type": "Course",
|
11
|
+
"course_id": 1,
|
12
|
+
"followed_by_user": false,
|
13
|
+
"avatar_url": null,
|
14
|
+
"role": null
|
15
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"auto_leader": "first",
|
3
|
+
"group_limit": null,
|
4
|
+
"id": 5,
|
5
|
+
"name": "mark red",
|
6
|
+
"role": null,
|
7
|
+
"self_signup": null,
|
8
|
+
"context_type": "Course",
|
9
|
+
"course_id": 1809,
|
10
|
+
"protected": false,
|
11
|
+
"allows_multiple_memberships": false,
|
12
|
+
"is_member": false
|
13
|
+
}
|
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.2.
|
4
|
+
version: 1.2.10
|
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: 2016-08-
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- spec/bearcat/client/submissions_spec.rb
|
168
168
|
- spec/bearcat/client/users_spec.rb
|
169
169
|
- spec/bearcat/client_spec.rb
|
170
|
+
- spec/bearcat/group_memberships_spec.rb
|
170
171
|
- spec/bearcat_spec.rb
|
171
172
|
- spec/fixtures/access_token.json
|
172
173
|
- spec/fixtures/account_admins.json
|
@@ -211,6 +212,9 @@ files:
|
|
211
212
|
- spec/fixtures/create_section.json
|
212
213
|
- spec/fixtures/created_assignment.json
|
213
214
|
- spec/fixtures/created_course.json
|
215
|
+
- spec/fixtures/created_group.json
|
216
|
+
- spec/fixtures/created_group_category.json
|
217
|
+
- spec/fixtures/created_group_membership.json
|
214
218
|
- spec/fixtures/custom_data.json
|
215
219
|
- spec/fixtures/custom_food_data.json
|
216
220
|
- spec/fixtures/delete_course.json
|
@@ -221,7 +225,9 @@ files:
|
|
221
225
|
- spec/fixtures/department_level_statistics.json
|
222
226
|
- spec/fixtures/enroll_student.json
|
223
227
|
- spec/fixtures/enrollment_terms.json
|
228
|
+
- spec/fixtures/group.json
|
224
229
|
- spec/fixtures/group_categories.json
|
230
|
+
- spec/fixtures/group_category.json
|
225
231
|
- spec/fixtures/group_conferences.json
|
226
232
|
- spec/fixtures/link_unlink_outcome.json
|
227
233
|
- spec/fixtures/merge_user.json
|
@@ -279,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
279
285
|
version: '0'
|
280
286
|
requirements: []
|
281
287
|
rubyforge_project:
|
282
|
-
rubygems_version: 2.
|
288
|
+
rubygems_version: 2.5.1
|
283
289
|
signing_key:
|
284
290
|
specification_version: 4
|
285
291
|
summary: Canvas API
|
@@ -313,6 +319,7 @@ test_files:
|
|
313
319
|
- spec/bearcat/client/submissions_spec.rb
|
314
320
|
- spec/bearcat/client/users_spec.rb
|
315
321
|
- spec/bearcat/client_spec.rb
|
322
|
+
- spec/bearcat/group_memberships_spec.rb
|
316
323
|
- spec/bearcat_spec.rb
|
317
324
|
- spec/fixtures/access_token.json
|
318
325
|
- spec/fixtures/account_admins.json
|
@@ -357,6 +364,9 @@ test_files:
|
|
357
364
|
- spec/fixtures/create_section.json
|
358
365
|
- spec/fixtures/created_assignment.json
|
359
366
|
- spec/fixtures/created_course.json
|
367
|
+
- spec/fixtures/created_group.json
|
368
|
+
- spec/fixtures/created_group_category.json
|
369
|
+
- spec/fixtures/created_group_membership.json
|
360
370
|
- spec/fixtures/custom_data.json
|
361
371
|
- spec/fixtures/custom_food_data.json
|
362
372
|
- spec/fixtures/delete_course.json
|
@@ -367,7 +377,9 @@ test_files:
|
|
367
377
|
- spec/fixtures/department_level_statistics.json
|
368
378
|
- spec/fixtures/enroll_student.json
|
369
379
|
- spec/fixtures/enrollment_terms.json
|
380
|
+
- spec/fixtures/group.json
|
370
381
|
- spec/fixtures/group_categories.json
|
382
|
+
- spec/fixtures/group_category.json
|
371
383
|
- spec/fixtures/group_conferences.json
|
372
384
|
- spec/fixtures/link_unlink_outcome.json
|
373
385
|
- spec/fixtures/merge_user.json
|
@@ -406,4 +418,3 @@ test_files:
|
|
406
418
|
- spec/fixtures/user_page_views.json
|
407
419
|
- spec/fixtures/user_profile.json
|
408
420
|
- spec/helper.rb
|
409
|
-
has_rdoc:
|