mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Removed unneccessary method from contacts helper
This commit is contained in:
parent
2a6a30c2b2
commit
adb6cb1e17
1 changed files with 6 additions and 11 deletions
|
@ -1,11 +1,13 @@
|
||||||
module Epp::ContactsHelper
|
module Epp::ContactsHelper
|
||||||
def create_contact
|
def create_contact
|
||||||
ph = params_hash['epp']['command']['create']['create']
|
ph = params_hash['epp']['command']['create']['create']
|
||||||
|
#todo, remove the first_or_initialize logic, since it's redundant due to
|
||||||
|
#<contact:id> 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: ph[:postalInfo][:name])
|
||||||
@contact.assign_attributes(name_and_ident_type)
|
|
||||||
|
|
||||||
@contact.addresses << new_address
|
@contact.addresses << new_address
|
||||||
stamp @contact
|
stamp @contact
|
||||||
|
@ -69,20 +71,13 @@ module Epp::ContactsHelper
|
||||||
)
|
)
|
||||||
end
|
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
|
def new_contact_info
|
||||||
ph = params_hash['epp']['command']['create']['create']
|
ph = params_hash['epp']['command']['create']['create']
|
||||||
{
|
{
|
||||||
code: ph[:id],
|
code: ph[:id],
|
||||||
phone: ph[:voice],
|
phone: ph[:voice],
|
||||||
ident: ph[:ident],
|
ident: ph[:ident],
|
||||||
|
ident_type: ident_type,
|
||||||
email: ph[:email],
|
email: ph[:email],
|
||||||
org_name: ph[:postalInfo][:org]
|
org_name: ph[:postalInfo][:org]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue