canvas_sync 0.9.4 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -0
  3. data/lib/canvas_sync/api_syncable.rb +1 -0
  4. data/lib/canvas_sync/generators/install_generator.rb +3 -3
  5. data/lib/canvas_sync/generators/templates/migrations/create_accounts.rb +17 -0
  6. data/lib/canvas_sync/generators/templates/{models → migrations}/create_admins.rb +2 -2
  7. data/lib/canvas_sync/generators/templates/{models → migrations}/create_assignment_groups.rb +2 -2
  8. data/lib/canvas_sync/generators/templates/{models → migrations}/create_assignments.rb +7 -7
  9. data/lib/canvas_sync/generators/templates/{models → migrations}/create_context_module_items.rb +4 -4
  10. data/lib/canvas_sync/generators/templates/{models → migrations}/create_context_modules.rb +2 -2
  11. data/lib/canvas_sync/generators/templates/{models → migrations}/create_courses.rb +7 -8
  12. data/lib/canvas_sync/generators/templates/{models → migrations}/create_enrollments.rb +4 -6
  13. data/lib/canvas_sync/generators/templates/{models → migrations}/create_roles.rb +2 -2
  14. data/lib/canvas_sync/generators/templates/{models → migrations}/create_sections.rb +5 -5
  15. data/lib/canvas_sync/generators/templates/{models → migrations}/create_submissions.rb +2 -2
  16. data/lib/canvas_sync/generators/templates/{models → migrations}/create_terms.rb +2 -2
  17. data/lib/canvas_sync/generators/templates/{models → migrations}/create_users.rb +4 -4
  18. data/lib/canvas_sync/generators/templates/models/account.rb +4 -4
  19. data/lib/canvas_sync/generators/templates/models/admin.rb +4 -4
  20. data/lib/canvas_sync/generators/templates/models/assignment.rb +10 -9
  21. data/lib/canvas_sync/generators/templates/models/assignment_group.rb +5 -5
  22. data/lib/canvas_sync/generators/templates/models/context_module.rb +2 -2
  23. data/lib/canvas_sync/generators/templates/models/context_module_item.rb +3 -2
  24. data/lib/canvas_sync/generators/templates/models/course.rb +14 -14
  25. data/lib/canvas_sync/generators/templates/models/enrollment.rb +10 -9
  26. data/lib/canvas_sync/generators/templates/models/role.rb +3 -3
  27. data/lib/canvas_sync/generators/templates/models/section.rb +6 -6
  28. data/lib/canvas_sync/generators/templates/models/submission.rb +5 -5
  29. data/lib/canvas_sync/generators/templates/models/term.rb +4 -3
  30. data/lib/canvas_sync/generators/templates/models/user.rb +6 -6
  31. data/lib/canvas_sync/generators/templates/services/live_events/base_event.rb +4 -0
  32. data/lib/canvas_sync/generators/templates/services/live_events/course/course_event.rb +1 -1
  33. data/lib/canvas_sync/generators/templates/services/live_events/course_section/course_section_event.rb +4 -4
  34. data/lib/canvas_sync/generators/templates/services/live_events/module/module_event.rb +1 -1
  35. data/lib/canvas_sync/generators/templates/services/live_events/module_item/module_item_event.rb +3 -3
  36. data/lib/canvas_sync/generators/templates/services/live_events/user/user_event.rb +1 -1
  37. data/lib/canvas_sync/jobs/sync_provisioning_report_job.rb +7 -2
  38. data/lib/canvas_sync/jobs/sync_simple_table_job.rb +7 -2
  39. data/lib/canvas_sync/processors/model_mappings.yml +35 -41
  40. data/lib/canvas_sync/version.rb +1 -1
  41. data/spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb +4 -4
  42. data/spec/canvas_sync/jobs/sync_simple_table_job_spec.rb +3 -3
  43. data/spec/canvas_sync/models/accounts_spec.rb +2 -2
  44. data/spec/canvas_sync/models/admins_spec.rb +3 -3
  45. data/spec/canvas_sync/models/assignment_group_spec.rb +4 -4
  46. data/spec/canvas_sync/models/assignment_spec.rb +8 -8
  47. data/spec/canvas_sync/models/context_module_spec.rb +2 -2
  48. data/spec/canvas_sync/models/course_spec.rb +7 -8
  49. data/spec/canvas_sync/models/enrollment_spec.rb +5 -5
  50. data/spec/canvas_sync/models/roles_spec.rb +3 -3
  51. data/spec/canvas_sync/models/section_spec.rb +4 -4
  52. data/spec/canvas_sync/models/submission_spec.rb +5 -5
  53. data/spec/canvas_sync/models/term_spec.rb +7 -7
  54. data/spec/canvas_sync/models/user_spec.rb +4 -4
  55. data/spec/canvas_sync/processors/provisioning_report_processor_spec.rb +5 -5
  56. data/spec/canvas_sync/services/module_event_spec.rb +1 -1
  57. data/spec/canvas_sync/services/module_item_event_spec.rb +7 -7
  58. data/spec/dummy/app/models/account.rb +9 -1
  59. data/spec/dummy/app/models/admin.rb +4 -4
  60. data/spec/dummy/app/models/assignment.rb +23 -5
  61. data/spec/dummy/app/models/assignment_group.rb +15 -3
  62. data/spec/dummy/app/models/context_module.rb +2 -2
  63. data/spec/dummy/app/models/context_module_item.rb +3 -2
  64. data/spec/dummy/app/models/course.rb +20 -7
  65. data/spec/dummy/app/models/enrollment.rb +20 -4
  66. data/spec/dummy/app/models/role.rb +3 -3
  67. data/spec/dummy/app/models/section.rb +14 -3
  68. data/spec/dummy/app/models/submission.rb +16 -4
  69. data/spec/dummy/app/models/term.rb +4 -3
  70. data/spec/dummy/app/models/user.rb +15 -4
  71. data/spec/dummy/app/services/live_events/base_event.rb +4 -0
  72. data/spec/dummy/app/services/live_events/course_event.rb +1 -1
  73. data/spec/dummy/app/services/live_events/course_section_event.rb +4 -4
  74. data/spec/dummy/app/services/live_events/module_event.rb +1 -1
  75. data/spec/dummy/app/services/live_events/module_item_event.rb +3 -3
  76. data/spec/dummy/app/services/live_events/user_event.rb +1 -1
  77. data/spec/dummy/db/migrate/{20180216171618_create_submissions.rb → 20190521003447_create_submissions.rb} +4 -4
  78. data/spec/dummy/db/migrate/{20180103162102_create_roles.rb → 20190521003448_create_roles.rb} +2 -2
  79. data/spec/dummy/db/migrate/{20180109210452_create_admins.rb → 20190521003449_create_admins.rb} +2 -2
  80. data/spec/dummy/db/migrate/{20180222163506_create_assignment_groups.rb → 20190521003450_create_assignment_groups.rb} +2 -2
  81. data/spec/dummy/db/migrate/{20180411215348_create_context_modules.rb → 20190521003451_create_context_modules.rb} +2 -2
  82. data/spec/dummy/db/migrate/{20180215214227_create_assignments.rb → 20190603192310_create_assignments.rb} +11 -11
  83. data/spec/dummy/db/migrate/{20180605172338_create_context_module_items.rb → 20190603193502_create_context_module_items.rb} +4 -4
  84. data/spec/dummy/db/migrate/{20180509194201_create_users.rb → 20190603215718_create_users.rb} +4 -4
  85. data/spec/dummy/db/migrate/{20170906193506_create_terms.rb → 20190603215721_create_terms.rb} +2 -2
  86. data/spec/dummy/db/migrate/{20171107213207_create_sections.rb → 20190603215722_create_sections.rb} +5 -5
  87. data/spec/dummy/db/migrate/{20170914181345_create_courses.rb → 20190603220011_create_courses.rb} +7 -8
  88. data/spec/dummy/db/migrate/{20170905192509_create_enrollments.rb → 20190603220013_create_enrollments.rb} +4 -6
  89. data/spec/dummy/db/migrate/{20180220172559_create_accounts.rb → 20190604193942_create_accounts.rb} +6 -6
  90. data/spec/dummy/db/schema.rb +56 -58
  91. data/spec/dummy/log/test.log +1350 -0
  92. data/spec/factories/account_factory.rb +5 -5
  93. data/spec/factories/admin_factory.rb +1 -1
  94. data/spec/factories/assignment_factory.rb +1 -1
  95. data/spec/factories/assignment_group_factory.rb +1 -1
  96. data/spec/factories/context_module_factory.rb +2 -2
  97. data/spec/factories/context_module_item_factory.rb +1 -1
  98. data/spec/factories/course_factory.rb +5 -5
  99. data/spec/factories/enrollment_factory.rb +1 -1
  100. data/spec/factories/role_factory.rb +1 -1
  101. data/spec/factories/section_factory.rb +1 -1
  102. data/spec/factories/submission_factory.rb +1 -1
  103. data/spec/factories/term_factory.rb +1 -1
  104. data/spec/factories/user_factory.rb +1 -1
  105. data/spec/spec_helper.rb +1 -0
  106. metadata +41 -41
  107. data/lib/canvas_sync/generators/templates/models/create_accounts.rb +0 -17
@@ -1,10 +1,10 @@
1
1
  FactoryGirl.define do
2
2
  factory :account do
3
- canvas_account_id { SecureRandom.random_number(100_000_000) }
4
- account_id { SecureRandom.hex }
5
- canvas_parent_id 1
6
- parent_account_id { SecureRandom.hex }
3
+ canvas_id { SecureRandom.random_number(100_000_000) }
4
+ sis_id { SecureRandom.hex }
5
+ canvas_parent_account_id 1
6
+ sis_parent_account_id { SecureRandom.hex }
7
7
  name "Account name"
8
- status "active"
8
+ workflow_state "active"
9
9
  end
10
10
  end
@@ -1,6 +1,6 @@
1
1
  FactoryGirl.define do
2
2
  factory :admin do
3
- canvas_admin_id { SecureRandom.random_number(100_000_000) }
3
+ canvas_id { SecureRandom.random_number(100_000_000) }
4
4
  role_name 'Cool Role'
5
5
  canvas_role_id { SecureRandom.random_number(100_000_000) }
6
6
  user_data { "{ 'id': 1}" }
@@ -1,6 +1,6 @@
1
1
  FactoryGirl.define do
2
2
  factory :assignment do
3
- sequence(:canvas_assignment_id) { |n| n }
3
+ sequence(:canvas_id) { |n| n }
4
4
  sequence(:title) { |n| "Assignment #{n}" }
5
5
  due_at { 1.week.from_now }
6
6
  unlock_at { 1.day.ago }
@@ -1,6 +1,6 @@
1
1
  FactoryGirl.define do
2
2
  factory :assignment_group do
3
- sequence(:canvas_assignment_group_id) { |n| n }
3
+ sequence(:canvas_id) { |n| n }
4
4
  name 'Dummy Assignment Group'
5
5
  workflow_state 'available'
6
6
  canvas_created_at {1.week.ago}
@@ -1,8 +1,8 @@
1
1
  FactoryGirl.define do
2
2
  factory :context_module do
3
- sequence(:canvas_context_module_id) { |n| n }
3
+ sequence(:canvas_id) { |n| n }
4
4
  name "Context Module"
5
5
  workflow_state "available"
6
- canvas_context { FactoryGirl.create(:course) }
6
+ context { FactoryGirl.create(:course) }
7
7
  end
8
8
  end
@@ -1,6 +1,6 @@
1
1
  FactoryGirl.define do
2
2
  factory :context_module_item do
3
- sequence(:canvas_context_module_item_id) { |n| n }
3
+ sequence(:canvas_id) { |n| n }
4
4
  assignment
5
5
  workflow_state "active"
6
6
  end
@@ -1,10 +1,10 @@
1
1
  FactoryGirl.define do
2
2
  factory :course do
3
- canvas_course_id { SecureRandom.random_number(100_000_000) }
3
+ canvas_id { SecureRandom.random_number(100_000_000) }
4
4
  sis_id { SecureRandom.hex }
5
- short_name 'Cool Course'
6
- long_name 'Really Really Cool Course'
7
- start_date { 3.days.ago }
8
- end_date { 3.weeks.from_now }
5
+ course_code 'Cool Course'
6
+ name 'Really Really Cool Course'
7
+ start_at { 3.days.ago }
8
+ end_at { 3.weeks.from_now }
9
9
  end
10
10
  end
@@ -1,5 +1,5 @@
1
1
  FactoryGirl.define do
2
2
  factory :enrollment do
3
- canvas_enrollment_id { SecureRandom.random_number(100_000_000) }
3
+ canvas_id { SecureRandom.random_number(100_000_000) }
4
4
  end
5
5
  end
@@ -2,7 +2,7 @@ FactoryGirl.define do
2
2
  factory :role do
3
3
  label 'Cool Role'
4
4
  base_role_type 'AccountMembership'
5
- canvas_role_id { SecureRandom.random_number(100_000_000) }
5
+ canvas_id { SecureRandom.random_number(100_000_000) }
6
6
  workflow_state 'active'
7
7
  end
8
8
  end
@@ -1,5 +1,5 @@
1
1
  FactoryGirl.define do
2
2
  factory :section do
3
- canvas_section_id { SecureRandom.random_number(100_000_000) }
3
+ canvas_id { SecureRandom.random_number(100_000_000) }
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  FactoryGirl.define do
2
2
  factory :submission do
3
- sequence(:canvas_submission_id) { |n| n }
3
+ sequence(:canvas_id) { |n| n }
4
4
  submitted_at { 1.week.ago }
5
5
  graded_at { 1.day.ago }
6
6
  score { 5 }
@@ -3,7 +3,7 @@ FactoryGirl.define do
3
3
  name 'Cool Term'
4
4
  start_at 3.days.ago
5
5
  end_at 3.days.from_now
6
- canvas_term_id { SecureRandom.random_number(100_000_000) }
6
+ canvas_id { SecureRandom.random_number(100_000_000) }
7
7
  workflow_state 'active'
8
8
  sis_id { SecureRandom.hex }
9
9
  end
@@ -1,6 +1,6 @@
1
1
  FactoryGirl.define do
2
2
  factory :user do
3
- canvas_user_id { SecureRandom.random_number(100_000_000) }
3
+ canvas_id { SecureRandom.random_number(100_000_000) }
4
4
  sis_id { SecureRandom.hex }
5
5
  email "cooldude@coolsite.com"
6
6
  first_name "Cool"
@@ -1,6 +1,7 @@
1
1
  ENV["RAILS_ENV"] ||= 'test'
2
2
  require "canvas_sync"
3
3
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
+ # Rails::Generators.invoke("canvas_sync:install", ["--models", "all"], destination_root: Rails.root)
4
5
  require "bundler/setup"
5
6
  require 'rspec/rails'
6
7
  require 'spec_helper'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Collings
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-07 00:00:00.000000000 Z
11
+ date: 2019-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -325,6 +325,19 @@ files:
325
325
  - lib/canvas_sync/engine.rb
326
326
  - lib/canvas_sync/generators/install_generator.rb
327
327
  - lib/canvas_sync/generators/install_live_events_generator.rb
328
+ - lib/canvas_sync/generators/templates/migrations/create_accounts.rb
329
+ - lib/canvas_sync/generators/templates/migrations/create_admins.rb
330
+ - lib/canvas_sync/generators/templates/migrations/create_assignment_groups.rb
331
+ - lib/canvas_sync/generators/templates/migrations/create_assignments.rb
332
+ - lib/canvas_sync/generators/templates/migrations/create_context_module_items.rb
333
+ - lib/canvas_sync/generators/templates/migrations/create_context_modules.rb
334
+ - lib/canvas_sync/generators/templates/migrations/create_courses.rb
335
+ - lib/canvas_sync/generators/templates/migrations/create_enrollments.rb
336
+ - lib/canvas_sync/generators/templates/migrations/create_roles.rb
337
+ - lib/canvas_sync/generators/templates/migrations/create_sections.rb
338
+ - lib/canvas_sync/generators/templates/migrations/create_submissions.rb
339
+ - lib/canvas_sync/generators/templates/migrations/create_terms.rb
340
+ - lib/canvas_sync/generators/templates/migrations/create_users.rb
328
341
  - lib/canvas_sync/generators/templates/models/account.rb
329
342
  - lib/canvas_sync/generators/templates/models/admin.rb
330
343
  - lib/canvas_sync/generators/templates/models/assignment.rb
@@ -332,19 +345,6 @@ files:
332
345
  - lib/canvas_sync/generators/templates/models/context_module.rb
333
346
  - lib/canvas_sync/generators/templates/models/context_module_item.rb
334
347
  - lib/canvas_sync/generators/templates/models/course.rb
335
- - lib/canvas_sync/generators/templates/models/create_accounts.rb
336
- - lib/canvas_sync/generators/templates/models/create_admins.rb
337
- - lib/canvas_sync/generators/templates/models/create_assignment_groups.rb
338
- - lib/canvas_sync/generators/templates/models/create_assignments.rb
339
- - lib/canvas_sync/generators/templates/models/create_context_module_items.rb
340
- - lib/canvas_sync/generators/templates/models/create_context_modules.rb
341
- - lib/canvas_sync/generators/templates/models/create_courses.rb
342
- - lib/canvas_sync/generators/templates/models/create_enrollments.rb
343
- - lib/canvas_sync/generators/templates/models/create_roles.rb
344
- - lib/canvas_sync/generators/templates/models/create_sections.rb
345
- - lib/canvas_sync/generators/templates/models/create_submissions.rb
346
- - lib/canvas_sync/generators/templates/models/create_terms.rb
347
- - lib/canvas_sync/generators/templates/models/create_users.rb
348
348
  - lib/canvas_sync/generators/templates/models/enrollment.rb
349
349
  - lib/canvas_sync/generators/templates/models/role.rb
350
350
  - lib/canvas_sync/generators/templates/models/section.rb
@@ -504,19 +504,19 @@ files:
504
504
  - spec/dummy/config/initializers/wrap_parameters.rb
505
505
  - spec/dummy/config/routes.rb
506
506
  - spec/dummy/config/secrets.yml
507
- - spec/dummy/db/migrate/20170905192509_create_enrollments.rb
508
- - spec/dummy/db/migrate/20170906193506_create_terms.rb
509
- - spec/dummy/db/migrate/20170914181345_create_courses.rb
510
- - spec/dummy/db/migrate/20171107213207_create_sections.rb
511
- - spec/dummy/db/migrate/20180103162102_create_roles.rb
512
- - spec/dummy/db/migrate/20180109210452_create_admins.rb
513
- - spec/dummy/db/migrate/20180215214227_create_assignments.rb
514
- - spec/dummy/db/migrate/20180216171618_create_submissions.rb
515
- - spec/dummy/db/migrate/20180220172559_create_accounts.rb
516
- - spec/dummy/db/migrate/20180222163506_create_assignment_groups.rb
517
- - spec/dummy/db/migrate/20180411215348_create_context_modules.rb
518
- - spec/dummy/db/migrate/20180509194201_create_users.rb
519
- - spec/dummy/db/migrate/20180605172338_create_context_module_items.rb
507
+ - spec/dummy/db/migrate/20190521003447_create_submissions.rb
508
+ - spec/dummy/db/migrate/20190521003448_create_roles.rb
509
+ - spec/dummy/db/migrate/20190521003449_create_admins.rb
510
+ - spec/dummy/db/migrate/20190521003450_create_assignment_groups.rb
511
+ - spec/dummy/db/migrate/20190521003451_create_context_modules.rb
512
+ - spec/dummy/db/migrate/20190603192310_create_assignments.rb
513
+ - spec/dummy/db/migrate/20190603193502_create_context_module_items.rb
514
+ - spec/dummy/db/migrate/20190603215718_create_users.rb
515
+ - spec/dummy/db/migrate/20190603215721_create_terms.rb
516
+ - spec/dummy/db/migrate/20190603215722_create_sections.rb
517
+ - spec/dummy/db/migrate/20190603220011_create_courses.rb
518
+ - spec/dummy/db/migrate/20190603220013_create_enrollments.rb
519
+ - spec/dummy/db/migrate/20190604193942_create_accounts.rb
520
520
  - spec/dummy/db/schema.rb
521
521
  - spec/dummy/db/test.sqlite3
522
522
  - spec/dummy/log/development.log
@@ -673,19 +673,19 @@ test_files:
673
673
  - spec/dummy/config/initializers/wrap_parameters.rb
674
674
  - spec/dummy/config/routes.rb
675
675
  - spec/dummy/config/secrets.yml
676
- - spec/dummy/db/migrate/20170905192509_create_enrollments.rb
677
- - spec/dummy/db/migrate/20170906193506_create_terms.rb
678
- - spec/dummy/db/migrate/20170914181345_create_courses.rb
679
- - spec/dummy/db/migrate/20171107213207_create_sections.rb
680
- - spec/dummy/db/migrate/20180103162102_create_roles.rb
681
- - spec/dummy/db/migrate/20180109210452_create_admins.rb
682
- - spec/dummy/db/migrate/20180215214227_create_assignments.rb
683
- - spec/dummy/db/migrate/20180216171618_create_submissions.rb
684
- - spec/dummy/db/migrate/20180220172559_create_accounts.rb
685
- - spec/dummy/db/migrate/20180222163506_create_assignment_groups.rb
686
- - spec/dummy/db/migrate/20180411215348_create_context_modules.rb
687
- - spec/dummy/db/migrate/20180509194201_create_users.rb
688
- - spec/dummy/db/migrate/20180605172338_create_context_module_items.rb
676
+ - spec/dummy/db/migrate/20190521003447_create_submissions.rb
677
+ - spec/dummy/db/migrate/20190521003448_create_roles.rb
678
+ - spec/dummy/db/migrate/20190521003449_create_admins.rb
679
+ - spec/dummy/db/migrate/20190521003450_create_assignment_groups.rb
680
+ - spec/dummy/db/migrate/20190521003451_create_context_modules.rb
681
+ - spec/dummy/db/migrate/20190603192310_create_assignments.rb
682
+ - spec/dummy/db/migrate/20190603193502_create_context_module_items.rb
683
+ - spec/dummy/db/migrate/20190603215718_create_users.rb
684
+ - spec/dummy/db/migrate/20190603215721_create_terms.rb
685
+ - spec/dummy/db/migrate/20190603215722_create_sections.rb
686
+ - spec/dummy/db/migrate/20190603220011_create_courses.rb
687
+ - spec/dummy/db/migrate/20190603220013_create_enrollments.rb
688
+ - spec/dummy/db/migrate/20190604193942_create_accounts.rb
689
689
  - spec/dummy/db/schema.rb
690
690
  - spec/dummy/db/test.sqlite3
691
691
  - spec/dummy/log/development.log
@@ -1,17 +0,0 @@
1
- <%= autogenerated_migration_warning %>
2
-
3
- class CreateAccounts < ActiveRecord::Migration[5.1]
4
- def change
5
- create_table :accounts do |t|
6
- t.bigint :canvas_account_id, null: false
7
- t.string :account_id
8
- t.bigint :canvas_parent_id
9
- t.string :parent_account_id
10
- t.string :name
11
- t.string :status
12
-
13
- t.timestamps
14
- end
15
- add_index :accounts, :canvas_account_id, unique: true
16
- end
17
- end