Class: AtlasEngine::AddressValidation::Concern

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
app/models/atlas_engine/address_validation/concern.rb

Constant Summary collapse

TYPES =
T.let(
  {
    warning: "warning",
    error: "error",
  }.freeze,
  T::Hash[Symbol, String],
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, message:, type:, type_level:, suggestion_ids:, field_names:, suggestion: nil) ⇒ Concern

Returns a new instance of Concern.



51
52
53
54
55
56
57
58
59
# File 'app/models/atlas_engine/address_validation/concern.rb', line 51

def initialize(code:, message:, type:, type_level:, suggestion_ids:, field_names:, suggestion: nil)
  @code = code
  @type = type
  @type_level = type_level
  @suggestion_ids = suggestion_ids
  @field_names = field_names
  @message = message
  @suggestion = T.let(suggestion, T.nilable(Suggestion))
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



18
19
20
# File 'app/models/atlas_engine/address_validation/concern.rb', line 18

def code
  @code
end

#field_namesObject (readonly)

Returns the value of attribute field_names.



33
34
35
# File 'app/models/atlas_engine/address_validation/concern.rb', line 33

def field_names
  @field_names
end

#messageObject (readonly)

Returns the value of attribute message.



21
22
23
# File 'app/models/atlas_engine/address_validation/concern.rb', line 21

def message
  @message
end

#suggestionObject (readonly)

Returns the value of attribute suggestion.



36
37
38
# File 'app/models/atlas_engine/address_validation/concern.rb', line 36

def suggestion
  @suggestion
end

#suggestion_idsObject (readonly)

Returns the value of attribute suggestion_ids.



30
31
32
# File 'app/models/atlas_engine/address_validation/concern.rb', line 30

def suggestion_ids
  @suggestion_ids
end

#typeObject (readonly)

Returns the value of attribute type.



24
25
26
# File 'app/models/atlas_engine/address_validation/concern.rb', line 24

def type
  @type
end

#type_levelObject (readonly)

Returns the value of attribute type_level.



27
28
29
# File 'app/models/atlas_engine/address_validation/concern.rb', line 27

def type_level
  @type_level
end

Instance Method Details

#attributesObject



62
63
64
65
66
67
68
69
70
71
# File 'app/models/atlas_engine/address_validation/concern.rb', line 62

def attributes
  {
    field_names: field_names,
    message: message,
    code: code,
    type: type,
    type_level: type_level,
    suggestion_ids: suggestion_ids,
  }
end