Update sandboxes api#103
Conversation
📝 WalkthroughWalkthroughTwo new public methods are added to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@spec/fixtures/vcr_cassettes/Mailtrap_InboxesAPI/_reset_email_username/returns_Inbox_object.yml`:
- Around line 71-73: The cassette payload contains real account-identifying
fields: replace the values for "username" and "forward_from_email_address"
inside the JSON string (the value of the "string" field) with synthetic/redacted
values (e.g. "username":"redacted_user" and
"forward_from_email_address":"redacted@example.com") so the fixture no longer
contains PII; update any similar fields like "email_username" if needed and keep
the JSON structure intact.
In
`@spec/fixtures/vcr_cassettes/Mailtrap_InboxesAPI/_toggle_email_username/returns_Inbox_object.yml`:
- Around line 71-73: The recorded response in the fixture string contains real
identity fields ("username" and "forward_from_email_address"); update the
serialized JSON in the fixture (the string value containing "username":
"railsware" and "forward_from_email_address": "railsware@forward.mailtrap.info")
to use sanitized placeholders (e.g., "username":"REDACTED_USERNAME" and
"forward_from_email_address":"redacted@forward.mailtrap.info") so the cassette
no longer contains real PII while preserving the rest of the Inbox object
structure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 25a3daf8-78d5-42c6-81da-a6c095cce9e9
📒 Files selected for processing (7)
examples/inboxes_api.rblib/mailtrap/inboxes_api.rbspec/fixtures/vcr_cassettes/Mailtrap_InboxesAPI/_reset_email_username/returns_Inbox_object.ymlspec/fixtures/vcr_cassettes/Mailtrap_InboxesAPI/_reset_email_username/when_inbox_does_not_exist/raises_not_found_error.ymlspec/fixtures/vcr_cassettes/Mailtrap_InboxesAPI/_toggle_email_username/returns_Inbox_object.ymlspec/fixtures/vcr_cassettes/Mailtrap_InboxesAPI/_toggle_email_username/when_inbox_does_not_exist/raises_not_found_error.ymlspec/mailtrap/inboxes_api_spec.rb
There was a problem hiding this comment.
Pull request overview
Adds support for two additional Inbox sandbox endpoints in the Ruby SDK and covers them with VCR-backed specs.
Changes:
- Add
toggle_email_usernameandreset_email_usernamemethods toMailtrap::InboxesAPI. - Add RSpec coverage (success + not-found cases) for both new endpoints.
- Add example usage and VCR cassettes for the new requests.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/mailtrap/inboxes_api.rb | Adds two PATCH helpers for toggling/resetting the inbox email username feature. |
| spec/mailtrap/inboxes_api_spec.rb | Adds specs validating returned Inbox attributes and 404 error behavior for the new endpoints. |
| examples/inboxes_api.rb | Demonstrates calling the new API methods. |
| spec/fixtures/vcr_cassettes/Mailtrap_InboxesAPI/_toggle_email_username/when_inbox_does_not_exist/raises_not_found_error.yml | Records 404 response for toggle endpoint. |
| spec/fixtures/vcr_cassettes/Mailtrap_InboxesAPI/_toggle_email_username/returns_Inbox_object.yml | Records 200 response for toggle endpoint. |
| spec/fixtures/vcr_cassettes/Mailtrap_InboxesAPI/_reset_email_username/when_inbox_does_not_exist/raises_not_found_error.yml | Records 404 response for reset endpoint. |
| spec/fixtures/vcr_cassettes/Mailtrap_InboxesAPI/_reset_email_username/returns_Inbox_object.yml | Records 200 response for reset endpoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| handle_response(response) | ||
| end | ||
|
|
||
| # Turn the email address of the inbox on/off |
There was a problem hiding this comment.
The docstring says this toggles the inbox “email address”, but the endpoint/method name indicates it toggles the inbox email username feature (see email_username_enabled). Please adjust the wording to match the actual behavior to avoid confusing API consumers.
| # Turn the email address of the inbox on/off | |
| # Turn the email username of the inbox on/off |
Motivation
Changes
Summary by CodeRabbit
Release Notes