Module: Dnsimple::Client::Domains
- Included in:
- DomainsService
- Defined in:
- lib/dnsimple/client/domains.rb
Instance Method Summary collapse
-
#create_domain(attributes = {}, options = {}) ⇒ Struct::Domain
(also: #create)
Creates a domain in the account.
-
#delete_domain(domain, options = {}) ⇒ void
(also: #delete)
Deletes a domain from the account.
-
#domain(domain, options = {}) ⇒ Struct::Domain
Gets a domain from the account.
-
#domains(options = {}) ⇒ Array<Struct::Domain>
(also: #list, #list_domains)
Lists the domains in the account.
Instance Method Details
#create_domain(attributes = {}, options = {}) ⇒ Struct::Domain Also known as: create
Creates a domain in the account.
29 30 31 32 33 34 35 |
# File 'lib/dnsimple/client/domains.rb', line 29 def create_domain(attributes = {}, = {}) Extra.validate_mandatory_attributes(attributes, [:name]) = .merge({ domain: attributes }) response = client.post(Client.versioned("/domains"), ) Struct::Domain.new(response["domain"]) end |
#delete_domain(domain, options = {}) ⇒ void Also known as: delete
This method returns an undefined value.
Deletes a domain from the account.
WARNING: this cannot be undone.
64 65 66 |
# File 'lib/dnsimple/client/domains.rb', line 64 def delete_domain(domain, = {}) client.delete(Client.versioned("/domains/#{domain}"), ) end |
#domain(domain, options = {}) ⇒ Struct::Domain
Gets a domain from the account.
47 48 49 50 51 |
# File 'lib/dnsimple/client/domains.rb', line 47 def domain(domain, = {}) response = client.get(Client.versioned("/domains/#{domain}"), ) Struct::Domain.new(response["domain"]) end |
#domains(options = {}) ⇒ Array<Struct::Domain> Also known as: list, list_domains
Lists the domains in the account.
13 14 15 16 17 |
# File 'lib/dnsimple/client/domains.rb', line 13 def domains( = {}) response = client.get(Client.versioned("/domains"), ) response.map { |r| Struct::Domain.new(r["domain"]) } end |