Sha256: 7ebc00e177d5e5e15d6a74abcafd2a9d425bdddf4d39e0765c5c38337c5c8b16

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Meibo
  class JapanProfile < ::Meibo::Profile
    class User < ::Meibo::User
      DataModel.define(
        self,
        attribute_name_to_header_field_map: superclass.attribute_name_to_header_field_map.merge(
          kana_given_name: 'metadata.jp.kanaGivenName',
          kana_family_name: 'metadata.jp.kanaFamilyName',
          kana_middle_name: 'metadata.jp.kanaMiddleName',
          home_class: 'metadata.jp.homeClass'
        ).freeze,
        converters: superclass.converters
      )

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
meibo-0.16.0 lib/meibo/japan_profile/user.rb
meibo-0.15.0 lib/meibo/japan_profile/user.rb
meibo-0.14.0 lib/meibo/japan_profile/user.rb
meibo-0.13.0 lib/meibo/japan_profile/user.rb