Method: Dnsimple::Client::TemplatesRecords#create_record

Defined in:
lib/dnsimple/client/templates_records.rb

#create_record(account_id, template_id, attributes, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::TemplateRecord>

Creates a record in the template.

Examples:

Create an A record for “alpha” template

client.templates.create_record(1010, "alpha", name: "", type: "A", content: "192.168.1.1", ttl: 600)

Parameters:

  • account_id (Integer)

    the account ID

  • template_id (String)

    the template name

  • attributes (Hash)
  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



82
83
84
85
86
87
88
# File 'lib/dnsimple/client/templates_records.rb', line 82

def create_record(, template_id, attributes, options = {})
  Extra.validate_mandatory_attributes(attributes, [:type, :name, :content])
  endpoint = Client.versioned("/%s/templates/%s/records" % [, template_id])
  response = client.post(endpoint, attributes, options)

  Dnsimple::Response.new(response, Struct::TemplateRecord.new(response["data"]))
end