Class: KonoEppUpdateContact
- Inherits:
-
KonoEppCommand
- Object
- REXML::Document
- KonoEppCommand
- KonoEppUpdateContact
- Defined in:
- lib/epp/epp_command/update_contact.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ KonoEppUpdateContact
constructor
TODO: Add and remove fields.
Constructor Details
#initialize(options) ⇒ KonoEppUpdateContact
TODO: Add and remove fields
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/epp/epp_command/update_contact.rb', line 4 def initialize( ) super( nil, nil ) command = root.elements['command'] update = command.add_element "update" contact_update = update.add_element( "contact:update", { "xmlns:contact" => "urn:ietf:params:xml:ns:contact-1.0", "xsi:schemaLocation" => "urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd" } ) id = contact_update.add_element "contact:id" id.text = [:id] contact_chg = contact_update.add_element "contact:chg" unless [:name].blank? \ and [:organization].blank? \ and [:address].blank? \ and [:city].blank? \ and [:state].blank? \ and [:postal_code].blank? \ and [:country].blank? postal_info = contact_chg.add_element "contact:postalInfo", { "type" => "loc" } unless [:name].blank? name = postal_info.add_element "contact:name" name.text = [:name] end unless [:organization].blank? organization = postal_info.add_element "contact:org" organization.text = [:organization] end # NOTE: city and country are REQUIRED unless [:address].blank? \ and [:city].blank? \ and [:state].blank? \ and [:postal_code].blank? \ and [:country].blank? addr = postal_info.add_element "contact:addr" unless [:address].blank? street = addr.add_element "contact:street" street.text = [:address] end city = addr.add_element "contact:city" city.text = [:city] unless [:state].blank? state = addr.add_element "contact:sp" state.text = [:state] end unless [:postal_code].blank? postal_code = addr.add_element "contact:pc" postal_code.text = [:postal_code] end country_code = addr.add_element "contact:cc" country_code.text = [:country] end end if [:voice] voice = contact_chg.add_element "contact:voice" voice.text = [:voice] end if [:fax] fax = contact_chg.add_element "contact:fax" fax.text = [:fax] end if [:email] email = contact_chg.add_element "contact:email" email.text = [:email] end unless not .has_key?( :publish ) \ and [:nationality].blank? \ and [:entity_type].blank? \ and [:reg_code].blank? # FIXME extension = command.add_element "extension" extension_update = extension.add_element "extcon:update", { "xmlns:extcon" => 'http://www.nic.it/ITNIC-EPP/extcon-1.0', "xsi:schemaLocation" => 'http://www.nic.it/ITNIC-EPP/extcon-1.0 extcon-1.0.xsd' } if .has_key?( :publish ) publish = extension_update.add_element "extcon:consentForPublishing" publish.text = [:publish] end if [:becomes_registrant] extcon_registrant = extension_update.add_element "extcon:registrant" extcon_nationality = extcon_registrant.add_element "extcon:nationalityCode" extcon_nationality.text = [:nationality] extcon_entity = extcon_registrant.add_element "extcon:entityType" extcon_entity.text = [:entity_type] extcon_regcode = extcon_registrant.add_element "extcon:regCode" extcon_regcode.text = [:reg_code] end end end |