canvas_sync 0.17.41 → 0.17.43

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfa9a724751a0d163496133f4c928f1ccfca544413d668ef045bb30178dd37fc
4
- data.tar.gz: c6107cc707e8474dc23e429760b276d0f91f5e482860cd870b4069279bcc9120
3
+ metadata.gz: 7d7516d1ed3059c0c62d1f1ac058841dd289aca1ff8007576be2b0d823def9b7
4
+ data.tar.gz: 39fc2b3ade4599edaec6282b1db7b45f8cb81817573d7f35e7de1377624b1474
5
5
  SHA512:
6
- metadata.gz: 6750a83429e8004c6c1a46079e349c63b5b14abd6ccc35f33117f74d791030708acd9918fe45f2a78f7da9bb0f07a5f3d2a1cd8990eabceb46541d430ae13719
7
- data.tar.gz: 104ef9be9f7dab34e823f9705595ed4ee411b2ac1ef9a92fd04e4e42861997ccf7d85705765b65c3bad833bb25fa1409fb32354a2d816cd1034f05a94a0e90d1
6
+ metadata.gz: '0978316cfc1c66f2411d1fe00b3c9375a4032b8b6be49d63807fb596bc07f25367fe013e3e5bbba32085e0ebf9a4bfcd977c19c5e20a11c41bf02de0da40bd2a'
7
+ data.tar.gz: 7496829655356548947c2782a024c76370f9d1f74ac6b96b17d2df2c4afd177f5e43be6d0b60b1cee79955e15ba5a387e002c784bcc0dde2ee48b3bae7f61783
@@ -8,6 +8,7 @@ module CanvasSync
8
8
  initializer "canvas_sync.safe_yaml_classes" do |app|
9
9
  app.config.active_record.yaml_column_permitted_classes ||= []
10
10
  app.config.active_record.yaml_column_permitted_classes |= [Symbol, ActiveSupport::HashWithIndifferentAccess]
11
+ ActiveRecord::Base.yaml_column_permitted_classes |= app.config.active_record.yaml_column_permitted_classes
11
12
  rescue
12
13
  end
13
14
 
@@ -40,12 +41,14 @@ module CanvasSync
40
41
 
41
42
  require 'panda_pal'
42
43
 
43
- def canvas_sync_client(account_id = nil)
44
- Bearcat::Client.new(
45
- prefix: current_organization.canvas_url,
46
- token: current_organization.canvas_api_token,
47
- master_rate_limit: (Rails.env.production? && !!defined?(Redis) && ENV['REDIS_URL'].present?),
48
- )
44
+ class ::Object
45
+ def canvas_sync_client(account_id = nil)
46
+ Bearcat::Client.new(
47
+ prefix: current_organization.canvas_url,
48
+ token: current_organization.canvas_api_token,
49
+ master_rate_limit: (Rails.env.production? && !!defined?(Redis) && ENV['REDIS_URL'].present?),
50
+ )
51
+ end
49
52
  end
50
53
  rescue LoadError
51
54
  end
@@ -6,12 +6,16 @@ module CanvasSync
6
6
  def perform(chain_definition, globals = {})
7
7
  @globals = globals
8
8
 
9
+ if globals[:updated_after] == nil && Rails.env.development?
10
+ globals[:updated_after] = false
11
+ end
12
+
9
13
  if globals[:updated_after] == false
10
14
  globals[:updated_after] = nil
11
15
  elsif !globals[:updated_after].present? || globals[:updated_after] == true
12
16
  last_batch = SyncBatch.where(status: 'completed', batch_genre: genre).last
13
17
  globals[:full_sync_every] ||= "sunday/2"
14
- globals[:updated_after] = last_batch&.started_at&.iso8601
18
+ globals[:updated_after] = ((last_batch.started_at - 1.day).iso8601 rescue nil)
15
19
  end
16
20
 
17
21
  # Refuse to run syncs of the same genre if there is a running full sync
@@ -26,7 +26,7 @@ module CanvasSync
26
26
  def download(report_name, report_url)
27
27
  Dir.mktmpdir do |dir|
28
28
  file_path = "#{dir}/#{report_name}"
29
- IO.copy_stream(open(report_url), file_path)
29
+ IO.copy_stream(URI.open(report_url), file_path)
30
30
  yield file_path
31
31
  end
32
32
  end
@@ -35,7 +35,11 @@ module CanvasSync
35
35
 
36
36
  protected
37
37
 
38
- def merge_report_params(options, params={}, term_scope: true)
38
+ # Ruby 3 changed how kwargs are handled. _kw_placeholder allows for backwards compatibility
39
+ # In Ruby 2, merge_report_params(options, params) would parse as merge_report_params(options, params={}, **params) (wtf?), so
40
+ # merge_report_params(options, params, {}) is used. That doesn't work in Ruby 3.
41
+ # In order to maintain compatibility with 2 and with any apps, this oddness is needed
42
+ def merge_report_params(options, params={}, _kw_placeholder=nil, term_scope: true)
39
43
  term_scope = options[:canvas_term_id] || batch_context[:canvas_term_id] if term_scope == true
40
44
  if term_scope.present?
41
45
  params[:enrollment_term_id] = term_scope
@@ -1,3 +1,3 @@
1
1
  module CanvasSync
2
- VERSION = "0.17.41".freeze
2
+ VERSION = "0.17.43".freeze
3
3
  end