Class: Gandi::Domain

Inherits:
Object
  • Object
show all
Extended by:
Transferin
Includes:
Contacts, Nameservers, Status, GandiObjectMethods
Defined in:
lib/gandi/domain.rb,
lib/gandi/domain/tld.rb,
lib/gandi/domain/host.rb,
lib/gandi/domain/zone.rb,
lib/gandi/domain/status.rb,
lib/gandi/domain/forward.rb,
lib/gandi/domain/mailbox.rb,
lib/gandi/domain/contacts.rb,
lib/gandi/domain/transferin.rb,
lib/gandi/domain/nameservers.rb,
lib/gandi/domain/zone/record.rb,
lib/gandi/domain/zone/version.rb

Defined Under Namespace

Modules: Contacts, Nameservers, Status, Transferin Classes: Forward, Host, Mailbox, Tld, Zone

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Transferin

transferin

Methods included from Nameservers

#nameservers, #nameservers=

Methods included from Status

#lock, #unlock

Methods included from Contacts

#contacts, #contacts=

Methods included from GandiObjectMethods

#[], included, #inspect, #to_hash

Constructor Details

#initialize(fqdn) ⇒ Domain

Returns a new instance of Domain.



23
24
25
26
# File 'lib/gandi/domain.rb', line 23

def initialize(fqdn)
  @fqdn = fqdn
  @attributes = info
end

Instance Attribute Details

#fqdnObject (readonly)

Returns the value of attribute fqdn.



21
22
23
# File 'lib/gandi/domain.rb', line 21

def fqdn
  @fqdn
end

Class Method Details

.available(fqdns) ⇒ Object

Check the availability of some domain names.



41
42
43
# File 'lib/gandi/domain.rb', line 41

def available(fqdns)
  call('domain.available', fqdns)
end

.count(filters = {}) ⇒ Object

Count domains visible by this account.



46
47
48
# File 'lib/gandi/domain.rb', line 46

def count(filters = {})
  call('domain.count', filters)
end

.create(fqdn, params) ⇒ Object

Create a domain with the given information. Returns a Gandi::Operation object.



61
62
63
64
# File 'lib/gandi/domain.rb', line 61

def create(fqdn, params)
  operation_hash = call('domain.create', fqdn, params)
  Gandi::Operation.new(operation_hash['id'], operation_hash)
end

.list(opts = {}) ⇒ Object

List operations done by this account. Note that domain.info will be called for each domain (as the info hash returned by domain.list is missing some informations). This may result in a lot of API calls if you have many registered domains for your contact, so using opts to restrict results is advised (or use a raw API call).



53
54
55
56
57
# File 'lib/gandi/domain.rb', line 53

def list(opts = {})
  call('domain.list', opts).map do |domain|
    self.new(domain['fqdn'])
  end
end

Instance Method Details

#infoObject

get domain information.



29
30
31
# File 'lib/gandi/domain.rb', line 29

def info
  self.class.call('domain.info', @fqdn)
end

#renew(params) ⇒ Object

Renew a domain.



34
35
36
37
# File 'lib/gandi/domain.rb', line 34

def renew(params)
  operation_hash = self.class.call('domain.renew', @fqdn, params)
  Gandi::Operation.new(operation_hash['id'], operation_hash)
end