lib/bearcat/client/courses.rb in bearcat-1.4.13 vs lib/bearcat/client/courses.rb in bearcat-1.5.0.beta1

- old
+ new

@@ -1,37 +1,29 @@ module Bearcat class Client < Footrest::Client module Courses + extend ClientModule - def course(course, params={}) - get("/api/v1/courses/#{course}", params) - end + post :create_course, "/api/v1/accounts/:account_id/courses" + get :list_users_courses, "/api/v1/courses" - def create_course(account_id, params={}) - post("/api/v1/accounts/#{account_id}/courses", params) - end + prefix "/api/v1/courses/:course/" do + get :course + put :update_course + delete :delete_course, defaults: { event: "delete" } + get :list_course_users, "users" + post :course_quiz_extensions, "quiz_extensions" + get :course_outcome_results, "outcome_results" - def delete_course(course, params={event: :delete}) - delete("/api/v1/courses/#{course}", params) - end + get :course_grading_standards, "grading_standards" + get :course_grading_standard, "grading_standards/:grading_standard_id" + get :course_gradebook_history, "gradebook_history/feed" - def update_course(course, params={}) - put("/api/v1/courses/#{course}", params) + # Performs effectively the same operation as #create_content_migration, but without the need to specify a file to be uploaded + post :copy_course, "content_migrations" end - def list_course_users(course, params={}) - get("/api/v1/courses/#{course}/users", params) - end - - def course_quiz_extensions(course, params={}) - post("/api/v1/courses/#{course}/quiz_extensions", params) - end - - def course_outcome_results(course, params={}) - get("/api/v1/courses/#{course}/outcome_results", params) - end - def create_content_migration_with_both_responses(course, file_path, params={}) content_migration_response = post("/api/v1/courses/#{course}/content_migrations", params) pre_attachment = content_migration_response['pre_attachment'] confirmation_url = post_file(pre_attachment['upload_url'], pre_attachment['upload_params'], file_path) [content_migration_response, confirm_file_upload(confirmation_url)] @@ -39,30 +31,8 @@ def create_content_migration(course, file_path, params={}) content_migration_response, file_upload_response = create_content_migration_with_both_responses(course, file_path, params) file_upload_response end - - # Performs effectively the same operation as #create_content_migration, but without the need to specify a file to be uploaded - def copy_course(course, params = {}) - post("/api/v1/courses/#{course}/content_migrations", params) - end - - def list_users_courses(params) - get("api/v1/courses", params) - end - - def course_grading_standards(course, params={}) - get("/api/v1/courses/#{course}/grading_standards", params) - end - - def course_grading_standard(course, grading_standard_id, params={}) - get("/api/v1/courses/#{course}/grading_standards/#{grading_standard_id}", params) - end - - def course_gradebook_history(course, params={}) - get("api/v1/courses/#{course}/gradebook_history/feed", params) - end - end end end