Contact creation improvements

This commit is contained in:
Martin Lensment 2014-07-02 18:11:03 +03:00
parent acb65c47d6
commit 6a456240fa
7 changed files with 39 additions and 7 deletions

View file

@ -1,5 +1,22 @@
module Epp::ContactsHelper
def create_contact
cp = Hash.from_xml(parsed_frame.css("epp command create create").to_xml).with_indifferent_access
ph = get_params_hash('epp command create create')[:create]
@contact = Contact.new(
code: ph[:id],
name: ph[:postalInfo][:name],
phone: ph[:voice],
email: ph[:email],
reg_no: ph[:ident]
)
@contact.addresses << Address.new(
country_id: Country.find_by(iso: ph[:postalInfo][:cc]),
street: ph[:postalInfo][:street],
zip: ph[:postalInfo][:pc]
)
@contact.save
render '/epp/contacts/create'
end
end