From 6e2a0bfe555debd1ba5abb15c60011cbd637c576 Mon Sep 17 00:00:00 2001 From: Guillermo Gutierrez Almazor Date: Mon, 30 Mar 2026 20:01:52 +0200 Subject: [PATCH 1/3] Add domain push identifier support and account name - Add `new_domain_push_identifier` parameter for domain pushes - Deprecate `new_account_email` in favor of `new_domain_push_identifier` - Add `name` field to `Account` struct - Update fixtures and tests Closes dnsimple/dnsimple-app#32668 --- lib/dnsimple/account.ex | 3 ++- lib/dnsimple/domains.ex | 4 +++- test/dnsimple/accounts_test.exs | 1 + test/dnsimple/domains_test.exs | 21 +++++++++++++++++++ .../accounts/success-account.http | 2 +- test/fixtures.http/accounts/success-user.http | 2 +- .../listAccounts/success-account.http | 2 +- .../listAccounts/success-user.http | 2 +- .../fixtures.http/whoami/success-account.http | 2 +- test/fixtures.http/whoami/success.http | 2 +- 10 files changed, 33 insertions(+), 8 deletions(-) diff --git a/lib/dnsimple/account.ex b/lib/dnsimple/account.ex index ef3c965e..0ee2d150 100644 --- a/lib/dnsimple/account.ex +++ b/lib/dnsimple/account.ex @@ -10,9 +10,10 @@ defmodule Dnsimple.Account do @type t :: %__MODULE__{ id: integer, email: String.t, + name: String.t, plan_identifier: String.t, } - defstruct ~w(id email plan_identifier)a + defstruct ~w(id email name plan_identifier)a end diff --git a/lib/dnsimple/domains.ex b/lib/dnsimple/domains.ex index c36dd9a3..b2b31913 100644 --- a/lib/dnsimple/domains.ex +++ b/lib/dnsimple/domains.ex @@ -409,9 +409,11 @@ defmodule Dnsimple.Domains do client = %Dnsimple.Client{access_token: "a1b2c3d4"} {:ok, response} = Dnsimple.Domains.initiate_push(client, account_id = 1010, domain_id = "example.com", %{ - new_account_email: "other@example.com", + new_domain_push_identifier: "abc123", }) + Note: `new_account_email` is deprecated in favor of `new_domain_push_identifier`. + """ @spec initiate_push(Client.t, String.t | integer, String.t | integer, map, Keyword.t) :: {:ok|:error, Response.t} def initiate_push(client, account_id, domain_id, attributes, options \\ []) do diff --git a/test/dnsimple/accounts_test.exs b/test/dnsimple/accounts_test.exs index f9a2365e..528a6d38 100644 --- a/test/dnsimple/accounts_test.exs +++ b/test/dnsimple/accounts_test.exs @@ -31,6 +31,7 @@ defmodule Dnsimple.AccountsTest do assert Enum.all?(data, fn(element) -> element.__struct__ == Dnsimple.Account end) assert Enum.all?(data, fn(element) -> is_integer(element.id) end) assert Enum.all?(data, fn(element) -> is_binary(element.email) end) + assert Enum.all?(data, fn(element) -> is_binary(element.name) end) assert Enum.all?(data, fn(element) -> is_binary(element.plan_identifier) end) end end diff --git a/test/dnsimple/domains_test.exs b/test/dnsimple/domains_test.exs index 1a5d8242..386078e6 100644 --- a/test/dnsimple/domains_test.exs +++ b/test/dnsimple/domains_test.exs @@ -413,6 +413,27 @@ defmodule Dnsimple.DomainsTest do end + describe ".initiate_push with domain push identifier" do + test "initiates the push using new_domain_push_identifier" do + url = "#{@client.base_url}/v2/#{@account_id}/domains/#{@domain_id}/pushes" + method = "post" + fixture = "initiatePush/success.http" + attributes = %{new_domain_push_identifier: "abc123"} + body = Poison.encode!(attributes) + + use_cassette :stub, ExvcrUtils.response_fixture(fixture, method: method, url: url, request_body: body) do + {:ok, response} = @module.initiate_push(@client, @account_id, @domain_id, attributes) + assert response.__struct__ == Dnsimple.Response + + data = response.data + assert data.__struct__ == Dnsimple.Push + assert data.id == 1 + assert data.account_id == 2020 + end + end + end + + @push_id 6789 diff --git a/test/fixtures.http/accounts/success-account.http b/test/fixtures.http/accounts/success-account.http index c3dc4dce..2d8e0f9e 100644 --- a/test/fixtures.http/accounts/success-account.http +++ b/test/fixtures.http/accounts/success-account.http @@ -17,4 +17,4 @@ x-permitted-cross-domain-policies: none x-xss-protection: 1; mode=block strict-transport-security: max-age=31536000 -{"data":[{"id":123,"email":"john@example.com","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"}]} +{"data":[{"id":123,"email":"john@example.com","name":"John","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"}]} diff --git a/test/fixtures.http/accounts/success-user.http b/test/fixtures.http/accounts/success-user.http index ee9fe42f..949c73ce 100644 --- a/test/fixtures.http/accounts/success-user.http +++ b/test/fixtures.http/accounts/success-user.http @@ -17,5 +17,5 @@ x-permitted-cross-domain-policies: none x-xss-protection: 1; mode=block strict-transport-security: max-age=31536000 -{"data":[{"id":123,"email":"john@example.com","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"},{"id":456,"email":"ops@company.com","plan_identifier":"teams-v1-monthly","created_at":"2012-03-16T16:02:54Z","updated_at":"2016-06-14T11:23:16Z"}]} +{"data":[{"id":123,"email":"john@example.com","name":"John","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"},{"id":456,"email":"ops@company.com","name":"Ops Company","plan_identifier":"teams-v1-monthly","created_at":"2012-03-16T16:02:54Z","updated_at":"2016-06-14T11:23:16Z"}]} diff --git a/test/fixtures.http/listAccounts/success-account.http b/test/fixtures.http/listAccounts/success-account.http index c3dc4dce..2d8e0f9e 100644 --- a/test/fixtures.http/listAccounts/success-account.http +++ b/test/fixtures.http/listAccounts/success-account.http @@ -17,4 +17,4 @@ x-permitted-cross-domain-policies: none x-xss-protection: 1; mode=block strict-transport-security: max-age=31536000 -{"data":[{"id":123,"email":"john@example.com","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"}]} +{"data":[{"id":123,"email":"john@example.com","name":"John","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"}]} diff --git a/test/fixtures.http/listAccounts/success-user.http b/test/fixtures.http/listAccounts/success-user.http index cbd017c3..3eeb423b 100644 --- a/test/fixtures.http/listAccounts/success-user.http +++ b/test/fixtures.http/listAccounts/success-user.http @@ -17,4 +17,4 @@ x-permitted-cross-domain-policies: none x-xss-protection: 1; mode=block strict-transport-security: max-age=31536000 -{"data":[{"id":123,"email":"john@example.com","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"},{"id":456,"email":"ops@company.com","plan_identifier":"teams-v1-monthly","created_at":"2012-03-16T16:02:54Z","updated_at":"2016-06-14T11:23:16Z"}]} +{"data":[{"id":123,"email":"john@example.com","name":"John","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"},{"id":456,"email":"ops@company.com","name":"Ops Company","plan_identifier":"teams-v1-monthly","created_at":"2012-03-16T16:02:54Z","updated_at":"2016-06-14T11:23:16Z"}]} diff --git a/test/fixtures.http/whoami/success-account.http b/test/fixtures.http/whoami/success-account.http index 24b6dc13..8c7650d2 100644 --- a/test/fixtures.http/whoami/success-account.http +++ b/test/fixtures.http/whoami/success-account.http @@ -12,4 +12,4 @@ x-request-id: 15a7f3a5-7ee5-4e36-ac5a-8c21c2e1fffd x-runtime: 0.141588 strict-transport-security: max-age=31536000 -{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com","plan_identifier":"teams-v1-monthly","created_at":"2015-09-18T23:04:37Z","updated_at":"2016-06-09T20:03:39Z"}}} +{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com","name":"Example Account","plan_identifier":"teams-v1-monthly","created_at":"2015-09-18T23:04:37Z","updated_at":"2016-06-09T20:03:39Z"}}} diff --git a/test/fixtures.http/whoami/success.http b/test/fixtures.http/whoami/success.http index 24b6dc13..8c7650d2 100644 --- a/test/fixtures.http/whoami/success.http +++ b/test/fixtures.http/whoami/success.http @@ -12,4 +12,4 @@ x-request-id: 15a7f3a5-7ee5-4e36-ac5a-8c21c2e1fffd x-runtime: 0.141588 strict-transport-security: max-age=31536000 -{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com","plan_identifier":"teams-v1-monthly","created_at":"2015-09-18T23:04:37Z","updated_at":"2016-06-09T20:03:39Z"}}} +{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com","name":"Example Account","plan_identifier":"teams-v1-monthly","created_at":"2015-09-18T23:04:37Z","updated_at":"2016-06-09T20:03:39Z"}}} From ff9ac1a46042c56a508e6683d87e2b96d3c30828 Mon Sep 17 00:00:00 2001 From: Guillermo Gutierrez Almazor Date: Mon, 13 Apr 2026 09:32:05 +0200 Subject: [PATCH 2/3] Fix domain push parameter name to match API spec Rename new_domain_push_identifier to new_account_identifier to align with the official API parameter name documented in the developer portal. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/dnsimple/domains.ex | 4 ++-- test/dnsimple/domains_test.exs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/dnsimple/domains.ex b/lib/dnsimple/domains.ex index b2b31913..4af8f68e 100644 --- a/lib/dnsimple/domains.ex +++ b/lib/dnsimple/domains.ex @@ -409,10 +409,10 @@ defmodule Dnsimple.Domains do client = %Dnsimple.Client{access_token: "a1b2c3d4"} {:ok, response} = Dnsimple.Domains.initiate_push(client, account_id = 1010, domain_id = "example.com", %{ - new_domain_push_identifier: "abc123", + new_account_identifier: "abc123", }) - Note: `new_account_email` is deprecated in favor of `new_domain_push_identifier`. + Note: `new_account_email` is deprecated in favor of `new_account_identifier`. """ @spec initiate_push(Client.t, String.t | integer, String.t | integer, map, Keyword.t) :: {:ok|:error, Response.t} diff --git a/test/dnsimple/domains_test.exs b/test/dnsimple/domains_test.exs index 386078e6..fe1de1a6 100644 --- a/test/dnsimple/domains_test.exs +++ b/test/dnsimple/domains_test.exs @@ -413,12 +413,12 @@ defmodule Dnsimple.DomainsTest do end - describe ".initiate_push with domain push identifier" do - test "initiates the push using new_domain_push_identifier" do + describe ".initiate_push with account identifier" do + test "initiates the push using new_account_identifier" do url = "#{@client.base_url}/v2/#{@account_id}/domains/#{@domain_id}/pushes" method = "post" fixture = "initiatePush/success.http" - attributes = %{new_domain_push_identifier: "abc123"} + attributes = %{new_account_identifier: "abc123"} body = Poison.encode!(attributes) use_cassette :stub, ExvcrUtils.response_fixture(fixture, method: method, url: url, request_body: body) do From 8e45347cf4d78cb5bc39061142dbe456c67a9b3b Mon Sep 17 00:00:00 2001 From: Guillermo Gutierrez Almazor Date: Tue, 14 Apr 2026 09:12:49 +0200 Subject: [PATCH 3/3] Add CHANGELOG entry for domain push identifier and account name Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e9c7a79..d3c74cd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/), the format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## Unreleased + +### Added + +- Added `new_account_identifier` option to `initiate_push` for initiating domain pushes by account identifier. +- Added `name` to `Account`. + +### Deprecated + +- Deprecated `new_account_email` option in `initiate_push`. Use `new_account_identifier` instead. + ## 8.2.0 - 2026-03-23 ### Added