Class: AtlasEngine::AddressValidation::Es::Validators::FullAddress
- Inherits:
-
FullAddressValidatorBase
- Object
- FullAddressValidatorBase
- AtlasEngine::AddressValidation::Es::Validators::FullAddress
- Includes:
- LogHelper
- Defined in:
- app/models/atlas_engine/address_validation/es/validators/full_address.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#message_format ⇒ Object
readonly
Returns the value of attribute message_format.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #build_candidate_result ⇒ Object
-
#initialize(address:, result: Result.new, message_format: MessageFormat::Instructional) ⇒ FullAddress
constructor
A new instance of FullAddress.
- #validate ⇒ Object
Methods included from LogHelper
#log_error, #log_info, #log_warn
Constructor Details
#initialize(address:, result: Result.new, message_format: MessageFormat::Instructional) ⇒ FullAddress
Returns a new instance of FullAddress.
14 15 16 17 18 |
# File 'app/models/atlas_engine/address_validation/es/validators/full_address.rb', line 14 def initialize(address:, result: Result.new, message_format: MessageFormat::Instructional) super @matching_strategy = MatchingStrategies::Es @message_format = end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
11 12 13 |
# File 'app/models/atlas_engine/address_validation/es/validators/full_address.rb', line 11 def address @address end |
#message_format ⇒ Object (readonly)
Returns the value of attribute message_format.
11 12 13 |
# File 'app/models/atlas_engine/address_validation/es/validators/full_address.rb', line 11 def @message_format end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
11 12 13 |
# File 'app/models/atlas_engine/address_validation/es/validators/full_address.rb', line 11 def result @result end |
Instance Method Details
#build_candidate_result ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/models/atlas_engine/address_validation/es/validators/full_address.rb', line 31 def build_candidate_result unless supported_address?(address) return AddressValidation::Validators::FullAddress::UnsupportedScriptResult.new( address:, result:, message_format:, ) end if best_candidate.nil? AddressValidation::Validators::FullAddress::NoCandidateResult.new( address:, result:, message_format:, ) else AddressValidation::Validators::FullAddress::CandidateResult.new( address_comparison: T.must(best_candidate), matching_strategy: @matching_strategy, result: result, message_format:, ) end end |
#validate ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/models/atlas_engine/address_validation/es/validators/full_address.rb', line 21 def validate return result if concerns_preclude_validation candidate_result = build_candidate_result candidate_result.update_result publish_notification(candidate_result: candidate_result) result end |