Sha256: 98dd8a156330591f9b0ede5abea843ad78691538b2e77c81c44b4ab8ad352b11

Contents?: true

Size: 1.94 KB

Versions: 92

Compression:

Stored size: 1.94 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_with_type(id, type, params = {})
        post("/api/v1/#{type}/#{id}/content_migrations", params)
      end

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

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

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

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

    end
  end
end

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
bearcat-1.4.10 lib/bearcat/client/content_migrations.rb
bearcat-1.4.9 lib/bearcat/client/content_migrations.rb
bearcat-1.4.8 lib/bearcat/client/content_migrations.rb
bearcat-1.4.7 lib/bearcat/client/content_migrations.rb
bearcat-1.4.6 lib/bearcat/client/content_migrations.rb
bearcat-1.4.5 lib/bearcat/client/content_migrations.rb
bearcat-1.4.4 lib/bearcat/client/content_migrations.rb
bearcat-1.4.3 lib/bearcat/client/content_migrations.rb
bearcat-1.4.2 lib/bearcat/client/content_migrations.rb
bearcat-1.4.1 lib/bearcat/client/content_migrations.rb
bearcat-1.4.0 lib/bearcat/client/content_migrations.rb
bearcat-1.3.55 lib/bearcat/client/content_migrations.rb
bearcat-1.3.53 lib/bearcat/client/content_migrations.rb
bearcat-1.3.52 lib/bearcat/client/content_migrations.rb
bearcat-1.3.51 lib/bearcat/client/content_migrations.rb
bearcat-1.3.49 lib/bearcat/client/content_migrations.rb
bearcat-1.3.48 lib/bearcat/client/content_migrations.rb
bearcat-1.3.47 lib/bearcat/client/content_migrations.rb
bearcat-1.3.46 lib/bearcat/client/content_migrations.rb
bearcat-1.3.45 lib/bearcat/client/content_migrations.rb