Skip to content

feat: add domain claims endpoints#194

Open
drish wants to merge 1 commit into
mainfrom
feat/domain-claims
Open

feat: add domain claims endpoints#194
drish wants to merge 1 commit into
mainfrom
feat/domain-claims

Conversation

@drish

@drish drish commented Jul 3, 2026

Copy link
Copy Markdown
Member

Adds Domains::Claims module with create, get, and verify methods covering the new Domain Claims API:

  • POST /domains/claim
  • GET /domains/{domain_id}/claim
  • POST /domains/{domain_id}/claim/verify

Summary by cubic

Adds Domain Claims API support to the Ruby SDK, enabling users to claim domains from other accounts, check claim status, and trigger verification. This helps teams transfer domains safely with fresh DNS records.

  • New Features
    • New Resend::Domains::Claims with create, get, verify for POST /domains/claim, GET /domains/{domain_id}/claim, POST /domains/{domain_id}/claim/verify.
    • Auto-required via lib/resend.rb.
    • Added examples/domain_claims.rb and specs for all methods.

Written for commit cb58805. Summary will update on new commits.

Review in cubic

Adds Domains::Claims module with create, get, and verify methods
covering the new Domain Claims API:
- POST /domains/claim
- GET /domains/{domain_id}/claim
- POST /domains/{domain_id}/claim/verify
@drish drish requested a review from joaopcm July 3, 2026 21:18

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 4 files

Confidence score: 4/5

  • In examples/domain_claims.rb, accessing nested response fields with symbol keys can produce blank or incorrect TXT record output in the sample, which may mislead users integrating domain claims — switch to record['name']/record['value'] before merging.
  • In spec/domain_claims_spec.rb (get/verify specs), missing assertions on Request.new path and HTTP verb leave room for regressions where calls hit the wrong endpoint without test failures — add explicit path/verb expectations to match the create coverage and de-risk future changes.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="examples/domain_claims.rb">

<violation number="1" location="examples/domain_claims.rb:19">
P2: This example can print blank/wrong TXT record fields because nested response objects are accessed with symbol keys instead of string keys. Using `record['name']`/`record['value']` keeps the sample aligned with actual response shape.

(Based on your team's feedback about nested response key access conventions.) [FEEDBACK_USED].</violation>
</file>

<file name="spec/domain_claims_spec.rb">

<violation number="1" location="spec/domain_claims_spec.rb:77">
P2: The `get` and `verify` tests don't verify the API path or HTTP verb used by the underlying Request, unlike the `create` tests which have a dedicated assertion for `Request.new` arguments. Adding path/verb expectations for `get` and `verify` would make refactoring safer — for example, catching accidental changes to the URL segment order or the HTTP method.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread examples/domain_claims.rb
puts "Status: #{claim[:status]}"

record = claim[:record]
puts "Add this TXT record to prove ownership: #{record[:name]} = #{record[:value]}" if record

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This example can print blank/wrong TXT record fields because nested response objects are accessed with symbol keys instead of string keys. Using record['name']/record['value'] keeps the sample aligned with actual response shape.

(Based on your team's feedback about nested response key access conventions.) .

View Feedback

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At examples/domain_claims.rb, line 19:

<comment>This example can print blank/wrong TXT record fields because nested response objects are accessed with symbol keys instead of string keys. Using `record['name']`/`record['value']` keeps the sample aligned with actual response shape.

(Based on your team's feedback about nested response key access conventions.) .</comment>

<file context>
@@ -0,0 +1,30 @@
+  puts "Status: #{claim[:status]}"
+
+  record = claim[:record]
+  puts "Add this TXT record to prove ownership: #{record[:name]} = #{record[:value]}" if record
+
+  # Get: poll the claim until the TXT record has been added and verification can run.
</file context>

allow(resp).to receive(:body).and_return(resp)
allow(HTTParty).to receive(:send).and_return(resp)

claim = Resend::Domains::Claims.get(resp[:domain_id])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The get and verify tests don't verify the API path or HTTP verb used by the underlying Request, unlike the create tests which have a dedicated assertion for Request.new arguments. Adding path/verb expectations for get and verify would make refactoring safer — for example, catching accidental changes to the URL segment order or the HTTP method.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At spec/domain_claims_spec.rb, line 77:

<comment>The `get` and `verify` tests don't verify the API path or HTTP verb used by the underlying Request, unlike the `create` tests which have a dedicated assertion for `Request.new` arguments. Adding path/verb expectations for `get` and `verify` would make refactoring safer — for example, catching accidental changes to the URL segment order or the HTTP method.</comment>

<file context>
@@ -0,0 +1,101 @@
+      allow(resp).to receive(:body).and_return(resp)
+      allow(HTTParty).to receive(:send).and_return(resp)
+
+      claim = Resend::Domains::Claims.get(resp[:domain_id])
+
+      expect(claim[:id]).to eql("dacf4072-4119-4d88-932f-6c6126d3a9d1")
</file context>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant