Added multiple streets to address

This commit is contained in:
Andres Keskküla 2014-08-13 13:35:25 +03:00
parent dc2ec5535f
commit e8ddf2272e
5 changed files with 20 additions and 14 deletions

View file

@ -120,7 +120,9 @@ module Epp::ContactsHelper
contact_hash = contact_hash.merge({
address_attributes: {
country_id: Country.find_by(iso: ph[:postalInfo][:addr][:cc]),
street: tidy_street,
street: ph[:postalInfo][:addr][:street][0],
street2: ph[:postalInfo][:addr][:street][1],
street3: ph[:postalInfo][:addr][:street][2],
zip: ph[:postalInfo][:addr][:pc]
}
}) if ph[:postalInfo].is_a?(Hash) && ph[:postalInfo][:addr].is_a?(Hash)
@ -135,16 +137,6 @@ module Epp::ContactsHelper
return false
end
def tidy_street
command = params[:command]
street = params_hash['epp']['command'][command][command][:postalInfo][:addr][:street]
return street if street.is_a? String
return street.join(',') if street.is_a? Array
return nil
rescue NoMethodError => e #refactor so wouldn't use rescue for flow control
return nil
end
def ident_type
result = params[:frame].slice(/(?<=\<ns2:ident type=)(.*)(?=<)/)