canvas_sync 0.27.12 → 0.27.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/canvas_sync/api/v1/health_check_controller.rb +0 -0
  3. data/app/models/canvas_sync/job_log.rb +0 -0
  4. data/app/models/canvas_sync/sync_batch.rb +0 -0
  5. data/config/initializers/apartment.rb +0 -0
  6. data/config/routes.rb +0 -0
  7. data/db/migrate/20170915210836_create_canvas_sync_job_log.rb +0 -0
  8. data/db/migrate/20180725155729_add_job_id_to_canvas_sync_job_logs.rb +0 -0
  9. data/db/migrate/20190916154829_add_fork_count_to_canvas_sync_job_logs.rb +0 -0
  10. data/db/migrate/20201018210836_create_canvas_sync_sync_batches.rb +0 -0
  11. data/db/migrate/20201030210836_add_full_sync_to_canvas_sync_sync_batch.rb +0 -0
  12. data/lib/canvas_sync/api_syncable.rb +0 -0
  13. data/lib/canvas_sync/batch_processor.rb +0 -0
  14. data/lib/canvas_sync/class_callback_executor.rb +0 -0
  15. data/lib/canvas_sync/concerns/ability_helper.rb +43 -2
  16. data/lib/canvas_sync/concerns/account/ancestry.rb +0 -0
  17. data/lib/canvas_sync/concerns/account/base.rb +0 -0
  18. data/lib/canvas_sync/concerns/api_syncable.rb +0 -0
  19. data/lib/canvas_sync/concerns/canvas_id_as_primary.rb +0 -0
  20. data/lib/canvas_sync/concerns/jit_syncing.rb +0 -0
  21. data/lib/canvas_sync/concerns/legacy_columns.rb +0 -0
  22. data/lib/canvas_sync/concerns/role/base.rb +0 -0
  23. data/lib/canvas_sync/generators/install_generator.rb +0 -0
  24. data/lib/canvas_sync/generators/install_live_events_generator.rb +0 -0
  25. data/lib/canvas_sync/generators/templates/migrations/create_accounts.rb +0 -0
  26. data/lib/canvas_sync/generators/templates/migrations/create_admins.rb +0 -0
  27. data/lib/canvas_sync/generators/templates/migrations/create_assignment_groups.rb +0 -0
  28. data/lib/canvas_sync/generators/templates/migrations/create_assignments.rb +0 -0
  29. data/lib/canvas_sync/generators/templates/migrations/create_content_migrations.rb +0 -0
  30. data/lib/canvas_sync/generators/templates/migrations/create_context_module_items.rb +0 -0
  31. data/lib/canvas_sync/generators/templates/migrations/create_context_modules.rb +0 -0
  32. data/lib/canvas_sync/generators/templates/migrations/create_course_nicknames.rb +0 -0
  33. data/lib/canvas_sync/generators/templates/migrations/create_course_progresses.rb +0 -0
  34. data/lib/canvas_sync/generators/templates/migrations/create_grading_period_groups.rb +0 -0
  35. data/lib/canvas_sync/generators/templates/migrations/create_grading_periods.rb +0 -0
  36. data/lib/canvas_sync/generators/templates/migrations/create_group_memberships.rb +0 -0
  37. data/lib/canvas_sync/generators/templates/migrations/create_groups.rb +0 -0
  38. data/lib/canvas_sync/generators/templates/migrations/create_learning_outcome_results.rb +0 -0
  39. data/lib/canvas_sync/generators/templates/migrations/create_learning_outcomes.rb +0 -0
  40. data/lib/canvas_sync/generators/templates/migrations/create_pseudonyms.rb +0 -0
  41. data/lib/canvas_sync/generators/templates/migrations/create_rubric_assessments.rb +0 -0
  42. data/lib/canvas_sync/generators/templates/migrations/create_rubric_associations.rb +0 -0
  43. data/lib/canvas_sync/generators/templates/migrations/create_rubrics.rb +0 -0
  44. data/lib/canvas_sync/generators/templates/migrations/create_sections.rb +0 -0
  45. data/lib/canvas_sync/generators/templates/migrations/create_submissions.rb +0 -0
  46. data/lib/canvas_sync/generators/templates/migrations/create_terms.rb +0 -0
  47. data/lib/canvas_sync/generators/templates/migrations/create_user_observers.rb +0 -0
  48. data/lib/canvas_sync/generators/templates/migrations/create_users.rb +0 -0
  49. data/lib/canvas_sync/generators/templates/models/content_migration.rb +0 -0
  50. data/lib/canvas_sync/generators/templates/models/course_nickname.rb +0 -0
  51. data/lib/canvas_sync/generators/templates/models/rubric.rb +0 -0
  52. data/lib/canvas_sync/generators/templates/models/rubric_assessment.rb +0 -0
  53. data/lib/canvas_sync/generators/templates/models/rubric_association.rb +0 -0
  54. data/lib/canvas_sync/generators/templates/services/live_events/assignment_event.rb +0 -0
  55. data/lib/canvas_sync/generators/templates/services/live_events/assignment_group_event.rb +0 -0
  56. data/lib/canvas_sync/generators/templates/services/live_events/course_event.rb +0 -0
  57. data/lib/canvas_sync/generators/templates/services/live_events/course_section_event.rb +0 -0
  58. data/lib/canvas_sync/generators/templates/services/live_events/enrollment_event.rb +0 -0
  59. data/lib/canvas_sync/generators/templates/services/live_events/grade_event.rb +0 -0
  60. data/lib/canvas_sync/generators/templates/services/live_events/module_event.rb +0 -0
  61. data/lib/canvas_sync/generators/templates/services/live_events/module_item_event.rb +0 -0
  62. data/lib/canvas_sync/generators/templates/services/live_events/submission_event.rb +0 -0
  63. data/lib/canvas_sync/generators/templates/services/live_events/syllabus_event.rb +0 -0
  64. data/lib/canvas_sync/generators/templates/services/live_events/user_event.rb +0 -0
  65. data/lib/canvas_sync/importers/legacy_importer.rb +0 -0
  66. data/lib/canvas_sync/jobs/begin_sync_chain_job.rb +0 -0
  67. data/lib/canvas_sync/jobs/canvas_process_waiter.rb +0 -0
  68. data/lib/canvas_sync/jobs/report_sync_task.rb +6 -3
  69. data/lib/canvas_sync/jobs/sync_admins_job.rb +0 -0
  70. data/lib/canvas_sync/jobs/sync_assignment_groups_job.rb +0 -0
  71. data/lib/canvas_sync/jobs/sync_assignments_job.rb +0 -0
  72. data/lib/canvas_sync/jobs/sync_content_migrations_job.rb +0 -0
  73. data/lib/canvas_sync/jobs/sync_context_module_items_job.rb +0 -0
  74. data/lib/canvas_sync/jobs/sync_context_modules_job.rb +0 -0
  75. data/lib/canvas_sync/jobs/sync_rubrics_job.rb +0 -0
  76. data/lib/canvas_sync/jobs/sync_simple_table_job.rb +0 -0
  77. data/lib/canvas_sync/live_events/base_handler.rb +0 -0
  78. data/lib/canvas_sync/live_events.rb +0 -0
  79. data/lib/canvas_sync/misc_helper.rb +0 -0
  80. data/lib/canvas_sync/processors/normal_processor.rb +0 -0
  81. data/lib/canvas_sync/sidekiq_job.rb +0 -0
  82. data/lib/canvas_sync/version.rb +1 -1
  83. data/spec/canvas_sync/concerns/ability_helper_spec.rb +165 -0
  84. data/spec/canvas_sync/jobs/canvas_process_waiter_spec.rb +0 -0
  85. data/spec/canvas_sync/jobs/report_starter_spec.rb +0 -0
  86. data/spec/canvas_sync/jobs/report_sync_task_spec.rb +56 -0
  87. data/spec/canvas_sync/jobs/sync_admins_job_spec.rb +0 -0
  88. data/spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb +0 -0
  89. data/spec/canvas_sync/jobs/sync_roles_job_spec.rb +0 -0
  90. data/spec/canvas_sync/jobs/sync_simple_table_job_spec.rb +0 -0
  91. data/spec/canvas_sync/jobs/sync_terms_job_spec.rb +0 -0
  92. data/spec/canvas_sync/live_events/live_event_sync_spec.rb +0 -0
  93. data/spec/canvas_sync/live_events/live_events_controller_spec.rb +0 -0
  94. data/spec/canvas_sync/misc_helper_spec.rb +0 -0
  95. data/spec/canvas_sync/models/accounts_spec.rb +0 -0
  96. data/spec/canvas_sync/models/admins_spec.rb +0 -0
  97. data/spec/canvas_sync/models/assignment_group_spec.rb +0 -0
  98. data/spec/canvas_sync/models/assignment_spec.rb +0 -0
  99. data/spec/canvas_sync/models/context_module_item_spec.rb +0 -0
  100. data/spec/canvas_sync/models/context_module_spec.rb +0 -0
  101. data/spec/canvas_sync/models/course_spec.rb +0 -0
  102. data/spec/canvas_sync/models/enrollment_spec.rb +0 -0
  103. data/spec/canvas_sync/models/group_membership_spec.rb +0 -0
  104. data/spec/canvas_sync/models/group_spec.rb +0 -0
  105. data/spec/canvas_sync/models/roles_spec.rb +0 -0
  106. data/spec/canvas_sync/models/section_spec.rb +0 -0
  107. data/spec/canvas_sync/models/submission_spec.rb +0 -0
  108. data/spec/canvas_sync/models/term_spec.rb +0 -0
  109. data/spec/canvas_sync/models/user_spec.rb +0 -0
  110. data/spec/canvas_sync/processors/assignment_groups_processor_spec.rb +0 -0
  111. data/spec/canvas_sync/processors/assignments_processor_spec.rb +0 -0
  112. data/spec/canvas_sync/processors/content_migrations_processor_spec.rb +0 -0
  113. data/spec/canvas_sync/processors/context_module_items_processor_spec.rb +0 -0
  114. data/spec/canvas_sync/processors/context_modules_processor_spec.rb +0 -0
  115. data/spec/canvas_sync/processors/course_completion_report_processor_spec.rb +0 -0
  116. data/spec/canvas_sync/processors/rubric_assessments_spec.rb +0 -0
  117. data/spec/canvas_sync/processors/rubric_associations_spec.rb +0 -0
  118. data/spec/canvas_sync/processors/rubrics_processor_spec.rb +0 -0
  119. data/spec/canvas_sync/processors/submissions_processor_spec.rb +0 -0
  120. data/spec/canvas_sync/services/module_event_spec.rb +0 -0
  121. data/spec/canvas_sync/services/module_item_event_spec.rb +0 -0
  122. data/spec/factories/admin_factory.rb +0 -0
  123. data/spec/factories/assignment_factory.rb +0 -0
  124. data/spec/factories/assignment_group_factory.rb +0 -0
  125. data/spec/factories/context_module_factory.rb +0 -0
  126. data/spec/factories/context_module_item_factory.rb +0 -0
  127. data/spec/factories/course_factory.rb +0 -0
  128. data/spec/factories/enrollment_factory.rb +0 -0
  129. data/spec/factories/group_factory.rb +0 -0
  130. data/spec/factories/group_membership_factory.rb +0 -0
  131. data/spec/factories/role_factory.rb +0 -0
  132. data/spec/factories/section_factory.rb +0 -0
  133. data/spec/factories/submission_factory.rb +0 -0
  134. data/spec/factories/term_factory.rb +0 -0
  135. data/spec/factories/user_factory.rb +0 -0
  136. data/spec/support/fixtures/canvas_responses/admins.json +0 -0
  137. data/spec/support/fixtures/canvas_responses/module.json +0 -0
  138. data/spec/support/fixtures/canvas_responses/module_item.json +0 -0
  139. data/spec/support/fixtures/canvas_responses/roles.json +0 -0
  140. data/spec/support/fixtures/canvas_responses/terms.json +0 -0
  141. data/spec/support/fixtures/reports/assignment_groups.csv +0 -0
  142. data/spec/support/fixtures/reports/assignments.csv +0 -0
  143. data/spec/support/fixtures/reports/content_migrations.csv +0 -0
  144. data/spec/support/fixtures/reports/context_module_items.csv +0 -0
  145. data/spec/support/fixtures/reports/context_modules.csv +0 -0
  146. data/spec/support/fixtures/reports/course_nicknames.csv +0 -0
  147. data/spec/support/fixtures/reports/course_progresses.csv +0 -0
  148. data/spec/support/fixtures/reports/course_progresses_conflict.csv +0 -0
  149. data/spec/support/fixtures/reports/grading_period_groups.csv +0 -0
  150. data/spec/support/fixtures/reports/grading_periods.csv +0 -0
  151. data/spec/support/fixtures/reports/group_memberships.csv +0 -0
  152. data/spec/support/fixtures/reports/groups.csv +0 -0
  153. data/spec/support/fixtures/reports/learning_outcome_results.csv +0 -0
  154. data/spec/support/fixtures/reports/learning_outcomes.csv +0 -0
  155. data/spec/support/fixtures/reports/provisioning_csv +0 -0
  156. data/spec/support/fixtures/reports/rubric_assessments.csv +0 -0
  157. data/spec/support/fixtures/reports/rubric_associations.csv +0 -0
  158. data/spec/support/fixtures/reports/rubrics.csv +0 -0
  159. data/spec/support/fixtures/reports/sections.csv +0 -0
  160. data/spec/support/fixtures/reports/submissions.csv +0 -0
  161. data/spec/support/fixtures/reports/user_observers.csv +0 -0
  162. data/spec/support/fixtures/reports/users.csv +0 -0
  163. data/spec/support/fixtures/reports/xlist.csv +0 -0
  164. metadata +5 -143
  165. data/spec/internal/app/models/account.rb +0 -35
  166. data/spec/internal/app/models/admin.rb +0 -35
  167. data/spec/internal/app/models/assignment.rb +0 -39
  168. data/spec/internal/app/models/assignment_group.rb +0 -31
  169. data/spec/internal/app/models/assignment_override.rb +0 -34
  170. data/spec/internal/app/models/content_migration.rb +0 -18
  171. data/spec/internal/app/models/context_module.rb +0 -69
  172. data/spec/internal/app/models/context_module_item.rb +0 -33
  173. data/spec/internal/app/models/course.rb +0 -57
  174. data/spec/internal/app/models/course_nickname.rb +0 -20
  175. data/spec/internal/app/models/course_progress.rb +0 -29
  176. data/spec/internal/app/models/enrollment.rb +0 -48
  177. data/spec/internal/app/models/grading_period.rb +0 -17
  178. data/spec/internal/app/models/grading_period_group.rb +0 -16
  179. data/spec/internal/app/models/group.rb +0 -28
  180. data/spec/internal/app/models/group_membership.rb +0 -26
  181. data/spec/internal/app/models/learning_outcome.rb +0 -30
  182. data/spec/internal/app/models/learning_outcome_result.rb +0 -54
  183. data/spec/internal/app/models/pseudonym.rb +0 -19
  184. data/spec/internal/app/models/role.rb +0 -27
  185. data/spec/internal/app/models/rubric.rb +0 -36
  186. data/spec/internal/app/models/rubric_assessment.rb +0 -23
  187. data/spec/internal/app/models/rubric_association.rb +0 -20
  188. data/spec/internal/app/models/score.rb +0 -18
  189. data/spec/internal/app/models/section.rb +0 -36
  190. data/spec/internal/app/models/submission.rb +0 -32
  191. data/spec/internal/app/models/term.rb +0 -46
  192. data/spec/internal/app/models/user.rb +0 -43
  193. data/spec/internal/app/models/user_observer.rb +0 -22
  194. data/spec/internal/app/services/live_events/assignment_event.rb +0 -43
  195. data/spec/internal/app/services/live_events/course_event.rb +0 -28
  196. data/spec/internal/app/services/live_events/course_section_event.rb +0 -28
  197. data/spec/internal/app/services/live_events/enrollment_event.rb +0 -30
  198. data/spec/internal/app/services/live_events/grade_event.rb +0 -36
  199. data/spec/internal/app/services/live_events/module_event.rb +0 -26
  200. data/spec/internal/app/services/live_events/module_item_event.rb +0 -25
  201. data/spec/internal/app/services/live_events/submission_event.rb +0 -28
  202. data/spec/internal/app/services/live_events/syllabus_event.rb +0 -31
  203. data/spec/internal/app/services/live_events/user_event.rb +0 -27
  204. data/spec/internal/db/migrate/20251029222307_create_users.rb +0 -26
  205. data/spec/internal/db/migrate/20251029222308_create_pseudonyms.rb +0 -24
  206. data/spec/internal/db/migrate/20251029222309_create_courses.rb +0 -30
  207. data/spec/internal/db/migrate/20251029222310_create_groups.rb +0 -29
  208. data/spec/internal/db/migrate/20251029222311_create_group_memberships.rb +0 -24
  209. data/spec/internal/db/migrate/20251029222312_create_accounts.rb +0 -23
  210. data/spec/internal/db/migrate/20251029222313_create_terms.rb +0 -24
  211. data/spec/internal/db/migrate/20251029222314_create_enrollments.rb +0 -31
  212. data/spec/internal/db/migrate/20251029222315_create_sections.rb +0 -27
  213. data/spec/internal/db/migrate/20251029222316_create_assignments.rb +0 -37
  214. data/spec/internal/db/migrate/20251029222317_create_submissions.rb +0 -32
  215. data/spec/internal/db/migrate/20251029222318_create_roles.rb +0 -24
  216. data/spec/internal/db/migrate/20251029222319_create_admins.rb +0 -26
  217. data/spec/internal/db/migrate/20251029222320_create_assignment_groups.rb +0 -28
  218. data/spec/internal/db/migrate/20251029222321_create_context_modules.rb +0 -28
  219. data/spec/internal/db/migrate/20251029222322_create_context_module_items.rb +0 -26
  220. data/spec/internal/db/migrate/20251029222324_create_grading_periods.rb +0 -28
  221. data/spec/internal/db/migrate/20251029222325_create_grading_period_groups.rb +0 -24
  222. data/spec/internal/db/migrate/20251029222326_create_content_migrations.rb +0 -30
  223. data/spec/internal/db/migrate/20251029222327_create_learning_outcomes.rb +0 -36
  224. data/spec/internal/db/migrate/20251029222328_create_learning_outcome_results.rb +0 -52
  225. data/spec/internal/db/migrate/20251029222330_create_rubrics.rb +0 -44
  226. data/spec/internal/db/migrate/20251029222331_create_rubric_associations.rb +0 -42
  227. data/spec/internal/db/migrate/20251029222332_create_rubric_assessments.rb +0 -37
  228. data/spec/internal/db/migrate/20251029222334_create_assignment_overrides.rb +0 -25
  229. data/spec/internal/db/migrate/20251029222335_create_scores.rb +0 -42
  230. data/spec/internal/db/migrate/20251029223411_create_user_observers.rb +0 -23
  231. data/spec/internal/db/migrate/20251029224009_create_course_nicknames.rb +0 -23
  232. data/spec/internal/db/migrate/20251029224010_create_course_progresses.rb +0 -26
  233. data/spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv +0 -3
  234. data/spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv +0 -4
@@ -1,43 +0,0 @@
1
- # #
2
- # AUTO GENERATED LIVE EVENT
3
- # This was auto generated by the CanvasSync Gem.
4
- # You can customize it as needed, but make sure you test
5
- # any changes you make to the auto generated methods.
6
- #
7
- # LiveEvent message formats can be found at https://canvas.instructure.com/doc/api/file.live_events.html
8
- # In the general case, LiveEvent message content should not be trusted - it is highly possible that events may
9
- # arrive out of order. Most of the CanvasSync LiveEvent templates solve this by always fetching the object from the API.
10
- #
11
-
12
-
13
- module LiveEvents
14
- class AssignmentEvent < CanvasSync::LiveEvents::BaseHandler
15
-
16
- def process
17
- canvas_assignment_id = local_canvas_id(payload[:assignment_id])
18
- assignment = Assignment.where(canvas_id: canvas_assignment_id).first_or_initialize
19
- assignment.context_id = canvas_course_id
20
- assignment.sync_from_api
21
- end
22
-
23
- private
24
-
25
- # This could be nil if the context type for this assignment is not 'Course' of if a local course was not found
26
- def canvas_course_id
27
- payload[:context_type] == "Course" ? local_canvas_id(payload[:context_id]) : nil
28
- end
29
-
30
- # This could be nil if the context type for this assignment is not 'Course' of if a local course was not found
31
- def course
32
- @course ||= begin
33
- course = Course.where(canvas_id: canvas_course_id).first_or_initialize
34
- course.sync_from_api unless course.persisted?
35
- course
36
- end
37
- end
38
-
39
- end
40
-
41
- class AssignmentCreatedEvent < LiveEvents::AssignmentEvent; end
42
- class AssignmentUpdatedEvent < LiveEvents::AssignmentEvent; end
43
- end
@@ -1,28 +0,0 @@
1
- # #
2
- # AUTO GENERATED LIVE EVENT
3
- # This was auto generated by the CanvasSync Gem.
4
- # You can customize it as needed, but make sure you test
5
- # any changes you make to the auto generated methods.
6
- #
7
- # LiveEvent message formats can be found at https://canvas.instructure.com/doc/api/file.live_events.html
8
- # In the general case, LiveEvent message content should not be trusted - it is highly possible that events may
9
- # arrive out of order. Most of the CanvasSync LiveEvent templates solve this by always fetching the object from the API.
10
- #
11
-
12
-
13
- module LiveEvents
14
- class CourseEvent < CanvasSync::LiveEvents::BaseHandler
15
- def process
16
- course = Course.where(canvas_id: local_canvas_id(payload[:course_id])).first_or_initialize
17
- course.canvas_account_id = local_canvas_id(payload[:account_id])
18
- if course.account.nil?
19
- acc = Account.new(canvas_id: course.canvas_account_id)
20
- acc.sync_from_api
21
- end
22
- course.sync_from_api
23
- end
24
- end
25
-
26
- class CourseCreatedEvent < LiveEvents::CourseEvent; end
27
- class CourseUpdatedEvent < LiveEvents::CourseEvent; end
28
- end
@@ -1,28 +0,0 @@
1
- # #
2
- # AUTO GENERATED LIVE EVENT
3
- # This was auto generated by the CanvasSync Gem.
4
- # You can customize it as needed, but make sure you test
5
- # any changes you make to the auto generated methods.
6
- #
7
- # LiveEvent message formats can be found at https://canvas.instructure.com/doc/api/file.live_events.html
8
- # In the general case, LiveEvent message content should not be trusted - it is highly possible that events may
9
- # arrive out of order. Most of the CanvasSync LiveEvent templates solve this by always fetching the object from the API.
10
- #
11
-
12
-
13
- module LiveEvents
14
- class CourseSectionEvent < CanvasSync::LiveEvents::BaseHandler
15
-
16
- def process
17
- section = Section.where(canvas_id: local_canvas_id(payload[:course_section_id])).first_or_initialize
18
- section.sync_from_api
19
- # A section change could constitute a crosslisting change, which means
20
- # we need to make sure all our enrollments are pointing to the correct course
21
- section.enrollments.update_all(canvas_course_id: section.canvas_course_id)
22
- end
23
-
24
- end
25
-
26
- class CourseSectionCreatedEvent < LiveEvents::CourseSectionEvent; end
27
- class CourseSectionUpdatedEvent < LiveEvents::CourseSectionEvent; end
28
- end
@@ -1,30 +0,0 @@
1
- # #
2
- # AUTO GENERATED LIVE EVENT
3
- # This was auto generated by the CanvasSync Gem.
4
- # You can customize it as needed, but make sure you test
5
- # any changes you make to the auto generated methods.
6
- #
7
- # LiveEvent message formats can be found at https://canvas.instructure.com/doc/api/file.live_events.html
8
- # In the general case, LiveEvent message content should not be trusted - it is highly possible that events may
9
- # arrive out of order. Most of the CanvasSync LiveEvent templates solve this by always fetching the object from the API.
10
- #
11
-
12
-
13
- module LiveEvents
14
- class EnrollmentEvent < CanvasSync::LiveEvents::BaseHandler
15
- attr_accessor :enrollment
16
-
17
- def process()
18
- @enrollment = Enrollment.where(canvas_id: local_canvas_id(payload[:enrollment_id])).first_or_initialize
19
- enrollment.canvas_course_id = local_canvas_id(payload[:course_id])
20
- enrollment.sync_from_api
21
- if enrollment.user.nil?
22
- u = User.new(canvas_id: enrollment.canvas_user_id)
23
- u.sync_from_api
24
- end
25
- end
26
- end
27
-
28
- class EnrollmentCreatedEvent < LiveEvents::EnrollmentEvent; end
29
- class EnrollmentUpdatedEvent < LiveEvents::EnrollmentEvent; end
30
- end
@@ -1,36 +0,0 @@
1
- # #
2
- # AUTO GENERATED LIVE EVENT
3
- # This was auto generated by the CanvasSync Gem.
4
- # You can customize it as needed, but make sure you test
5
- # any changes you make to the auto generated methods.
6
- #
7
- # LiveEvent message formats can be found at https://canvas.instructure.com/doc/api/file.live_events.html
8
- # In the general case, LiveEvent message content should not be trusted - it is highly possible that events may
9
- # arrive out of order. Most of the CanvasSync LiveEvent templates solve this by always fetching the object from the API.
10
- #
11
-
12
-
13
- module LiveEvents
14
- class GradeEvent < CanvasSync::LiveEvents::BaseHandler
15
-
16
- def process
17
- raise "process must be implemented in your subclass"
18
- end
19
-
20
- private
21
-
22
- def submission
23
- Submission.find_by(canvas_submission_id: local_canvas_id(payload[:submission_id]))
24
- end
25
-
26
- def assignment
27
- Assignment.find_by(canvas_assignment_id: local_canvas_id(payload[:assignment_id]))
28
- end
29
-
30
- def user
31
- User.find_by(canvas_user_id: local_canvas_id(payload[:user_id]))
32
- end
33
- end
34
-
35
- class GradeChangedEvent < LiveEvents::GradeEvent; end
36
- end
@@ -1,26 +0,0 @@
1
- # #
2
- # AUTO GENERATED LIVE EVENT
3
- # This was auto generated by the CanvasSync Gem.
4
- # You can customize it as needed, but make sure you test
5
- # any changes you make to the auto generated methods.
6
- #
7
- # LiveEvent message formats can be found at https://canvas.instructure.com/doc/api/file.live_events.html
8
- # In the general case, LiveEvent message content should not be trusted - it is highly possible that events may
9
- # arrive out of order. Most of the CanvasSync LiveEvent templates solve this by always fetching the object from the API.
10
- #
11
-
12
-
13
- module LiveEvents
14
- class ModuleEvent < CanvasSync::LiveEvents::BaseHandler
15
-
16
- def process
17
- return unless payload["context_type"] == "Course"
18
- context_module = ContextModule.find_or_initialize_by(canvas_id: payload["module_id"])
19
- context_module.sync_from_api
20
- end
21
-
22
- end
23
-
24
- class ModuleCreatedEvent < LiveEvents::ModuleEvent; end
25
- class ModuleUpdatedEvent < LiveEvents::ModuleEvent; end
26
- end
@@ -1,25 +0,0 @@
1
- # #
2
- # AUTO GENERATED LIVE EVENT
3
- # This was auto generated by the CanvasSync Gem.
4
- # You can customize it as needed, but make sure you test
5
- # any changes you make to the auto generated methods.
6
- #
7
- # LiveEvent message formats can be found at https://canvas.instructure.com/doc/api/file.live_events.html
8
- # In the general case, LiveEvent message content should not be trusted - it is highly possible that events may
9
- # arrive out of order. Most of the CanvasSync LiveEvent templates solve this by always fetching the object from the API.
10
- #
11
-
12
-
13
- module LiveEvents
14
- class ModuleItemEvent < CanvasSync::LiveEvents::BaseHandler
15
-
16
- def process
17
- context_module_item = ContextModuleItem.find_or_initialize_by(canvas_id: payload["module_item_id"])
18
- context_module_item.sync_from_api
19
- end
20
-
21
- end
22
-
23
- class ModuleItemCreatedEvent < LiveEvents::ModuleItemEvent; end
24
- class ModuleItemUpdatedEvent < LiveEvents::ModuleItemEvent; end
25
- end
@@ -1,28 +0,0 @@
1
- # #
2
- # AUTO GENERATED LIVE EVENT
3
- # This was auto generated by the CanvasSync Gem.
4
- # You can customize it as needed, but make sure you test
5
- # any changes you make to the auto generated methods.
6
- #
7
- # LiveEvent message formats can be found at https://canvas.instructure.com/doc/api/file.live_events.html
8
- # In the general case, LiveEvent message content should not be trusted - it is highly possible that events may
9
- # arrive out of order. Most of the CanvasSync LiveEvent templates solve this by always fetching the object from the API.
10
- #
11
-
12
-
13
- module LiveEvents
14
- class SubmissionEvent < CanvasSync::LiveEvents::BaseHandler
15
-
16
- def process
17
- submission = Submission.where(canvas_id: local_canvas_id(payload["submission_id"])).first_or_initialize
18
- submission.canvas_assignment_id = local_canvas_id(payload["assignment_id"])
19
- submission.canvas_user_id = local_canvas_id(payload["user_id"])
20
- submission.canvas_course_id = submission.assignment.context.canvas_id
21
- submission.sync_from_api
22
- end
23
-
24
- end
25
-
26
- class SubmissionCreatedEvent < LiveEvents::SubmissionEvent; end
27
- class SubmissionUpdatedEvent < LiveEvents::SubmissionEvent; end
28
- end
@@ -1,31 +0,0 @@
1
- # #
2
- # AUTO GENERATED LIVE EVENT
3
- # This was auto generated by the CanvasSync Gem.
4
- # You can customize it as needed, but make sure you test
5
- # any changes you make to the auto generated methods.
6
- #
7
- # LiveEvent message formats can be found at https://canvas.instructure.com/doc/api/file.live_events.html
8
- # In the general case, LiveEvent message content should not be trusted - it is highly possible that events may
9
- # arrive out of order. Most of the CanvasSync LiveEvent templates solve this by always fetching the object from the API.
10
- #
11
-
12
-
13
- module LiveEvents
14
- class SyllabusEvent < CanvasSync::LiveEvents::BaseHandler
15
-
16
- def process
17
- # syllabus = Syllabus.where(course_id: attrs[:course_id]).first_or_initialize
18
- # syllabus.body = attrs[:syllabus_body] # Syllabus Body can get truncated by live events
19
- # syllabus.save!
20
- raise "process must be implemented in your subclass"
21
- end
22
-
23
- private
24
-
25
- def course
26
- Course.find_by(canvas_course_id: local_canvas_id(payload[:course_id]))
27
- end
28
- end
29
-
30
- class SyllabusUpdatedEvent < LiveEvents::SyllabusEvent; end
31
- end
@@ -1,27 +0,0 @@
1
- # #
2
- # AUTO GENERATED LIVE EVENT
3
- # This was auto generated by the CanvasSync Gem.
4
- # You can customize it as needed, but make sure you test
5
- # any changes you make to the auto generated methods.
6
- #
7
- # LiveEvent message formats can be found at https://canvas.instructure.com/doc/api/file.live_events.html
8
- # In the general case, LiveEvent message content should not be trusted - it is highly possible that events may
9
- # arrive out of order. Most of the CanvasSync LiveEvent templates solve this by always fetching the object from the API.
10
- #
11
-
12
-
13
- module LiveEvents
14
- class UserEvent < CanvasSync::LiveEvents::BaseHandler
15
- def process
16
- canvas_user_id = local_canvas_id(payload[:user_id])
17
- user = User.where(canvas_id: canvas_user_id).first_or_initialize
18
- user.sync_from_api
19
- rescue Footrest::HttpError::Unauthorized => e
20
- # This can happen when a new user is created, but hasn't setup a login on Canvas yet.
21
- Rails.logger.info("Failed to fetch user #{canvas_user_id}: #{e.backtrace}")
22
- end
23
- end
24
-
25
- class UserCreatedEvent < LiveEvents::UserEvent; end
26
- class UserUpdatedEvent < LiveEvents::UserEvent; end
27
- end
@@ -1,26 +0,0 @@
1
- # #
2
- # AUTO GENERATED MIGRATION
3
- # This migration was auto generated by the CanvasSync Gem.
4
- # You can add new columns to this table, but removing or
5
- # re-naming ones created here may break Canvas Syncing.
6
- #
7
-
8
-
9
- class CreateUsers < ActiveRecord::Migration[5.1]
10
- def change
11
- create_table :users, id: false do |t|
12
- t.bigint :canvas_id, null: false
13
- t.string :email
14
- t.string :first_name
15
- t.string :last_name
16
- t.string :workflow_state
17
- t.string :login_id
18
- t.string :name
19
- t.string :sortable_name
20
-
21
- t.timestamps
22
- end
23
-
24
- add_index :users, :canvas_id, unique: true
25
- end
26
- end
@@ -1,24 +0,0 @@
1
- # #
2
- # AUTO GENERATED MIGRATION
3
- # This migration was auto generated by the CanvasSync Gem.
4
- # You can add new columns to this table, but removing or
5
- # re-naming ones created here may break Canvas Syncing.
6
- #
7
-
8
-
9
- class CreatePseudonyms < ActiveRecord::Migration[5.1]
10
- def change
11
- create_table :pseudonyms, id: false do |t|
12
- t.bigint :canvas_id, null: false
13
- t.bigint :canvas_user_id
14
- t.string :sis_id
15
- t.string :unique_id
16
- t.string :workflow_state
17
-
18
- t.timestamps
19
- end
20
-
21
- add_index :pseudonyms, :canvas_id, unique: true
22
- add_index :pseudonyms, :canvas_user_id
23
- end
24
- end
@@ -1,30 +0,0 @@
1
- # #
2
- # AUTO GENERATED MIGRATION
3
- # This migration was auto generated by the CanvasSync Gem.
4
- # You can add new columns to this table, but removing or
5
- # re-naming ones created here may break Canvas Syncing.
6
- #
7
-
8
-
9
- class CreateCourses < ActiveRecord::Migration[5.1]
10
- def change
11
- create_table :courses, id: false do |t|
12
- t.bigint :canvas_id, null: false
13
- t.string :sis_id
14
- t.string :course_code
15
- t.string :name
16
- t.string :workflow_state
17
- t.integer :canvas_account_id
18
- t.integer :canvas_term_id
19
- t.datetime :start_at
20
- t.datetime :end_at
21
- t.bigint :grading_standard_id
22
- # Optional opt-in columns
23
- # t.string :public_description
24
-
25
- t.timestamps
26
- end
27
-
28
- add_index :courses, :canvas_id, unique: true
29
- end
30
- end
@@ -1,29 +0,0 @@
1
- # #
2
- # AUTO GENERATED MIGRATION
3
- # This migration was auto generated by the CanvasSync Gem.
4
- # You can add new columns to this table, but removing or
5
- # re-naming ones created here may break Canvas Syncing.
6
- #
7
-
8
-
9
- class CreateGroups < ActiveRecord::Migration[5.1]
10
- def change
11
- create_table :groups, id: false do |t|
12
- t.bigint :canvas_id, null: false
13
- t.string :sis_id
14
- t.bigint :canvas_group_category_id
15
- t.string :group_category_sis_id
16
- t.bigint :canvas_account_id
17
- t.bigint :canvas_course_id
18
- t.string :name
19
- t.string :workflow_state
20
- t.bigint :context_id
21
- t.string :context_type
22
- t.integer :max_membership
23
-
24
- t.timestamps
25
- end
26
-
27
- add_index :groups, :canvas_id, unique: true
28
- end
29
- end
@@ -1,24 +0,0 @@
1
- # #
2
- # AUTO GENERATED MIGRATION
3
- # This migration was auto generated by the CanvasSync Gem.
4
- # You can add new columns to this table, but removing or
5
- # re-naming ones created here may break Canvas Syncing.
6
- #
7
-
8
-
9
- class CreateGroupMemberships < ActiveRecord::Migration[5.1]
10
- def change
11
- create_table :group_memberships, id: false do |t|
12
- t.bigint :canvas_id, null: false
13
- t.bigint :canvas_user_id, null: false
14
- t.bigint :canvas_group_id, null: false
15
- t.string :group_sis_id
16
- t.string :user_sis_id
17
- t.string :workflow_state
18
-
19
- t.timestamps
20
- end
21
-
22
- add_index :group_memberships, :canvas_id, unique: true
23
- end
24
- end
@@ -1,23 +0,0 @@
1
- # #
2
- # AUTO GENERATED MIGRATION
3
- # This migration was auto generated by the CanvasSync Gem.
4
- # You can add new columns to this table, but removing or
5
- # re-naming ones created here may break Canvas Syncing.
6
- #
7
-
8
-
9
- class CreateAccounts < ActiveRecord::Migration[5.1]
10
- def change
11
- create_table :accounts, id: false do |t|
12
- t.bigint :canvas_id, null: false
13
- t.string :sis_id
14
- t.bigint :canvas_parent_account_id
15
- t.string :sis_parent_account_id
16
- t.string :name
17
- t.string :workflow_state
18
-
19
- t.timestamps
20
- end
21
- add_index :accounts, :canvas_id, unique: true
22
- end
23
- end
@@ -1,24 +0,0 @@
1
- # #
2
- # AUTO GENERATED MIGRATION
3
- # This migration was auto generated by the CanvasSync Gem.
4
- # You can add new columns to this table, but removing or
5
- # re-naming ones created here may break Canvas Syncing.
6
- #
7
-
8
-
9
- class CreateTerms < ActiveRecord::Migration[5.1]
10
- def change
11
- create_table :terms, id: false do |t|
12
- t.integer :canvas_id, null: false
13
- t.string :name
14
- t.datetime :start_at
15
- t.datetime :end_at
16
- t.string :workflow_state
17
- t.integer :grading_period_group_id
18
- t.string :sis_id
19
-
20
- t.timestamps
21
- end
22
- add_index :terms, :canvas_id, unique: true
23
- end
24
- end
@@ -1,31 +0,0 @@
1
- # #
2
- # AUTO GENERATED MIGRATION
3
- # This migration was auto generated by the CanvasSync Gem.
4
- # You can add new columns to this table, but removing or
5
- # re-naming ones created here may break Canvas Syncing.
6
- #
7
-
8
-
9
- class CreateEnrollments < ActiveRecord::Migration[5.1]
10
- def change
11
- create_table :enrollments, id: false do |t|
12
- t.bigint :canvas_id, null: false
13
- t.bigint :canvas_course_id
14
- t.string :course_sis_id
15
- t.bigint :canvas_user_id
16
- t.string :user_sis_id
17
- t.string :role
18
- t.integer :canvas_role_id
19
- t.bigint :canvas_section_id
20
- t.string :workflow_state
21
- t.string :base_role_type
22
- t.datetime :completed_at
23
-
24
- t.timestamps
25
- end
26
-
27
- add_index :enrollments, :canvas_id, unique: true
28
- add_index :enrollments, :canvas_course_id
29
- add_index :enrollments, :canvas_user_id
30
- end
31
- end
@@ -1,27 +0,0 @@
1
- # #
2
- # AUTO GENERATED MIGRATION
3
- # This migration was auto generated by the CanvasSync Gem.
4
- # You can add new columns to this table, but removing or
5
- # re-naming ones created here may break Canvas Syncing.
6
- #
7
-
8
-
9
- class CreateSections < ActiveRecord::Migration[5.1]
10
- def change
11
- create_table :sections, id: false do |t|
12
- t.bigint :canvas_id, null: false
13
- t.string :sis_id
14
- t.bigint :canvas_course_id
15
- t.bigint :canvas_nonxlist_course_id
16
- t.string :name
17
- t.string :workflow_state
18
- t.datetime :start_at
19
- t.datetime :end_at
20
-
21
- t.timestamps
22
- end
23
-
24
- add_index :sections, :canvas_id, unique: true
25
- add_index :sections, :canvas_course_id
26
- end
27
- end
@@ -1,37 +0,0 @@
1
- # #
2
- # AUTO GENERATED MIGRATION
3
- # This migration was auto generated by the CanvasSync Gem.
4
- # You can add new columns to this table, but removing or
5
- # re-naming ones created here may break Canvas Syncing.
6
- #
7
-
8
-
9
- class CreateAssignments < ActiveRecord::Migration[5.1]
10
- def change
11
- create_table :assignments, id: false do |t|
12
- t.bigint :canvas_id, null: false
13
- t.string :title
14
- t.text :description
15
- t.datetime :due_at
16
- t.datetime :unlock_at
17
- t.datetime :lock_at
18
- t.float :points_possible
19
- t.float :min_score
20
- t.float :max_score
21
- t.float :mastery_score
22
- t.string :grading_type
23
- t.string :submission_types
24
- t.string :workflow_state
25
- t.integer :canvas_context_id
26
- t.string :canvas_context_type
27
- t.integer :canvas_assignment_group_id
28
- t.integer :canvas_grading_scheme_id
29
- t.integer :canvas_grading_standard_id
30
-
31
- t.timestamps
32
- end
33
-
34
- add_index :assignments, :canvas_id, unique: true
35
- add_index :assignments, [:canvas_context_id, :canvas_context_type]
36
- end
37
- end
@@ -1,32 +0,0 @@
1
- # #
2
- # AUTO GENERATED MIGRATION
3
- # This migration was auto generated by the CanvasSync Gem.
4
- # You can add new columns to this table, but removing or
5
- # re-naming ones created here may break Canvas Syncing.
6
- #
7
-
8
-
9
- class CreateSubmissions < ActiveRecord::Migration[5.1]
10
- def change
11
- create_table :submissions, id: false do |t|
12
- t.bigint :canvas_id, null: false
13
- t.bigint :canvas_course_id
14
- t.bigint :canvas_assignment_id
15
- t.bigint :canvas_user_id
16
- t.datetime :submitted_at
17
- t.datetime :due_at
18
- t.datetime :graded_at
19
- t.float :score
20
- t.float :points_possible
21
- t.boolean :excused
22
- t.string :workflow_state
23
-
24
- t.timestamps
25
- end
26
-
27
- add_index :submissions, :canvas_id, unique: true
28
- add_index :submissions, :canvas_assignment_id
29
- add_index :submissions, :canvas_course_id
30
- add_index :submissions, :canvas_user_id
31
- end
32
- end
@@ -1,24 +0,0 @@
1
- # #
2
- # AUTO GENERATED MIGRATION
3
- # This migration was auto generated by the CanvasSync Gem.
4
- # You can add new columns to this table, but removing or
5
- # re-naming ones created here may break Canvas Syncing.
6
- #
7
-
8
-
9
- class CreateRoles < ActiveRecord::Migration[5.1]
10
- def change
11
- create_table :roles, id: false do |t|
12
- t.bigint :canvas_id, null: false
13
- t.string :label
14
- t.string :base_role_type
15
- t.bigint :canvas_account_id
16
- t.string :workflow_state
17
- t.json :permissions
18
-
19
- t.timestamps
20
- end
21
- add_index :roles, :canvas_id, unique: true
22
- add_index :roles, :canvas_account_id
23
- end
24
- end