Class: AtlasEngine::AddressImporter::Validation::FieldValidations::Province

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Includes:
Interface
Defined in:
app/models/atlas_engine/address_importer/validation/field_validations/province.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address:, allow_partial_zip: false) ⇒ Province

Returns a new instance of Province.



29
30
31
32
33
# File 'app/models/atlas_engine/address_importer/validation/field_validations/province.rb', line 29

def initialize(address:, allow_partial_zip: false)
  @country_code = address.country_code
  @province_code = address.province_code
  @errors = []
end

Instance Attribute Details

#country_codeObject (readonly)

Returns the value of attribute country_code.



15
16
17
# File 'app/models/atlas_engine/address_importer/validation/field_validations/province.rb', line 15

def country_code
  @country_code
end

#errorsObject (readonly)

Returns the value of attribute errors.



21
22
23
# File 'app/models/atlas_engine/address_importer/validation/field_validations/province.rb', line 21

def errors
  @errors
end

#province_codeObject (readonly)

Returns the value of attribute province_code.



18
19
20
# File 'app/models/atlas_engine/address_importer/validation/field_validations/province.rb', line 18

def province_code
  @province_code
end

Instance Method Details

#validation_errorsObject



36
37
38
39
40
# File 'app/models/atlas_engine/address_importer/validation/field_validations/province.rb', line 36

def validation_errors
  validate_country
  validate_province if errors.empty?
  errors
end