Sha256: 5456014aec36366093d38c99d960bb03f18b50e33dbfe5e33b666150c47df653
Contents?: true
Size: 1 KB
Versions: 82
Compression:
Stored size: 1 KB
Contents
# <%= autogenerated_model_warning %> class Admin < ApplicationRecord include CanvasSync::Record include CanvasSync::Concerns::ApiSyncable validates :canvas_id, uniqueness: true, presence: true belongs_to :account, primary_key: :canvas_id, foreign_key: :canvas_account_id, optional: true belongs_to :user, primary_key: :canvas_id, foreign_key: :canvas_user_id, optional: true belongs_to :role, primary_key: :canvas_id, foreign_key: :canvas_role_id, optional: true api_syncable({ canvas_id: :id, role_name: :role, canvas_role_id: :role_id, canvas_user_id: ->(r) { r['user']['id'] }, # NOTICE: The :account_id field is added by CanvasSync - it is not included in the Canvas API response canvas_account_id: :account_id, workflow_state: :workflow_state, }, -> (api) { admins = api.account_admins(canvas_account_id).all_pages! admin_data = admins.find{|admin| admin['id'] == canvas_id } raise Footrest::HttpError::NotFound unless admin_data.present? admin_data }) end
Version data entries
82 entries across 82 versions & 1 rubygems