meibo 0.25.2 → 0.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +1 -1
- data/Gemfile.lock +1 -1
- data/lib/meibo/classroom_set.rb +3 -1
- data/lib/meibo/converter.rb +27 -4
- data/lib/meibo/course_set.rb +5 -1
- data/lib/meibo/enrollment.rb +1 -0
- data/lib/meibo/enrollment_set.rb +4 -1
- data/lib/meibo/eportal_v3/classroom.rb +15 -0
- data/lib/meibo/eportal_v3/course.rb +15 -0
- data/lib/meibo/eportal_v3/enrollment.rb +15 -0
- data/lib/meibo/eportal_v3/organization.rb +15 -0
- data/lib/meibo/eportal_v3/user.rb +16 -0
- data/lib/meibo/eportal_v3/user_profile.rb +15 -0
- data/lib/meibo/factory_bot/organization.rb +1 -0
- data/lib/meibo/japan_profile/academic_session.rb +1 -0
- data/lib/meibo/japan_profile/organization_set.rb +17 -0
- data/lib/meibo/japan_profile/user.rb +3 -1
- data/lib/meibo/profiles.rb +22 -0
- data/lib/meibo/user_set.rb +2 -0
- data/lib/meibo/version.rb +1 -1
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eba37b50b98d947b9bdc5912ae9f25ea71f57e81797f8b08756f031935cc62bd
|
4
|
+
data.tar.gz: d97317ead377eba9e18eb7df2876e7f132cdf09f1bae4a931047dd980b9ce6f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 721e920151cf6ad03d369f77320abd9ba98822cc1e614259432422a323fd3af59104f0e9b20f9162f9cbe525a1f95d1d3efe75383294013ed7fcdad16a34ed33
|
7
|
+
data.tar.gz: 46e733cf816e857a8fe8804801d7253f84c9bc9a8d4d59d876ec9fb216989712ff430a0d2995d8eacf1b83206fc8a4fab4d6d043f4c8fbb1aaac44ba6ee18399
|
data/.rubocop_todo.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/meibo/classroom_set.rb
CHANGED
@@ -6,7 +6,9 @@ module Meibo
|
|
6
6
|
super
|
7
7
|
|
8
8
|
each do |classroom|
|
9
|
-
roster.organizations.find(classroom.school_sourced_id)
|
9
|
+
school = roster.organizations.find(classroom.school_sourced_id)
|
10
|
+
raise InvalidDataTypeError unless school.school?
|
11
|
+
|
10
12
|
roster.courses.find(classroom.course_sourced_id)
|
11
13
|
|
12
14
|
raise DataNotFoundError, "termSourcedIdは1つ以上指定してください" if classroom.term_sourced_ids.empty?
|
data/lib/meibo/converter.rb
CHANGED
@@ -13,6 +13,8 @@ module Meibo
|
|
13
13
|
date
|
14
14
|
datetime
|
15
15
|
enum
|
16
|
+
format
|
17
|
+
fullwidth
|
16
18
|
mext_grade_code
|
17
19
|
integer
|
18
20
|
status
|
@@ -43,9 +45,9 @@ module Meibo
|
|
43
45
|
fields_to_be_converted = converters[converter_type]
|
44
46
|
method_name = "build_#{converter_type}_field_#{write_or_parser}_converter"
|
45
47
|
if fields_to_be_converted && respond_to?(method_name, true)
|
46
|
-
if converter_type
|
47
|
-
|
48
|
-
send(method_name,
|
48
|
+
if %i[enum format].include?(converter_type)
|
49
|
+
definition = fields_to_be_converted.transform_keys { |field| fields.index(field) }
|
50
|
+
send(method_name, definition)
|
49
51
|
else
|
50
52
|
indexes = fields_to_be_converted.map { |field| fields.index(field) }
|
51
53
|
send(method_name, indexes)
|
@@ -146,7 +148,28 @@ module Meibo
|
|
146
148
|
return field unless field
|
147
149
|
|
148
150
|
enum = enum_definition[field_info.index]
|
149
|
-
raise InvalidDataTypeError if enum&.none? { |
|
151
|
+
raise InvalidDataTypeError if enum&.none? { |pat| pat.is_a?(String) ? field == pat : field.match?(pat) }
|
152
|
+
|
153
|
+
field
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def build_format_field_parser_converter(format_definition)
|
158
|
+
format_definition = format_definition.dup.freeze
|
159
|
+
lambda do |field, field_info|
|
160
|
+
return field unless field
|
161
|
+
|
162
|
+
format = format_definition[field_info.index]
|
163
|
+
raise InvalidDataTypeError if format && !field.match?(format)
|
164
|
+
|
165
|
+
field
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def build_fullwidth_field_parser_converter(fullwidth_field_indexes)
|
170
|
+
fullwidth_field_indexes = fullwidth_field_indexes.dup.freeze
|
171
|
+
lambda do |field, field_info|
|
172
|
+
raise InvalidDataTypeError if field && fullwidth_field_indexes.include?(field_info.index) && field.match?(/[\p{In_Halfwidth_and_Fullwidth_Forms}&&\p{Katakana}]/)
|
150
173
|
|
151
174
|
field
|
152
175
|
end
|
data/lib/meibo/course_set.rb
CHANGED
@@ -6,7 +6,11 @@ module Meibo
|
|
6
6
|
super
|
7
7
|
|
8
8
|
each do |course|
|
9
|
-
|
9
|
+
if course.school_year_sourced_id
|
10
|
+
school_year = roster.academic_sessions.find(course.school_year_sourced_id)
|
11
|
+
|
12
|
+
raise InvalidDataTypeError unless school_year.school_year?
|
13
|
+
end
|
10
14
|
|
11
15
|
roster.organizations.find(course.org_sourced_id)
|
12
16
|
end
|
data/lib/meibo/enrollment.rb
CHANGED
data/lib/meibo/enrollment_set.rb
CHANGED
@@ -7,8 +7,11 @@ module Meibo
|
|
7
7
|
|
8
8
|
each do |enrollment|
|
9
9
|
roster.classes.find(enrollment.class_sourced_id)
|
10
|
-
roster.organizations.find(enrollment.school_sourced_id)
|
10
|
+
school = roster.organizations.find(enrollment.school_sourced_id)
|
11
|
+
raise InvalidDataTypeError unless school.school?
|
12
|
+
|
11
13
|
roster.users.find(enrollment.user_sourced_id)
|
14
|
+
raise InvalidDataTypeError if enrollment.primary && !enrollment.teacher?
|
12
15
|
end
|
13
16
|
end
|
14
17
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Meibo
|
4
|
+
module EportalV3
|
5
|
+
class Classroom < ::Meibo::JapanProfile::Classroom
|
6
|
+
DataModel.define(
|
7
|
+
self,
|
8
|
+
attribute_name_to_header_field_map: superclass.attribute_name_to_header_field_map,
|
9
|
+
converters: superclass.converters.merge(
|
10
|
+
fullwidth: %i[title location].freeze
|
11
|
+
).freeze
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Meibo
|
4
|
+
module EportalV3
|
5
|
+
class Course < ::Meibo::JapanProfile::Course
|
6
|
+
DataModel.define(
|
7
|
+
self,
|
8
|
+
attribute_name_to_header_field_map: superclass.attribute_name_to_header_field_map,
|
9
|
+
converters: superclass.converters.merge(
|
10
|
+
fullwidth: %i[title].freeze
|
11
|
+
).freeze
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Meibo
|
4
|
+
module EportalV3
|
5
|
+
class Enrollment < ::Meibo::JapanProfile::Enrollment
|
6
|
+
DataModel.define(
|
7
|
+
self,
|
8
|
+
attribute_name_to_header_field_map: superclass.attribute_name_to_header_field_map,
|
9
|
+
converters: superclass.converters.merge(
|
10
|
+
required: [*superclass.converters[:required], :primary].freeze
|
11
|
+
).freeze
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Meibo
|
4
|
+
module EportalV3
|
5
|
+
class Organization < ::Meibo::JapanProfile::Organization
|
6
|
+
DataModel.define(
|
7
|
+
self,
|
8
|
+
attribute_name_to_header_field_map: superclass.attribute_name_to_header_field_map,
|
9
|
+
converters: superclass.converters.merge(
|
10
|
+
fullwidth: %i[name].freeze
|
11
|
+
).freeze
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Meibo
|
4
|
+
module EportalV3
|
5
|
+
class User < ::Meibo::JapanProfile::UserM0
|
6
|
+
DataModel.define(
|
7
|
+
self,
|
8
|
+
attribute_name_to_header_field_map: superclass.attribute_name_to_header_field_map,
|
9
|
+
converters: superclass.converters.merge(
|
10
|
+
fullwidth: %i[given_name family_name middle_name preferred_given_name preferred_middle_name preferred_family_name kana_given_name kana_family_name kana_middle_name].freeze,
|
11
|
+
required: [*superclass.converters[:required], :user_master_identifier, :preferred_given_name, :preferred_family_name, :kana_given_name, :kana_family_name].freeze
|
12
|
+
).freeze
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Meibo
|
4
|
+
module EportalV3
|
5
|
+
class UserProfile < ::Meibo::UserProfile
|
6
|
+
DataModel.define(
|
7
|
+
self,
|
8
|
+
attribute_name_to_header_field_map: superclass.attribute_name_to_header_field_map,
|
9
|
+
converters: superclass.converters.merge(
|
10
|
+
fullwidth: %i[description].freeze
|
11
|
+
).freeze
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Meibo
|
4
|
+
module JapanProfile
|
5
|
+
class OrganizationSet < ::Meibo::OrganizationSet
|
6
|
+
def check_semantically_consistent
|
7
|
+
super
|
8
|
+
|
9
|
+
each do |organization|
|
10
|
+
next unless organization.parent_sourced_id
|
11
|
+
|
12
|
+
raise InvalidDataTypeError if organization.district?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -13,7 +13,9 @@ module Meibo
|
|
13
13
|
kana_middle_name: "metadata.jp.kanaMiddleName",
|
14
14
|
home_class: "metadata.jp.homeClass"
|
15
15
|
).freeze,
|
16
|
-
converters: klass.superclass.converters
|
16
|
+
converters: klass.superclass.converters.merge(
|
17
|
+
mext_grade_code: [:grades].freeze
|
18
|
+
)
|
17
19
|
)
|
18
20
|
end
|
19
21
|
end
|
data/lib/meibo/profiles.rb
CHANGED
@@ -68,6 +68,7 @@ module Meibo
|
|
68
68
|
file_users: JapanProfile::User
|
69
69
|
),
|
70
70
|
data_set: profile121.data_set.merge(
|
71
|
+
orgs: JapanProfile::OrganizationSet,
|
71
72
|
users: JapanProfile::UserSet
|
72
73
|
)
|
73
74
|
)
|
@@ -92,10 +93,31 @@ module Meibo
|
|
92
93
|
data_set: japan_profile120_v11.data_set
|
93
94
|
)
|
94
95
|
|
96
|
+
eportal_v3 = Profile.new(
|
97
|
+
builders: japan_profile120_v11.builders.merge(
|
98
|
+
class: Builder::ClassroomBuilder.create(EportalV3::Classroom),
|
99
|
+
course: Builder::CourseBuilder.create(EportalV3::Course),
|
100
|
+
enrollment: Builder::EnrollmentBuilder.create(EportalV3::Enrollment),
|
101
|
+
organization: Builder::OrganizationBuilder.create(EportalV3::Organization),
|
102
|
+
user_profile: Builder::UserProfileBuilder.create(EportalV3::UserProfile),
|
103
|
+
user: Builder::UserBuilder.create(EportalV3::User)
|
104
|
+
),
|
105
|
+
data_models: japan_profile120_v11.data_models.merge(
|
106
|
+
file_classes: EportalV3::Classroom,
|
107
|
+
file_courses: EportalV3::Course,
|
108
|
+
file_enrollments: EportalV3::Enrollment,
|
109
|
+
file_orgs: EportalV3::Organization,
|
110
|
+
file_user_profiles: EportalV3::UserProfile,
|
111
|
+
file_users: EportalV3::User
|
112
|
+
),
|
113
|
+
data_set: japan_profile120_v11.data_set
|
114
|
+
)
|
115
|
+
|
95
116
|
PROFILES = {
|
96
117
|
"v1.2" => profile121,
|
97
118
|
"v1.2.1" => profile121,
|
98
119
|
"v1.2.0" => profile120,
|
120
|
+
"v1.2.0 ep v3.00" => eportal_v3,
|
99
121
|
"v1.2.0 jp v1.0" => japan_profile120_v10,
|
100
122
|
"v1.2.0 jp v1.1" => japan_profile120_v11,
|
101
123
|
"v1.2.1 jp v1.1" => japan_profile121_v11
|
data/lib/meibo/user_set.rb
CHANGED
@@ -5,6 +5,8 @@ module Meibo
|
|
5
5
|
def check_semantically_consistent
|
6
6
|
super
|
7
7
|
|
8
|
+
raise Error, "userMasterIdentifier\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059" if @data.filter_map(&:user_master_identifier).tally.values.any? { |v| v > 1 }
|
9
|
+
|
8
10
|
each do |user|
|
9
11
|
roster.organizations.find(user.primary_org_sourced_id) if user.primary_org_sourced_id
|
10
12
|
|
data/lib/meibo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meibo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seiei Miyagi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: csv
|
@@ -94,6 +94,12 @@ files:
|
|
94
94
|
- lib/meibo/demographic_set.rb
|
95
95
|
- lib/meibo/enrollment.rb
|
96
96
|
- lib/meibo/enrollment_set.rb
|
97
|
+
- lib/meibo/eportal_v3/classroom.rb
|
98
|
+
- lib/meibo/eportal_v3/course.rb
|
99
|
+
- lib/meibo/eportal_v3/enrollment.rb
|
100
|
+
- lib/meibo/eportal_v3/organization.rb
|
101
|
+
- lib/meibo/eportal_v3/user.rb
|
102
|
+
- lib/meibo/eportal_v3/user_profile.rb
|
97
103
|
- lib/meibo/errors.rb
|
98
104
|
- lib/meibo/factory_bot/academic_session.rb
|
99
105
|
- lib/meibo/factory_bot/all.rb
|
@@ -113,6 +119,7 @@ files:
|
|
113
119
|
- lib/meibo/japan_profile/demographic.rb
|
114
120
|
- lib/meibo/japan_profile/enrollment.rb
|
115
121
|
- lib/meibo/japan_profile/organization.rb
|
122
|
+
- lib/meibo/japan_profile/organization_set.rb
|
116
123
|
- lib/meibo/japan_profile/role_jp_m0.rb
|
117
124
|
- lib/meibo/japan_profile/user.rb
|
118
125
|
- lib/meibo/japan_profile/user_m0.rb
|
@@ -142,7 +149,7 @@ metadata:
|
|
142
149
|
allowed_push_host: https://rubygems.org/
|
143
150
|
homepage_uri: https://github.com/hanachin/meibo
|
144
151
|
source_code_uri: https://github.com/hanachin/meibo
|
145
|
-
changelog_uri: https://github.com/hanachin/meibo/blob/meibo/v0.
|
152
|
+
changelog_uri: https://github.com/hanachin/meibo/blob/meibo/v0.26.0/CHANGELOG.md
|
146
153
|
rubygems_mfa_required: 'true'
|
147
154
|
post_install_message:
|
148
155
|
rdoc_options: []
|