canvas_sync 0.23.1 → 0.23.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93ae5e4352ec2cd93ccbda29fdb2b101695f901842c39a24d7a4084694336a76
4
- data.tar.gz: d1eada607b543891b5d657d1fe0db3d211275bf2af8fb32a8ee4e4a1a5d78491
3
+ metadata.gz: 87dcb3a29883abf28f3be7ef70a6aaa6b8b303c7115d5a52e8a7ae9785c1ba3d
4
+ data.tar.gz: ac6c904f3ce0af3e8cdcd32dea735b69dbb856a21c6a2122a0cf9a4d6fe910cc
5
5
  SHA512:
6
- metadata.gz: 0f05dfc8155287d2b636f1e064ee6180a064c3c02cb087ffcf2e8eb68477d6f7c6baeabb669c068aa5aa63c5f36152d7056155c62ca7949a22cb1976a19ef9e8
7
- data.tar.gz: a9ae2c98e3944468142bee9f072ba79f9cd59d7608f8f85edf178cf29badd3942a3d7e7b2c762137b1beac4e8909377c2dd6979dbe26017b4985131b71eccd6a
6
+ metadata.gz: 398b3bf5a5da8cc4709c49a69587000a48d56cf86e9b46b5ada2768dab58f2b8dc14125c70885074dc4311c4b0aa818105283b6c0d3edc820e5c1e092b1e38d7
7
+ data.tar.gz: b89d3d9d41fd62f9c017742ee7b08c5b50ca0e379dfa3bd48e9e78598dfd7b113917666211c146efa9b471b2a9827d4acb6e8620c0da4806d9c99dd0a51f314c
@@ -13,6 +13,8 @@ class CreateCourses < ActiveRecord::Migration[5.1]
13
13
  t.datetime :start_at
14
14
  t.datetime :end_at
15
15
  t.bigint :grading_standard_id
16
+ # Optional opt-in columns
17
+ # t.string :public_description
16
18
 
17
19
  t.timestamps
18
20
  end
@@ -34,7 +34,10 @@ class Course < ApplicationRecord
34
34
  canvas_account_id: :account_id,
35
35
  start_at: :start_at,
36
36
  end_at: :end_at,
37
+ # If opting in the public_description, make sure to also add the 'include' array in the api call
38
+ # public_description: :public_description,
37
39
  }, -> (api) { api.course(canvas_id) })
40
+ # }, -> (api) { api.course(canvas_id, { include: ['public_description'] }) })
38
41
 
39
42
  scope :active, -> { where(workflow_state: 'active') }
40
43
 
@@ -104,6 +104,9 @@ courses:
104
104
  grading_standard_id:
105
105
  database_column_name: grading_standard_id
106
106
  type: integer
107
+ public_description:
108
+ database_column_name: public_description
109
+ type: string
107
110
 
108
111
  course_progresses:
109
112
  conflict_target:
@@ -24,8 +24,8 @@ module CanvasSync
24
24
  if options[:models].length == 1
25
25
  run_import(options[:models][0], report_file_path)
26
26
  else
27
- unzipped_file_path = extract(report_file_path)
28
- Dir[unzipped_file_path + "/*.csv"].sort.each do |file_path|
27
+ unzipped_file_dir = extract(report_file_path)
28
+ Dir[unzipped_file_dir + "/*.csv"].sort.each do |file_path|
29
29
  model_name = file_path.split("/").last.split(".").first
30
30
  run_import(model_name, file_path)
31
31
  end
@@ -35,17 +35,23 @@ module CanvasSync
35
35
  private
36
36
 
37
37
  def extract(file_path)
38
- unzipped_file_path = "#{file_path}_unzipped"
38
+ unzipped_file_dir = "#{file_path}_unzipped"
39
39
 
40
40
  Zip::File.open(file_path) do |zip_file|
41
41
  zip_file.each do |f|
42
- f_path = File.join(unzipped_file_path, f.name)
42
+ f_path = File.join(unzipped_file_dir, f.name)
43
43
  FileUtils.mkdir_p(File.dirname(f_path))
44
- zip_file.extract(f, f_path) unless File.exist?(f_path)
44
+ next if File.exist?(f_path)
45
+
46
+ if Zip::VERSION < "3.0.0"
47
+ zip_file.extract(f, destination_directory: unzipped_file_dir)
48
+ else
49
+ zip_file.extract(f, f_path)
50
+ end
45
51
  end
46
52
  end
47
53
 
48
- unzipped_file_path
54
+ unzipped_file_dir
49
55
  end
50
56
 
51
57
  def run_import(model_name, report_file_path)
@@ -1,3 +1,3 @@
1
1
  module CanvasSync
2
- VERSION = "0.23.1".freeze
2
+ VERSION = "0.23.3".freeze
3
3
  end
@@ -40,7 +40,11 @@ class Course < ApplicationRecord
40
40
  canvas_account_id: :account_id,
41
41
  start_at: :start_at,
42
42
  end_at: :end_at,
43
+ # If opting in the public_description, make sure to also add the 'include' array in the api call
44
+ # public_description: :public_description,
43
45
  }, -> (api) { api.course(canvas_id) })
46
+ # }, -> (api) { api.course(canvas_id, { include: ['public_description'] }) })
47
+
44
48
 
45
49
  scope :active, -> { where(workflow_state: 'active') }
46
50
 
@@ -19,6 +19,8 @@ class CreateCourses < ActiveRecord::Migration[5.1]
19
19
  t.datetime :start_at
20
20
  t.datetime :end_at
21
21
  t.bigint :grading_standard_id
22
+ # Optional opt-in columns
23
+ # t.string :public_description
22
24
 
23
25
  t.timestamps
24
26
  end
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema[7.1].define(version: 2025_06_26_194330) do
13
+ ActiveRecord::Schema[7.1].define(version: 2025_07_30_124426) do
14
14
  # These are extensions that must be enabled in order to support this database
15
15
  enable_extension "plpgsql"
16
16
 
@@ -214,6 +214,7 @@ ActiveRecord::Schema[7.1].define(version: 2025_06_26_194330) do
214
214
  t.datetime "start_at", precision: nil
215
215
  t.datetime "end_at", precision: nil
216
216
  t.bigint "grading_standard_id"
217
+ t.string "public_description"
217
218
  t.datetime "created_at", precision: nil, null: false
218
219
  t.datetime "updated_at", precision: nil, null: false
219
220
  t.index ["canvas_id"], name: "index_courses_on_canvas_id", unique: true
@@ -363,10 +364,10 @@ ActiveRecord::Schema[7.1].define(version: 2025_06_26_194330) do
363
364
  end
364
365
 
365
366
  create_table "roles", force: :cascade do |t|
366
- t.integer "canvas_id", null: false
367
+ t.bigint "canvas_id", null: false
367
368
  t.string "label"
368
369
  t.string "base_role_type"
369
- t.integer "canvas_account_id"
370
+ t.bigint "canvas_account_id"
370
371
  t.string "workflow_state"
371
372
  t.json "permissions"
372
373
  t.datetime "created_at", precision: nil, null: false
@@ -1,3 +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,5
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,public_description
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,"Description 1"
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,5,"Description 2"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.1
4
+ version: 0.23.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure CustomDev
@@ -289,6 +289,20 @@ dependencies:
289
289
  - - ">="
290
290
  - !ruby/object:Gem::Version
291
291
  version: '0'
292
+ - !ruby/object:Gem::Dependency
293
+ name: csv
294
+ requirement: !ruby/object:Gem::Requirement
295
+ requirements:
296
+ - - ">="
297
+ - !ruby/object:Gem::Version
298
+ version: '0'
299
+ type: :runtime
300
+ prerelease: false
301
+ version_requirements: !ruby/object:Gem::Requirement
302
+ requirements:
303
+ - - ">="
304
+ - !ruby/object:Gem::Version
305
+ version: '0'
292
306
  - !ruby/object:Gem::Dependency
293
307
  name: open-uri
294
308
  requirement: !ruby/object:Gem::Requirement
@@ -884,7 +898,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
884
898
  - !ruby/object:Gem::Version
885
899
  version: '0'
886
900
  requirements: []
887
- rubygems_version: 3.6.7
901
+ rubygems_version: 3.6.9
888
902
  specification_version: 4
889
903
  summary: Gem for generating Canvas models and migrations and syncing data from Canvas
890
904
  test_files: