meibo 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -4
  3. data/.rubocop_todo.yml +130 -0
  4. data/Gemfile +2 -0
  5. data/Gemfile.lock +11 -2
  6. data/lib/meibo/academic_session.rb +17 -16
  7. data/lib/meibo/builder/academic_session_builder.rb +2 -2
  8. data/lib/meibo/builder/base_builder.rb +3 -2
  9. data/lib/meibo/builder/classroom_builder.rb +3 -3
  10. data/lib/meibo/builder/course_builder.rb +3 -3
  11. data/lib/meibo/builder/demographic_builder.rb +2 -2
  12. data/lib/meibo/builder/enrollment_builder.rb +3 -3
  13. data/lib/meibo/builder/organization_builder.rb +2 -2
  14. data/lib/meibo/builder/role_builder.rb +3 -3
  15. data/lib/meibo/builder/user_builder.rb +2 -2
  16. data/lib/meibo/builder/user_profile_builder.rb +3 -3
  17. data/lib/meibo/builder.rb +3 -2
  18. data/lib/meibo/classroom.rb +27 -28
  19. data/lib/meibo/classroom_set.rb +1 -3
  20. data/lib/meibo/converter.rb +29 -31
  21. data/lib/meibo/course.rb +15 -16
  22. data/lib/meibo/course_set.rb +1 -3
  23. data/lib/meibo/data_model.rb +6 -9
  24. data/lib/meibo/data_set.rb +17 -8
  25. data/lib/meibo/demographic.rb +30 -29
  26. data/lib/meibo/enrollment.rb +18 -17
  27. data/lib/meibo/factory_bot/academic_session.rb +3 -3
  28. data/lib/meibo/factory_bot/all.rb +11 -11
  29. data/lib/meibo/factory_bot/classroom.rb +4 -4
  30. data/lib/meibo/factory_bot/course.rb +4 -4
  31. data/lib/meibo/factory_bot/demographic.rb +3 -3
  32. data/lib/meibo/factory_bot/enrollment.rb +3 -3
  33. data/lib/meibo/factory_bot/manifest.rb +2 -2
  34. data/lib/meibo/factory_bot/organization.rb +15 -12
  35. data/lib/meibo/factory_bot/role.rb +3 -3
  36. data/lib/meibo/factory_bot/roster.rb +2 -2
  37. data/lib/meibo/factory_bot/user.rb +6 -6
  38. data/lib/meibo/factory_bot/user_profile.rb +7 -7
  39. data/lib/meibo/japan_profile/academic_session.rb +4 -2
  40. data/lib/meibo/japan_profile/classroom.rb +1 -1
  41. data/lib/meibo/japan_profile/course.rb +2 -2
  42. data/lib/meibo/japan_profile/enrollment.rb +9 -8
  43. data/lib/meibo/japan_profile/organization.rb +2 -2
  44. data/lib/meibo/japan_profile/role.rb +3 -3
  45. data/lib/meibo/japan_profile/user.rb +6 -5
  46. data/lib/meibo/japan_profile/user_set.rb +1 -3
  47. data/lib/meibo/japan_profile.rb +2 -2
  48. data/lib/meibo/manifest/processing_mode.rb +6 -5
  49. data/lib/meibo/manifest.rb +47 -41
  50. data/lib/meibo/organization.rb +16 -15
  51. data/lib/meibo/profile.rb +3 -3
  52. data/lib/meibo/reader.rb +11 -7
  53. data/lib/meibo/role.rb +28 -27
  54. data/lib/meibo/role_set.rb +1 -3
  55. data/lib/meibo/roster.rb +64 -41
  56. data/lib/meibo/user.rb +29 -28
  57. data/lib/meibo/user_profile.rb +14 -13
  58. data/lib/meibo/user_set.rb +1 -3
  59. data/lib/meibo/version.rb +1 -1
  60. data/lib/meibo.rb +2 -2
  61. data/meibo.gemspec +2 -0
  62. metadata +19 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e25f22026f4551e67b4016aad6a5e526e8ccfefe07e860b0f1ec092b6e21dd37
4
- data.tar.gz: 608bd3b794791f86d01a3931ddb17433d26ce7631ac125881b3bb01f14e7958d
3
+ metadata.gz: a5350e34b1f267f232e20b8551f5b34b24977191b4806d081f66934e816ef6a2
4
+ data.tar.gz: 71e84fe449b9b64a78cf53b605633eacc9e0a56ebefe80d844e36741b2a760fe
5
5
  SHA512:
6
- metadata.gz: 0cc22ea80b35a152b99de89bd6452cad6699d950653a8461976f73e0d93f64e4a3974641cf1f12802372e0a8d9f8f31e2b7c7d1c49deddbd03d66eb2006970f4
7
- data.tar.gz: 3f60761df5b94e9dd8f60661b730598b34788c6ff980eb83924bc8c472a9facf890e12d0b08a6d777fdd4184954d023f37fb613b494eee889544664807ada22d
6
+ metadata.gz: 40950b59e99e11e1925afbb8474d5b09b7812619348a216a55639ea960a0fa5cff4c584850395cc5180b0057f65ed02439adeae5d9570b9837037a1cfe04e038
7
+ data.tar.gz: 8fbf1f6b72c2939c0a8ac9cf39fb1094eca8838b09f8024ce4fe4b31d8845c72402d2c871e21eaccf5c4ca615e796fcd7bab41e517061e5edc437e152f5a10b9
data/.rubocop.yml CHANGED
@@ -1,5 +1,12 @@
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-rspec
4
+
5
+ inherit_from: .rubocop_todo.yml
6
+
1
7
  AllCops:
2
- TargetRubyVersion: 2.6
8
+ NewCops: enable
9
+ TargetRubyVersion: 2.7
3
10
 
4
11
  Style/StringLiterals:
5
12
  Enabled: true
@@ -8,6 +15,3 @@ Style/StringLiterals:
8
15
  Style/StringLiteralsInInterpolation:
9
16
  Enabled: true
10
17
  EnforcedStyle: double_quotes
11
-
12
- Layout/LineLength:
13
- Max: 120
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,130 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2022-12-06 10:28:10 UTC using RuboCop version 1.36.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 19
10
+ # Configuration parameters: AllowComments.
11
+ Lint/EmptyInPattern:
12
+ Exclude:
13
+ - 'spec/meibo/reader_spec.rb'
14
+ - 'spec/meibo/roster_spec.rb'
15
+
16
+ # Offense count: 1
17
+ # This cop supports safe autocorrection (--autocorrect).
18
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
19
+ Lint/UnusedMethodArgument:
20
+ Exclude:
21
+ - 'lib/meibo/enrollment.rb'
22
+
23
+ # Offense count: 10
24
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
25
+ Metrics/AbcSize:
26
+ Max: 28
27
+
28
+ # Offense count: 11
29
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, inherit_mode.
30
+ # AllowedMethods: refine
31
+ Metrics/BlockLength:
32
+ Max: 57
33
+
34
+ # Offense count: 4
35
+ # Configuration parameters: CountComments, CountAsOne.
36
+ Metrics/ClassLength:
37
+ Max: 156
38
+
39
+ # Offense count: 1
40
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
41
+ Metrics/CyclomaticComplexity:
42
+ Max: 10
43
+
44
+ # Offense count: 26
45
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
46
+ Metrics/MethodLength:
47
+ Max: 25
48
+
49
+ # Offense count: 1
50
+ # Configuration parameters: CountComments, CountAsOne.
51
+ Metrics/ModuleLength:
52
+ Max: 222
53
+
54
+ # Offense count: 16
55
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
56
+ Metrics/ParameterLists:
57
+ Max: 25
58
+
59
+ # Offense count: 1
60
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
61
+ Metrics/PerceivedComplexity:
62
+ Max: 11
63
+
64
+ # Offense count: 25
65
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
66
+ # AllowedNames: as, at, by, db, id, in, io, ip, of, on, os, pp, to
67
+ Naming/MethodParameterName:
68
+ Exclude:
69
+ - 'lib/meibo/builder.rb'
70
+ - 'lib/meibo/builder/academic_session_builder.rb'
71
+ - 'lib/meibo/builder/classroom_builder.rb'
72
+ - 'lib/meibo/builder/course_builder.rb'
73
+ - 'lib/meibo/builder/demographic_builder.rb'
74
+ - 'lib/meibo/builder/enrollment_builder.rb'
75
+ - 'lib/meibo/builder/organization_builder.rb'
76
+ - 'lib/meibo/builder/role_builder.rb'
77
+ - 'lib/meibo/builder/user_builder.rb'
78
+ - 'lib/meibo/builder/user_profile_builder.rb'
79
+
80
+ # Offense count: 5
81
+ # Configuration parameters: CountAsOne.
82
+ RSpec/ExampleLength:
83
+ Max: 213
84
+
85
+ # Offense count: 1
86
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
87
+ # Include: **/*_spec*rb*, **/spec/**/*
88
+ RSpec/FilePath:
89
+ Exclude:
90
+ - 'spec/meibo/japan_profile_user_set_spec.rb'
91
+
92
+ # Offense count: 2
93
+ RSpec/MultipleExpectations:
94
+ Max: 9
95
+
96
+ # Offense count: 4
97
+ # Configuration parameters: AllowSubject.
98
+ RSpec/MultipleMemoizedHelpers:
99
+ Max: 6
100
+
101
+ # Offense count: 1
102
+ # Configuration parameters: AllowedGroups.
103
+ RSpec/NestedGroups:
104
+ Max: 4
105
+
106
+ # Offense count: 49
107
+ # Configuration parameters: AllowedConstants.
108
+ Style/Documentation:
109
+ Enabled: false
110
+
111
+ # Offense count: 2
112
+ # This cop supports safe autocorrection (--autocorrect).
113
+ # Configuration parameters: EnforcedStyle.
114
+ # SupportedStyles: format, sprintf, percent
115
+ Style/FormatString:
116
+ Exclude:
117
+ - 'lib/meibo/converter.rb'
118
+ - 'lib/meibo/factory_bot/organization.rb'
119
+
120
+ # Offense count: 1
121
+ Style/MultilineBlockChain:
122
+ Exclude:
123
+ - 'lib/meibo/data_set.rb'
124
+
125
+ # Offense count: 12
126
+ # This cop supports safe autocorrection (--autocorrect).
127
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
128
+ # URISchemes: http, https
129
+ Layout/LineLength:
130
+ Max: 454
data/Gemfile CHANGED
@@ -10,6 +10,8 @@ gem "rake", "~> 13.0"
10
10
  gem "rspec", "~> 3.0"
11
11
 
12
12
  gem "rubocop", "~> 1.21"
13
+ gem "rubocop-rake"
14
+ gem "rubocop-rspec"
13
15
 
14
16
  gem "factory_bot"
15
17
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meibo (0.16.0)
4
+ meibo (0.17.0)
5
+ csv (>= 3.1.4)
5
6
  rubyzip
6
7
  zeitwerk
7
8
 
@@ -15,6 +16,7 @@ GEM
15
16
  tzinfo (~> 2.0)
16
17
  ast (2.4.2)
17
18
  concurrent-ruby (1.1.10)
19
+ csv (3.2.5)
18
20
  debug (1.6.3)
19
21
  irb (>= 1.3.6)
20
22
  reline (>= 0.3.1)
@@ -62,14 +64,19 @@ GEM
62
64
  unicode-display_width (>= 1.4.0, < 3.0)
63
65
  rubocop-ast (1.22.0)
64
66
  parser (>= 3.1.1.0)
67
+ rubocop-rake (0.6.0)
68
+ rubocop (~> 1.0)
69
+ rubocop-rspec (2.15.0)
70
+ rubocop (~> 1.33)
65
71
  ruby-progressbar (1.11.0)
66
72
  rubyzip (2.3.2)
67
73
  tzinfo (2.0.5)
68
74
  concurrent-ruby (~> 1.0)
69
75
  unicode-display_width (2.3.0)
70
- zeitwerk (2.6.5)
76
+ zeitwerk (2.6.6)
71
77
 
72
78
  PLATFORMS
79
+ ruby
73
80
  x86_64-linux
74
81
 
75
82
  DEPENDENCIES
@@ -79,6 +86,8 @@ DEPENDENCIES
79
86
  rake (~> 13.0)
80
87
  rspec (~> 3.0)
81
88
  rubocop (~> 1.21)
89
+ rubocop-rake
90
+ rubocop-rspec
82
91
 
83
92
  BUNDLED WITH
84
93
  2.3.7
@@ -3,36 +3,37 @@
3
3
  module Meibo
4
4
  class AcademicSession
5
5
  TYPES = {
6
- grading_period: 'gradingPeriod',
7
- semester: 'semester',
8
- school_year: 'schoolYear',
9
- term: 'term'
6
+ grading_period: "gradingPeriod",
7
+ semester: "semester",
8
+ school_year: "schoolYear",
9
+ term: "term"
10
10
  }.freeze
11
11
 
12
12
  DataModel.define(
13
13
  self,
14
14
  attribute_name_to_header_field_map: {
15
- sourced_id: 'sourcedId',
16
- status: 'status',
17
- date_last_modified: 'dateLastModified',
18
- title: 'title',
19
- type: 'type',
20
- start_date: 'startDate',
21
- end_date: 'endDate',
22
- parent_sourced_id: 'parentSourcedId',
23
- school_year: 'schoolYear'
15
+ sourced_id: "sourcedId",
16
+ status: "status",
17
+ date_last_modified: "dateLastModified",
18
+ title: "title",
19
+ type: "type",
20
+ start_date: "startDate",
21
+ end_date: "endDate",
22
+ parent_sourced_id: "parentSourcedId",
23
+ school_year: "schoolYear"
24
24
  }.freeze,
25
25
  converters: {
26
26
  enum: { type: [*TYPES.values.freeze, ENUM_EXT_PATTERN] }.freeze,
27
- date: [:start_date, :end_date].freeze,
27
+ date: %i[start_date end_date].freeze,
28
28
  datetime: [:date_last_modified].freeze,
29
- required: [:sourced_id, :title, :type, :start_date, :end_date, :school_year].freeze,
29
+ required: %i[sourced_id title type start_date end_date school_year].freeze,
30
30
  status: [:status].freeze,
31
31
  year: [:school_year].freeze
32
32
  }.freeze
33
33
  )
34
34
 
35
- def initialize(sourced_id:, status: nil, date_last_modified: nil, school_year:, title: nil, type:, start_date:, end_date:, parent_sourced_id: nil, **extension_fields)
35
+ def initialize(sourced_id:, school_year:, type:, start_date:, end_date:, status: nil, date_last_modified: nil,
36
+ title: nil, parent_sourced_id: nil, **extension_fields)
36
37
  @sourced_id = sourced_id
37
38
  @status = status
38
39
  @date_last_modified = date_last_modified
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'securerandom'
3
+ require "securerandom"
4
4
 
5
5
  module Meibo
6
6
  class Builder
@@ -8,7 +8,7 @@ module Meibo
8
8
  extend BaseBuilder
9
9
 
10
10
  def self.builder_attribute_names
11
- [:builder, :parent]
11
+ %i[builder parent]
12
12
  end
13
13
 
14
14
  def initialize(builder:, sourced_id: SecureRandom.uuid, parent: nil, **kw)
@@ -1,13 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Meibo
2
4
  class Builder
3
5
  module BaseBuilder
4
6
  def create(klass)
5
7
  builder_klass = Class.new(klass)
6
8
  builder_klass.prepend(self)
7
- builder_klass.attr_reader(*self.builder_attribute_names)
9
+ builder_klass.attr_reader(*builder_attribute_names)
8
10
  builder_klass
9
11
  end
10
12
  end
11
13
  end
12
14
  end
13
-
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'securerandom'
3
+ require "securerandom"
4
4
 
5
5
  module Meibo
6
6
  class Builder
@@ -8,10 +8,10 @@ module Meibo
8
8
  extend BaseBuilder
9
9
 
10
10
  def self.builder_attribute_names
11
- [:builder, :course, :school, :terms]
11
+ %i[builder course school terms]
12
12
  end
13
13
 
14
- def initialize(builder:, sourced_id: SecureRandom.uuid, course:, school:, terms:, **kw)
14
+ def initialize(builder:, course:, school:, terms:, sourced_id: SecureRandom.uuid, **kw)
15
15
  super(
16
16
  sourced_id: sourced_id,
17
17
  course_sourced_id: course.sourced_id,
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'securerandom'
3
+ require "securerandom"
4
4
 
5
5
  module Meibo
6
6
  class Builder
@@ -8,10 +8,10 @@ module Meibo
8
8
  extend BaseBuilder
9
9
 
10
10
  def self.builder_attribute_names
11
- [:builder, :school_year, :organization]
11
+ %i[builder school_year organization]
12
12
  end
13
13
 
14
- def initialize(builder:, sourced_id: SecureRandom.uuid, school_year: nil, organization:, **kw)
14
+ def initialize(builder:, organization:, sourced_id: SecureRandom.uuid, school_year: nil, **kw)
15
15
  super(
16
16
  sourced_id: sourced_id,
17
17
  school_year_sourced_id: school_year&.sourced_id,
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'securerandom'
3
+ require "securerandom"
4
4
 
5
5
  module Meibo
6
6
  class Builder
@@ -8,7 +8,7 @@ module Meibo
8
8
  extend BaseBuilder
9
9
 
10
10
  def self.builder_attribute_names
11
- [:builder, :user]
11
+ %i[builder user]
12
12
  end
13
13
 
14
14
  def initialize(builder:, user:, **kw)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'securerandom'
3
+ require "securerandom"
4
4
 
5
5
  module Meibo
6
6
  class Builder
@@ -8,10 +8,10 @@ module Meibo
8
8
  extend BaseBuilder
9
9
 
10
10
  def self.builder_attribute_names
11
- [:builder, :classroom, :school, :user]
11
+ %i[builder classroom school user]
12
12
  end
13
13
 
14
- def initialize(builder:, sourced_id: SecureRandom.uuid, classroom:, school:, user:, **kw)
14
+ def initialize(builder:, classroom:, school:, user:, sourced_id: SecureRandom.uuid, **kw)
15
15
  super(
16
16
  sourced_id: sourced_id,
17
17
  class_sourced_id: classroom.sourced_id,
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'securerandom'
3
+ require "securerandom"
4
4
 
5
5
  module Meibo
6
6
  class Builder
@@ -8,7 +8,7 @@ module Meibo
8
8
  extend BaseBuilder
9
9
 
10
10
  def self.builder_attribute_names
11
- [:builder, :parent]
11
+ %i[builder parent]
12
12
  end
13
13
 
14
14
  def initialize(builder:, sourced_id: SecureRandom.uuid, parent: nil, **kw)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'securerandom'
3
+ require "securerandom"
4
4
 
5
5
  module Meibo
6
6
  class Builder
@@ -8,10 +8,10 @@ module Meibo
8
8
  extend BaseBuilder
9
9
 
10
10
  def self.builder_attribute_names
11
- [:builder, :user, :organization, :user_profile]
11
+ %i[builder user organization user_profile]
12
12
  end
13
13
 
14
- def initialize(builder:, sourced_id: SecureRandom.uuid, user:, organization:, user_profile: nil, **kw)
14
+ def initialize(builder:, user:, organization:, sourced_id: SecureRandom.uuid, user_profile: nil, **kw)
15
15
  super(
16
16
  sourced_id: sourced_id,
17
17
  user_sourced_id: user.sourced_id,
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'securerandom'
3
+ require "securerandom"
4
4
 
5
5
  module Meibo
6
6
  class Builder
@@ -8,7 +8,7 @@ module Meibo
8
8
  extend BaseBuilder
9
9
 
10
10
  def self.builder_attribute_names
11
- [:builder, :agents, :primary_organization]
11
+ %i[builder agents primary_organization]
12
12
  end
13
13
 
14
14
  def initialize(builder:, sourced_id: SecureRandom.uuid, agents: nil, primary_organization: nil, **kw)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'securerandom'
3
+ require "securerandom"
4
4
 
5
5
  module Meibo
6
6
  class Builder
@@ -8,10 +8,10 @@ module Meibo
8
8
  extend BaseBuilder
9
9
 
10
10
  def self.builder_attribute_names
11
- [:builder, :user]
11
+ %i[builder user]
12
12
  end
13
13
 
14
- def initialize(builder:, sourced_id: SecureRandom.uuid, user:, **kw)
14
+ def initialize(builder:, user:, sourced_id: SecureRandom.uuid, **kw)
15
15
  super(sourced_id: sourced_id, user_sourced_id: user.sourced_id, **kw)
16
16
  @builder = builder
17
17
  @user = user
data/lib/meibo/builder.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'forwardable'
3
+ require "forwardable"
4
4
 
5
5
  module Meibo
6
6
  class Builder
@@ -8,7 +8,8 @@ module Meibo
8
8
 
9
9
  attr_reader :roster, :profile
10
10
 
11
- def_delegators :@roster, :academic_sessions, :classes, :courses, :demographics, :enrollments, :organizations, :roles, :users, :user_profiles
11
+ def_delegators :@roster, :academic_sessions, :classes, :courses, :demographics, :enrollments, :organizations,
12
+ :roles, :users, :user_profiles
12
13
 
13
14
  def initialize(roster:, profile: Meibo.default_profile)
14
15
  @roster = roster
@@ -3,49 +3,48 @@
3
3
  module Meibo
4
4
  class Classroom
5
5
  TYPES = {
6
- homeroom: 'homeroom',
7
- scheduled: 'scheduled'
6
+ homeroom: "homeroom",
7
+ scheduled: "scheduled"
8
8
  }.freeze
9
9
 
10
10
  DataModel.define(
11
11
  self,
12
12
  attribute_name_to_header_field_map: {
13
- sourced_id: 'sourcedId',
14
- status: 'status',
15
- date_last_modified: 'dateLastModified',
16
- title: 'title',
17
- grades: 'grades',
18
- course_sourced_id: 'courseSourcedId',
19
- class_code: 'classCode',
20
- class_type: 'classType',
21
- location: 'location',
22
- school_sourced_id: 'schoolSourcedId',
23
- term_sourced_ids: 'termSourcedIds',
24
- subjects: 'subjects',
25
- subject_codes: 'subjectCodes',
26
- periods: 'periods'
13
+ sourced_id: "sourcedId",
14
+ status: "status",
15
+ date_last_modified: "dateLastModified",
16
+ title: "title",
17
+ grades: "grades",
18
+ course_sourced_id: "courseSourcedId",
19
+ class_code: "classCode",
20
+ class_type: "classType",
21
+ location: "location",
22
+ school_sourced_id: "schoolSourcedId",
23
+ term_sourced_ids: "termSourcedIds",
24
+ subjects: "subjects",
25
+ subject_codes: "subjectCodes",
26
+ periods: "periods"
27
27
  }.freeze,
28
28
  converters: {
29
29
  datetime: [:date_last_modified].freeze,
30
30
  enum: {
31
31
  class_type: [*TYPES.values, ENUM_EXT_PATTERN].freeze
32
32
  }.freeze,
33
- list: [
34
- :grades,
35
- :term_sourced_ids,
36
- :subjects,
37
- :subject_codes,
38
- :periods
33
+ list: %i[
34
+ grades
35
+ term_sourced_ids
36
+ subjects
37
+ subject_codes
38
+ periods
39
39
  ].freeze,
40
- required: [:sourced_id, :title, :class_type, :course_sourced_id, :term_sourced_ids, :school_sourced_id].freeze,
40
+ required: %i[sourced_id title class_type course_sourced_id term_sourced_ids school_sourced_id].freeze,
41
41
  status: [:status].freeze
42
42
  }
43
43
  )
44
44
 
45
- def initialize(sourced_id:, status: nil, date_last_modified: nil, title:, grades: [], course_sourced_id:, class_code: nil, class_type:, location: nil, school_sourced_id:, term_sourced_ids:, subjects: [], subject_codes: [], periods: [], **extension_fields)
46
- unless subjects.is_a?(Array) && subject_codes.is_a?(Array) && subjects.size == subject_codes.size
47
- raise InvalidDataTypeError
48
- end
45
+ def initialize(sourced_id:, title:, course_sourced_id:, class_type:, school_sourced_id:, term_sourced_ids:, status: nil, date_last_modified: nil, grades: [],
46
+ class_code: nil, location: nil, subjects: [], subject_codes: [], periods: [], **extension_fields)
47
+ raise InvalidDataTypeError unless subjects.is_a?(Array) && subject_codes.is_a?(Array) && subjects.size == subject_codes.size
49
48
 
50
49
  @sourced_id = sourced_id
51
50
  @status = status
@@ -85,7 +84,7 @@ module Meibo
85
84
  end
86
85
 
87
86
  def terms
88
- term_sourced_ids.map {|term_sourced_id| Meibo.current_roster.academic_sessions.find(term_sourced_id) }
87
+ term_sourced_ids.map { |term_sourced_id| Meibo.current_roster.academic_sessions.find(term_sourced_id) }
89
88
  end
90
89
 
91
90
  def enrollments
@@ -9,9 +9,7 @@ module Meibo
9
9
  roster.organizations.find(classroom.school_sourced_id)
10
10
  roster.courses.find(classroom.course_sourced_id)
11
11
 
12
- if classroom.term_sourced_ids.empty?
13
- raise DataNotFoundError, "termSourcedIdは1つ以上指定してください"
14
- end
12
+ raise DataNotFoundError, "termSourcedIdは1つ以上指定してください" if classroom.term_sourced_ids.empty?
15
13
 
16
14
  classroom.term_sourced_ids.each do |term_sourced_id|
17
15
  roster.academic_sessions.find(term_sourced_id)