Merge branch 'postalinfo'

Conflicts:
	app/helpers/epp/contacts_helper.rb
	app/models/address.rb
	app/models/contact.rb
	db/schema.rb
	spec/epp/contact_spec.rb
	spec/fabricators/contact_fabricator.rb
	spec/fabricators/international_address_fabricator.rb
	spec/models/address_spec.rb
	spec/models/contact_spec.rb
This commit is contained in:
Andres Keskküla 2014-08-26 10:09:52 +03:00
commit 8d5152d400
17 changed files with 343 additions and 195 deletions

View file

@ -49,9 +49,12 @@ module Epp::ContactsHelper
@ph = params_hash['epp']['command']['create']['create']
xml_attrs_present?(@ph, [['id'],
%w(authInfo pw),
%w(postalInfo name),
%w(postalInfo addr city),
%w(postalInfo addr cc)])
%w(postalInfo)])
if @ph['postalInfo'].is_a?(Hash) || @ph['postalInfo'].is_a?(Array)
xml_nested_attrs_present?( @ph['postalInfo'], [ %w(name),
%w(addr city),
%w(addr cc)])
end
end
## UPDATE
@ -102,12 +105,14 @@ module Epp::ContactsHelper
case type
when :update
contact_hash = Contact.extract_attributes(@ph[:chg], type)
contact_hash[:address_attributes] =
Address.extract_attributes(( @ph.try(:[], :chg).try(:[], :postalInfo).try(:[], :addr) || []), type)
contact_hash = contact_hash.merge(
Address.extract_attributes(( @ph.try(:[], :chg).try(:[], :postalInfo) || [] ), type)
)
else
contact_hash = Contact.extract_attributes(@ph, type)
contact_hash[:address_attributes] =
Address.extract_attributes(( @ph.try(:[], :postalInfo).try(:[], :addr) || []), type)
contact_hash = contact_hash.merge(
Address.extract_attributes(( @ph.try(:[], :postalInfo) || [] ), type)
)
end
contact_hash[:ident_type] = ident_type unless ident_type.nil?
contact_hash