Module: Bearcat::Client::ContentMigrations

Defined in:
lib/bearcat/client/content_migrations.rb

Instance Method Summary collapse

Instance Method Details

#create_account_content_migration(account_id, params = {}) ⇒ Object



36
37
38
# File 'lib/bearcat/client/content_migrations.rb', line 36

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

#create_content_migration_with_type(id, type, params = {}) ⇒ Object



32
33
34
# File 'lib/bearcat/client/content_migrations.rb', line 32

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

#create_course_content_migration(course_id, params = {}) ⇒ Object



40
41
42
# File 'lib/bearcat/client/content_migrations.rb', line 40

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

#create_group_content_migration(group_id, params = {}) ⇒ Object



44
45
46
# File 'lib/bearcat/client/content_migrations.rb', line 44

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

#create_user_content_migration(user_id, params = {}) ⇒ Object



48
49
50
# File 'lib/bearcat/client/content_migrations.rb', line 48

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

#get_account_content_migration(account_id, migration_id, params = {}) ⇒ Object



16
17
18
# File 'lib/bearcat/client/content_migrations.rb', line 16

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

#get_content_migration(id, migration_id, type, params = {}) ⇒ Object



12
13
14
# File 'lib/bearcat/client/content_migrations.rb', line 12

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

#get_course_content_migration(course_id, migration_id, params = {}) ⇒ Object



20
21
22
# File 'lib/bearcat/client/content_migrations.rb', line 20

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

#get_group_content_migration(group_id, migration_id, params = {}) ⇒ Object



24
25
26
# File 'lib/bearcat/client/content_migrations.rb', line 24

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

#get_user_content_migration(user_id, migration_id, params = {}) ⇒ Object



28
29
30
# File 'lib/bearcat/client/content_migrations.rb', line 28

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

#upload_content_package(api_path, file_path, params = {}) ⇒ Object



5
6
7
8
9
10
# File 'lib/bearcat/client/content_migrations.rb', line 5

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