Class: Registrar::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/registrar/client.rb

Overview

This class provides a generic client interface for accessing domain registrars as a domain reseller. The interface provides methods for checking domain availability, registering domain names and finding details on domains that are already registered.

For examples of how to use this interface please see README.textile.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider) ⇒ Client

Initialize the client with an provider.

adapter - The provider instance.



24
25
26
# File 'lib/registrar/client.rb', line 24

def initialize(provider)
  @provider = provider 
end

Instance Attribute Details

#providerObject (readonly)

Returns the value of attribute provider.



19
20
21
# File 'lib/registrar/client.rb', line 19

def provider
  @provider
end

Instance Method Details

#auto_renew?(name) ⇒ Boolean

Return true if the domain is set up for auto renewal

name - The fully-qualified domain name

Returns true if the domain should be auto renewed by the registrar

Returns:

  • (Boolean)


122
123
124
# File 'lib/registrar/client.rb', line 122

def auto_renew?(name)
  provider.auto_renew?(name)
end

#available?(name) ⇒ Boolean

Check for the availability of a domain.

name - The fully-qualified domain name to check.

Returns true if the name is available.

Returns:

  • (Boolean)


51
52
53
# File 'lib/registrar/client.rb', line 51

def available?(name)
  provider.available?(name.downcase)
end

#contacts(name) ⇒ Object



200
201
202
# File 'lib/registrar/client.rb', line 200

def contacts(name)
  provider.contacts(name)
end

#disable_auto_renewal(name) ⇒ Object Also known as: disable_auto_renew

Disable auto-renewal for a domain

name - The name that has auto renewal enabled

Returns true if the auto-renewal was disabled



141
142
143
# File 'lib/registrar/client.rb', line 141

def disable_auto_renewal(name)
  provider.disable_auto_renewal(name) 
end

#enable_auto_renewal(name) ⇒ Object Also known as: enable_auto_renew

Enable auto-renewal for a domain

name - The name to auto renew

Returns true of auto-renewal was enabled



131
132
133
# File 'lib/registrar/client.rb', line 131

def enable_auto_renewal(name)
  provider.enable_auto_renewal(name) 
end

#extended_attributes(name) ⇒ Object

Get a set of extended attribute descriptor objects. This set can be used to determine what extended registry attributes must be collected for the given domain.

name - The fully-qualified domain name.

Returns an array of Registrar::ExtendedAttribute objects.



74
75
76
# File 'lib/registrar/client.rb', line 74

def extended_attributes(name)
  provider.extended_attributes(name)
end

#find(name) ⇒ Object Also known as: find_domain

Find a domain and return an object representing that domain. If the domain is not registered or is registered with another reseller then this method will return nil.

name - The fully-qualified domain name.

Returns a Registrar::Domain object.



62
63
64
# File 'lib/registrar/client.rb', line 62

def find(name)
  provider.find(name.downcase)
end

#find_name_server(name) ⇒ Object

Find a name server by name.

name - The name server name

Returns a Registrar::NameServer instance



171
172
173
# File 'lib/registrar/client.rb', line 171

def find_name_server(name)
  provider.find_name_server(name)
end

#minimum_number_of_years(tld) ⇒ Object

Return the minimum number of years required to register a domain.

tld - The TLD.

Returns the minimum number of years required for registration.



187
188
189
# File 'lib/registrar/client.rb', line 187

def minimum_number_of_years(tld)
  provider.minimum_number_of_years(tld.downcase)
end

#name_servers(name) ⇒ Object Also known as: nameservers

List name servers for a domain.

name - The fully-qualified domain name.

Returns a list of name servers attached to this domain



151
152
153
# File 'lib/registrar/client.rb', line 151

def name_servers(name)
  provider.name_servers(name.downcase)
end

#order(id) ⇒ Object

Get the order identified by the given ID

id - The order ID

Returns a Registrar::Order



94
95
96
# File 'lib/registrar/client.rb', line 94

def order(id)
  provider.order(id)
end

#order_for_domain(name) ⇒ Object

Get the most recent order for the given name

name - The fully-qualified domain name

Returns a Registrar::Order instance



103
104
105
# File 'lib/registrar/client.rb', line 103

def order_for_domain(name)
  provider.order_for_domain(name)
end

#parse(name) ⇒ Object

Parse a domain name into it’s top-level domain part and its remaining parts.

name - The fully-qualified domain name to parse

Returns an array with two elements. The first element is a string with all parts of the domain minus the TLD. The last element is the TLD string.



36
37
38
39
# File 'lib/registrar/client.rb', line 36

def parse(name)
  name = name.downcase
  parse_cache[name] ||= provider.parse(name)
end

#purchase(name, registrant, registration_options = nil) ⇒ Object

Purchase a domain name for the given registrant.

name - The fully-qualified domain name to purchase. registrant - A complete Registrar::Contact instance. registration_options - Optional Registrar::RegistrationOptions instance.

Returns a Registrar::Order



85
86
87
# File 'lib/registrar/client.rb', line 85

def purchase(name, registrant, registration_options=nil)
  provider.purchase(name.downcase, registrant, registration_options)
end

#register_name_server(name_server) ⇒ Object

Registers a name server with various registries

name_server - The NameServer to register, including IP address



178
179
180
# File 'lib/registrar/client.rb', line 178

def register_name_server(name_server)
  provider.register_name_server(name_server)
end

#renew(name, renewal_options = nil) ⇒ Object

Renew a domain name.

name - The fully-qualified domain name to renew. renewal_options - Optional Registrar::RenewalOptions instance.

Returns a Registrar::Order



113
114
115
# File 'lib/registrar/client.rb', line 113

def renew(name, renewal_options=nil)
  provider.renew(name.downcase, renewal_options)
end

#set_name_servers(name, name_servers = []) ⇒ Object

Set the name servers for a given name.

name - The fully-qualified domain name. name_servers - A set of name server names as strings.

Returns the list of name servers



162
163
164
# File 'lib/registrar/client.rb', line 162

def set_name_servers(name, name_servers=[])
  provider.set_name_servers(name, name_servers)
end

#tld_retail_transfer_price(tld) ⇒ Object

Return the retail transfer price for the given TLD.

tld - The TLD.

Returns the transfer price.



196
197
198
# File 'lib/registrar/client.rb', line 196

def tld_retail_transfer_price(tld)
  provider.tld_retail_transfer_price(tld)
end

#update_administrative_contact(name, contact) ⇒ Object



216
217
218
# File 'lib/registrar/client.rb', line 216

def update_administrative_contact(name, contact)
  provider.update_administrative_contact(name, contact)
end

#update_aux_billing_contact(name, contact) ⇒ Object



220
221
222
# File 'lib/registrar/client.rb', line 220

def update_aux_billing_contact(name, contact)
  provider.update_aux_billing_contact(name, contact)
end

#update_contacts(name, contact) ⇒ Object



208
209
210
# File 'lib/registrar/client.rb', line 208

def update_contacts(name, contact)
  provider.update_contacts(name, contact)
end

#update_registrant(name, contact) ⇒ Object



204
205
206
# File 'lib/registrar/client.rb', line 204

def update_registrant(name, contact)
  provider.update_registrant(name, contact)
end

#update_technical_contact(name, contact) ⇒ Object



212
213
214
# File 'lib/registrar/client.rb', line 212

def update_technical_contact(name, contact)
  provider.update_technical_contact(name, contact)
end