Module: Epp::Eis::ContactCommands

Defined in:
lib/epp-eis/contact.rb

Instance Method Summary collapse

Instance Method Details

#check_contact(*contacts) ⇒ Object

Check availability for a contact id. You may provide multiple contact id names.



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/epp-eis/contact.rb', line 150

def check_contact(*contacts)
  builder = build_epp_request do |xml|
    xml.command {
      xml.check {
        xml.check('xmlns:contact' => XML_NS_CONTACT, 'xsi:schemaLocation' => XML_CONTACT_SCHEMALOC) {
          xml.parent.namespace = xml.parent.namespace_definitions.first
          contacts.each { |contact| xml['contact'].id_ contact }
        }
      }
      xml.clTRID UUIDTools::UUID.timestamp_create.to_s
    }
  end

  ContactCheckResponse.new(send_request(builder.to_xml))
end

#create_contact(contact, name, street, city, postal_code, country_code, voice, email, ident, ident_type) ⇒ Object

Create a new contact object. The contact object will be available immediately.



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/epp-eis/contact.rb', line 167

def create_contact(contact, name, street, city, postal_code, country_code, voice, email, ident, ident_type)
  builder = build_epp_request do |xml|
    xml.command {
      xml.create {
        xml.create('xmlns:contact' => XML_NS_CONTACT, 'xsi:schemaLocation' => XML_CONTACT_SCHEMALOC) {
          xml.parent.namespace = xml.parent.namespace_definitions.first
          xml['contact'].id_ contact
          xml['contact'].postalInfo {
            xml['contact'].name name
            xml['contact'].addr {
              xml['contact'].street street
              xml['contact'].city city
              xml['contact'].pc postal_code
              xml['contact'].cc country_code
            }
          }
          xml['contact'].voice voice
          xml['contact'].email email
          xml['contact'].ident ident, 'type' => ident_type
        }
      }
      xml.clTRID UUIDTools::UUID.timestamp_create.to_s
    }
  end
  
  ContactCreateResponse.new(send_request(builder.to_xml))
end

#delete_contact(contact) ⇒ Object

Delete contact handle. Contact object can not be deleted if it has relations to other objects like domains or nssets.



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/epp-eis/contact.rb', line 197

def delete_contact(contact)
  builder = build_epp_request do |xml|
    xml.command {
      xml.delete {
        xml.delete('xmlns:contact' => XML_NS_CONTACT, 'xsi:schemaLocation' => XML_CONTACT_SCHEMALOC) {
          xml.parent.namespace = xml.parent.namespace_definitions.first
          xml['contact'].id_ contact
        }
      }
      xml.clTRID UUIDTools::UUID.timestamp_create.to_s
    }
  end
  
  ContactDeleteResponse.new(send_request(builder.to_xml))
end

#info_contact(contact) ⇒ Object

Returns detailed information about a contact.



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/epp-eis/contact.rb', line 214

def info_contact(contact)
  builder = build_epp_request do |xml|
    xml.command {
      xml.info {
        xml.info('xmlns:contact' => XML_NS_CONTACT, 'xsi:schemaLocation' => XML_CONTACT_SCHEMALOC) {
          xml.parent.namespace = xml.parent.namespace_definitions.first
          xml['contact'].id_ contact
        }
      }
      xml.clTRID UUIDTools::UUID.timestamp_create.to_s
    }
  end
  
  ContactInfoResponse.new(send_request(builder.to_xml))
end

#list_contactsObject



230
231
232
# File 'lib/epp-eis/contact.rb', line 230

def list_contacts
  list_command('listContacts')
end

#update_contact(contact, name, street, city, postal_code, country_code, voice, email, ident, ident_type, legal_document, legal_doc_type) ⇒ Object

Update contact object. All domain and nsset objects will be updated as well.



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/epp-eis/contact.rb', line 235

def update_contact(contact, name, street, city, postal_code, country_code, voice, email, ident, ident_type, legal_document, legal_doc_type)
  builder = build_epp_request do |xml|
    xml.command {
      xml.update {
        xml.update('xmlns:contact' => XML_NS_CONTACT, 'xsi:schemaLocation' => XML_CONTACT_SCHEMALOC) {
          xml.parent.namespace = xml.parent.namespace_definitions.first
          xml['contact'].id_ contact
          if [name, street, city, postal_code, country_code].any?{ |item| !item.nil? }
            xml['contact'].postalInfo {
              xml['contact'].name name if name
              if [street, city, postal_code, country_code].any?{ |item| !item.nil? }
                xml['contact'].addr {
                  xml['contact'].street street if street
                  xml['contact'].city city if city
                  xml['contact'].pc postal_code if postal_code
                  xml['contact'].cc country_code if country_code
                }
              end
            }
          end
          xml['contact'].voice voice if voice
          xml['contact'].email email if email
          xml['contact'].ident ident, 'type' => ident_type
        }
      }
      append_legal_document(xml, legal_document, legal_doc_type)
      xml.clTRID UUIDTools::UUID.timestamp_create.to_s
    }
  end
  
  ContactUpdateResponse.new(send_request(builder.to_xml))
end