Class: AtlasEngine::AddressValidation::Validators::FullAddress::UnmatchedFieldConcernBuilder

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
ConcernFormatter
Defined in:
app/models/atlas_engine/address_validation/validators/full_address/unmatched_field_concern_builder.rb

Constant Summary collapse

COMPONENTS_TO_LABELS =
{
  zip: "ZIP",
  province_code: "state",
  city: "city",
  street: "street name",
}.freeze
SHORTENED_COMPONENT_NAMES =
{
  province_code: :province,
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConcernFormatter

#country_name, #province_name

Constructor Details

#initialize(unmatched_component, matched_components, address, unmatched_field = nil, message_format = MessageFormat::Instructional) ⇒ UnmatchedFieldConcernBuilder

Returns a new instance of UnmatchedFieldConcernBuilder.



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/models/atlas_engine/address_validation/validators/full_address/unmatched_field_concern_builder.rb', line 33

def initialize(
  unmatched_component,
  matched_components,
  address,
  unmatched_field = nil,
  message_format = MessageFormat::Instructional
)
  @address = address
  @unmatched_component = unmatched_component
  @matched_components = matched_components
  @unmatched_field = unmatched_field || unmatched_component
  @message_format = message_format
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



11
12
13
# File 'app/models/atlas_engine/address_validation/validators/full_address/unmatched_field_concern_builder.rb', line 11

def address
  @address
end

#matched_componentsObject (readonly)

Returns the value of attribute matched_components.



11
12
13
# File 'app/models/atlas_engine/address_validation/validators/full_address/unmatched_field_concern_builder.rb', line 11

def matched_components
  @matched_components
end

#message_formatObject (readonly)

Returns the value of attribute message_format.



11
12
13
# File 'app/models/atlas_engine/address_validation/validators/full_address/unmatched_field_concern_builder.rb', line 11

def message_format
  @message_format
end

#unmatched_componentObject (readonly)

Returns the value of attribute unmatched_component.



11
12
13
# File 'app/models/atlas_engine/address_validation/validators/full_address/unmatched_field_concern_builder.rb', line 11

def unmatched_component
  @unmatched_component
end

#unmatched_fieldObject (readonly)

Returns the value of attribute unmatched_field.



11
12
13
# File 'app/models/atlas_engine/address_validation/validators/full_address/unmatched_field_concern_builder.rb', line 11

def unmatched_field
  @unmatched_field
end

Instance Method Details

#build(suggestion_ids = []) ⇒ Object



52
53
54
55
56
57
58
59
60
61
# File 'app/models/atlas_engine/address_validation/validators/full_address/unmatched_field_concern_builder.rb', line 52

def build(suggestion_ids = [])
  Concern.new(
    code: code,
    field_names: field_names,
    message: message,
    type: T.must(Concern::TYPES[:warning]),
    type_level: 3,
    suggestion_ids: suggestion_ids,
  )
end