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.5.37 lib/bearcat/client/content_migrations.rb
bearcat-1.5.36 lib/bearcat/client/content_migrations.rb
bearcat-1.5.35 lib/bearcat/client/content_migrations.rb
bearcat-1.5.34 lib/bearcat/client/content_migrations.rb
bearcat-1.5.33 lib/bearcat/client/content_migrations.rb
bearcat-1.5.32 lib/bearcat/client/content_migrations.rb
bearcat-1.5.31 lib/bearcat/client/content_migrations.rb
bearcat-1.5.30 lib/bearcat/client/content_migrations.rb
bearcat-1.5.29 lib/bearcat/client/content_migrations.rb
bearcat-1.5.28 lib/bearcat/client/content_migrations.rb
bearcat-1.5.28.beta1 lib/bearcat/client/content_migrations.rb
bearcat-1.5.26 lib/bearcat/client/content_migrations.rb
bearcat-1.5.24 lib/bearcat/client/content_migrations.rb
bearcat-1.5.23 lib/bearcat/client/content_migrations.rb
bearcat-1.5.20 lib/bearcat/client/content_migrations.rb
bearcat-1.5.19 lib/bearcat/client/content_migrations.rb
bearcat-1.5.17 lib/bearcat/client/content_migrations.rb
bearcat-1.5.16 lib/bearcat/client/content_migrations.rb
bearcat-1.5.15 lib/bearcat/client/content_migrations.rb
bearcat-1.5.14 lib/bearcat/client/content_migrations.rb