Sha256: ac0b08bc0b5b12d2725ab42d5653ddac57da1778659c618513dbdaff794e0e0d

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

Stored size: 1.51 KB

Contents

module Bearcat
  class Client < Footrest::Client
    module Submissions

      def course_submissions(course, params={})
        get("/api/v1/courses/#{course.to_s}/students/submissions", params)
      end

      def get_course_submissions(course, assignment, params={})
        get("/api/v1/courses/#{course.to_s}/assignments/#{assignment}/submissions", params)
      end

      def course_submission(course, assignment, params)
        post("/api/v1/courses/#{course}/assignments/#{assignment}/submissions", params)
      end

      def section_submission(section, assignment, params)
        post("/api/v1/sections/#{section}/assignments/#{assignment}/submissions", params)
      end

      def course_file_upload_submission(course, assignment, user, file_path, params={})
        response = upload_file("/api/v1/courses/#{course}/assignments/#{assignment}/submissions/#{user}/files", file_path, params)
        params['submission'] = {
          'submission_type' => 'online_upload',
          'file_ids'=> [response['id']]
        }
        course_submission(course, assignment, params)
      end

      def section_file_upload_submission(section, assignment, user, file_path, params={})
        response = upload_file("/api/v1/sections/#{section}/assignments/#{assignment}/submissions/#{user}/files", file_path, params)
        params['submission'] = {
          'submission_type' => 'online_upload',
          'file_ids'=> [response['id']]
        }
        section_submission(section, assignment, params)
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bearcat-1.0.6 lib/bearcat/client/submissions.rb
bearcat-1.0.5 lib/bearcat/client/submissions.rb