From e8ddf2272e5e4ce9ae6ce06abd801b03224a6536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Keskk=C3=BCla?= Date: Wed, 13 Aug 2014 13:35:25 +0300 Subject: [PATCH] Added multiple streets to address --- app/helpers/epp/contacts_helper.rb | 14 +++----------- .../20140813102245_add_streets_to_address.rb | 6 ++++++ db/schema.rb | 4 +++- spec/epp/contact_spec.rb | 9 +++++++-- spec/fabricators/address_fabricator.rb | 1 + 5 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20140813102245_add_streets_to_address.rb diff --git a/app/helpers/epp/contacts_helper.rb b/app/helpers/epp/contacts_helper.rb index 07d43ad7e..ee2afcad4 100644 --- a/app/helpers/epp/contacts_helper.rb +++ b/app/helpers/epp/contacts_helper.rb @@ -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(/(?<=\