Class: Registrar::Provider::OpenSRS::Contact

Inherits:
Object
  • Object
show all
Defined in:
lib/registrar/provider/opensrs/contact.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contact) ⇒ Contact

Returns a new instance of Contact.

Raises:

  • (ArgumentError)


8
9
10
11
# File 'lib/registrar/provider/opensrs/contact.rb', line 8

def initialize(contact)
  raise ArgumentError, "Contact is required" unless contact
  @contact = contact
end

Instance Attribute Details

#contactObject (readonly)

Returns the value of attribute contact.



6
7
8
# File 'lib/registrar/provider/opensrs/contact.rb', line 6

def contact
  @contact
end

Instance Method Details

#to_xml(builder) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/registrar/provider/opensrs/contact.rb', line 13

def to_xml(builder)
  builder.item(contact.first_name, :key => "first_name")
  builder.item(contact.last_name, :key => "last_name")
  builder.item(contact.phone, :key => "phone")
  builder.item(contact.fax, :key => "fax")
  builder.item(contact.email, :key => "email")
  builder.item(contact.organization_name, :key => "org_name")
  builder.item(contact.address_1, :key => "address1")
  builder.item(contact.address_2, :key => "address2")
  builder.item(contact.city, :key => "city")
  builder.item(contact.state_province, :key => "state")
  builder.item(contact.country, :key => "country")
  builder.item(contact.postal_code, :key => "postal_code")
end