Class: AtlasEngine::AddressImporter::Validation::Wrapper
- Inherits:
-
Object
- Object
- AtlasEngine::AddressImporter::Validation::Wrapper
- Extended by:
- T::Sig
- Includes:
- ImportLogHelper, Validator
- Defined in:
- app/models/atlas_engine/address_importer/validation/wrapper.rb
Defined Under Namespace
Classes: AddressStruct
Constant Summary
Constants included from ImportLogHelper
ImportLogHelper::TEST_TIMESTAMP
Instance Attribute Summary collapse
-
#country_import ⇒ Object
readonly
Returns the value of attribute country_import.
-
#validator ⇒ Object
readonly
Returns the value of attribute validator.
Instance Method Summary collapse
-
#initialize(country_import:, validator: nil, log_invalid_records: true) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #valid?(address) ⇒ Boolean
Methods included from ImportLogHelper
#import_log_error, #import_log_info
Methods included from LogHelper
#log_error, #log_info, #log_warn
Constructor Details
#initialize(country_import:, validator: nil, log_invalid_records: true) ⇒ Wrapper
Returns a new instance of Wrapper.
24 25 26 27 28 |
# File 'app/models/atlas_engine/address_importer/validation/wrapper.rb', line 24 def initialize(country_import:, validator: nil, log_invalid_records: true) @country_import = country_import @validator = validator || DefaultValidator.new(country_code: country_import.country_code) @log_invalid_records = log_invalid_records end |
Instance Attribute Details
#country_import ⇒ Object (readonly)
Returns the value of attribute country_import.
13 14 15 |
# File 'app/models/atlas_engine/address_importer/validation/wrapper.rb', line 13 def country_import @country_import end |
#validator ⇒ Object (readonly)
Returns the value of attribute validator.
13 14 15 |
# File 'app/models/atlas_engine/address_importer/validation/wrapper.rb', line 13 def validator @validator end |
Instance Method Details
#valid?(address) ⇒ Boolean
31 32 33 34 35 36 37 38 39 40 |
# File 'app/models/atlas_engine/address_importer/validation/wrapper.rb', line 31 def valid?(address) return false unless address errors = validation_errors(address) return true if errors.empty? log_invalid_address(address, errors) if @log_invalid_records false end |