Method: AtlasEngine::CountryRepository#initialize

Defined in:
app/models/atlas_engine/country_repository.rb

#initialize(country_code:, repository_class:, locale: nil, index_configuration: nil) ⇒ CountryRepository



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/models/atlas_engine/country_repository.rb', line 29

def initialize(country_code:, repository_class:, locale: nil, index_configuration: nil)
  @country_code = T.let(country_code.to_s.downcase, String)
  @country_profile = T.let(CountryProfile.for(@country_code, locale), CountryProfile)

  @repository = T.let(
    repository_class.new(
      index_base_name: index_name(country_code: @country_code, locale: locale),
      index_mappings: index_configuration.present? ? index_configuration["mappings"] : {},
      index_settings: index_configuration.present? ? index_configuration["settings"] : {},
      mapper_callable: mapper_callable,
    ),
    Elasticsearch::RepositoryInterface,
  )
end