Module: Epp::Eis::DomainCommands
- Defined in:
- lib/epp-eis/domain.rb
Instance Method Summary collapse
-
#check_domain(*domains) ⇒ Object
Check availability for a domain or a list of domains.
-
#create_domain(domain, nsset, registrant, admins, legal_document, legal_doc_type) ⇒ Object
Create a new domain.
-
#delete_domain(domain, legal_document, legal_doc_type) ⇒ Object
Delete domain.
-
#info_domain(domain) ⇒ Object
Will return detailed information about the domain.
-
#is_domain_available?(domain) ⇒ Boolean
Shortcut function to check whether domain is available.
- #list_domains ⇒ Object
-
#renew_domain(domain, current_expire_date) ⇒ Object
Updates domain expiration period for another year.
-
#transfer_domain(domain, auth_info, legal_document, legal_doc_type) ⇒ Object
Used to transfer domain ownership from one registrar to another.
-
#update_domain(domain, add_admins, rem_admins, nsset, registrant, auth_info, legal_document, legal_doc_type) ⇒ Object
Used to update domain information.
Instance Method Details
#check_domain(*domains) ⇒ Object
Check availability for a domain or a list of domains.
Returns DomainCheckResponse object with server response information
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File 'lib/epp-eis/domain.rb', line 379 def check_domain(*domains) builder = build_epp_request do |xml| xml.command { xml.check { xml.check('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) { xml.parent.namespace = xml.parent.namespace_definitions.first domains.each do |domain| xml['domain'].name domain end } } xml.clTRID UUIDTools::UUID..to_s } end DomainCheckResponse.new(send_request(builder.to_xml)) end |
#create_domain(domain, nsset, registrant, admins, legal_document, legal_doc_type) ⇒ Object
Create a new domain.
Domain names with IDN characters õ, ä. ö. ü, š, ž will be allowed. If a domain name contains at least one of these characters then it must be translated to PUNYCODE before domain create.
domain - Domain name to be registered nsset - Nameserver id registrant - Registrant contact id admin - Admin contact id, or array of id-s legal_document - Legal document binary data legal_doc_type - Legal document type (pdf, ddoc)
Returns DomainCreateResponse object
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/epp-eis/domain.rb', line 210 def create_domain(domain, nsset, registrant, admins, legal_document, legal_doc_type) builder = build_epp_request do |xml| xml.command { xml.create { xml.create('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) { xml.parent.namespace = xml.parent.namespace_definitions.first xml['domain'].name domain xml['domain'].period '1', 'unit' => 'y' xml['domain'].nsset nsset xml['domain'].registrant registrant [admins].flatten.each { |admin| xml['domain'].admin admin } } } append_legal_document(xml, legal_document, legal_doc_type) xml.clTRID UUIDTools::UUID..to_s } end DomainCreateResponse.new(send_request(builder.to_xml)) end |
#delete_domain(domain, legal_document, legal_doc_type) ⇒ Object
Delete domain.
domain - Domain name to be registered legal_document - Legal document binary data legal_doc_type - Legal document type (pdf, ddoc)
Returns DomainDeleteResponse object
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/epp-eis/domain.rb', line 238 def delete_domain(domain, legal_document, legal_doc_type) builder = build_epp_request do |xml| xml.command { xml.delete { xml.delete('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) { xml.parent.namespace = xml.parent.namespace_definitions.first xml['domain'].name domain } } append_legal_document(xml, legal_document, legal_doc_type) xml.clTRID UUIDTools::UUID..to_s } end DomainDeleteResponse.new(send_request(builder.to_xml)) end |
#info_domain(domain) ⇒ Object
Will return detailed information about the domain. The information will include domain password field. The field will be populated with a real value if the domain owner executed the function. Non-owner will see empty domain password field value.
domain - Domain name to be queried
Returns DomainInfoResponse object
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/epp-eis/domain.rb', line 262 def info_domain(domain) builder = build_epp_request do |xml| xml.command { xml.info { xml.info('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) { xml.parent.namespace = xml.parent.namespace_definitions.first xml['domain'].name domain } } xml.clTRID UUIDTools::UUID..to_s } end DomainInfoResponse.new(send_request(builder.to_xml)) end |
#is_domain_available?(domain) ⇒ Boolean
Shortcut function to check whether domain is available.
domain - Domain name to be checked
Returns true if domain is available and false if it is not.
402 403 404 405 |
# File 'lib/epp-eis/domain.rb', line 402 def is_domain_available?(domain) results = check_domain(domain).items results.nil? ? false : results.first.available? end |
#list_domains ⇒ Object
372 373 374 |
# File 'lib/epp-eis/domain.rb', line 372 def list_domains list_command('listDomains') end |
#renew_domain(domain, current_expire_date) ⇒ Object
Updates domain expiration period for another year.
domain - Domain to be renewed current_expire_date - Current expiration date of the domain in YYYY-MM-DD format
Returns DomainRenewResponse object with server response information
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/epp-eis/domain.rb', line 284 def renew_domain(domain, current_expire_date) builder = build_epp_request do |xml| xml.command { xml.renew { xml.renew('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) { xml.parent.namespace = xml.parent.namespace_definitions.first xml['domain'].name domain xml['domain'].curExpDate current_expire_date xml['domain'].period '1', 'unit' => 'y' } } xml.clTRID UUIDTools::UUID..to_s } end DomainRenewResponse.new(send_request(builder.to_xml)) end |
#transfer_domain(domain, auth_info, legal_document, legal_doc_type) ⇒ Object
Used to transfer domain ownership from one registrar to another.
domain - Name of the domain to be transferred auth_info - Domain authorization code
Returns DomainTransferResponse object
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/epp-eis/domain.rb', line 308 def transfer_domain(domain, auth_info, legal_document, legal_doc_type) builder = build_epp_request do |xml| xml.command { xml.transfer('op' => 'request') { xml.transfer('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) { xml.parent.namespace = xml.parent.namespace_definitions.first xml['domain'].name domain xml['domain'].authInfo auth_info } } append_legal_document(xml, legal_document, legal_doc_type) xml.clTRID UUIDTools::UUID..to_s } end DomainTransferResponse.new(send_request(builder.to_xml)) end |
#update_domain(domain, add_admins, rem_admins, nsset, registrant, auth_info, legal_document, legal_doc_type) ⇒ Object
Used to update domain information.
domain - Domain name to be updated add_admins - Array of admin contact ids to be added. Set to nil or empty array if no changes needed rem_admins - Array of admin contact ids to be removed. Set to nil or empty array if no changes needed nsset - Domain nsset id to be changed. Set to nil if no changes needed registrant - Domain registrant contact id to be changed. Set to nil if no changes needed auth_info - Domain authorization code to be changed. Set to nil if no changes needed legal_document - Legal document binary data legal_doc_type - Legal document type (pdf, ddoc)
Returns DomainUpdateResponse object
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/epp-eis/domain.rb', line 338 def update_domain(domain, add_admins, rem_admins, nsset, registrant, auth_info, legal_document, legal_doc_type) builder = build_epp_request do |xml| xml.command { xml.update { xml.update('xmlns:domain' => XML_NS_DOMAIN, 'xsi:schemaLocation' => XML_DOMAIN_SCHEMALOC) { xml.parent.namespace = xml.parent.namespace_definitions.first xml['domain'].name domain if !add_admins.nil? && !add_admins.empty? xml['domain'].add { add_admins.each { |add_admin| xml['domain'].admin add_admin } } end if !rem_admins.nil? && !rem_admins.empty? xml['domain'].rem { rem_admins.each { |rem_admin| xml['domain'].admin rem_admin } } end if [nsset, registrant, auth_info].any?{ |item| !item.nil? } xml['domain'].chg { xml['domain'].nsset nsset if nsset xml['domain'].registrant registrant if registrant xml['domain'].auth_info auth_info if auth_info } end } } append_legal_document(xml, legal_document, legal_doc_type) xml.clTRID UUIDTools::UUID..to_s } end DomainUpdateResponse.new(send_request(builder.to_xml)) end |