Module: Dnsimple::Client::DomainsRecords
- Included in:
- DomainsService
- Defined in:
- lib/dnsimple/client/domains_records.rb
Instance Method Summary collapse
-
#create_record(domain, attributes = {}, options = {}) ⇒ Struct::Record
Creates a record for a domain.
-
#delete_record(domain, record, options = {}) ⇒ void
Deletes a record for a domain.
-
#record(domain, record, options = {}) ⇒ Struct::Record
Gets a record for a domain.
-
#records(domain, options = {}) ⇒ Array<Struct::Record>
(also: #list_record)
Lists the records for a domain.
-
#update_record(domain, record, attributes = {}, options = {}) ⇒ Struct::Record
Updates a record for a domain.
Instance Method Details
#create_record(domain, attributes = {}, options = {}) ⇒ Struct::Record
Creates a record for a domain.
32 33 34 35 36 37 38 |
# File 'lib/dnsimple/client/domains_records.rb', line 32 def create_record(domain, attributes = {}, = {}) Extra.validate_mandatory_attributes(attributes, [:name, :record_type, :content]) = .merge({ record: attributes }) response = client.post(Client.versioned("domains/#{domain}/records"), ) Struct::Record.new(response["record"]) end |
#delete_record(domain, record, options = {}) ⇒ void
This method returns an undefined value.
Deletes a record for a domain.
84 85 86 |
# File 'lib/dnsimple/client/domains_records.rb', line 84 def delete_record(domain, record, = {}) client.delete(Client.versioned("domains/#{domain}/records/#{record}"), ) end |
#record(domain, record, options = {}) ⇒ Struct::Record
Gets a record for a domain.
50 51 52 53 54 |
# File 'lib/dnsimple/client/domains_records.rb', line 50 def record(domain, record, = {}) response = client.get(Client.versioned("domains/#{domain}/records/#{record}"), ) Struct::Record.new(response["record"]) end |
#records(domain, options = {}) ⇒ Array<Struct::Record> Also known as: list_record
Lists the records for a domain.
15 16 17 18 19 |
# File 'lib/dnsimple/client/domains_records.rb', line 15 def records(domain, = {}) response = client.get(Client.versioned("domains/#{domain}/records"), ) response.map { |r| Struct::Record.new(r["record"]) } end |
#update_record(domain, record, attributes = {}, options = {}) ⇒ Struct::Record
Updates a record for a domain.
67 68 69 70 71 72 |
# File 'lib/dnsimple/client/domains_records.rb', line 67 def update_record(domain, record, attributes = {}, = {}) = .merge({ record: attributes }) response = client.put(Client.versioned("domains/#{domain}/records/#{record}"), ) Struct::Record.new(response["record"]) end |