bearcat 1.0.13 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bearcat/client/accounts.rb +9 -1
- data/lib/bearcat/version.rb +1 -1
- data/spec/bearcat/client/accounts_spec.rb +15 -0
- data/spec/fixtures/account_admins.json +54 -0
- data/spec/fixtures/accounts.json +13 -0
- data/spec/helper.rb +1 -0
- metadata +24 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca811650c1ee4f7aed39e96aa9ba95ea0f4a6568
|
4
|
+
data.tar.gz: abc0e3425e4d2ced526565757c474d6817b17267
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a0b2b9d1ba47c482ea51515182b176e5875e01907641a4ca83b669e10f70a516be86c9b88353e9b313cc7c89b58f69bfca7a03e0453e6e5fcade9c3b49692d7
|
7
|
+
data.tar.gz: 6b600db642f6f79c858a57041f67a2bab46150ebe37b7d8c19e82a810c8f4eb8f08f38e22034453c90bca42af403c2467a84b2ee98e1d327118271ce3f3d2d4d
|
@@ -2,12 +2,20 @@ module Bearcat
|
|
2
2
|
class Client < Footrest::Client
|
3
3
|
module Accounts
|
4
4
|
|
5
|
+
def list_accounts(params = {})
|
6
|
+
get("/api/v1/accounts", params)
|
7
|
+
end
|
8
|
+
|
5
9
|
def account(account)
|
6
10
|
get("/api/v1/accounts/#{account}")
|
7
11
|
end
|
8
12
|
|
9
13
|
def terms(account, params = {})
|
10
|
-
get("/api/v1/accounts/#{account}/terms")
|
14
|
+
get("/api/v1/accounts/#{account}/terms", params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def account_admins(account, params = {})
|
18
|
+
get("/api/v1/accounts/#{account}/admins", params)
|
11
19
|
end
|
12
20
|
|
13
21
|
end
|
data/lib/bearcat/version.rb
CHANGED
@@ -5,6 +5,21 @@ describe Bearcat::Client::Accounts do
|
|
5
5
|
@client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
|
6
6
|
end
|
7
7
|
|
8
|
+
it 'returns a list of all the accounts the user belongs to' do
|
9
|
+
stub_get(@client, "/api/v1/accounts").to_return(json_response("accounts.json"))
|
10
|
+
accounts = @client.list_accounts
|
11
|
+
accounts.count.should == 1
|
12
|
+
accounts.first['name'].should == 'Local Testing'
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns a list of all of the accounts admins' do
|
16
|
+
stub_get(@client, "/api/v1/accounts/1/admins").to_return(json_response("account_admins.json"))
|
17
|
+
account_admins = @client.account_admins(1)
|
18
|
+
account_admins.count.should == 4
|
19
|
+
account_admins.first['id'].should == 3
|
20
|
+
account_admins.last['role'].should == 'Custom Admin'
|
21
|
+
end
|
22
|
+
|
8
23
|
it "returns a single account" do
|
9
24
|
stub_get(@client, "/api/v1/accounts/1").to_return(json_response("single_account.json"))
|
10
25
|
account = @client.account(1)
|
@@ -0,0 +1,54 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 3,
|
4
|
+
"role": "AccountAdmin",
|
5
|
+
"role_id": 1,
|
6
|
+
"user": {
|
7
|
+
"id": 32,
|
8
|
+
"name": "first admin",
|
9
|
+
"sortable_name": "admin, first",
|
10
|
+
"short_name": "first admin",
|
11
|
+
"sis_user_id": "firstadmin",
|
12
|
+
"integration_id": null,
|
13
|
+
"sis_login_id": "firstadmin",
|
14
|
+
"sis_import_id": null,
|
15
|
+
"login_id": "firstadmin"
|
16
|
+
}
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"id": 4,
|
20
|
+
"role": "AccountAdmin",
|
21
|
+
"role_id": 1,
|
22
|
+
"user": {
|
23
|
+
"id": 35,
|
24
|
+
"name": "second admin",
|
25
|
+
"sortable_name": "admin, second",
|
26
|
+
"short_name": "second admin",
|
27
|
+
"login_id": "secondadmin"
|
28
|
+
}
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"id": 5,
|
32
|
+
"role": "AccountAdmin",
|
33
|
+
"role_id": 1,
|
34
|
+
"user": {
|
35
|
+
"id": 36,
|
36
|
+
"name": "third admin",
|
37
|
+
"sortable_name": "admin, third",
|
38
|
+
"short_name": "third admin",
|
39
|
+
"login_id": "thirdadmin@example.com"
|
40
|
+
}
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"id": 6,
|
44
|
+
"role": "Custom Admin",
|
45
|
+
"role_id": 13,
|
46
|
+
"user": {
|
47
|
+
"id": 39,
|
48
|
+
"name": "fourth admin",
|
49
|
+
"sortable_name": "admin, fourth",
|
50
|
+
"short_name": "fourth admin",
|
51
|
+
"login_id": "fourthadmin"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
]
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 1,
|
4
|
+
"name": "Local Testing",
|
5
|
+
"parent_account_id": null,
|
6
|
+
"root_account_id": null,
|
7
|
+
"workflow_state": "active",
|
8
|
+
"default_storage_quota_mb": 500,
|
9
|
+
"default_user_storage_quota_mb": 50,
|
10
|
+
"default_group_storage_quota_mb": 50,
|
11
|
+
"default_time_zone": "America/Denver"
|
12
|
+
}
|
13
|
+
]
|
data/spec/helper.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
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.14
|
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-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.0.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.6'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: webmock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: footrest
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 0.2.2
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.2.2
|
97
97
|
description: Ruby interface for interacting with the canvas API
|
@@ -103,9 +103,7 @@ extra_rdoc_files: []
|
|
103
103
|
files:
|
104
104
|
- Rakefile
|
105
105
|
- bearcat.gemspec
|
106
|
-
- lib/bearcat.rb
|
107
106
|
- lib/bearcat/api_array.rb
|
108
|
-
- lib/bearcat/client.rb
|
109
107
|
- lib/bearcat/client/account_reports.rb
|
110
108
|
- lib/bearcat/client/accounts.rb
|
111
109
|
- lib/bearcat/client/assignment_groups.rb
|
@@ -130,7 +128,9 @@ files:
|
|
130
128
|
- lib/bearcat/client/sections.rb
|
131
129
|
- lib/bearcat/client/submissions.rb
|
132
130
|
- lib/bearcat/client/users.rb
|
131
|
+
- lib/bearcat/client.rb
|
133
132
|
- lib/bearcat/version.rb
|
133
|
+
- lib/bearcat.rb
|
134
134
|
- spec/bearcat/client/accounts_spec.rb
|
135
135
|
- spec/bearcat/client/assignment_groups_spec.rb
|
136
136
|
- spec/bearcat/client/assignments_spec.rb
|
@@ -154,12 +154,14 @@ files:
|
|
154
154
|
- spec/bearcat/client/users_spec.rb
|
155
155
|
- spec/bearcat/client_spec.rb
|
156
156
|
- spec/bearcat_spec.rb
|
157
|
+
- spec/fixtures/account_admins.json
|
157
158
|
- spec/fixtures/account_reports.json
|
158
159
|
- spec/fixtures/account_reports_index.json
|
159
160
|
- spec/fixtures/account_reports_result_success.json
|
160
161
|
- spec/fixtures/account_reports_start_result.json
|
161
162
|
- spec/fixtures/account_user.json
|
162
163
|
- spec/fixtures/account_users.json
|
164
|
+
- spec/fixtures/accounts.json
|
163
165
|
- spec/fixtures/add_custom_user_data.json
|
164
166
|
- spec/fixtures/add_user.json
|
165
167
|
- spec/fixtures/assignment_groups.json
|
@@ -237,17 +239,17 @@ require_paths:
|
|
237
239
|
- lib
|
238
240
|
required_ruby_version: !ruby/object:Gem::Requirement
|
239
241
|
requirements:
|
240
|
-
- -
|
242
|
+
- - '>='
|
241
243
|
- !ruby/object:Gem::Version
|
242
244
|
version: '0'
|
243
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
246
|
requirements:
|
245
|
-
- -
|
247
|
+
- - '>='
|
246
248
|
- !ruby/object:Gem::Version
|
247
249
|
version: '0'
|
248
250
|
requirements: []
|
249
251
|
rubyforge_project:
|
250
|
-
rubygems_version: 2.
|
252
|
+
rubygems_version: 2.0.14
|
251
253
|
signing_key:
|
252
254
|
specification_version: 4
|
253
255
|
summary: Canvas API
|
@@ -275,12 +277,14 @@ test_files:
|
|
275
277
|
- spec/bearcat/client/users_spec.rb
|
276
278
|
- spec/bearcat/client_spec.rb
|
277
279
|
- spec/bearcat_spec.rb
|
280
|
+
- spec/fixtures/account_admins.json
|
278
281
|
- spec/fixtures/account_reports.json
|
279
282
|
- spec/fixtures/account_reports_index.json
|
280
283
|
- spec/fixtures/account_reports_result_success.json
|
281
284
|
- spec/fixtures/account_reports_start_result.json
|
282
285
|
- spec/fixtures/account_user.json
|
283
286
|
- spec/fixtures/account_users.json
|
287
|
+
- spec/fixtures/accounts.json
|
284
288
|
- spec/fixtures/add_custom_user_data.json
|
285
289
|
- spec/fixtures/add_user.json
|
286
290
|
- spec/fixtures/assignment_groups.json
|
@@ -349,3 +353,4 @@ test_files:
|
|
349
353
|
- spec/fixtures/user_page_views.json
|
350
354
|
- spec/fixtures/user_profile.json
|
351
355
|
- spec/helper.rb
|
356
|
+
has_rdoc:
|