bearcat 1.4.13 → 1.5.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/bearcat.gemspec +9 -3
  3. data/lib/bearcat/client/account_reports.rb +6 -14
  4. data/lib/bearcat/client/accounts.rb +20 -56
  5. data/lib/bearcat/client/analytics.rb +4 -7
  6. data/lib/bearcat/client/assignment_groups.rb +7 -19
  7. data/lib/bearcat/client/assignments.rb +15 -39
  8. data/lib/bearcat/client/blueprint_courses.rb +14 -20
  9. data/lib/bearcat/client/calendar_events.rb +9 -17
  10. data/lib/bearcat/client/canvas_files.rb +0 -2
  11. data/lib/bearcat/client/conferences.rb +3 -8
  12. data/lib/bearcat/client/conversations.rb +3 -8
  13. data/lib/bearcat/client/courses.rb +15 -45
  14. data/lib/bearcat/client/custom_gradebook_columns.rb +11 -25
  15. data/lib/bearcat/client/discussions.rb +11 -37
  16. data/lib/bearcat/client/enrollments.rb +9 -29
  17. data/lib/bearcat/client/external_tools.rb +9 -36
  18. data/lib/bearcat/client/file_helper.rb +2 -2
  19. data/lib/bearcat/client/files.rb +2 -4
  20. data/lib/bearcat/client/folders.rb +13 -59
  21. data/lib/bearcat/client/group_categories.rb +8 -17
  22. data/lib/bearcat/client/group_memberships.rb +6 -14
  23. data/lib/bearcat/client/groups.rb +9 -24
  24. data/lib/bearcat/client/module_items.rb +9 -17
  25. data/lib/bearcat/client/modules.rb +10 -20
  26. data/lib/bearcat/client/outcome_groups.rb +2 -4
  27. data/lib/bearcat/client/outcomes.rb +4 -7
  28. data/lib/bearcat/client/pages.rb +8 -23
  29. data/lib/bearcat/client/progresses.rb +2 -3
  30. data/lib/bearcat/client/quizzes.rb +15 -35
  31. data/lib/bearcat/client/reports.rb +8 -19
  32. data/lib/bearcat/client/roles.rb +1 -1
  33. data/lib/bearcat/client/rubric.rb +8 -20
  34. data/lib/bearcat/client/rubric_assessment.rb +5 -11
  35. data/lib/bearcat/client/rubric_association.rb +6 -12
  36. data/lib/bearcat/client/search.rb +2 -4
  37. data/lib/bearcat/client/sections.rb +11 -26
  38. data/lib/bearcat/client/submissions.rb +13 -36
  39. data/lib/bearcat/client/tabs.rb +4 -7
  40. data/lib/bearcat/client/users.rb +17 -44
  41. data/lib/bearcat/client.rb +72 -44
  42. data/lib/bearcat/client_module.rb +101 -0
  43. data/lib/bearcat/rate_limiting/redis_script.rb +164 -0
  44. data/lib/bearcat/rate_limiting.rb +70 -0
  45. data/lib/bearcat/spec_helpers.rb +62 -31
  46. data/lib/bearcat/version.rb +1 -1
  47. data/lib/bearcat.rb +8 -21
  48. data/lib/catalogcat/api_array.rb +18 -0
  49. data/lib/catalogcat/client/catalogs.rb +21 -0
  50. data/lib/catalogcat/client/certificates.rb +9 -0
  51. data/lib/catalogcat/client/courses.rb +25 -0
  52. data/lib/catalogcat/client/orders.rb +9 -0
  53. data/lib/catalogcat/client.rb +39 -0
  54. data/lib/catalogcat/version.rb +3 -0
  55. data/lib/catalogcat.rb +14 -0
  56. data/spec/bearcat/client/canvas_files_spec.rb +1 -2
  57. data/spec/bearcat/client/content_migrations_spec.rb +1 -1
  58. data/spec/bearcat/client/courses_spec.rb +2 -4
  59. data/spec/bearcat/{group_memberships_spec.rb → client/group_memberships_spec.rb} +0 -0
  60. data/spec/bearcat/client_spec.rb +1 -4
  61. data/spec/bearcat/rate_limiting_spec.rb +62 -0
  62. data/spec/bearcat/stub_bearcat_spec.rb +15 -0
  63. data/spec/helper.rb +1 -0
  64. metadata +195 -180
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56127337ffe67a0c9a01aa12a8c7d858331c49a8c608c2ec7e82de2b10abaadc
4
- data.tar.gz: ef63a06ce0fc281a255763afbd1d7e0d07e85b2d40bf2a45b01a4a41f21efb1b
3
+ metadata.gz: dfa0e208c1e9c27cf47f857f4830167fe833c966cb96eebfb3df5b9edcc1d407
4
+ data.tar.gz: 2a06fb44fbbf24b35be34943782aaedb6357d1a98b6031a9ce2cc24a8be91801
5
5
  SHA512:
6
- metadata.gz: 9dee94f956ca584cc6c0d892277e424430f81c62074106f040fe92974d926b5df72dc8b57d7e3f84dff64d135ba274967da32110bb8201aee061715b331b4969
7
- data.tar.gz: 114bbcc3a2374c8b8774da933c412ea73f57a9adb0273a5d1683ee4949fd077088bdb12ca91e430011cda1740023a4c9b480a45c573c9685ee30a9215488d2c0
6
+ metadata.gz: 9f78f3fe0c128b86553b7748e58fd17e4ccbe124709c6bf7d1446781f7fdb1f758577d181d4957925a7b006c6e09ec43ca7616bc6f696d5b678e7f8bd253505a
7
+ data.tar.gz: 736439d3fe242e26c77389230ab7e262c98de5b7f0802cd4a5bc061f178b4f24f90b342b339c5e5852eae75c462c799202b130d67f4d16c87045508593eb76c1
data/bearcat.gemspec CHANGED
@@ -2,7 +2,13 @@
2
2
  # spec/fixtures/bearcat.jpg Attribution: TassiloRau at the German language Wikipedia
3
3
  lib = File.expand_path('../lib', __FILE__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'bearcat/version'
5
+
6
+ begin
7
+ require 'bearcat/version'
8
+ version = Bearcat::VERSION
9
+ rescue LoadError
10
+ version = "0.0.0.docker"
11
+ end
6
12
 
7
13
  Gem::Specification.new do |gem|
8
14
  gem.authors = ["Nathan Mills, Jake Sorce"]
@@ -16,15 +22,15 @@ Gem::Specification.new do |gem|
16
22
  gem.test_files = Dir.glob("spec/**/*")
17
23
  gem.name = "bearcat"
18
24
  gem.require_paths = ["lib"]
19
- gem.version = Bearcat::VERSION
25
+ gem.version = version
20
26
 
21
27
  gem.add_development_dependency "rake"
22
28
  gem.add_development_dependency "bundler", ">= 1.0.0"
23
29
  gem.add_development_dependency "rspec", "~> 2.6"
24
30
  gem.add_development_dependency "webmock"
25
31
  gem.add_development_dependency 'pry'
32
+ gem.add_development_dependency 'sidekiq', "< 7.0"
26
33
 
27
34
  gem.add_dependency "activesupport"
28
35
  gem.add_dependency "footrest", ">= 0.2.2"
29
- gem.add_dependency "paul_walker", "~> 0.1.1"
30
36
  end
@@ -1,21 +1,13 @@
1
1
  module Bearcat
2
2
  class Client
3
3
  module AccountReports
4
+ extend ClientModule
4
5
 
5
- def available_reports(account, params={})
6
- get("/api/v1/accounts/#{account}/reports", params)
7
- end
8
-
9
- def start_report(account, report, params)
10
- post("api/v1/accounts/#{account}/reports/#{report}", params)
11
- end
12
-
13
- def report_index(account, report, params={})
14
- get("/api/v1/accounts/#{account}/reports/#{report}", params)
15
- end
16
-
17
- def report_status(account, report, report_id)
18
- get("/api/v1/accounts/#{account}/reports/#{report}/#{report_id}")
6
+ prefix "/api/v1/accounts/:account/reports/" do
7
+ get :available_reports
8
+ post :start_report, ":report"
9
+ get :report_index, ":report"
10
+ get :report_status, ":report/:report_id"
19
11
  end
20
12
  end
21
13
  end
@@ -1,63 +1,27 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Accounts
4
-
5
- def list_accounts(params = {})
6
- get("/api/v1/accounts", params)
7
- end
8
-
9
- def account(account)
10
- get("/api/v1/accounts/#{account}")
11
- end
12
-
13
- def list_sub_accounts(account, params = {})
14
- get("api/v1/accounts/#{account}/sub_accounts", params)
15
- end
16
-
17
- def terms(account, params = {})
18
- get("/api/v1/accounts/#{account}/terms", params)
19
- end
20
-
21
- def account_admins(account, params = {})
22
- get("/api/v1/accounts/#{account}/admins", params)
23
- end
24
-
25
- def create_account_admin(account, params = {})
26
- post("/api/v1/accounts/#{account}/admins", params)
27
- end
28
-
29
- def delete_account_admin(account, user, params = {})
30
- delete("/api/v1/accounts/#{account}/admins/#{user}", params)
31
- end
32
-
33
- def list_roles(account, params = {})
34
- get("/api/v1/accounts/#{account}/roles", params)
35
- end
36
-
37
- def account_roles(account, params = {})
38
- get("/api/v1/accounts/#{account}/roles", params)
39
- end
40
-
41
- def account_courses(account, params = {})
42
- get("/api/v1/accounts/#{account}/courses", params)
43
- end
44
-
45
- def account_grading_standards(account, params={})
46
- get("/api/v1/accounts/#{account}/grading_standards", params)
4
+ extend ClientModule
5
+
6
+ prefix "/api/v1/accounts/" do
7
+ get :list_accounts
8
+
9
+ prefix ":account/" do
10
+ get :account
11
+ get :list_sub_accounts, "sub_accounts"
12
+ get :terms, "terms"
13
+ get :account_admins, "admins"
14
+ post :create_account_admin, "admins"
15
+ delete :delete_account_admin, "admins/:user"
16
+ get :list_roles, "roles"
17
+ get :account_roles, "roles"
18
+ get :account_courses, "courses"
19
+ get :account_grading_standards, "grading_standards"
20
+ get :account_grading_standard, "grading_standards/:grading_standard_id"
21
+ get :account_sis_imports, "sis_imports"
22
+ get :enrollment, "enrollments/:enrollment"
23
+ end
47
24
  end
48
-
49
- def account_grading_standard(account, grading_standard_id, params={})
50
- get("/api/v1/accounts/#{account}/grading_standards/#{grading_standard_id}", params)
51
- end
52
-
53
- def account_sis_imports(account, params={})
54
- get("/api/v1/accounts/#{account}/sis_imports", params)
55
- end
56
-
57
- def enrollment(account, enrollment, params={})
58
- get("/api/v1/accounts/#{account.to_s}/enrollments/#{enrollment.to_s}", params)
59
- end
60
-
61
25
  end
62
26
  end
63
27
  end
@@ -1,15 +1,12 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Analytics
4
+ extend ClientModule
4
5
 
5
- def department_level_participation(account, term)
6
- get("/api/v1/accounts/#{account}/analytics/terms/#{term}/activity")
6
+ prefix "/api/v1/accounts/:account/analytics/terms/:term/" do
7
+ get :department_level_participation, "activity"
8
+ get :department_level_statistics, "statistics"
7
9
  end
8
-
9
- def department_level_statistics(account, term)
10
- get("/api/v1/accounts/#{account}/analytics/terms/#{term}/statistics")
11
- end
12
-
13
10
  end
14
11
  end
15
12
  end
@@ -1,27 +1,15 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module AssignmentGroups
4
+ extend ClientModule
4
5
 
5
- def list_assignment_groups(course, params={})
6
- get("/api/v1/courses/#{course}/assignment_groups", params)
6
+ prefix "/api/v1/courses/:course/assignment_groups/" do
7
+ get :list_assignment_groups
8
+ post :create_assignment_group
9
+ get :assignment_group, ":assignment_group_id"
10
+ put :update_assignment_group, ":assignment_group_id"
11
+ delete :delete_assignment_group, ":assignment_group_id"
7
12
  end
8
-
9
- def assignment_group(course_id, assignment_group_id, params={})
10
- get("/api/v1/courses/#{course_id}/assignment_groups/#{assignment_group_id}", params)
11
- end
12
-
13
- def create_assignment_group(course, params={})
14
- post("/api/v1/courses/#{course}/assignment_groups", params)
15
- end
16
-
17
- def update_assignment_group(course, assignment_group_id, params={})
18
- put("/api/v1/courses/#{course}/assignment_groups/#{assignment_group_id}", params)
19
- end
20
-
21
- def delete_assignment_group(course, assignment_group_id, params={})
22
- delete("/api/v1/courses/#{course}/assignment_groups/#{assignment_group_id}", params)
23
- end
24
-
25
13
  end
26
14
  end
27
15
  end
@@ -1,49 +1,25 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Assignments
4
+ extend ClientModule
4
5
 
5
- def assignments(course, params={})
6
- get("/api/v1/courses/#{course}/assignments", params)
7
- end
6
+ prefix "/api/v1/courses/:course/assignments/" do
7
+ get :assignments, ""
8
+ post :create_assignment, ""
8
9
 
9
- def assignment(course, assignment, params={})
10
- get("/api/v1/courses/#{course}/assignments/#{assignment}", params)
11
- end
10
+ get :all_assignment_overrides, "overrides"
11
+ post :batch_create_assignment_overrides, "overrides"
12
+ put :batch_update_assignment_overrides, "overrides"
12
13
 
13
- def assignment_overrides(course, assignment)
14
- get("/api/v1/courses/#{course}/assignments/#{assignment}/overrides")
15
- end
16
-
17
- def all_assignment_overrides(course_id)
18
- get("/api/v1/courses/#{course_id}/assignments/overrides")
19
- end
20
-
21
- def create_assignment_override(course, assignment, params)
22
- post("api/v1/courses/#{course}/assignments/#{assignment}/overrides", params)
23
- end
24
-
25
- def delete_assignment_override(course_id, assignment_id, override_id, params={})
26
- delete("api/v1/courses/#{course_id}/assignments/#{assignment_id}/overrides/#{override_id}", params)
27
- end
28
-
29
- def batch_create_assignment_overrides(course_id, params)
30
- post("/api/v1/courses/#{course_id}/assignments/overrides", params)
31
- end
32
-
33
- def batch_update_assignment_overrides(course_id, params)
34
- put("/api/v1/courses/#{course_id}/assignments/overrides", params)
35
- end
36
-
37
- def create_assignment(course, params={})
38
- post("/api/v1/courses/#{course}/assignments", params)
39
- end
40
-
41
- def edit_assignment(course, assignment, params={})
42
- put("/api/v1/courses/#{course}/assignments/#{assignment}", params)
43
- end
14
+ prefix ":assignment/" do
15
+ get :assignment
16
+ put :edit_assignment
17
+ delete :delete_assignment
44
18
 
45
- def delete_assignment(course, assignment)
46
- delete("/api/v1/courses/#{course}/assignments/#{assignment}")
19
+ get :assignment_overrides, "overrides"
20
+ post :create_assignment_override, "overrides"
21
+ delete :delete_assignment_override, "overrides/:override"
22
+ end
47
23
  end
48
24
  end
49
25
  end
@@ -1,31 +1,25 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module BlueprintCourses
4
+ extend ClientModule
4
5
 
5
- # Get blueprint information
6
- # https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates.show
7
- def blueprint_template(course, template_id='default')
8
- get("/api/v1/courses/#{course}/blueprint_templates/#{template_id}")
9
- end
6
+ prefix "/api/v1/courses/:course/" do
7
+ # Get blueprint information
8
+ # https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates.show
9
+ get :blueprint_template, "blueprint_templates/:template_id", defaults: { template_id: 'default' }
10
10
 
11
- # List blueprint subscriptions
12
- # https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates.subscriptions_index
13
- def blueprint_subscriptions(course)
14
- get("/api/v1/courses/#{course}/blueprint_subscriptions")
15
- end
11
+ # List blueprint subscriptions
12
+ # https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates.subscriptions_index
13
+ get :blueprint_subscriptions, "blueprint_subscriptions"
16
14
 
17
- # Update associated courses
18
- # https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates.update_associations
19
- def blueprint_update_associations(course, template_id='default', params={})
20
- put("/api/v1/courses/#{course}/blueprint_templates/#{template_id}/update_associations", params)
21
- end
15
+ # Update associated courses
16
+ # https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates.update_associations
17
+ put :blueprint_update_associations, "blueprint_templates/:template_id/update_associations", defaults: { template_id: 'default' }
22
18
 
23
- # Begin a migration to push to associated courses
24
- # https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates.queue_migration
25
- def start_blueprint_migration(course, template_id='default', params={})
26
- post("/api/v1/courses/#{course}/blueprint_templates/#{template_id}/migrations", params)
19
+ # Begin a migration to push to associated courses
20
+ # https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates.queue_migration
21
+ post :start_blueprint_migration, "blueprint_templates/:template_id/migrations", defaults: { template_id: 'default' }
27
22
  end
28
-
29
23
  end
30
24
  end
31
25
  end
@@ -1,25 +1,17 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module CalendarEvents
4
+ extend ClientModule
4
5
 
5
- def calendar_events(params = {})
6
- get("/api/v1/calendar_events", params)
7
- end
8
-
9
- def calendar_event(event, params = {})
10
- get("/api/v1/calendar_events/#{event}", params)
11
- end
12
-
13
- def create_calendar_event(params = {})
14
- post("/api/v1/calendar_events", params)
15
- end
16
-
17
- def update_calendar_event(event, params = {})
18
- put("/api/v1/calendar_events/#{event}", params)
19
- end
6
+ prefix "/api/v1/calendar_events/" do
7
+ get :calendar_events
8
+ post :create_calendar_event
20
9
 
21
- def delete_calendar_event(event, params = {})
22
- delete("/api/v1/calendar_events/#{event}", params)
10
+ prefix ":event/" do
11
+ get :calendar_event
12
+ put :update_calendar_event
13
+ delete :delete_calendar_event
14
+ end
23
15
  end
24
16
  end
25
17
  end
@@ -1,13 +1,11 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module CanvasFiles
4
-
5
4
  def upload_file(api_path, file_path, params = {})
6
5
  declare_response = declare_file(api_path, file_params(file_path).merge(params))
7
6
  confirmation_url = post_file(declare_response['upload_url'], declare_response['upload_params'], file_path)
8
7
  confirm_file_upload(confirmation_url)
9
8
  end
10
-
11
9
  end
12
10
  end
13
11
  end
@@ -1,15 +1,10 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Conferences
4
+ extend ClientModule
4
5
 
5
- def course_conferences(course)
6
- get("/api/v1/courses/#{course.to_s}/conferences")
7
- end
8
-
9
- def group_conferences(section)
10
- get("/api/v1/groups/#{section.to_s}/conferences")
11
- end
12
-
6
+ get :course_conferences, "/api/v1/courses/:course/conferences"
7
+ get :group_conferences, "/api/v1/groups/:section/conferences"
13
8
  end
14
9
  end
15
10
  end
@@ -1,15 +1,10 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Conversations
4
+ extend ClientModule
4
5
 
5
- def create_conversation(params = {})
6
- post("/api/v1/conversations", params)
7
- end
8
-
9
- def delete_conversation(conversation)
10
- delete("/api/v1/conversations/#{conversation.to_s}")
11
- end
12
-
6
+ post :create_conversation, "/api/v1/conversations"
7
+ delete :delete_conversation, "/api/v1/conversations/:conversation"
13
8
  end
14
9
  end
15
10
  end
@@ -1,33 +1,25 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Courses
4
+ extend ClientModule
4
5
 
5
- def course(course, params={})
6
- get("/api/v1/courses/#{course}", params)
7
- end
8
-
9
- def create_course(account_id, params={})
10
- post("/api/v1/accounts/#{account_id}/courses", params)
11
- end
12
-
13
- def delete_course(course, params={event: :delete})
14
- delete("/api/v1/courses/#{course}", params)
15
- end
6
+ post :create_course, "/api/v1/accounts/:account_id/courses"
7
+ get :list_users_courses, "/api/v1/courses"
16
8
 
17
- def update_course(course, params={})
18
- put("/api/v1/courses/#{course}", params)
19
- end
9
+ prefix "/api/v1/courses/:course/" do
10
+ get :course
11
+ put :update_course
12
+ delete :delete_course, defaults: { event: "delete" }
13
+ get :list_course_users, "users"
14
+ post :course_quiz_extensions, "quiz_extensions"
15
+ get :course_outcome_results, "outcome_results"
20
16
 
21
- def list_course_users(course, params={})
22
- get("/api/v1/courses/#{course}/users", params)
23
- end
17
+ get :course_grading_standards, "grading_standards"
18
+ get :course_grading_standard, "grading_standards/:grading_standard_id"
19
+ get :course_gradebook_history, "gradebook_history/feed"
24
20
 
25
- def course_quiz_extensions(course, params={})
26
- post("/api/v1/courses/#{course}/quiz_extensions", params)
27
- end
28
-
29
- def course_outcome_results(course, params={})
30
- get("/api/v1/courses/#{course}/outcome_results", params)
21
+ # Performs effectively the same operation as #create_content_migration, but without the need to specify a file to be uploaded
22
+ post :copy_course, "content_migrations"
31
23
  end
32
24
 
33
25
  def create_content_migration_with_both_responses(course, file_path, params={})
@@ -41,28 +33,6 @@ module Bearcat
41
33
  content_migration_response, file_upload_response = create_content_migration_with_both_responses(course, file_path, params)
42
34
  file_upload_response
43
35
  end
44
-
45
- # Performs effectively the same operation as #create_content_migration, but without the need to specify a file to be uploaded
46
- def copy_course(course, params = {})
47
- post("/api/v1/courses/#{course}/content_migrations", params)
48
- end
49
-
50
- def list_users_courses(params)
51
- get("api/v1/courses", params)
52
- end
53
-
54
- def course_grading_standards(course, params={})
55
- get("/api/v1/courses/#{course}/grading_standards", params)
56
- end
57
-
58
- def course_grading_standard(course, grading_standard_id, params={})
59
- get("/api/v1/courses/#{course}/grading_standards/#{grading_standard_id}", params)
60
- end
61
-
62
- def course_gradebook_history(course, params={})
63
- get("api/v1/courses/#{course}/gradebook_history/feed", params)
64
- end
65
-
66
36
  end
67
37
  end
68
38
  end
@@ -1,35 +1,21 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module CustomGradebookColumns
4
+ extend ClientModule
4
5
 
5
- def custom_gradebook_columns(course, params={})
6
- get("/api/v1/courses/#{course.to_s}/custom_gradebook_columns", params)
7
- end
8
-
9
- def create_gradebook_columns(course, params={})
10
- post("/api/v1/courses/#{course.to_s}/custom_gradebook_columns", params)
11
- end
6
+ put :bulk_update_gradebook_columns_data, "/api/v1/courses/:course/custom_gradebook_column_data"
12
7
 
13
- def update_gradebook_columns(course, gradebook_column, params={})
14
- put("/api/v1/courses/#{course.to_s}/custom_gradebook_columns/#{gradebook_column}", params)
15
- end
16
-
17
- def delete_gradebook_columns(course, gradebook_column, params={})
18
- delete("/api/v1/courses/#{course.to_s}/custom_gradebook_columns/#{gradebook_column}", params)
19
- end
8
+ prefix "/api/v1/courses/:course/custom_gradebook_columns/" do
9
+ get :custom_gradebook_columns
10
+ post :create_gradebook_columns
20
11
 
21
- def gradebook_columns_data(course, gradebook_column, params={})
22
- get("/api/v1/courses/#{course.to_s}/custom_gradebook_columns/#{gradebook_column}/data", params)
12
+ prefix ":gradebook_column/" do
13
+ put :update_gradebook_columns
14
+ delete :delete_gradebook_columns
15
+ get :gradebook_columns_data, "data"
16
+ put :update_gradebook_columns_data, "data/:student"
17
+ end
23
18
  end
24
-
25
- def update_gradebook_columns_data(course, gradebook_column, student, params={})
26
- put("/api/v1/courses/#{course.to_s}/custom_gradebook_columns/#{gradebook_column}/data/#{student}", params)
27
- end
28
-
29
- def bulk_update_gradebook_columns_data(course, params={})
30
- put("/api/v1/courses/#{course.to_s}/custom_gradebook_column_data", params)
31
- end
32
-
33
19
  end
34
20
  end
35
21
  end
@@ -1,43 +1,17 @@
1
1
  module Bearcat
2
2
  class Client < Footrest::Client
3
3
  module Discussions
4
-
5
- def create_group_discussion(group_id, params = {})
6
- post("/api/v1/groups/#{group_id}/discussion_topics", params)
7
- end
8
-
9
- def create_course_discussion(course_id, params= {})
10
- post("/api/v1/courses/#{course_id}/discussion_topics", params)
11
- end
12
-
13
- def group_discussions(group_id, params = {})
14
- get("/api/v1/groups/#{group_id}/discussion_topics", params)
15
- end
16
-
17
- def course_discussions(course_id, params= {})
18
- get("/api/v1/courses/#{course_id}/discussion_topics", params)
19
- end
20
-
21
- def course_discussion(course_id, discussion_topic_id, params = {})
22
- get("/api/v1/courses/#{course_id}/discussion_topics/#{discussion_topic_id}", params)
23
- end
24
-
25
- def group_discussion_entries(group_id, discussion_id, params = {})
26
- get("/api/v1/groups/#{group_id}/discussion_topics/#{discussion_id}/entries", params)
27
- end
28
-
29
- def course_discussion_entries(course_id, discussion_id, params= {})
30
- get("/api/v1/courses/#{course_id}/discussion_topics/#{discussion_id}/entries", params)
31
- end
32
-
33
- def group_discussion_entry_replies(group_id, discussion_id, entry_id, params = {})
34
- get("/api/v1/groups/#{group_id}/discussion_topics/#{discussion_id}/entries/#{entry_id}/replies", params)
35
- end
36
-
37
- def course_discussion_entry_replies(course_id, discussion_id, entry_id, params= {})
38
- get("/api/v1/courses/#{course_id}/discussion_topics/#{discussion_id}/entries/#{entry_id}/replies", params)
39
- end
40
-
4
+ extend ClientModule
5
+
6
+ post :create_group_discussion, "/api/v1/groups/:group/discussion_topics"
7
+ post :create_course_discussion, "/api/v1/courses/:course/discussion_topics"
8
+ get :group_discussions, "/api/v1/groups/:group/discussion_topics"
9
+ get :course_discussions, "/api/v1/courses/:course/discussion_topics"
10
+ get :course_discussion, "/api/v1/courses/:course/discussion_topics/:discussion_topic"
11
+ get :group_discussion_entries, "/api/v1/groups/:group/discussion_topics/:discussion/entries"
12
+ get :course_discussion_entries, "/api/v1/courses/:course/discussion_topics/:discussion/entries"
13
+ get :group_discussion_entry_replies, "/api/v1/groups/:group/discussion_topics/:discussion/entries/:entry/replies"
14
+ get :course_discussion_entry_replies, "/api/v1/courses/:course/discussion_topics/:discussion/entries/:entry/replies"
41
15
  end
42
16
  end
43
17
  end
@@ -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