bearcat 1.4.12 → 1.5.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/bearcat.gemspec +9 -3
  3. data/lib/bearcat/api_array.rb +2 -0
  4. data/lib/bearcat/client/account_reports.rb +6 -14
  5. data/lib/bearcat/client/accounts.rb +20 -56
  6. data/lib/bearcat/client/analytics.rb +4 -7
  7. data/lib/bearcat/client/assignment_groups.rb +7 -19
  8. data/lib/bearcat/client/assignments.rb +15 -39
  9. data/lib/bearcat/client/blueprint_courses.rb +14 -20
  10. data/lib/bearcat/client/calendar_events.rb +9 -17
  11. data/lib/bearcat/client/canvas_files.rb +0 -2
  12. data/lib/bearcat/client/conferences.rb +3 -8
  13. data/lib/bearcat/client/conversations.rb +3 -8
  14. data/lib/bearcat/client/courses.rb +15 -45
  15. data/lib/bearcat/client/custom_gradebook_columns.rb +11 -25
  16. data/lib/bearcat/client/discussions.rb +11 -37
  17. data/lib/bearcat/client/enrollments.rb +9 -29
  18. data/lib/bearcat/client/external_tools.rb +9 -36
  19. data/lib/bearcat/client/file_helper.rb +3 -3
  20. data/lib/bearcat/client/files.rb +2 -4
  21. data/lib/bearcat/client/folders.rb +13 -59
  22. data/lib/bearcat/client/group_categories.rb +8 -17
  23. data/lib/bearcat/client/group_memberships.rb +6 -14
  24. data/lib/bearcat/client/groups.rb +9 -24
  25. data/lib/bearcat/client/module_items.rb +9 -17
  26. data/lib/bearcat/client/modules.rb +10 -20
  27. data/lib/bearcat/client/outcome_groups.rb +2 -4
  28. data/lib/bearcat/client/outcomes.rb +4 -7
  29. data/lib/bearcat/client/pages.rb +8 -23
  30. data/lib/bearcat/client/progresses.rb +2 -3
  31. data/lib/bearcat/client/quizzes.rb +15 -35
  32. data/lib/bearcat/client/reports.rb +8 -19
  33. data/lib/bearcat/client/roles.rb +1 -1
  34. data/lib/bearcat/client/rubric.rb +8 -20
  35. data/lib/bearcat/client/rubric_assessment.rb +5 -11
  36. data/lib/bearcat/client/rubric_association.rb +6 -12
  37. data/lib/bearcat/client/search.rb +2 -4
  38. data/lib/bearcat/client/sections.rb +11 -26
  39. data/lib/bearcat/client/submissions.rb +48 -44
  40. data/lib/bearcat/client/tabs.rb +4 -7
  41. data/lib/bearcat/client/users.rb +17 -44
  42. data/lib/bearcat/client.rb +72 -44
  43. data/lib/bearcat/client_module.rb +101 -0
  44. data/lib/bearcat/rate_limiting/redis_script.rb +164 -0
  45. data/lib/bearcat/rate_limiting.rb +70 -0
  46. data/lib/bearcat/spec_helpers.rb +62 -31
  47. data/lib/bearcat/version.rb +1 -1
  48. data/lib/bearcat.rb +8 -21
  49. data/lib/catalogcat/api_array.rb +18 -0
  50. data/lib/catalogcat/client/catalogs.rb +21 -0
  51. data/lib/catalogcat/client/certificates.rb +9 -0
  52. data/lib/catalogcat/client/courses.rb +25 -0
  53. data/lib/catalogcat/client/orders.rb +9 -0
  54. data/lib/catalogcat/client.rb +39 -0
  55. data/lib/catalogcat/version.rb +3 -0
  56. data/lib/catalogcat.rb +14 -0
  57. data/spec/bearcat/client/canvas_files_spec.rb +1 -2
  58. data/spec/bearcat/client/content_migrations_spec.rb +2 -2
  59. data/spec/bearcat/client/courses_spec.rb +2 -4
  60. data/spec/bearcat/{group_memberships_spec.rb → client/group_memberships_spec.rb} +0 -0
  61. data/spec/bearcat/client/learning_outcomes_spec.rb +2 -2
  62. data/spec/bearcat/client/submissions_spec.rb +14 -0
  63. data/spec/bearcat/client_spec.rb +1 -4
  64. data/spec/bearcat/rate_limiting_spec.rb +62 -0
  65. data/spec/bearcat/stub_bearcat_spec.rb +15 -0
  66. data/spec/helper.rb +1 -0
  67. metadata +196 -181
@@ -1,35 +1,15 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Enrollments
4
-
5
- def user_enrollments(user, params={})
6
- get("/api/v1/users/#{user.to_s}/enrollments", params)
7
- end
8
-
9
- def course_enrollments(course, params={})
10
- get("/api/v1/courses/#{course.to_s}/enrollments", params)
11
- end
12
-
13
- def section_enrollments(section, params={})
14
- get("/api/v1/sections/#{section.to_s}/enrollments", params)
15
- end
16
-
17
- def enroll_in_section(section, params={})
18
- post("/api/v1/sections/#{section.to_s}/enrollments", params)
19
- end
20
-
21
- def enroll_in_course(course, params={})
22
- post("/api/v1/courses/#{course.to_s}/enrollments", params)
23
- end
24
-
25
- def conclude_enrollment(course, enrollment, params={})
26
- delete("/api/v1/courses/#{course}/enrollments/#{enrollment}", params)
27
- end
28
-
29
- def reactivate_enrollment(course, enrollment, params={})
30
- put("/api/v1/courses/#{course}/enrollments/#{enrollment}/reactivate", params)
31
- end
32
-
4
+ extend ClientModule
5
+
6
+ get :user_enrollments, "/api/v1/users/:user/enrollments"
7
+ get :course_enrollments, "/api/v1/courses/:course/enrollments"
8
+ get :section_enrollments, "/api/v1/sections/:section/enrollments"
9
+ post :enroll_in_section, "/api/v1/sections/:section/enrollments"
10
+ post :enroll_in_course, "/api/v1/courses/:course/enrollments"
11
+ delete :conclude_enrollment, "/api/v1/courses/:course/enrollments/:enrollment"
12
+ put :reactivate_enrollment, "/api/v1/courses/:course/enrollments/:enrollment/reactivate"
33
13
  end
34
14
  end
35
15
  end
@@ -1,44 +1,17 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module ExternalTools
4
- def course_external_tools(course_id, params={})
5
- get("/api/v1/courses/#{course_id}/external_tools", params)
6
- end
7
-
8
- def account_external_tools(account_id, params={})
9
- get("/api/v1/accounts/#{account_id}/external_tools", params)
10
- end
11
-
12
- def course_external_tool(course_id, tool_id, params={})
13
- get("/api/v1/courses/#{course_id}/external_tools/#{tool_id}", params)
14
- end
15
-
16
- def account_external_tool(account_id, tool_id, params={})
17
- get("/api/v1/accounts/#{account_id}/external_tools/#{tool_id}", params)
18
- end
19
-
20
- def create_course_external_tool(course_id, params={})
21
- post("/api/v1/courses/#{course_id}/external_tools", params)
22
- end
23
-
24
- def create_account_external_tool(account_id, params={})
25
- post("/api/v1/accounts/#{account_id}/external_tools", params)
26
- end
27
-
28
- def edit_course_external_tool(course_id, tool_id, params={})
29
- put("/api/v1/courses/#{course_id}/external_tools/#{tool_id}", params)
30
- end
31
-
32
- def edit_account_external_tool(account_id, tool_id, params={})
33
- put("/api/v1/accounts/#{account_id}/external_tools/#{tool_id}", params)
34
- end
4
+ extend ClientModule
35
5
 
36
- def delete_course_external_tool(course_id, tool_id, params={})
37
- delete("/api/v1/courses/#{course_id}/external_tools/#{tool_id}", params)
38
- end
6
+ context_types %i[course account] do |ct|
7
+ prefix "/api/v1/#{ct}s/:#{ct}/external_tools/" do
8
+ get :"#{ct}_external_tools"
9
+ post :"create_#{ct}_external_tool"
39
10
 
40
- def delete_account_external_tool(account_id, tool_id, params={})
41
- delete("/api/v1/accounts/#{account_id}/external_tools/#{tool_id}", params)
11
+ get :"#{ct}_external_tool", ":tool"
12
+ put :"edit_#{ct}_external_tool", ":tool"
13
+ delete :"delete_#{ct}_external_tool", ":tool"
14
+ end
42
15
  end
43
16
  end
44
17
  end
@@ -5,7 +5,7 @@ module Bearcat
5
5
  {
6
6
  size: File.open(file_path).size,
7
7
  name: File.basename(file_path)
8
- }
8
+ }.with_indifferent_access
9
9
  end
10
10
 
11
11
  def declare_file(api_path, params)
@@ -25,8 +25,8 @@ module Bearcat
25
25
 
26
26
  def confirm_file_upload(url)
27
27
  uri = URI(url)
28
- query = uri.query
29
- query.blank? ? get(uri.path) : get(uri.path, CGI::parse(query))
28
+ uri.scheme = uri.host = uri.port = nil
29
+ get(uri.to_s)
30
30
  end
31
31
 
32
32
  def upload_connection
@@ -1,11 +1,9 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Files
4
+ extend ClientModule
4
5
 
5
- def list_course_files(course, params = {})
6
- get("/api/v1/courses/#{course}/files", params)
7
- end
8
-
6
+ get :list_course_files, "/api/v1/courses/:course/files"
9
7
  end
10
8
  end
11
9
  end
@@ -1,70 +1,24 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Folders
4
+ extend ClientModule
4
5
 
5
- def get_course_folder(course, folder, params = {})
6
- get("/api/v1/courses/#{course}/folders/#{folder}", params)
6
+ context_types %i[course user group] do |ct|
7
+ prefix "/api/v1/#{ct}s/:#{ct}/folders/" do
8
+ get :"list_#{ct}_folders"
9
+ post :"create_#{ct}_folder"
10
+ get :"get_#{ct}_folder", ":folder"
11
+ get :"resolve_path_for_#{ct}", "by_path/:full_path"
12
+ end
7
13
  end
8
14
 
9
- def list_course_folders(course, params = {})
10
- get("/api/v1/courses/#{course}/folders", params)
15
+ prefix "/api/v1/folders/:folder/" do
16
+ put :update_folder
17
+ delete :delete_folder
11
18
  end
12
19
 
13
- def resolve_path_for_course(course, full_path = nil, params)
14
- get("/api/v1/courses/#{course}/folders/by_path#{full_path == nil ? "" : "/#{full_path}"}", params)
15
- end
16
-
17
- def create_course_folder(course, params = {})
18
- post("/api/v1/courses/#{course}/folders", params)
19
- end
20
-
21
- def get_user_folder(user, folder, params = {})
22
- get("/api/v1/users/#{user}/folders/#{folder}", params)
23
- end
24
-
25
- def list_user_folders(user, params = {})
26
- get("/api/v1/users/#{user}/folders", params)
27
- end
28
-
29
- def resolve_path_for_user(user, full_path = nil, params = {})
30
- get("/api/v1/users/#{user}/folders/by_path#{full_path == nil ? "" : "/#{full_path}"}", params)
31
- end
32
-
33
- def create_user_folder(user, params = {})
34
- post("/api/v1/users/#{user}/folders", params)
35
- end
36
-
37
- def get_group_folder(group, folder, params = {})
38
- get("/api/v1/groups/#{group}/folders/#{folder}", params)
39
- end
40
-
41
- def list_group_folders(group, params = {})
42
- get("/api/v1/groups/#{group}/folders", params)
43
- end
44
-
45
- def resolve_path_for_group(group, full_path = nil, params = {})
46
- get("/api/v1/groups/#{group}/folders/by_path#{full_path == nil ? "" : "/#{full_path}"}", params)
47
- end
48
-
49
- def create_group_folder(group, params = {})
50
- post("/api/v1/groups/#{group}/folders", params)
51
- end
52
-
53
- def update_folder(folder, params = {})
54
- put("/api/v1/folders/#{folder}", params)
55
- end
56
-
57
- def delete_folder(folder, params = {})
58
- delete("/api/v1/folders/#{folder}", params)
59
- end
60
-
61
- def copy_folder(destination_folder, params = {})
62
- post("/api/v1/folders/#{destination_folder}/copy_folder", params)
63
- end
64
-
65
- def copy_file_to_folder(destination_folder, params = {})
66
- post("/api/v1/folders/#{destination_folder}/copy_file", params)
67
- end
20
+ post :copy_folder, "/api/v1/folders/:destination_folder/copy_folder"
21
+ post :copy_file_to_folder, "/api/v1/folders/:destination_folder/copy_file"
68
22
  end
69
23
  end
70
24
  end
@@ -1,27 +1,18 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module GroupCategories
4
+ extend ClientModule
4
5
 
5
- def list_group_categories(context, id)
6
- get("/api/v1/#{context}/#{id}/group_categories")
6
+ prefix "/api/v1/:context/:id/group_categories/" do
7
+ get :list_group_categories
8
+ post :create_group_category
7
9
  end
8
10
 
9
- def group_category(id)
10
- get("/api/v1/group_categories/#{id}")
11
+ prefix "/api/v1/group_categories/:id/" do
12
+ get :group_category
13
+ put :edit_group_category
14
+ delete :delete_group_category
11
15
  end
12
-
13
- def edit_group_category(id, params={})
14
- put("/api/v1/group_categories/#{id}", params)
15
- end
16
-
17
- def create_group_category(context, id, params={})
18
- post("/api/v1/#{context}/#{id}/group_categories", params)
19
- end
20
-
21
- def delete_group_category(id, params={})
22
- delete("/api/v1/group_categories/#{id}/", params)
23
- end
24
-
25
16
  end
26
17
  end
27
18
  end
@@ -1,21 +1,13 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module GroupMemberships
4
+ extend ClientModule
4
5
 
5
- def group_membership(group, group_membership)
6
- get("/api/v1/groups/#{group}/memberships/#{group_membership}")
7
- end
8
-
9
- def list_group_memberships(group)
10
- get("/api/v1/groups/#{group.to_s}/memberships")
11
- end
12
-
13
- def create_group_membership(group_id, params={})
14
- post("/api/v1/groups/#{group_id}/memberships", params)
15
- end
16
-
17
- def delete_group_membership(group_id, context, context_id)
18
- delete("/api/v1/groups/#{group_id}/#{context}/#{context_id}")
6
+ prefix "/api/v1/groups/:group/" do
7
+ get :group_membership, "memberships/:group_membership"
8
+ get :list_group_memberships, "memberships"
9
+ post :create_group_membership, "memberships"
10
+ delete :delete_group_membership, ":context/:context_id"
19
11
  end
20
12
  end
21
13
  end
@@ -1,34 +1,19 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Groups
4
+ extend ClientModule
4
5
 
5
- def course_groups(course)
6
- get("/api/v1/courses/#{course.to_s}/groups")
6
+ prefix "/api/v1/groups/:group/" do
7
+ get :group
8
+ put :edit_group
9
+ delete :delete_group
7
10
  end
8
11
 
9
- def account_groups(account_id)
10
- get("/api/v1/accounts/#{account_id}/groups")
11
- end
12
-
13
- def category_groups(group_category_id)
14
- get("/api/v1/group_categories/#{group_category_id}/groups")
15
- end
16
-
17
- def group(id)
18
- get("/api/v1/groups/#{id}")
19
- end
12
+ get :course_groups, "/api/v1/courses/:course/groups"
13
+ get :account_groups, "/api/v1/accounts/:account/groups"
20
14
 
21
- def create_group(group_category_id, params={})
22
- post("/api/v1/group_categories/#{group_category_id}/groups", params)
23
- end
24
-
25
- def edit_group(group_id, params={})
26
- put("/api/v1/groups/#{group_id}", params)
27
- end
28
-
29
- def delete_group(group_id)
30
- delete("/api/v1/groups/#{group_id}")
31
- end
15
+ get :category_groups, "/api/v1/group_categories/:group_category/groups"
16
+ post :create_group, "/api/v1/group_categories/:group_category/groups"
32
17
  end
33
18
  end
34
19
  end
@@ -1,25 +1,17 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module ModuleItems
4
+ extend ClientModule
4
5
 
5
- def list_module_items(course, mod, params = {})
6
- get("/api/v1/courses/#{course}/modules/#{mod}/items", params)
7
- end
8
-
9
- def module_item(course_id, module_id, module_item_id, params = {})
10
- get("/api/v1/courses/#{course_id}/modules/#{module_id}/items/#{module_item_id}", params)
11
- end
12
-
13
- def create_module_item(course_id, module_id, params={})
14
- post("/api/v1/courses/#{course_id}/modules/#{module_id}/items", params)
15
- end
16
-
17
- def update_module_item(course_id, module_id, module_item_id, params={})
18
- put("/api/v1/courses/#{course_id}/modules/#{module_id}/items/#{module_item_id}", params)
19
- end
6
+ prefix "/api/v1/courses/:course/modules/:module/items/" do
7
+ get :list_module_items
8
+ post :create_module_item
20
9
 
21
- def delete_module_item(course_id, module_id, module_item_id, params={})
22
- delete("/api/v1/courses/#{course_id}/modules/#{module_id}/items/#{module_item_id}", params)
10
+ prefix ":module_item/" do
11
+ get :module_item
12
+ put :update_module_item
13
+ delete :delete_module_item
14
+ end
23
15
  end
24
16
  end
25
17
  end
@@ -1,29 +1,19 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Modules
4
+ extend ClientModule
4
5
 
5
- def course_modules(course, params = {})
6
- get("/api/v1/courses/#{course.to_s}/modules", params)
7
- end
8
-
9
- def course_module_item_sequence(course, params = {})
10
- get("/api/v1/courses/#{course}/module_item_sequence", params)
11
- end
12
-
13
- def course_module(course_id, context_module_id, params={})
14
- get("/api/v1/courses/#{course_id}/modules/#{context_module_id}", params)
15
- end
16
-
17
- def create_module(course, params={})
18
- post("/api/v1/courses/#{course}/modules", params)
19
- end
6
+ prefix "/api/v1/courses/:course/" do
7
+ prefix "modules/" do
8
+ get :course_modules
9
+ post :create_module
20
10
 
21
- def update_module(course, module_id, params={})
22
- put("/api/v1/courses/#{course}/modules/#{module_id}", params)
23
- end
11
+ get :course_module, ":context_module_id"
12
+ put :update_module, ":module_id"
13
+ delete :delete_module, ":module_id"
14
+ end
24
15
 
25
- def delete_module(course, module_id, params={})
26
- delete("/api/v1/courses/#{course}/modules/#{module_id}", params)
16
+ get :course_module_item_sequence, "module_item_sequence"
27
17
  end
28
18
  end
29
19
  end
@@ -1,6 +1,7 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module OutcomeGroups
4
+ extend ClientModule
4
5
 
5
6
  def show_outcome_group(outcome_group_id, params={})
6
7
  get("#{outcomes_context_slug(params)}#{outcome_group_id}")
@@ -61,21 +62,18 @@ module Bearcat
61
62
  end
62
63
 
63
64
  private
65
+
64
66
  def account_slug(account_id)
65
67
  "accounts/#{account_id}/outcome_groups/"
66
68
  end
67
69
 
68
-
69
- private
70
70
  def course_slug(course_id)
71
71
  "courses/#{course_id}/outcome_groups/"
72
72
  end
73
73
 
74
- private
75
74
  def global_slug
76
75
  "global/outcome_groups/"
77
76
  end
78
-
79
77
  end
80
78
  end
81
79
  end
@@ -1,15 +1,12 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Outcomes
4
+ extend ClientModule
4
5
 
5
- def show_outcome(id)
6
- get("/api/v1/outcomes/#{id}")
6
+ prefix "/api/v1/outcomes/:outcome/" do
7
+ get :show_outcome
8
+ put :update_outcome
7
9
  end
8
-
9
- def update_outcome(id, params={})
10
- put("/api/v1/outcomes/#{id}", params)
11
- end
12
-
13
10
  end
14
11
  end
15
12
  end
@@ -1,29 +1,14 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Pages
4
-
5
- def list_course_pages(course, params={})
6
- get("/api/v1/courses/#{course}/pages", params)
7
- end
8
-
9
- def list_group_pages(group, params={})
10
- get("/api/v1/groups/#{group}/pages", params)
11
- end
12
-
13
- def show_course_page(course, url, params={})
14
- get("/api/v1/courses/#{course}/pages/#{url}", params)
15
- end
16
-
17
- def show_group_page(group, url, params={})
18
- get("/api/v1/groups/#{group}/pages/#{url}", params)
19
- end
20
-
21
- def add_course_page(course, params={})
22
- post("api/v1/courses/#{course}/pages", params)
23
- end
24
-
25
- def add_group_page(group, params={})
26
- post("/api/v1/groups/#{group}/pages", params)
4
+ extend ClientModule
5
+
6
+ context_types %i[course group] do |ct|
7
+ prefix "/api/v1/#{ct}s/:#{ct}/pages/" do
8
+ get :"list_#{ct}_pages"
9
+ post :"add_#{ct}_page"
10
+ get :"show_#{ct}_page", ":url"
11
+ end
27
12
  end
28
13
  end
29
14
  end
@@ -1,10 +1,9 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Progresses
4
+ extend ClientModule
4
5
 
5
- def progress(progress, params={})
6
- get("/api/v1/progress/#{progress}", params)
7
- end
6
+ get :progress, "/api//v1/progress/:progress"
8
7
  end
9
8
  end
10
9
  end
@@ -1,41 +1,21 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
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 edit_quiz(course, quiz, params={})
14
- put("/api/v1/courses/#{course}/quizzes/#{quiz}", params)
15
- end
16
-
17
- def quiz_extensions(course, quiz, params={})
18
- post("/api/v1/courses/#{course}/quizzes/#{quiz}/extensions", params)
19
- end
20
-
21
- def quiz_assignment_overrides(course, params={})
22
- get("/api/v1/courses/#{course}/quizzes/assignment_overrides", params)
23
- end
24
-
25
- def quiz_questions(course, quiz, params={})
26
- get("/api/v1/courses/#{course}/quizzes/#{quiz}/questions", params)
27
- end
28
-
29
- def create_quiz(course, params={})
30
- post("/api/v1/courses/#{course}/quizzes", params)
31
- end
32
-
33
- def create_quiz_report(course, quiz, params={})
34
- post("/api/v1/courses/#{course}/quizzes/#{quiz}/reports", params)
35
- end
36
-
37
- def get_quiz_report(course, quiz, report, params)
38
- get("/api/v1/courses/#{course}/quizzes/#{quiz}/reports/#{report}", params)
4
+ extend ClientModule
5
+
6
+ prefix "/api/v1/courses/:course/" do
7
+ get :list_course_quizzes, "quizzes"
8
+ post :create_quiz, "quizzes"
9
+ get :quiz_assignment_overrides, "quizzes/assignment_overrides"
10
+
11
+ prefix "quizzes/:quiz/" do
12
+ get :quiz
13
+ put :edit_quiz
14
+ post :quiz_extensions, "extensions"
15
+ get :quiz_questions, "questions"
16
+ post :create_quiz_report, "reports"
17
+ get :get_quiz_report, "reports/:report"
18
+ end
39
19
  end
40
20
  end
41
21
  end
@@ -3,25 +3,14 @@ require 'csv'
3
3
  module Bearcat
4
4
  class Client < Footrest::Client
5
5
  module Reports
6
-
7
- def report_list(account)
8
- get("/api/v1/accounts/#{account}/reports")
9
- end
10
-
11
- def start_report(account, report_name, params = {})
12
- post("/api/v1/accounts/#{account}/reports/#{report_name}", params)
13
- end
14
-
15
- def report_history(account, report_name)
16
- get("/api/v1/accounts/#{account}/reports/#{report_name}")
17
- end
18
-
19
- def report_status(account, report_name, report_id)
20
- get("/api/v1/accounts/#{account}/reports/#{report_name}/#{report_id}")
21
- end
22
-
23
- def delete_report(account, report_name, report_id)
24
- delete("/api/v1/accounts/#{account}/reports/#{report_name}/#{report_id}")
6
+ extend ClientModule
7
+
8
+ prefix "/api/v1/accounts/:account/reports/" do
9
+ get :report_list
10
+ post :start_report, ":report_name"
11
+ get :report_history, ":report_name"
12
+ get :report_status, ":report_name/:report_id"
13
+ delete :delete_report, ":report_name/:report_id"
25
14
  end
26
15
 
27
16
  def download_report(url, save_location=nil)
@@ -1,6 +1,7 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Roles
4
+ extend ClientModule
4
5
 
5
6
  def roles(account_id='self', params={})
6
7
  get("/api/v1/accounts/#{account_id}/roles", params)
@@ -9,7 +10,6 @@ module Bearcat
9
10
  def role(role_id, account_id='self', params={})
10
11
  get("/api/v1/accounts/#{account_id}/roles/#{role_id}", params)
11
12
  end
12
-
13
13
  end
14
14
  end
15
15
  end
@@ -1,29 +1,17 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Rubric
4
- def course_rubric(course, rubric)
5
- get("api/v1/courses/#{course}/rubrics/#{rubric}")
6
- end
7
-
8
- def course_rubrics(course, params={})
9
- get("api/v1/courses/#{course}/rubrics", params)
10
- end
11
-
12
- def create_course_rubric(course, params={})
13
- post("api/v1/courses/#{course}/rubrics/", params)
14
- end
15
-
16
- def update_course_rubric(course, rubric, params={})
17
- put("api/v1/courses/#{course}/rubrics/#{rubric}", params)
18
- end
4
+ extend ClientModule
19
5
 
20
- def delete_course_rubric(course, rubric)
21
- delete("api/v1/courses/#{course}/rubrics/#{rubric}")
6
+ prefix "/api/v1/courses/:course/rubrics/" do
7
+ get :course_rubric, ":rubric"
8
+ get :course_rubrics
9
+ post :create_course_rubric
10
+ put :update_course_rubric, ":rubric"
11
+ delete :delete_course_rubric, ":rubric"
22
12
  end
23
13
 
24
- def account_rubrics(account, params={})
25
- get("api/v1/accounts/#{account}/rubrics", params={})
26
- end
14
+ get :account_rubrics, "api/v1/accounts/:account/rubrics"
27
15
  end
28
16
  end
29
17
  end