Skip to content

Conversation

@DagonWat
Copy link

@DagonWat DagonWat commented Dec 26, 2025

There were some mistakes in new documentation on Ruby SDK side of things, these changes aim to eliminate it.

Summary by CodeRabbit

  • Documentation
    • Updated API code examples with standardized templated identifiers instead of hard-coded values.
    • Standardized method naming conventions across API samples.
    • Restructured sandbox API usage patterns for clearer integration examples.
    • Reduced coverage for select code samples.

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

@DagonWat DagonWat requested a review from yanchuk December 26, 2025 11:00
@coderabbitai
Copy link

coderabbitai bot commented Dec 26, 2025

📝 Walkthrough

Walkthrough

OpenAPI specification files updated across four APIs to standardize Ruby code samples: replacing hard-coded account IDs (12345) with templated YOUR_ACCOUNT_ID, updating method names (get_all → list), adjusting constructor patterns for account-scoped clients, removing some Ruby sample blocks, and introducing a wrapper API pattern (ProjectsAPI) for sandbox endpoints.

Changes

Cohort / File(s) Summary
Contacts API
specs/contacts.openapi.yml
Replaced hard-coded account ID 12345 with YOUR_ACCOUNT_ID template variable across code samples; updated method names from get_all to list; adjusted constructor calls to use templated account identifier for ContactsAPI, Exports, Imports, Lists, Fields, and Events examples.
Email API
specs/email-api.openapi.yml
Removed Ruby code samples for domain operations (create, list, get, delete, setup-instructions); updated remaining Ruby samples to use YOUR_ACCOUNT_ID instead of numeric IDs; changed method names (get_all → list) in email templates section; added Ruby sample for getting single email template by ID.
General API
specs/general.openapi.yml
Removed multiple Ruby code sample blocks across various endpoint definitions; no changes to other languages or endpoint declarations.
Sandbox API
specs/sandbox.openapi.yml
Replaced direct sandbox API calls (client.sandbox.projects, etc.) with wrapper pattern using ProjectsAPI; updated samples to instantiate ProjectsAPI wrapper and invoke methods via projects.create(...) instead of direct sandbox methods; removed numerous Ruby samples for inbox and message operations; introduced sandbox initialization pattern in JavaScript example.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • .NET examples for Email section #1 — Updates specs/email-api.openapi.yml examples to replace hard-coded account IDs with YOUR_ACCOUNT_ID and align with account-scoped client usage patterns.

Suggested reviewers

  • mklocek
  • yanchuk
  • VladimirTaytor
  • leonid-shevtsov

Poem

🐰 Hopping through YOUR_ACCOUNT_ID dreams,
Old hardcodes gone, like forgotten schemes,
ProjectsAPI wraps the sandbox so neat,
Ruby samples shine, consistent and sweet! 🌱

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately reflects the main changes: removing non-existent/outdated Ruby code examples and updating Ruby SDK usage patterns (account ID placeholders, method naming conventions, wrapper API patterns).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch MT-20066-review-current-open-api-specs-ruby-examples

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.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
specs/sandbox.openapi.yml (1)

1912-1922: Fix Ruby SDK client initialization — incorrect parameters and missing environment variables.

The code sample contains multiple errors:

  1. The Mailtrap::Client.new method does not support sandbox or inbox_id parameters. The SDK expects the inbox ID to be set via the MAILTRAP_TEST_INBOX_ID (or MAILTRAP_INBOX_ID) environment variable for sandbox sending.

  2. The API key must use an environment variable per coding guidelines. Update to ENV['MAILTRAP_API_KEY'] instead of the hardcoded 'YOUR_API_TOKEN'.

  3. Replace TEST_INBOX_ID with ENV['MAILTRAP_TEST_INBOX_ID'] to follow SDK conventions.

The corrected initialization should be:

client = Mailtrap::Client.new(api_key: ENV['MAILTRAP_API_KEY'])

with MAILTRAP_TEST_INBOX_ID environment variable set before the sample runs.

🧹 Nitpick comments (1)
specs/email-api.openapi.yml (1)

1228-1238: Good additions of Ruby samples for UPDATE and DELETE operations.

These new Ruby code samples complete the CRUD operation coverage for email templates. The patterns are consistent with other samples. Note that these samples use EMAIL_TEMPLATE_ID as a constant, which should match the convention established in other samples (some use template_id as a variable).

Consider standardizing the template ID reference across all samples for consistency - either use lowercase template_id as a variable or uppercase EMAIL_TEMPLATE_ID as a constant.

Also applies to: 1311-1321

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c37b21 and 74b5829.

📒 Files selected for processing (4)
  • specs/contacts.openapi.yml
  • specs/email-api.openapi.yml
  • specs/general.openapi.yml
  • specs/sandbox.openapi.yml
💤 Files with no reviewable changes (1)
  • specs/general.openapi.yml
🧰 Additional context used
📓 Path-based instructions (1)
specs/**/*.openapi.yml

📄 CodeRabbit inference engine (CLAUDE.md)

specs/**/*.openapi.yml: Base URLs must never be changed in OpenAPI specs. Use https://send.api.mailtrap.io for transactional emails, https://bulk.api.mailtrap.io for bulk emails, and https://mailtrap.io for all other APIs
All documentation links in OpenAPI specs must be absolute URLs pointing to docs.mailtrap.io, not relative links or help.mailtrap.io
Update contact URLs in spec info blocks to use https://docs.mailtrap.io, not help.mailtrap.io
Use GitBook markdown syntax in OpenAPI description fields, ensuring all blocks are properly closed: {% hint %}...{% endhint %} and {% tab %}...{% endtab %}
Tabs cannot be nested inside details blocks when using GitBook syntax in OpenAPI descriptions
Include code samples in x-codeSamples in this priority order: Node.js, PHP, Python, Ruby, .NET, Java, cURL
Use official Mailtrap SDKs for language-specific code samples in x-codeSamples, with Node.js (mailtrap/mailtrap-nodejs), PHP (railsware/mailtrap-php), Python (railsware/mailtrap-python), and Ruby (railsware/mailtrap-ruby)
Use environment variables for API keys in code samples (e.g., process.env.MAILTRAP_API_KEY)
Validate YAML syntax, OpenAPI 3.1 compliance, base URLs, contact URLs, GitBook blocks, links, and code samples before committing OpenAPI spec changes
Do not use emojis in specification content
Keep OpenAPI descriptions concise and developer-focused, with technical accuracy prioritized
Use custom OpenAPI extensions for GitBook navigation: x-page-title, x-page-icon, x-page-description, x-parent, x-codeSamples, and x-logo
Structure tags with x-page-title, x-page-description, and x-parent for GitBook nested navigation in OpenAPI specs
Use official product naming: 'Email API/SMTP' (can shorten to 'Email API' or 'API/SMTP'), 'Email Sandbox' (can shorten to 'Sandbox'), 'Email Marketing' (can shorten to 'Marketing')

Files:

  • specs/email-api.openapi.yml
  • specs/contacts.openapi.yml
  • specs/sandbox.openapi.yml
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
Repo: mailtrap/mailtrap-openapi PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-23T11:20:58.573Z
Learning: Applies to specs/**/*.openapi.yml : Use official Mailtrap SDKs for language-specific code samples in `x-codeSamples`, with Node.js (mailtrap/mailtrap-nodejs), PHP (railsware/mailtrap-php), Python (railsware/mailtrap-python), and Ruby (railsware/mailtrap-ruby)
Learnt from: CR
Repo: mailtrap/mailtrap-openapi PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-23T11:20:58.573Z
Learning: Applies to specs/**/*.openapi.yml : Update contact URLs in spec `info` blocks to use `https://docs.mailtrap.io`, not help.mailtrap.io
Learnt from: CR
Repo: mailtrap/mailtrap-openapi PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-23T11:20:58.573Z
Learning: Applies to specs/**/*.openapi.yml : Include code samples in `x-codeSamples` in this priority order: Node.js, PHP, Python, Ruby, .NET, Java, cURL
📚 Learning: 2025-12-23T11:20:58.573Z
Learnt from: CR
Repo: mailtrap/mailtrap-openapi PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-23T11:20:58.573Z
Learning: Applies to specs/**/*.openapi.yml : Use official Mailtrap SDKs for language-specific code samples in `x-codeSamples`, with Node.js (mailtrap/mailtrap-nodejs), PHP (railsware/mailtrap-php), Python (railsware/mailtrap-python), and Ruby (railsware/mailtrap-ruby)

Applied to files:

  • specs/email-api.openapi.yml
  • specs/contacts.openapi.yml
  • specs/sandbox.openapi.yml
📚 Learning: 2025-12-23T11:20:58.573Z
Learnt from: CR
Repo: mailtrap/mailtrap-openapi PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-23T11:20:58.573Z
Learning: Applies to specs/**/*.openapi.yml : Update contact URLs in spec `info` blocks to use `https://docs.mailtrap.io`, not help.mailtrap.io

Applied to files:

  • specs/email-api.openapi.yml
  • specs/contacts.openapi.yml
  • specs/sandbox.openapi.yml
📚 Learning: 2025-12-23T11:20:58.573Z
Learnt from: CR
Repo: mailtrap/mailtrap-openapi PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-23T11:20:58.573Z
Learning: Applies to specs/**/*.openapi.yml : Base URLs must never be changed in OpenAPI specs. Use `https://send.api.mailtrap.io` for transactional emails, `https://bulk.api.mailtrap.io` for bulk emails, and `https://mailtrap.io` for all other APIs

Applied to files:

  • specs/email-api.openapi.yml
📚 Learning: 2025-12-23T11:20:58.573Z
Learnt from: CR
Repo: mailtrap/mailtrap-openapi PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-23T11:20:58.573Z
Learning: Applies to specs/**/*.openapi.yml : Use official product naming: 'Email API/SMTP' (can shorten to 'Email API' or 'API/SMTP'), 'Email Sandbox' (can shorten to 'Sandbox'), 'Email Marketing' (can shorten to 'Marketing')

Applied to files:

  • specs/email-api.openapi.yml
  • specs/sandbox.openapi.yml
📚 Learning: 2025-12-23T11:20:58.573Z
Learnt from: CR
Repo: mailtrap/mailtrap-openapi PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-23T11:20:58.573Z
Learning: Applies to specs/**/*.openapi.yml : Include code samples in `x-codeSamples` in this priority order: Node.js, PHP, Python, Ruby, .NET, Java, cURL

Applied to files:

  • specs/email-api.openapi.yml
  • specs/sandbox.openapi.yml
📚 Learning: 2025-12-23T11:20:58.573Z
Learnt from: CR
Repo: mailtrap/mailtrap-openapi PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-23T11:20:58.573Z
Learning: Applies to specs/**/*.openapi.yml : Use environment variables for API keys in code samples (e.g., `process.env.MAILTRAP_API_KEY`)

Applied to files:

  • specs/email-api.openapi.yml
  • specs/sandbox.openapi.yml
🔇 Additional comments (9)
specs/email-api.openapi.yml (3)

1072-1084: Verify consistency with updated constructor pattern.

The constructor now uses YOUR_ACCOUNT_ID consistently with other Ruby samples. Ensure this matches the verified Ruby SDK pattern once the earlier verification is complete.


1169-1179: Good addition of Ruby sample for GET template by ID.

This new Ruby code sample improves SDK coverage. The pattern is consistent with other Ruby samples using YOUR_ACCOUNT_ID and calling templates.get(template_id). Verify that the get method name matches the official Ruby SDK.

The verification can be done using the same script from the earlier comment to check if the get method exists in the Ruby SDK.


967-973: No changes needed. The code sample is correct per the official mailtrap-ruby SDK:

  • EmailTemplatesAPI.new accepts account_id as the first parameter ✓
  • The method name is list (confirmed from SDK source: def list) ✓
  • YOUR_ACCOUNT_ID is correctly used as a variable placeholder without quotes ✓
specs/contacts.openapi.yml (5)

1221-1227: Verify ContactListsAPI method name change from get_all to list.

Similar to the EmailTemplatesAPI changes, this Ruby sample changes the method name from get_all to list (line 1227). This suggests a consistent API naming convention across the Ruby SDK.

Please verify that:

  1. The list method name is correct for ContactListsAPI
  2. This naming convention is consistent across all *API classes in the Ruby SDK
  3. The constructor pattern ContactListsAPI.new(YOUR_ACCOUNT_ID, client) is correct

The verification script from the earlier comments can be extended to check ContactListsAPI as well.

Based on learnings, use official Mailtrap SDKs for code samples.


1636-1642: Consistent API pattern across ContactFieldsAPI.

The ContactFieldsAPI follows the same pattern as other API classes:

  • Constructor uses YOUR_ACCOUNT_ID (line 1641)
  • Method renamed from get_all to list (line 1642)

This consistency across EmailTemplatesAPI, ContactListsAPI, and ContactFieldsAPI suggests a deliberate SDK-wide naming convention. The changes look correct and maintain consistency.

Based on learnings, use official Mailtrap SDKs for code samples.


497-503: Verify ContactsAPI constructor pattern.

The constructor now uses YOUR_ACCOUNT_ID instead of hard-coded 12345 across multiple ContactsAPI operations. Please verify this matches the official Ruby SDK (railsware/mailtrap-ruby) constructor signature:

Mailtrap::ContactsAPI.new(YOUR_ACCOUNT_ID, client)
#!/bin/bash
# Verify ContactsAPI constructor and methods

# Search for ContactsAPI class definition
rg -n -A10 -B3 'class ContactsAPI' --type=rb

# Check initialize method signature
rg -n 'def initialize' --type=rb -A3 | rg -A3 'ContactsAPI'

Based on learnings, use official Mailtrap SDKs for code samples.

Also applies to: 608-614


1017-1025: Method name create is correct for ContactImportsAPI in mailtrap-ruby SDK.

The Ruby code sample correctly uses the create method. The official mailtrap-ruby SDK at railsware/mailtrap-ruby confirms this is the correct method name and constructor signature: Mailtrap::ContactImportsAPI.new(account_id, client) followed by imports.create(...).


502-502: Remove or correct inaccurate method name change claims.

The Ruby SDK uses list (not get_all) and create (not create_import) as the official method names. The code samples in the spec already align with the official railsware/mailtrap-ruby SDK. Either these method names were never used before, or the original samples were already correct. The review comment incorrectly implies systematic changes from outdated method names to new ones. Verify the actual git diff to confirm what was actually changed before approving.

specs/sandbox.openapi.yml (1)

290-298: Changes are consistent with the new API pattern.

The ProjectsAPI wrapper pattern and list method are consistent with the createProject sample above. This approval is contingent on verifying the SDK API as noted in the previous comment.

Comment on lines +169 to 176
projects = Mailtrap::ProjectsAPI.new(
YOUR_ACCOUNT_ID,
client
)
project = projects.create(
name: 'Example Project'
)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the actual file content around the changed lines
cat -n specs/sandbox.openapi.yml | sed -n '160,180p'

Repository: mailtrap/mailtrap-openapi

Length of output: 712


🏁 Script executed:

# Also check the request body example mentioned (around line 107)
cat -n specs/sandbox.openapi.yml | sed -n '100,115p'

Repository: mailtrap/mailtrap-openapi

Length of output: 676


🏁 Script executed:

# Check all the changed lines mentioned in the comment
cat -n specs/sandbox.openapi.yml | sed -n '285,305p'

Repository: mailtrap/mailtrap-openapi

Length of output: 798


🏁 Script executed:

# Let's also check lines around 1912 and 1922
cat -n specs/sandbox.openapi.yml | sed -n '1905,1930p'

Repository: mailtrap/mailtrap-openapi

Length of output: 1068


🌐 Web query:

mailtrap-ruby ProjectsAPI official SDK documentation

💡 Result:

Here are the official resources for the Mailtrap Ruby SDK and the Projects API documentation:

  • Mailtrap Ruby SDK (official GitHub repo / README). [1]
  • Mailtrap API v2 — Projects endpoints (Projects API reference). [2]

References:
[1] https://github.com/mailtrap/mailtrap-ruby
[2] https://api-docs.mailtrap.io/docs/mailtrap-api-docs/c088109b11d07-get-a-list-of-projects


🏁 Script executed:

# Let's check the official Ruby SDK repository structure and README
curl -s https://api.github.com/repos/railsware/mailtrap-ruby/contents/ | jq -r '.[] | select(.type=="file") | .name' | head -20

Repository: mailtrap/mailtrap-openapi

Length of output: 133


🏁 Script executed:

# Get the README content to check the API documentation
curl -s https://raw.githubusercontent.com/railsware/mailtrap-ruby/main/README.md | head -200

Repository: mailtrap/mailtrap-openapi

Length of output: 6106


🏁 Script executed:

# Let's also check the lib directory structure
curl -s https://api.github.com/repos/railsware/mailtrap-ruby/contents/lib | jq -r '.[] | .name'

Repository: mailtrap/mailtrap-openapi

Length of output: 133


🏁 Script executed:

# Check the Ruby SDK source code to see what API classes are available
curl -s https://raw.githubusercontent.com/railsware/mailtrap-ruby/main/lib/mailtrap.rb | head -100

Repository: mailtrap/mailtrap-openapi

Length of output: 900


🏁 Script executed:

# Look for the ProjectsAPI class definition
curl -s https://api.github.com/repos/railsware/mailtrap-ruby/git/trees/main?recursive=1 | grep -i project

Repository: mailtrap/mailtrap-openapi

Length of output: 51


🏁 Script executed:

# Try to get a list of all files in the lib directory
curl -s "https://api.github.com/repos/railsware/mailtrap-ruby/contents/lib?ref=main" 2>/dev/null | grep -o '"name":"[^"]*"' | head -30

Repository: mailtrap/mailtrap-openapi

Length of output: 51


🌐 Web query:

mailtrap ruby SDK Projects API create list methods

💡 Result:

Short answer: use the Projects endpoints — GET /projects (list) and POST /projects (create). In Mailtrap’s Ruby SDK these map to the Projects API wrapper (methods named like list/get or create depending on version — e.g. a Projects (or ProjectsAPI) client that calls the API’s "get a list of projects" and "create project" endpoints). See Mailtrap API docs for endpoint details and the official Ruby client repo/docs for the SDK usage. [1][2][3]

Sources:

  • Mailtrap API — Get a list of projects / Create project (API v2). [1]
  • Official mailtrap-ruby GitHub repository (official Ruby client). [2]
  • Mailtrap SDK / Ruby integration docs (overview of SDKs and features). [3]

References:
[1] https://api-docs.mailtrap.io/docs/mailtrap-api-docs/c088109b11d07-get-a-list-of-projects and https://api-docs.mailtrap.io/docs/mailtrap-api-docs/ee252e413d78a-create-project
[2] https://github.com/railsware/mailtrap-ruby
[3] https://help.mailtrap.io/article/140-mailtrap-ruby-integration


🏁 Script executed:

# Check if projects_api.rb exists in the Ruby SDK
curl -s "https://api.github.com/repos/railsware/mailtrap-ruby/contents/lib/mailtrap?ref=main" 2>/dev/null | grep -o '"name":"[^"]*"'

Repository: mailtrap/mailtrap-openapi

Length of output: 51


🏁 Script executed:

# Get the email_templates_api.rb as a reference to understand the pattern
curl -s https://raw.githubusercontent.com/railsware/mailtrap-ruby/main/lib/mailtrap/email_templates_api.rb

Repository: mailtrap/mailtrap-openapi

Length of output: 2419


🌐 Web query:

mailtrap-ruby "ProjectsAPI" class

💡 Result:

Do you want the ProjectsAPI class source code, its methods/usage examples, or help using it in your project?


🏁 Script executed:

# Search for any mention of ProjectsAPI in the official Ruby SDK repo
curl -s https://api.github.com/search/code?q=ProjectsAPI+repo:railsware/mailtrap-ruby | grep -o '"name":"[^"]*"' | head -20

Repository: mailtrap/mailtrap-openapi

Length of output: 51


🏁 Script executed:

# Let's check if projects_api.rb file exists at all
curl -s https://raw.githubusercontent.com/railsware/mailtrap-ruby/main/lib/mailtrap/projects_api.rb

Repository: mailtrap/mailtrap-openapi

Length of output: 83


🏁 Script executed:

# Let's look at the actual mailtrap.rb file content more thoroughly to see all requires
curl -s https://raw.githubusercontent.com/railsware/mailtrap-ruby/main/lib/mailtrap.rb

Repository: mailtrap/mailtrap-openapi

Length of output: 900


🌐 Web query:

site:github.com/railsware/mailtrap-ruby ProjectsAPI

💡 Result:

I found the mailtrap/mailtrap-ruby repository on GitHub but there is no ProjectsAPI class/file in that repository. Source: mailtrap/mailtrap-ruby GitHub repo. [1]

[1] https://github.com/mailtrap/mailtrap-ruby


🏁 Script executed:

# Check the Client class to see what methods are available
curl -s https://raw.githubusercontent.com/railsware/mailtrap-ruby/main/lib/mailtrap/client.rb | head -100

Repository: mailtrap/mailtrap-openapi

Length of output: 3728


🏁 Script executed:

# Let's check all files in the lib/mailtrap directory
curl -s "https://api.github.com/repos/railsware/mailtrap-ruby/contents/lib/mailtrap" 2>/dev/null

Repository: mailtrap/mailtrap-openapi

Length of output: 302


🌐 Web query:

mailtrap ruby SDK how to use projects API endpoints

💡 Result:

Do you want (A) a Ruby code example for calling Mailtrap Projects endpoints directly (HTTP), or (B) I should check whether the official mailtrap Ruby gem already implements the Projects (Email‑Sandbox) API and show how to use it?


🏁 Script executed:

# Let's verify the latest release/main branch version by checking gemspec or version
curl -s https://raw.githubusercontent.com/railsware/mailtrap-ruby/main/lib/mailtrap/version.rb

Repository: mailtrap/mailtrap-openapi

Length of output: 139


🏁 Script executed:

# Check if there's any example showing how to use Projects API with the current SDK
curl -s https://raw.githubusercontent.com/railsware/mailtrap-ruby/main/examples/full.rb 2>/dev/null

Repository: mailtrap/mailtrap-openapi

Length of output: 2124


🌐 Web query:

mailtrap ruby SDK v2 how to access projects endpoint API key account management

💡 Result:

Short answer — use the mailtrap gem (API v2) Mailtrap::Client with an API token (Bearer auth). The gem exposes Testing (projects) endpoints via helper classes; API tokens / account-level permissions are created/managed in the Mailtrap UI (Settings → API Tokens).

Example (minimal):

  • Install gem and create client:
    client = Mailtrap::Client.new(api_key: ENV["MAILTRAP_API_KEY"]) # uses your API token. [1]
  • Call the Projects (Email Testing) API (the gem includes examples / Testing APIs — see examples in the repo). For the raw REST API the Projects endpoint is /api/projects (Mailtrap API v2). [1][3]

Where to find docs:

  • mailtrap-ruby repo / usage & examples (shows Mailtrap::Client and examples). [1]
  • Manage/create API tokens and set token permission (Account Admin vs project) in Mailtrap UI: Settings → API Tokens (use token as Bearer Authorization). [2]
  • Mailtrap API v2 Projects endpoint docs (GET a list of projects / API reference). [3]

Sources:
[1] mailtrap/mailtrap-ruby (README, examples).
[2] Mailtrap — API Tokens (Settings → API Tokens; Bearer auth).
[3] Mailtrap API v2 — Get a list of projects (Projects endpoint).


🏁 Script executed:

# Final verification - let's check the most recent releases/tags to ensure we're checking the right version
curl -s "https://api.github.com/repos/railsware/mailtrap-ruby/releases?per_page=5" | grep -o '"tag_name":"[^"]*"'

Repository: mailtrap/mailtrap-openapi

Length of output: 51


🏁 Script executed:

# Let's also verify what the Client class exposes as public methods
curl -s https://raw.githubusercontent.com/railsware/mailtrap-ruby/main/lib/mailtrap/client.rb | grep -E "^\s+def " | head -20

Repository: mailtrap/mailtrap-openapi

Length of output: 779


The Mailtrap::ProjectsAPI class does not exist in the official mailtrap-ruby SDK (v2.5.0).

The updated Ruby samples at lines 169-176 and 290-293 will fail at runtime with a NameError. The mailtrap-ruby gem does not provide a ProjectsAPI wrapper for the Projects endpoints. While the REST API endpoints for projects exist (GET/POST /api/projects), the Ruby SDK does not include a corresponding domain class like it does for EmailTemplatesAPI or ContactsAPI.

Additionally, the sample uses 'Example Project' while the request body example (line 107) specifies 'My New Project'—update the sample to match the documented request body.

🤖 Prompt for AI Agents
In specs/sandbox.openapi.yml around lines 169-176 (and also update the parallel
sample at 290-293), replace the nonexistent Mailtrap::ProjectsAPI usage with a
call that uses the SDK's generic HTTP client to POST to /api/projects (e.g.,
invoke the client to send a POST request to the projects endpoint with a JSON
body). Also change the project name to match the request-body example ("My New
Project") and ensure request/response variable names reflect the raw client call
instead of a ProjectsAPI wrapper.

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.

3 participants