From adb6cb1e178c16d28e49e448995a39130993e0ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Keskk=C3=BCla?= Date: Mon, 4 Aug 2014 14:49:17 +0300 Subject: [PATCH] Removed unneccessary method from contacts helper --- app/helpers/epp/contacts_helper.rb | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/app/helpers/epp/contacts_helper.rb b/app/helpers/epp/contacts_helper.rb index f5813985c..271b75101 100644 --- a/app/helpers/epp/contacts_helper.rb +++ b/app/helpers/epp/contacts_helper.rb @@ -1,11 +1,13 @@ module Epp::ContactsHelper def create_contact ph = params_hash['epp']['command']['create']['create'] + #todo, remove the first_or_initialize logic, since it's redundant due to + # from EPP api - ph[:ident] ? @contact = Contact.where(ident: ph[:ident]).first_or_initialize : @contact = Contact.new + @contact = Contact.new + @contact = Contact.where(ident: ph[:ident]).first_or_initialize( new_contact_info ) if ph[:ident] - @contact.assign_attributes(new_contact_info ) if @contact.new_record? - @contact.assign_attributes(name_and_ident_type) + @contact.assign_attributes(name: ph[:postalInfo][:name]) @contact.addresses << new_address stamp @contact @@ -69,20 +71,13 @@ module Epp::ContactsHelper ) end - def name_and_ident_type - ph = params_hash['epp']['command']['create']['create'] - { - name: ph[:postalInfo][:name], - ident_type: ident_type - } - end - def new_contact_info ph = params_hash['epp']['command']['create']['create'] { code: ph[:id], phone: ph[:voice], ident: ph[:ident], + ident_type: ident_type, email: ph[:email], org_name: ph[:postalInfo][:org] }