Skip to content

Conversation

@DagonWat
Copy link
Contributor

@DagonWat DagonWat commented Jan 4, 2026

Motivation

Adding Sending Domains API for Ruby SDK

Changes

  • Adding full API scope

Summary by CodeRabbit

  • New Features

    • Added Sending Domains management: create, list, retrieve, delete, and send DNS setup instructions.
  • Documentation

    • Added a Sending Domains API example reference in the README (Ruby example).
  • Tests

    • Added comprehensive RSpec coverage and VCR fixtures to validate Sending Domains flows and error cases.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 4, 2026

📝 Walkthrough

Walkthrough

Adds Sending Domains support: new SendingDomain struct and Mailtrap::SendingDomainsAPI (list/get/create/delete/send_setup_instructions), an example script, a require in lib/mailtrap.rb, RSpec tests, and VCR fixtures for success and error scenarios.

Changes

Cohort / File(s) Summary
Core API Implementation
lib/mailtrap/sending_domain.rb, lib/mailtrap/sending_domains_api.rb
Adds SendingDomain struct with to_h; implements Mailtrap::SendingDomainsAPI with response_class, supported_options, and methods: list, get, create, delete, send_setup_instructions.
Library integration & Docs
lib/mailtrap.rb, README.md
Registers the new API via require_relative 'mailtrap/sending_domains_api' and adds README references to the Sending Domains example.
Usage Example
examples/sending_domains_api.rb
New Ruby example demonstrating create -> list -> get -> send_setup_instructions -> delete (no error handling).
Domain model tests
spec/mailtrap/sending_domain_spec.rb
Adds specs for SendingDomain including attribute mapping and to_h compacting behavior.
API tests
spec/mailtrap/sending_domains_api_spec.rb
Adds specs for SendingDomainsAPI covering list/get/create/send_setup_instructions/delete and error cases (auth, validation, not found).
VCR Fixtures
spec/fixtures/vcr_cassettes/Mailtrap_SendingDomainsAPI/*
Adds recorded HTTP fixtures for create (ok/error), list (ok/auth error), get (ok/not found), delete (ok/not found), send_setup_instructions (ok/not found).

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant SendingDomainsAPI as Mailtrap::SendingDomainsAPI
  participant MailtrapAPI as mailtrap.io API

  Client->>SendingDomainsAPI: create(sending_domain)
  SendingDomainsAPI->>MailtrapAPI: POST /api/accounts/{account_id}/sending_domains
  MailtrapAPI-->>SendingDomainsAPI: 200 OK (sending_domain JSON)
  SendingDomainsAPI-->>Client: SendingDomain object

  Client->>SendingDomainsAPI: list()
  SendingDomainsAPI->>MailtrapAPI: GET /api/accounts/{account_id}/sending_domains
  MailtrapAPI-->>SendingDomainsAPI: 200 OK [sending_domain...]
  SendingDomainsAPI-->>Client: [SendingDomain objects]

  Client->>SendingDomainsAPI: send_setup_instructions(id, email)
  SendingDomainsAPI->>MailtrapAPI: POST /api/accounts/{account_id}/sending_domains/{id}/send_setup_instructions
  MailtrapAPI-->>SendingDomainsAPI: 204 No Content
  SendingDomainsAPI-->>Client: nil

  Client->>SendingDomainsAPI: delete(id)
  SendingDomainsAPI->>MailtrapAPI: DELETE /api/accounts/{account_id}/sending_domains/{id}
  MailtrapAPI-->>SendingDomainsAPI: 204 No Content
  SendingDomainsAPI-->>Client: nil
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • i7an
  • IgorDobryn

Poem

🐰 I hopped through code to add a domain,
Examples, tests, and fixtures in the lane,
Requests and responses snugly tied,
Methods ready, models verified,
A little rabbit cheers with a hop and a refrain.

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete, missing the 'How to test' section with test checkboxes and the 'Images and GIFs' comparison table required by the template. Add a 'How to test' section with test checkboxes and optionally include the 'Images and GIFs' section as specified in the repository template.
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately describes the main change: adding a new Sending Domains API to the Ruby SDK.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

# => #<struct Mailtrap::SendingDomain id=1, domain_name="proper.com">

# Send setup email
sending_domains.clean(sending_domain.id, '[email protected]')
Copy link
Contributor

Choose a reason for hiding this comment

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

what is clean?

# @attr_reader created_at [String] The creation timestamp
# @attr_reader updated_at [String] The last update timestamp
#
SendingDomain = Struct.new(
Copy link
Contributor

Choose a reason for hiding this comment

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

there are much more fields that our api returns

keyword_init: true
) do
# @return [Hash] The SendingDomain attributes as a hash
def to_h
Copy link
Contributor

Choose a reason for hiding this comment

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

rm

class SendingDomainsAPI
include BaseAPI

self.supported_options = %i[domain_name]
Copy link
Contributor

Choose a reason for hiding this comment

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

minor. Domain name can be specified only on creation. I'd maybe considered specifying it explicitly when calling base_create.

# @return nil
# @!macro api_errors
def send_setup_instructions(domain_id, email)
client.post("#{base_path}/#{domain_id}/send_setup_instructions", { email: email })
Copy link
Contributor

Choose a reason for hiding this comment

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

handle the response

# @param email [String] The email for instructions
# @return nil
# @!macro api_errors
def send_setup_instructions(domain_id, email)
Copy link
Contributor

Choose a reason for hiding this comment

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

lets use kwargs for email for consistency. see list(email: nil) in suppressions api

end
end

describe '#to_h' do
Copy link
Contributor

Choose a reason for hiding this comment

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

rm

@i7an i7an marked this pull request as draft January 7, 2026 16:36
Base automatically changed from add-projects-api to main January 13, 2026 12:35
@DagonWat DagonWat marked this pull request as ready for review January 27, 2026 12:29
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@examples/sending_domains_api.rb`:
- Around line 23-25: The example calls the wrong method: replace the call to
sending_domains.clean with sending_domains.send_setup_instructions so it matches
the API spec; update the invocation that currently passes sending_domain.id and
'[email protected]' to call send_setup_instructions(sending_domain.id,
'[email protected]') and ensure the example comment remains accurate.
- Line 5: The example instantiates the wrong API class: replace the
instantiation of Mailtrap::InboxesAPI with Mailtrap::SendingDomainsAPI for the
sending_domains variable so it uses the correct client; update the line that
creates sending_domains (currently referencing Mailtrap::InboxesAPI) to use
Mailtrap::SendingDomainsAPI while keeping the account_id and client arguments
unchanged.

In
`@spec/fixtures/vcr_cassettes/Mailtrap_SendingDomainsAPI/_send_setup_instructions/returns_nil.yml`:
- Around line 6-8: The cassette contains a real developer email in the recorded
request body; replace the literal string "[email protected]" in
the fixture content
(spec/fixtures/vcr_cassettes/Mailtrap_SendingDomainsAPI/_send_setup_instructions/returns_nil.yml
— the body.string value) with an anonymized test address like "[email protected]"
to remove PII while preserving the fixture structure.

In
`@spec/fixtures/vcr_cassettes/Mailtrap_SendingDomainsAPI/_send_setup_instructions/when_sending_domain_does_not_exist/raises_not_found_error.yml`:
- Around line 6-8: The fixture contains a real email in the VCR cassette
body.string; update the value '{"email":"[email protected]"}'
to use a placeholder/test address (e.g. [email protected]) so the body.string
entry in the Mailtrap_SendingDomainsAPI cassette no longer exposes a real
developer email.
🧹 Nitpick comments (4)
lib/mailtrap/sending_domains_api.rb (1)

53-55: Consider validating the email parameter.

The email parameter is sent directly without validation. While the server will reject invalid input, adding client-side validation would provide a better developer experience with immediate feedback.

♻️ Optional: Add email presence validation
 def send_setup_instructions(domain_id, email)
+  raise ArgumentError, 'email is required' if email.nil? || email.to_s.strip.empty?
+
   client.post("#{base_path}/#{domain_id}/send_setup_instructions", { email: email })
 end
spec/mailtrap/sending_domain_spec.rb (2)

33-42: Remove unused project variable.

The project variable is defined but never used in the test. The actual test uses sending_domain defined in the context block. This appears to be leftover code, possibly from copy-paste.

🧹 Proposed fix to remove dead code
   describe '#to_h' do
     subject(:hash) { sending_domain.to_h }
 
-    let(:project) do
-      described_class.new(
-        id: '123456',
-        domain_name: 'My Sending Domain',
-        dns_verified: false,
-        compliance_status: 'pending',
-        created_at: '2024-01-01T00:00:00Z',
-        updated_at: '2024-01-02T00:00:00Z'
-      )
-    end
-
     context 'when some attributes are nil' do

44-64: Consider adding test coverage for to_h when all attributes are present.

The #to_h tests only cover the case when some attributes are nil. Consider adding a test case verifying that all attributes are included in the hash when none are nil.

💡 Suggested additional test case
context 'when all attributes are present' do
  let(:sending_domain) do
    described_class.new(
      id: '123456',
      domain_name: 'My Sending Domain',
      dns_verified: false,
      compliance_status: 'pending',
      created_at: '2024-01-01T00:00:00Z',
      updated_at: '2024-01-02T00:00:00Z'
    )
  end

  it 'returns a hash with all attributes' do
    expect(hash).to eq(
      id: '123456',
      domain_name: 'My Sending Domain',
      dns_verified: false,
      compliance_status: 'pending',
      created_at: '2024-01-01T00:00:00Z',
      updated_at: '2024-01-02T00:00:00Z'
    )
  end
end
spec/mailtrap/sending_domains_api_spec.rb (1)

125-127: Test description doesn't match the expectation.

The test is named 'returns deleted sending domain data' but it expects nil. Consider renaming to accurately describe the behavior, such as 'returns nil on successful deletion'.

📝 Proposed fix
-    it 'returns deleted sending domain data' do
+    it 'returns nil on successful deletion' do
       expect(delete).to be_nil
     end

Comment on lines 6 to 8
body:
encoding: UTF-8
string: '{"email":"[email protected]"}'
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Same privacy concern: consider anonymizing the email address.

As noted in the other cassette, replace the developer email with a test email like [email protected].

🤖 Prompt for AI Agents
In
`@spec/fixtures/vcr_cassettes/Mailtrap_SendingDomainsAPI/_send_setup_instructions/returns_nil.yml`
around lines 6 - 8, The cassette contains a real developer email in the recorded
request body; replace the literal string "[email protected]" in
the fixture content
(spec/fixtures/vcr_cassettes/Mailtrap_SendingDomainsAPI/_send_setup_instructions/returns_nil.yml
— the body.string value) with an anonymized test address like "[email protected]"
to remove PII while preserving the fixture structure.

Comment on lines 6 to 8
body:
encoding: UTF-8
string: '{"email":"[email protected]"}'
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider anonymizing the email address in test fixtures.

The request body contains what appears to be a real developer email address. For privacy and to avoid potential spam, consider replacing it with a test/placeholder email like [email protected].

🤖 Prompt for AI Agents
In
`@spec/fixtures/vcr_cassettes/Mailtrap_SendingDomainsAPI/_send_setup_instructions/when_sending_domain_does_not_exist/raises_not_found_error.yml`
around lines 6 - 8, The fixture contains a real email in the VCR cassette
body.string; update the value '{"email":"[email protected]"}'
to use a placeholder/test address (e.g. [email protected]) so the body.string
entry in the Mailtrap_SendingDomainsAPI cassette no longer exposes a real
developer email.

@DagonWat DagonWat force-pushed the MT-19854-sending-domains branch from c5248e9 to 465d4f4 Compare January 27, 2026 17:03
@DagonWat DagonWat changed the base branch from main to coderabbit-config January 27, 2026 17:04
@DagonWat
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 27, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@DagonWat DagonWat requested review from IgorDobryn and i7an January 27, 2026 17:09
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@examples/sending_domains_api.rb`:
- Around line 23-25: Replace the real-looking example email passed to
sending_domains.send_setup_instructions (call site uses sending_domain.id and
'[email protected]') with a non-real placeholder such as '[email protected]' or
'[email protected]' so the example stays safe and generic; update the argument
to the send_setup_instructions call accordingly.
- Around line 15-17: Add a public update wrapper to SendingDomainsAPI so
examples calling sending_domains.update(...) don't raise NoMethodError:
implement a method named update in the SendingDomainsAPI class that accepts
domain_id and options and delegates to the existing base_update(domain_id,
options), matching other API operation wrappers.

In `@lib/mailtrap/sending_domain.rb`:
- Around line 4-25: The SendingDomain DTO (Struct named SendingDomain) omits API
fields and silently drops data; add :dns_records, :dns_verified_at, and
:permissions to the Struct.new(...) declaration (keeping keyword_init: true) so
incoming API responses map fully to the DTO, and ensure the existing to_h method
continues to return the compacted hash of all attributes.

In
`@spec/fixtures/vcr_cassettes/Mailtrap_SendingDomainsAPI/_get/when_sending_domain_does_not_exist/raises_not_found_error.yml`:
- Around line 5-70: The cassette contains sensitive account and trace/request
IDs (e.g. account "1111111" in the URI and X-Request-Id / X-Cloud-Trace-Context
/ Cf-Ray headers) — update your VCR configuration (e.g. in your VCR.configure
block in spec helper or spec/support/vcr.rb) to scrub these before recording:
add VCR.filter_sensitive_data('<ACCOUNT_ID>') { '1111111' } or a regex-based
replacement for account IDs in request URIs, and add filters or a before_record
hook to replace header values like X-Request-Id, X-Cloud-Trace-Context and
Cf-Ray with placeholders (e.g. '<X_REQUEST_ID>', '<TRACE_CONTEXT>', '<CF_RAY>');
re-run tests to regenerate the cassette with redacted values and commit the
updated fixture
(spec/fixtures/vcr_cassettes/Mailtrap_SendingDomainsAPI/_get/when_sending_domain_does_not_exist/raises_not_found_error.yml).
🧹 Nitpick comments (1)
spec/mailtrap/sending_domains_api_spec.rb (1)

9-27: Consider asserting additional mapped fields.

Once the DTO includes dns_records and permissions, it would be valuable to assert these in the list mapping so regressions are caught early.

Comment on lines +4 to +25
# Data Transfer Object for Sending Domain
# @see https://docs.mailtrap.io/developers/management/sending-domains
# @attr_reader id [Integer] The sending domain ID
# @attr_reader domain_name [String] The sending domain name
# @attr_reader dns_verified [Boolean] Whether the DNS is verified
# @attr_reader compliance_status [String] The compliance status
# @attr_reader created_at [String] The creation timestamp
# @attr_reader updated_at [String] The last update timestamp
#
SendingDomain = Struct.new(
:id,
:domain_name,
:dns_verified,
:compliance_status,
:created_at,
:updated_at,
keyword_init: true
) do
# @return [Hash] The SendingDomain attributes as a hash
def to_h
super.compact
end
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Mailtrap Sending Domains API GET response fields documentation

💡 Result:

Mailtrap documents the GET Sending Domains response schema on the “Sending Domains” Management API page—expand “Show properties” under the 200 → Response object[] section to see the full list of fields returned for each sending domain object. [1]

If you need the schema in a machine-readable form (e.g., for client generation), Mailtrap also publishes their OpenAPI specifications and links to the public GitHub repository from the OpenAPI Specs page. [2]

Relevant docs pages:

  • GET https://mailtrap.io/api/accounts/{account_id}/sending_domains (response: object[]) [1]
  • GET https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id} (response: object) [1]
  • OpenAPI Specs (link to the OpenAPI repository) [2]

Sources: [1] [2]


🏁 Script executed:

# Search for fixtures or test files that might contain SendingDomain data
find . -type f \( -name "*fixture*" -o -name "*test*" -o -name "*.json" \) | head -20

Repository: mailtrap/mailtrap-ruby

Length of output: 48


🏁 Script executed:

# Look for references to SendingDomain in the codebase to see how it's used
rg "SendingDomain" -t rb --context 3

Repository: mailtrap/mailtrap-ruby

Length of output: 92


🏁 Script executed:

# Check if there are any API response examples or specs
find . -type f -name "*.rb" | xargs grep -l "dns_records\|permissions\|dns_verified_at" | head -10

Repository: mailtrap/mailtrap-ruby

Length of output: 214


🏁 Script executed:

# Search for sending_domain related files
find . -type f -name "*sending_domain*"

Repository: mailtrap/mailtrap-ruby

Length of output: 471


🏁 Script executed:

# Search for fixture files or test data directories
find . -type d -name "fixtures" -o -type d -name "spec" | head -10

Repository: mailtrap/mailtrap-ruby

Length of output: 88


🏁 Script executed:

# Look for YAML or JSON files that might contain API response examples
find . -type f \( -name "*.yml" -o -name "*.yaml" -o -name "*.json" \) | grep -E "(fixture|spec|test)" | head -20

Repository: mailtrap/mailtrap-ruby

Length of output: 2430


🏁 Script executed:

# Search for references to the specific fields mentioned in the review
rg "dns_records|permissions|dns_verified_at" --type yaml --type json --type rb

Repository: mailtrap/mailtrap-ruby

Length of output: 92


🏁 Script executed:

# Check the actual file and see if there are any comments or references
cat -n lib/mailtrap/sending_domain.rb

Repository: mailtrap/mailtrap-ruby

Length of output: 1067


🏁 Script executed:

# Read the fixture file to see what fields are actually returned by the API
cat spec/fixtures/vcr_cassettes/Mailtrap_SendingDomainsAPI/_create/maps_response_data_to_sending_domain_object.yml

Repository: mailtrap/mailtrap-ruby

Length of output: 3245


🏁 Script executed:

# Read the spec file to see how SendingDomain is used
cat spec/mailtrap/sending_domain_spec.rb

Repository: mailtrap/mailtrap-ruby

Length of output: 1826


🏁 Script executed:

# Check the SendingDomainsAPI implementation to see how it maps data
cat spec/mailtrap/sending_domains_api_spec.rb

Repository: mailtrap/mailtrap-ruby

Length of output: 4198


🏁 Script executed:

# Let's check the SendingDomainsAPI implementation to see how it maps the response
cat -n lib/mailtrap/sending_domains_api.rb | head -100

Repository: mailtrap/mailtrap-ruby

Length of output: 2354


🏁 Script executed:

# Check if there's any mapping/conversion happening in the API layer
rg "SendingDomain" lib/ -A 5 -B 5 | head -100

Repository: mailtrap/mailtrap-ruby

Length of output: 3611


DTO is missing API fields that cause data loss: dns_records, dns_verified_at, permissions.

The API response includes these fields, but the struct definition omits them. When API responses are mapped to the struct, these values are dropped silently. Add them to maintain full API scope.

🧩 Proposed fix
-  # `@attr_reader` compliance_status [String] The compliance status
+  # `@attr_reader` compliance_status [String] The compliance status
+  # `@attr_reader` dns_records [Array<Hash>] DNS records
+  # `@attr_reader` permissions [Hash] Permissions (can_read, can_update, can_destroy)
+  # `@attr_reader` dns_verified_at [String] DNS verification timestamp
   # `@attr_reader` created_at [String] The creation timestamp
   # `@attr_reader` updated_at [String] The last update timestamp
   #
   SendingDomain = Struct.new(
     :id,
     :domain_name,
     :dns_verified,
     :compliance_status,
+    :dns_records,
+    :permissions,
+    :dns_verified_at,
     :created_at,
     :updated_at,
     keyword_init: true
   ) do
🤖 Prompt for AI Agents
In `@lib/mailtrap/sending_domain.rb` around lines 4 - 25, The SendingDomain DTO
(Struct named SendingDomain) omits API fields and silently drops data; add
:dns_records, :dns_verified_at, and :permissions to the Struct.new(...)
declaration (keeping keyword_init: true) so incoming API responses map fully to
the DTO, and ensure the existing to_h method continues to return the compacted
hash of all attributes.

Comment on lines +5 to +70
uri: https://mailtrap.io/api/accounts/1111111/sending_domains/-1
body:
encoding: US-ASCII
string: ''
headers:
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
User-Agent:
- mailtrap-ruby (https://github.com/mailtrap/mailtrap-ruby)
Host:
- mailtrap.io
Authorization:
- Bearer <BEARER_TOKEN>
Content-Type:
- application/json
response:
status:
code: 404
message: Not Found
headers:
Date:
- Sun, 04 Jan 2026 16:24:02 GMT
Content-Type:
- application/json; charset=utf-8
Transfer-Encoding:
- chunked
Connection:
- keep-alive
Server:
- cloudflare
X-Frame-Options:
- SAMEORIGIN
X-Xss-Protection:
- 1; mode=block
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Permitted-Cross-Domain-Policies:
- none
Referrer-Policy:
- strict-origin-when-cross-origin
Vary:
- Accept
X-Mailtrap-Version:
- v2
X-Ratelimit-Limit:
- '150'
X-Ratelimit-Remaining:
- '148'
Cache-Control:
- no-cache
X-Request-Id:
- 0b7c9190-ce7f-4a83-b2c9-2b3c416747a5
X-Runtime:
- '0.016330'
X-Cloud-Trace-Context:
- 6497608d8e4442a3cb0403a7a8635ef8;o=0
Strict-Transport-Security:
- max-age=0
Cf-Cache-Status:
- DYNAMIC
Cf-Ray:
- 9b8c1574b858e98a-FRA
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Redact internal identifiers from the cassette.

Line 5 and Line 59–70 contain account and trace/request IDs that can be sensitive. Please scrub them via VCR filters to avoid leaking internal identifiers.

🛡️ Proposed redaction
-    uri: https://mailtrap.io/api/accounts/1111111/sending_domains/-1
+    uri: https://mailtrap.io/api/accounts/<ACCOUNT_ID>/sending_domains/-1
...
-      X-Request-Id:
-      - 0b7c9190-ce7f-4a83-b2c9-2b3c416747a5
+      X-Request-Id:
+      - <REQUEST_ID>
...
-      X-Cloud-Trace-Context:
-      - 6497608d8e4442a3cb0403a7a8635ef8;o=0
+      X-Cloud-Trace-Context:
+      - <TRACE_CONTEXT>
...
-      Cf-Ray:
-      - 9b8c1574b858e98a-FRA
+      Cf-Ray:
+      - <CF_RAY>

As per coding guidelines, please scrub potentially sensitive identifiers.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uri: https://mailtrap.io/api/accounts/1111111/sending_domains/-1
body:
encoding: US-ASCII
string: ''
headers:
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
User-Agent:
- mailtrap-ruby (https://github.com/mailtrap/mailtrap-ruby)
Host:
- mailtrap.io
Authorization:
- Bearer <BEARER_TOKEN>
Content-Type:
- application/json
response:
status:
code: 404
message: Not Found
headers:
Date:
- Sun, 04 Jan 2026 16:24:02 GMT
Content-Type:
- application/json; charset=utf-8
Transfer-Encoding:
- chunked
Connection:
- keep-alive
Server:
- cloudflare
X-Frame-Options:
- SAMEORIGIN
X-Xss-Protection:
- 1; mode=block
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Permitted-Cross-Domain-Policies:
- none
Referrer-Policy:
- strict-origin-when-cross-origin
Vary:
- Accept
X-Mailtrap-Version:
- v2
X-Ratelimit-Limit:
- '150'
X-Ratelimit-Remaining:
- '148'
Cache-Control:
- no-cache
X-Request-Id:
- 0b7c9190-ce7f-4a83-b2c9-2b3c416747a5
X-Runtime:
- '0.016330'
X-Cloud-Trace-Context:
- 6497608d8e4442a3cb0403a7a8635ef8;o=0
Strict-Transport-Security:
- max-age=0
Cf-Cache-Status:
- DYNAMIC
Cf-Ray:
- 9b8c1574b858e98a-FRA
uri: https://mailtrap.io/api/accounts/<ACCOUNT_ID>/sending_domains/-1
body:
encoding: US-ASCII
string: ''
headers:
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
User-Agent:
- mailtrap-ruby (https://github.com/mailtrap/mailtrap-ruby)
Host:
- mailtrap.io
Authorization:
- Bearer <BEARER_TOKEN>
Content-Type:
- application/json
response:
status:
code: 404
message: Not Found
headers:
Date:
- Sun, 04 Jan 2026 16:24:02 GMT
Content-Type:
- application/json; charset=utf-8
Transfer-Encoding:
- chunked
Connection:
- keep-alive
Server:
- cloudflare
X-Frame-Options:
- SAMEORIGIN
X-Xss-Protection:
- 1; mode=block
X-Content-Type-Options:
- nosniff
X-Download-Options:
- noopen
X-Permitted-Cross-Domain-Policies:
- none
Referrer-Policy:
- strict-origin-when-cross-origin
Vary:
- Accept
X-Mailtrap-Version:
- v2
X-Ratelimit-Limit:
- '150'
X-Ratelimit-Remaining:
- '148'
Cache-Control:
- no-cache
X-Request-Id:
- <REQUEST_ID>
X-Runtime:
- '0.016330'
X-Cloud-Trace-Context:
- <TRACE_CONTEXT>
Strict-Transport-Security:
- max-age=0
Cf-Cache-Status:
- DYNAMIC
Cf-Ray:
- <CF_RAY>
🤖 Prompt for AI Agents
In
`@spec/fixtures/vcr_cassettes/Mailtrap_SendingDomainsAPI/_get/when_sending_domain_does_not_exist/raises_not_found_error.yml`
around lines 5 - 70, The cassette contains sensitive account and trace/request
IDs (e.g. account "1111111" in the URI and X-Request-Id / X-Cloud-Trace-Context
/ Cf-Ray headers) — update your VCR configuration (e.g. in your VCR.configure
block in spec helper or spec/support/vcr.rb) to scrub these before recording:
add VCR.filter_sensitive_data('<ACCOUNT_ID>') { '1111111' } or a regex-based
replacement for account IDs in request URIs, and add filters or a before_record
hook to replace header values like X-Request-Id, X-Cloud-Trace-Context and
Cf-Ray with placeholders (e.g. '<X_REQUEST_ID>', '<TRACE_CONTEXT>', '<CF_RAY>');
re-run tests to regenerate the cassette with redacted values and commit the
updated fixture
(spec/fixtures/vcr_cassettes/Mailtrap_SendingDomainsAPI/_get/when_sending_domain_does_not_exist/raises_not_found_error.yml).

@DagonWat DagonWat mentioned this pull request Jan 28, 2026
@i7an i7an force-pushed the coderabbit-config branch from 3b328ba to aae72b7 Compare January 28, 2026 14:40
Base automatically changed from coderabbit-config to main January 28, 2026 14:49
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@examples/sending_domains_api.rb`:
- Around line 15-17: Update the stale example comment after the call to
sending_domains.get so it reflects the actual created domain; replace
domain_name="proper.com" with domain_name="example.com" (or remove the example
output line) to match the created resource and avoid confusion—look for the
sending_domain variable and the sending_domains.get(sending_domain.id) call to
locate the line to change.

Comment on lines +15 to +17
# Get sending domain
sending_domain = sending_domains.get(sending_domain.id)
# => #<struct Mailtrap::SendingDomain id=1, domain_name="proper.com">
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Stale comment shows incorrect domain name.

The comment on line 17 indicates domain_name="proper.com", but the domain was created with "example.com" on line 8. This appears to be a leftover from a removed update operation and will confuse readers.

✏️ Proposed fix
 # Get sending domain
 sending_domain = sending_domains.get(sending_domain.id)
-# => #<struct Mailtrap::SendingDomain id=1, domain_name="proper.com">
+# => #<struct Mailtrap::SendingDomain id=1, domain_name="example.com">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Get sending domain
sending_domain = sending_domains.get(sending_domain.id)
# => #<struct Mailtrap::SendingDomain id=1, domain_name="proper.com">
# Get sending domain
sending_domain = sending_domains.get(sending_domain.id)
# => #<struct Mailtrap::SendingDomain id=1, domain_name="example.com">
🤖 Prompt for AI Agents
In `@examples/sending_domains_api.rb` around lines 15 - 17, Update the stale
example comment after the call to sending_domains.get so it reflects the actual
created domain; replace domain_name="proper.com" with domain_name="example.com"
(or remove the example output line) to match the created resource and avoid
confusion—look for the sending_domain variable and the
sending_domains.get(sending_domain.id) call to locate the line to change.

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.

4 participants