Merge branch 'master' of github.com:internetee/registry

This commit is contained in:
Martin Lensment 2015-01-08 11:45:40 +02:00
commit ab7ec778dc
4 changed files with 9 additions and 3 deletions

View file

@ -168,8 +168,7 @@ module Epp::ContactsHelper
end end
def ident_type def ident_type
result = params[:frame].slice(/(?<=\<ns2:ident type=)(.*)(?=<)/) result = parsed_frame.css('ident').first.try(:attributes).try(:[], 'flag').try(:value)
return nil unless result return nil unless result
Contact::IDENT_TYPES.any? { |type| return type if result.include?(type) } Contact::IDENT_TYPES.any? { |type| return type if result.include?(type) }

View file

@ -164,6 +164,7 @@ class Contact < ActiveRecord::Base
contact_hash = { contact_hash = {
phone: ph[:voice], phone: ph[:voice],
ident: ph[:ident], ident: ph[:ident],
ident_type: ph[:ident_type],
email: ph[:email], email: ph[:email],
fax: ph[:fax], fax: ph[:fax],
name: ph[:postalInfo].try(:[], :name), name: ph[:postalInfo].try(:[], :name),

View file

@ -57,6 +57,12 @@ describe 'EPP Contact', epp: true do
expect(response[:results].count).to eq 6 expect(response[:results].count).to eq 6
end end
it 'successfully saves ident type' do
xml = {ident: { value: '37605030299' , attrs: { flag: 'birthday' } }}
response = epp_request(create_contact_xml(xml), :xml)
expect(Contact.last.ident_type).to eq('birthday')
end
it 'successfully creates a contact' do it 'successfully creates a contact' do
response = epp_request(create_contact_xml, :xml) response = epp_request(create_contact_xml, :xml)

View file

@ -11,7 +11,7 @@ module EppContactXmlHelper
}, },
voice: { value: '+372.1234567' }, voice: { value: '+372.1234567' },
email: { value: 'test@example.example' }, email: { value: 'test@example.example' },
ident: { value: '37605030299' } ident: { value: '37605030299' , attrs: { flag: 'op' } }
} }
xml_params = defaults.deep_merge(xml_params) xml_params = defaults.deep_merge(xml_params)