Sha256: 64a7e16c7ee7088b9445a739be102711e192bf3c46903692cc0bd3bf854de9a2

Contents?: true

Size: 1.8 KB

Versions: 5

Compression:

Stored size: 1.8 KB

Contents

# frozen_string_literal: true

module Meibo
  class Profile
    BUILDERS = {
      academic_session: Builder::AcademicSessionBuilder.create(AcademicSession),
      class: Builder::ClassroomBuilder.create(Classroom),
      course: Builder::CourseBuilder.create(Course),
      demographic: Builder::DemographicBuilder.create(Demographic),
      enrollment: Builder::EnrollmentBuilder.create(Enrollment),
      org: Builder::OrganizationBuilder.create(Organization),
      role: Builder::RoleBuilder.create(Role),
      user: Builder::UserBuilder.create(User),
      user_profile: Builder::UserProfileBuilder.create(UserProfile)
    }.freeze

    DATA_MODELS = {
      file_academic_sessions: Meibo::AcademicSession,
      file_classes: Meibo::Classroom,
      file_courses: Meibo::Course,
      file_demographics: Meibo::Demographic,
      file_enrollments: Meibo::Enrollment,
      file_orgs: Meibo::Organization,
      file_roles: Meibo::Role,
      file_user_profiles: Meibo::UserProfile,
      file_users: Meibo::User
    }.freeze

    DATA_SET = {
      academic_sessions: Meibo::AcademicSessionSet,
      classes: Meibo::ClassroomSet,
      courses: Meibo::CourseSet,
      demographics: Meibo::DemographicSet,
      enrollments: Meibo::EnrollmentSet,
      orgs: Meibo::OrganizationSet,
      roles: Meibo::RoleSet,
      user_profiles: Meibo::UserProfileSet,
      users: Meibo::UserSet
    }.freeze

    attr_reader :builders, :data_models, :data_set

    def initialize(builders: BUILDERS, data_models: DATA_MODELS, data_set: DATA_SET)
      @builders = builders
      @data_models = data_models
      @data_set = data_set
    end

    def builder_for(key)
      builders[key]
    end

    def data_model_for(file_attribute)
      data_models[file_attribute]
    end

    def data_set_for(name)
      data_set[name]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
meibo-0.21.0 lib/meibo/profile.rb
meibo-0.20.0 lib/meibo/profile.rb
meibo-0.19.0 lib/meibo/profile.rb
meibo-0.18.0 lib/meibo/profile.rb
meibo-0.17.0 lib/meibo/profile.rb