Sha256: 802d03c3dbc5ba4957133a30b55d460641922282764833927f6f7d32c723e027

Contents?: true

Size: 1.77 KB

Versions: 7

Compression:

Stored size: 1.77 KB

Contents

module Bearcat
  class Client < Footrest::Client
    module Courses
      extend ClientModule

      post :create_course, "/api/v1/accounts/:account_id/courses"
      get :list_users_courses, "/api/v1/courses"

      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"

        get :course_grading_standards, "grading_standards"
        get :course_grading_standard, "grading_standards/:grading_standard_id"
        get :course_gradebook_history, "gradebook_history/feed"

        # 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"

        get :course_settings, 'settings'

        get :course_late_policy, 'late_policy'
        post :create_course_late_policy, 'late_policy'
        patch :update_course_late_policy, 'late_policy'
      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)]
      end

      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
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bearcat-1.5.33 lib/bearcat/client/courses.rb
bearcat-1.5.32 lib/bearcat/client/courses.rb
bearcat-1.5.31 lib/bearcat/client/courses.rb
bearcat-1.5.30 lib/bearcat/client/courses.rb
bearcat-1.5.29 lib/bearcat/client/courses.rb
bearcat-1.5.28 lib/bearcat/client/courses.rb
bearcat-1.5.28.beta1 lib/bearcat/client/courses.rb