Sha256: 6ac54537f4d11712f1a1f580da42ba3dcdb520e5eae4bcea4c159aaaf7b299a9

Contents?: true

Size: 1.89 KB

Versions: 1

Compression:

Stored size: 1.89 KB

Contents

module Bearcat
  class Client < Footrest::Client
    module ContentMigrations

      def upload_content_package(api_path, file_path, params = {})
        response = post(api_path, params)
        pre_attachment = response['pre_attachment']
        confirmation_url = post_file(pre_attachment['upload_url'], pre_attachment['upload_params'], file_path)
        confirm_file_upload(confirmation_url)
      end

      def get_content_migration(id, migration_id, type, params = {})
        get("/api/v1/#{type}/#{id}/content_migrations/#{migration_id}", params)
      end

      def get_account_content_migration(account_id, migration_id, params = {})
        get_content_migration(account_id, migration_id, 'accounts', params = {})
      end

      def get_course_content_migration(course_id, migration_id, params = {})
        get_content_migration(course_id, migration_id, 'courses', params = {})
      end

      def get_group_content_migration(group_id, migration_id, params = {})
        get_content_migration(group_id, migration_id, 'groups', params = {})
      end

      def get_user_content_migration(user_id, migration_id, params = {})
        get_content_migration(user_id, migration_id, 'users', params = {})
      end

      def create_content_migration(id, type, params = {})
        post("/api/v1/#{type}/#{id}/content_migrations", params)
      end

      def create_account_content_migration(account_id, params = {})
        create_content_migration(account_id, 'accounts', params)
      end

      def create_course_content_migration(course_id, params = {})
        create_content_migration(course_id, 'courses', params)
      end

      def create_group_content_migration(group_id, params = {})
        create_content_migration(group_id, 'groups', params)
      end

      def create_user_content_migration(user_id, params = {})
        create_content_migration(user_id, 'users', params)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bearcat-1.3.5 lib/bearcat/client/content_migrations.rb