Sha256: 15fce3c63b63535de8686811301ec24ba279ac1edc76c6f5f3595ee45367cee4

Contents?: true

Size: 1.45 KB

Versions: 10

Compression:

Stored size: 1.45 KB

Contents

# frozen_string_literal: true

module Meibo
  class UserM0 < ::Meibo::User
    DataModel.define(
      self,
      attribute_name_to_header_field_map: {
        sourced_id: "sourcedId",
        status: "status",
        date_last_modified: "dateLastModified",
        enabled_user: "enabledUser",
        username: "username",
        user_ids: "userIds",
        given_name: "givenName",
        family_name: "familyName",
        middle_name: "middleName",
        identifier: "identifier",
        email: "email",
        sms: "sms",
        phone: "phone",
        agent_sourced_ids: "agentSourcedIds",
        grades: "grades",
        password: "password",
        user_master_identifier: "userMasterIdentifier",
        resource_sourced_ids: "resourceSourcedIds",
        preferred_given_name: "preferredGivenName",
        preferred_middle_name: "preferredMiddleName",
        preferred_family_name: "preferredFamilyName",
        primary_org_sourced_id: "primaryOrgSourcedId",
        pronouns: "pronouns"
      }.freeze,
      converters: superclass.converters.merge(
        list: %i[user_ids agent_sourced_ids grades resource_sourced_ids].freeze
      )
    )

    # NOTE: enabled_userは必須ではないが固定
    def initialize(resource_sourced_ids: nil, **other_fields)
      super(**other_fields)
      @resource_sourced_ids = resource_sourced_ids
    end

    def home_classroom
      home_class && Meibo.current_roster.classes.find(home_class)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
meibo-0.27.1 lib/meibo/user_m0.rb
meibo-0.27.0 lib/meibo/user_m0.rb
meibo-0.26.0 lib/meibo/user_m0.rb
meibo-0.25.3 lib/meibo/user_m0.rb
meibo-0.25.2 lib/meibo/user_m0.rb
meibo-0.25.1 lib/meibo/user_m0.rb
meibo-0.25.0 lib/meibo/user_m0.rb
meibo-0.24.0 lib/meibo/user_m0.rb
meibo-0.23.0 lib/meibo/user_m0.rb
meibo-0.22.0 lib/meibo/user_m0.rb