canvas_sync 0.10.3 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +57 -2
  3. data/db/migrate/20190916154829_add_fork_count_to_canvas_sync_job_logs.rb +13 -0
  4. data/lib/canvas_sync.rb +43 -8
  5. data/lib/canvas_sync/api_syncable.rb +8 -0
  6. data/lib/canvas_sync/generators/templates/migrations/create_admins.rb +7 -4
  7. data/lib/canvas_sync/generators/templates/migrations/create_roles.rb +3 -4
  8. data/lib/canvas_sync/generators/templates/models/account.rb +2 -0
  9. data/lib/canvas_sync/generators/templates/models/admin.rb +4 -5
  10. data/lib/canvas_sync/generators/templates/models/role.rb +0 -4
  11. data/lib/canvas_sync/generators/templates/models/term.rb +0 -2
  12. data/lib/canvas_sync/importers/bulk_importer.rb +7 -4
  13. data/lib/canvas_sync/job.rb +24 -1
  14. data/lib/canvas_sync/jobs/fork_gather.rb +59 -0
  15. data/lib/canvas_sync/jobs/report_starter.rb +12 -1
  16. data/lib/canvas_sync/jobs/sync_admins_job.rb +9 -5
  17. data/lib/canvas_sync/jobs/sync_assignment_groups_job.rb +2 -8
  18. data/lib/canvas_sync/jobs/sync_assignments_job.rb +2 -8
  19. data/lib/canvas_sync/jobs/sync_context_module_items_job.rb +2 -8
  20. data/lib/canvas_sync/jobs/sync_context_modules_job.rb +2 -8
  21. data/lib/canvas_sync/jobs/sync_provisioning_report_job.rb +23 -11
  22. data/lib/canvas_sync/jobs/sync_roles_job.rb +8 -5
  23. data/lib/canvas_sync/jobs/sync_simple_table_job.rb +17 -7
  24. data/lib/canvas_sync/jobs/sync_submissions_job.rb +1 -5
  25. data/lib/canvas_sync/jobs/sync_terms_job.rb +8 -2
  26. data/lib/canvas_sync/jobs/sync_users_job.rb +5 -7
  27. data/lib/canvas_sync/processors/assignment_groups_processor.rb +3 -2
  28. data/lib/canvas_sync/processors/assignments_processor.rb +3 -2
  29. data/lib/canvas_sync/processors/context_module_items_processor.rb +3 -2
  30. data/lib/canvas_sync/processors/context_modules_processor.rb +3 -2
  31. data/lib/canvas_sync/processors/normal_processor.rb +2 -1
  32. data/lib/canvas_sync/processors/provisioning_report_processor.rb +7 -2
  33. data/lib/canvas_sync/processors/submissions_processor.rb +3 -2
  34. data/lib/canvas_sync/version.rb +1 -1
  35. data/spec/canvas_sync/canvas_sync_spec.rb +17 -0
  36. data/spec/canvas_sync/jobs/fork_gather_spec.rb +73 -0
  37. data/spec/canvas_sync/jobs/job_spec.rb +39 -5
  38. data/spec/canvas_sync/jobs/sync_admins_job_spec.rb +2 -1
  39. data/spec/canvas_sync/jobs/sync_assignment_groups_job_spec.rb +1 -1
  40. data/spec/canvas_sync/jobs/sync_assignments_job_spec.rb +2 -2
  41. data/spec/canvas_sync/jobs/sync_context_module_items_job_spec.rb +2 -2
  42. data/spec/canvas_sync/jobs/sync_context_modules_job_spec.rb +2 -2
  43. data/spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb +20 -11
  44. data/spec/canvas_sync/jobs/sync_roles_job_spec.rb +2 -1
  45. data/spec/canvas_sync/jobs/sync_simple_table_job_spec.rb +1 -0
  46. data/spec/canvas_sync/jobs/sync_submissions_job_spec.rb +1 -1
  47. data/spec/canvas_sync/jobs/sync_users_job_spec.rb +1 -1
  48. data/spec/canvas_sync/models/admins_spec.rb +3 -5
  49. data/spec/canvas_sync/models/roles_spec.rb +5 -5
  50. data/spec/canvas_sync/models/term_spec.rb +3 -3
  51. data/spec/dummy/app/models/account.rb +2 -0
  52. data/spec/dummy/app/models/admin.rb +4 -5
  53. data/spec/dummy/app/models/role.rb +0 -4
  54. data/spec/dummy/app/models/term.rb +0 -2
  55. data/spec/dummy/db/migrate/{20190702203628_create_roles.rb → 20190927204545_create_roles.rb} +3 -4
  56. data/spec/dummy/db/migrate/{20190702203629_create_admins.rb → 20190927204546_create_admins.rb} +7 -4
  57. data/spec/dummy/db/schema.rb +12 -9
  58. data/spec/dummy/db/test.sqlite3 +0 -0
  59. data/spec/dummy/log/development.log +1248 -0
  60. data/spec/dummy/log/test.log +43258 -0
  61. data/spec/factories/admin_factory.rb +0 -1
  62. data/spec/support/fake_canvas.rb +2 -2
  63. data/spec/support/fixtures/canvas_responses/roles.json +6 -0
  64. data/spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv +3 -0
  65. data/spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv +4 -0
  66. metadata +25 -12
@@ -3,7 +3,6 @@ FactoryGirl.define do
3
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
- user_data { "{ 'id': 1}" }
7
6
  canvas_user_id 1
8
7
  workflow_state 'active'
9
8
  end
@@ -8,11 +8,11 @@ class FakeCanvas < Sinatra::Base
8
8
  json_response 200, 'terms.json'
9
9
  end
10
10
 
11
- get '/api/v1/accounts/self/roles' do
11
+ get '/api/v1/accounts/1/roles' do
12
12
  json_response 200, 'roles.json'
13
13
  end
14
14
 
15
- get '/api/v1/accounts/self/admins' do
15
+ get '/api/v1/accounts/1/admins' do
16
16
  json_response 200, 'admins.json'
17
17
  end
18
18
 
@@ -414,6 +414,9 @@
414
414
  "applies_to_descendants": true,
415
415
  "applies_to_self": true
416
416
  }
417
+ },
418
+ "account": {
419
+ "id": 10
417
420
  }
418
421
  },
419
422
  {
@@ -743,6 +746,9 @@
743
746
  "readonly": true,
744
747
  "explicit": false
745
748
  }
749
+ },
750
+ "account": {
751
+ "id": 10
746
752
  }
747
753
  }
748
754
  ]
@@ -0,0 +1,3 @@
1
+ canvas_course_id,course_id,integration_id,short_name,long_name,canvas_account_id,account_id,canvas_term_id,term_id,status,start_date,end_date,course_format,created_by_sis
2
+ 1,course_sis_id_1,,C1,Course #1,1,,1,term_sis_id_1,active,2017-03-27T15:53:18-06:00,2017-04-27T06:21:18-06:00,,FALSE
3
+ 2,course_sis_id_2,,C2,Course #2,1,,1,term_sis_id_2,unpublished,2017-03-27T15:53:18-06:00,2017-04-27T06:21:18-06:00,,FALSE
@@ -0,0 +1,4 @@
1
+ canvas_user_id,user_id,integration_id,authentication_provider_id,login_id,first_name,last_name,full_name,sortable_name,short_name,email,status,created_by_sis
2
+ 1,sis_id_1,,123,spiderdude1337,Patches,the Spider,Patches the Spider,"the Spider, Patches",,poorbastard@yharnam.com,active,FALSE
3
+ 2,sis_id_2,,1234,retireddude109,Hunter,Djura,Hunter Djura,"Djura, Hunter",,dreamer@yharnam.com,active,FALSE
4
+ 2,sis_id_2,,1234,retireddude110,Hunter,Djura,Hunter Djura,"Djura, Hunter",,dreamer@yharnam.com,active,FALSE
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.10.3
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Collings
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-03 00:00:00.000000000 Z
11
+ date: 2020-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -304,7 +304,7 @@ dependencies:
304
304
  - - ">="
305
305
  - !ruby/object:Gem::Version
306
306
  version: '0'
307
- description:
307
+ description:
308
308
  email:
309
309
  - ncollings@instructure.com
310
310
  executables: []
@@ -319,6 +319,7 @@ files:
319
319
  - config/initializers/apartment.rb
320
320
  - db/migrate/20170915210836_create_canvas_sync_job_log.rb
321
321
  - db/migrate/20180725155729_add_job_id_to_canvas_sync_job_logs.rb
322
+ - db/migrate/20190916154829_add_fork_count_to_canvas_sync_job_logs.rb
322
323
  - lib/canvas_sync.rb
323
324
  - lib/canvas_sync/api_syncable.rb
324
325
  - lib/canvas_sync/config.rb
@@ -366,6 +367,7 @@ files:
366
367
  - lib/canvas_sync/importers/bulk_importer.rb
367
368
  - lib/canvas_sync/importers/legacy_importer.rb
368
369
  - lib/canvas_sync/job.rb
370
+ - lib/canvas_sync/jobs/fork_gather.rb
369
371
  - lib/canvas_sync/jobs/report_checker.rb
370
372
  - lib/canvas_sync/jobs/report_processor_job.rb
371
373
  - lib/canvas_sync/jobs/report_starter.rb
@@ -392,6 +394,7 @@ files:
392
394
  - lib/canvas_sync/sidekiq_job.rb
393
395
  - lib/canvas_sync/version.rb
394
396
  - spec/canvas_sync/canvas_sync_spec.rb
397
+ - spec/canvas_sync/jobs/fork_gather_spec.rb
395
398
  - spec/canvas_sync/jobs/job_spec.rb
396
399
  - spec/canvas_sync/jobs/report_checker_spec.rb
397
400
  - spec/canvas_sync/jobs/report_processor_job_spec.rb
@@ -495,12 +498,15 @@ files:
495
498
  - spec/dummy/db/migrate/20190702203625_create_sections.rb
496
499
  - spec/dummy/db/migrate/20190702203626_create_assignments.rb
497
500
  - spec/dummy/db/migrate/20190702203627_create_submissions.rb
498
- - spec/dummy/db/migrate/20190702203628_create_roles.rb
499
- - spec/dummy/db/migrate/20190702203629_create_admins.rb
500
501
  - spec/dummy/db/migrate/20190702203630_create_assignment_groups.rb
501
502
  - spec/dummy/db/migrate/20190702203631_create_context_modules.rb
502
503
  - spec/dummy/db/migrate/20190702203632_create_context_module_items.rb
504
+ - spec/dummy/db/migrate/20190927204545_create_roles.rb
505
+ - spec/dummy/db/migrate/20190927204546_create_admins.rb
503
506
  - spec/dummy/db/schema.rb
507
+ - spec/dummy/db/test.sqlite3
508
+ - spec/dummy/log/development.log
509
+ - spec/dummy/log/test.log
504
510
  - spec/factories/account_factory.rb
505
511
  - spec/factories/admin_factory.rb
506
512
  - spec/factories/assignment_factory.rb
@@ -528,6 +534,8 @@ files:
528
534
  - spec/support/fixtures/reports/courses.csv
529
535
  - spec/support/fixtures/reports/enrollments.csv
530
536
  - spec/support/fixtures/reports/provisioning_csv
537
+ - spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv
538
+ - spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv
531
539
  - spec/support/fixtures/reports/sections.csv
532
540
  - spec/support/fixtures/reports/submissions.csv
533
541
  - spec/support/fixtures/reports/users.csv
@@ -535,7 +543,7 @@ files:
535
543
  homepage: https://instructure.com
536
544
  licenses: []
537
545
  metadata: {}
538
- post_install_message:
546
+ post_install_message:
539
547
  rdoc_options: []
540
548
  require_paths:
541
549
  - lib
@@ -550,13 +558,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
550
558
  - !ruby/object:Gem::Version
551
559
  version: '0'
552
560
  requirements: []
553
- rubyforge_project:
554
- rubygems_version: 2.5.2.1
555
- signing_key:
561
+ rubygems_version: 3.1.2
562
+ signing_key:
556
563
  specification_version: 4
557
564
  summary: Gem for generating Canvas models and migrations and syncing data from Canvas
558
565
  test_files:
559
566
  - spec/canvas_sync/canvas_sync_spec.rb
567
+ - spec/canvas_sync/jobs/fork_gather_spec.rb
560
568
  - spec/canvas_sync/jobs/job_spec.rb
561
569
  - spec/canvas_sync/jobs/report_checker_spec.rb
562
570
  - spec/canvas_sync/jobs/report_processor_job_spec.rb
@@ -660,12 +668,15 @@ test_files:
660
668
  - spec/dummy/db/migrate/20190702203625_create_sections.rb
661
669
  - spec/dummy/db/migrate/20190702203626_create_assignments.rb
662
670
  - spec/dummy/db/migrate/20190702203627_create_submissions.rb
663
- - spec/dummy/db/migrate/20190702203628_create_roles.rb
664
- - spec/dummy/db/migrate/20190702203629_create_admins.rb
665
671
  - spec/dummy/db/migrate/20190702203630_create_assignment_groups.rb
666
672
  - spec/dummy/db/migrate/20190702203631_create_context_modules.rb
667
673
  - spec/dummy/db/migrate/20190702203632_create_context_module_items.rb
674
+ - spec/dummy/db/migrate/20190927204545_create_roles.rb
675
+ - spec/dummy/db/migrate/20190927204546_create_admins.rb
668
676
  - spec/dummy/db/schema.rb
677
+ - spec/dummy/db/test.sqlite3
678
+ - spec/dummy/log/development.log
679
+ - spec/dummy/log/test.log
669
680
  - spec/factories/account_factory.rb
670
681
  - spec/factories/admin_factory.rb
671
682
  - spec/factories/assignment_factory.rb
@@ -693,6 +704,8 @@ test_files:
693
704
  - spec/support/fixtures/reports/courses.csv
694
705
  - spec/support/fixtures/reports/enrollments.csv
695
706
  - spec/support/fixtures/reports/provisioning_csv
707
+ - spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv
708
+ - spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv
696
709
  - spec/support/fixtures/reports/sections.csv
697
710
  - spec/support/fixtures/reports/submissions.csv
698
711
  - spec/support/fixtures/reports/users.csv