module JokerDMAPI::Domain
Public Instance Methods
Register new domain
Takes domain
and domain's fields as hash:
:period
-
registration period (years!!!)
:registrant
-
registrant (owner) handle (registered)
:admin
-
admin handle (registered)
:tech
-
tech handle (registered)
:billing
-
billing handle (registered)
:nservers
-
an array of NS servers
Returned is a hash of response:
:headers
:proc_id
-
process ID (used at check result)
:tracking_id
-
tracking ID
# File lib/joker-dmapi/domain.rb, line 84 def domain_create(domain, fields) unless ([ :period, :registrant, :admin, :tech, :billing, :nservers ] - fields.keys).empty? raise ArgumentError, "Required fields not found" end query :domain_register, { domain: domain, period: (fields[:period] * 12), owner_c: fields[:registrant], admin_c: fields[:admin], tech_c: fields[:tech], billing_c: fields[:billing], ns_list: fields[:nservers].join(':') } end
Returns the information about a domain or nil
if not exists
Takes FQDN as string
Returned is a hash:
:fqdn
-
FQDN
:status
-
domain status
:registrant
-
registrant (owner) as hash keys:
:name
-
registrant's name
:organization
-
registrant's organization
:address
-
an array of registrant's address
:postal_code
-
registrant's postal code
:country
-
registrant's country code
:owner_c_email
-
owner's email address
:email
-
registrant's email address
:phone
-
registrant's voice phone number
:fax
-
registrant's fax number
:reseller_lines
-
an array of reseller data
:admin_c
-
registrant's admin-c handle
:tech_c
-
registrant's tech-c handle
:billing_c
-
registrant's billing-c handle
:nservers
-
an array of NS servers
:created_date
-
date and time of creation
:modified_date
-
date and time of modification
:expires
-
date and time of expiration
# File lib/joker-dmapi/domain.rb, line 30 def domain_info(domain) response = query_no_raise :query_whois, domain: domain case response[:headers][:status_code] when '2303' then nil when '0' then result = {} response[:body].split("\n").each do |line| line.slice! /^domain\./ line_parsed = parse_line(line) next if line_parsed.is_a? String key, value = line_parsed.first case key when :fqdn, :status then result.merge! line_parsed when :name, :organization, :city, :postal_code, :country, :owner_c_email, :email, :phone, :fax then result[:registrant] = {} unless result.has_key? :registrant result[:registrant].merge! line_parsed when :address_1, :address_2, :address_3 then result[:registrant] = {} unless result.has_key? :registrant result[:registrant][:address] = [] unless result[:registrant].has_key? :address result[:registrant][:address] << value when :reseller_line then result[:reseller_lines] = [] unless result.has_key? :reseller_lines result[:reseller_lines] << value when :created_date, :modified_date, :expires then result[key] = DateTime.parse value when :admin_c, :tech_c, :billing_c then result.merge! line_parsed when :nservers_nserver_handle then result[:nservers] = [] unless result.has_key? :nservers result[:nservers] << value else next end end result else raise_response response end end
Update registrant's info
Takes domain
and fields (see contact_update)
# File lib/joker-dmapi/domain.rb, line 135 def domain_registrant_update(domain, fields) fields = contact_prepare(fields) fields[:domain] = domain query :domain_owner_change, fields end
Renew domain
Takes domain
and period
WARNING!!! period
in YEARS
# File lib/joker-dmapi/domain.rb, line 128 def domain_renew(domain, period) query :domain_renew, { domain: domain, period: (12 * period) } end
Update domain
Takes domain
and domain's fields as hash:
:admin
-
admin handle (registered)
:tech
-
tech handle (registered)
:billing
-
billing handle (registered)
:nservers
-
an array of NS servers
Returned is a hash of response:
:headers
:proc_id
-
process ID (used at check result)
:tracking_id
-
tracking ID
# File lib/joker-dmapi/domain.rb, line 111 def domain_update(domain, fields) unless ([ :admin, :tech, :billing, :nservers ] - fields.keys).empty? raise ArgumentError, "Required fields not found" end query :domain_modify, { domain: domain, admin_c: fields[:admin], tech_c: fields[:tech], billing_c: fields[:billing], ns_list: fields[:nservers].join(':') } end