Method: Dnsimple::Client::TemplatesRecords#records

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

#records(account_id, template_id, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::TemplateRecord> Also known as: list_records

Lists the records in the template.

Examples:

List the first page of records for the template “alpha”

client.templates.records(1010, "alpha")

List records for the template “alpha”, providing a specific page

client.templates.records(1010, "alpha", page: 2)

List records for the template “alpha”, providing sorting policy

client.templates.records(1010, "alpha", sort: "type:asc")

Parameters:

  • account_id (Integer)

    the account ID

  • template_id (String)

    the template name

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

    the filtering and sorting options

Options Hash (options):

  • :page (Integer)

    current page (pagination)

  • :per_page (Integer)

    number of entries to return (pagination)

  • :sort (String)

    sorting policy

Returns:

Raises:

See Also:



29
30
31
32
33
34
# File 'lib/dnsimple/client/templates_records.rb', line 29

def records(, template_id, options = {})
  endpoint = Client.versioned("/%s/templates/%s/records" % [, template_id])
  response = client.get(endpoint, Options::ListOptions.new(options))

  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::TemplateRecord.new(r) })
end