Sha256: 303510d5099040f8af6bade25940ee8c0ed8256526afd27bdc3e2517b9e3a847

Contents?: true

Size: 604 Bytes

Versions: 5

Compression:

Stored size: 604 Bytes

Contents

module CanvasSync
  module Jobs
    class SyncRolesJob < CanvasSync::Job
      # Syncs Roles using the Canvas API
      #
      #
      # @param job_chain [Hash]
      # @param options [Hash]
      def perform(job_chain, options)
        updated_roles = []
        CanvasSync.get_canvas_sync_client(job_chain[:global_options]).list_roles('self').all_pages!.each do |role_params|
          role = Role.create_or_update(role_params)
          updated_roles.push(role.id)
        end
        Role.where.not(id: updated_roles).delete_all
        CanvasSync.invoke_next(job_chain)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
canvas_sync-0.3.12 lib/canvas_sync/jobs/sync_roles_job.rb
canvas_sync-0.3.11 lib/canvas_sync/jobs/sync_roles_job.rb
canvas_sync-0.3.10 lib/canvas_sync/jobs/sync_roles_job.rb
canvas_sync-0.3.9 lib/canvas_sync/jobs/sync_roles_job.rb
canvas_sync-0.3.8 lib/canvas_sync/jobs/sync_roles_job.rb