feat: add domain claims endpoints#194
Conversation
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
There was a problem hiding this comment.
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 torecord['name']/record['value']before merging. - In
spec/domain_claims_spec.rb(get/verifyspecs), missing assertions onRequest.newpath and HTTP verb leave room for regressions where calls hit the wrong endpoint without test failures — add explicit path/verb expectations to match thecreatecoverage 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
| puts "Status: #{claim[:status]}" | ||
|
|
||
| record = claim[:record] | ||
| puts "Add this TXT record to prove ownership: #{record[:name]} = #{record[:value]}" if record |
There was a problem hiding this comment.
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.) .
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]) |
There was a problem hiding this comment.
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>
Adds Domains::Claims module with create, get, and verify methods covering the new Domain Claims API:
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.
Resend::Domains::Claimswithcreate,get,verifyfor POST/domains/claim, GET/domains/{domain_id}/claim, POST/domains/{domain_id}/claim/verify.lib/resend.rb.examples/domain_claims.rband specs for all methods.Written for commit cb58805. Summary will update on new commits.