Skip to content

update readme #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

update readme #66

wants to merge 4 commits into from

Conversation

yanchuk
Copy link

@yanchuk yanchuk commented Aug 4, 2025

Updating a readme to have a bit the same structure as https://github.com/railsware/mailtrap-php
with Prerequisites and Supported functionality sections

Summary by CodeRabbit

  • Documentation
    • Expanded and reorganized the README to provide clearer setup instructions, detailed usage examples, and comprehensive feature lists.
    • Added new sections covering prerequisites, supported functionality, and example scripts.
    • Enhanced usage examples, including sending emails, using templates, sandbox testing, and managing contacts.
    • Updated Ruby on Rails integration details and clarified encoding information.
    • Improved formatting and minor syntax corrections for better readability.

@yanchuk yanchuk requested review from leonid-shevtsov and i7an August 4, 2025 16:06
Copy link

coderabbitai bot commented Aug 4, 2025

Walkthrough

The README.md file was extensively rewritten and expanded to provide detailed guidance for the Mailtrap Ruby client. New sections, enhanced usage examples, improved formatting, and clarifications were introduced, covering prerequisites, supported features, installation, usage scenarios, API examples, and encoding details. No code or public API changes were made.

Changes

Cohort / File(s) Change Summary
Documentation Overhaul
README.md
Major expansion and restructuring: added license badge, prerequisites, supported functionality, enhanced usage section with multiple new examples, updated Ruby on Rails and pure Ruby examples, extended Email Templates and Contacts API examples, added multiple Mailtrap clients usage, introduced a comprehensive Examples section, moved and expanded encoding explanation, and improved formatting and syntax throughout.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇
I hopped through README fields anew,
With badges bright and sections true,
Examples sprout, instructions bloom,
For Mailtrap’s Ruby guide, make room!
Now clearer paths for bunnies keen,
To send their mails—so swift, so clean!
📬✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch readme-update

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 0

🧹 Nitpick comments (3)
README.md (3)

24-33: Fix nested-bullet indentation for consistent GitHub rendering

The second-level bullets are indented with two spaces; GitHub-flavoured Markdown only guarantees sub-list rendering when the indent is at least four spaces or one tab. On narrower screens this often collapses into a single list level, reducing readability.

-* **Email API/SMTP**
-  * Send an email (Transactional and Bulk streams)
-  * Send an email with a template
-  * Send a batch of emails (Transactional and Bulk streams)
+* **Email API/SMTP**
+    * Send an email (Transactional and Bulk streams)
+    * Send an email with a template
+    * Send a batch of emails (Transactional and Bulk streams)

(Apply the same 4-space indent to all nested items in Lines 25-33 and 35-43.)


79-88: Avoid using client.send in examples to prevent confusion with Object#send

Because Object#send is a core Ruby method, using the same name in documentation can mislead newcomers and static analyzers.
If the gem exposes an alias such as deliver/deliver_mail, prefer it in docs; otherwise consider clarifying with a comment.

# Prefer an alias if available
client.deliver(
  from: sender,
  
)

93-101: Show environment-based configuration instead of hard-coding secrets

Hard-coded API keys in README snippets risk copy-pasta into production. Demonstrate best practice by fetching from ENV:

# config/environments/production.rb
config.action_mailer.delivery_method = :mailtrap
config.action_mailer.mailtrap_settings = {
  api_key: ENV.fetch("MAILTRAP_API_KEY")
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 022fa3b and b8d70a7.

📒 Files selected for processing (1)
  • README.md (6 hunks)
🔇 Additional comments (1)
README.md (1)

257-261: Confirmed: ContactsAPI#upsert exists

The upsert method is defined in lib/mailtrap/contacts_api.rb (lines 50–53), so the README example is accurate and will not raise a NoMethodError.

@yanchuk yanchuk linked an issue Aug 4, 2025 that may be closed by this pull request
@yanchuk yanchuk requested a review from IgorDobryn August 6, 2025 08:58
Copy link
Contributor

@IgorDobryn IgorDobryn left a comment

Choose a reason for hiding this comment

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

Adjust example before merging, please

README.md Outdated
Comment on lines 75 to 80
TOKEN = "<YOUR-TOKEN-HERE>"
SENDER_EMAIL = "<[email protected]>"
RECIPIENT_EMAIL = "<[email protected]>"

client = Mailtrap::Client.new(api_key: TOKEN)
sender = { name: "Mailtrap Test", email: SENDER_EMAIL }

client.send(
from: sender,
to: [{ email: RECIPIENT_EMAIL }],
subject: "Hello from Mailtrap!",
text: "Welcome to Mailtrap Sending!"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a bit of inconsistency with further examples:

  • we use MAILTRAP_API_KEY. Env var should have special meaning, but anyways better to use same terminology
  • SENDER_EMAIL and RECIPIENT_EMAIL do not have to be constant, in other examples they are not stored into variables at all

Copy link
Author

Choose a reason for hiding this comment

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

hi. makes sense, I did some changes. is it better now?

yanchuk and others added 3 commits August 6, 2025 18:21
- Update title alignment with main branch
- Add API v2 documentation note
- Enhance Email Templates API examples with full CRUD operations
- Improve Contacts API examples with list management methods
- Standardize API key usage: 'your-api-key' for simple examples, ENV.fetch for Rails
- Fix nested bullet point indentation for proper GitHub rendering
- Align examples with actual /examples folder implementations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
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: 0

🔭 Outside diff range comments (1)
README.md (1)

210-231: email_template is undefined – the example will raise NameError

Lines 224-230 reference email_template.id, but the variable is never assigned. Readers copying the snippet will see a runtime failure.

-templates.create(
+email_template = templates.create(
   name: 'Welcome Email',
   ...
 )
 
 # Get a specific template
-templates.get(email_template.id)
+templates.get(email_template.id)

Capturing the return value (or using the ID returned by create) fixes the issue and keeps the workflow clear.

🧹 Nitpick comments (2)
README.md (2)

24-45: Indent nested bullets with 2 spaces to satisfy common Markdown linters

markdownlint (rule MD007) flags the sub-lists under “Supported functionality” because they’re indented by 4 spaces instead of 2. This breaks consistency with the rest of the README and some renderers.

-* **Email API/SMTP**
-    * Send an email (Transactional and Bulk streams)
-    * Send an email with a template
-    * Send a batch of emails (Transactional and Bulk streams)
+* **Email API/SMTP**
+  * Send an email (Transactional and Bulk streams)
+  * Send an email with a template
+  * Send a batch of emails (Transactional and Bulk streams)
   ...

Applying a uniform 2-space indentation across all sub-bullets will silence the linter and improve readability.


65-81: Show environment variable usage consistently across examples

Most later snippets promote ENV.fetch('MAILTRAP_API_KEY'), but the “Minimal” example hard-codes the key. Switching to the env-var form keeps terminology consistent (addressing an earlier review) and discourages committing secrets.

-client = Mailtrap::Client.new(api_key: 'your-api-key')
+client = Mailtrap::Client.new(api_key: ENV.fetch('MAILTRAP_API_KEY'))
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b8d70a7 and 84c3cc9.

📒 Files selected for processing (1)
  • README.md (6 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md

27-27: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


28-28: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


29-29: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


31-31: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


32-32: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


33-33: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


34-34: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


35-35: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


37-37: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


38-38: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


39-39: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


41-41: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


42-42: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


43-43: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


44-44: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


45-45: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)

🔇 Additional comments (1)
README.md (1)

233-275: LGTM – examples are complete and correctly chained

The Contacts API walkthrough covers list, field and contact CRUD in a logical order with valid arguments. Nice improvement over the previous docs.

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: 0

🔭 Outside diff range comments (1)
README.md (1)

220-240: email_template variable is undefined in the Templates API example

templates.create is not assigned to any variable, yet later calls reference email_template.id, which will raise NameError if copied verbatim.

-email_template = templates.create(
+email_template = templates.create(
   name: 'Welcome Email',
   subject: 'Welcome to Mailtrap!',
   body_html: '<h1>Hello</h1>',
   body_text: 'Hello',
   category: 'welcome'
 )
 
 # Get all templates
 templates.list
 
 # Get a specific template
-templates.get(email_template.id)
+templates.get(email_template.id)

Capture the return value (as above) or switch subsequent calls to the correct variable name.

🧹 Nitpick comments (3)
README.md (3)

24-45: Fix list indentation to comply with Markdown style guide

The nested “Supported functionality” bullets are indented 4 spaces instead of the 2-space indentation enforced by markdownlint (MD007). This is purely cosmetic but currently breaks style checks in some CI pipelines.

-* **Email API/SMTP**
-    * Send an email (Transactional and Bulk streams)
-    * Send an email with a template
-    * Send a batch of emails (Transactional and Bulk streams)
-* **Email Sandbox (Testing)**
-    * Send an email
-    * Send an email with a template
-    * Message management
-    * Inbox management
-    * Project management
-* **Contact management**
-    * Contacts CRUD
-    * Lists CRUD
-    * Contact fields CRUD
-* **General**
-    * Templates CRUD
-    * Suppressions management (find and delete)
-    * Account access management
-    * Permissions management
-    * List accounts you have access to
+* **Email API/SMTP**
+  * Send an email (Transactional and Bulk streams)
+  * Send an email with a template
+  * Send a batch of emails (Transactional and Bulk streams)
+* **Email Sandbox (Testing)**
+  * Send an email
+  * Send an email with a template
+  * Message management
+  * Inbox management
+  * Project management
+* **Contact management**
+  * Contacts CRUD
+  * Lists CRUD
+  * Contact fields CRUD
+* **General**
+  * Templates CRUD
+  * Suppressions management (find and delete)
+  * Account access management
+  * Permissions management
+  * List accounts you have access to

68-71: Unify bullet style (“*” vs “-”)

The README mostly uses * but this list uses -, triggering MD004. Switching to asterisks keeps the formatting consistent.

- - A [Mailtrap account](https://mailtrap.io/signup)
- - A [verified domain](https://mailtrap.io/sending/domains) 
- - An API key from your Mailtrap dashboard
+* A [Mailtrap account](https://mailtrap.io/signup)
+* A [verified domain](https://mailtrap.io/sending/domains) 
+* An API key from your Mailtrap dashboard

85-92: Discourage hard-coding secrets in examples

The minimal example still inlines "your-api-key". All earlier guidance encourages using the MAILTRAP_API_KEY env var, so the snippet should follow the same pattern to avoid encouraging bad practice.

-client = Mailtrap::Client.new(api_key: 'your-api-key')
+client = Mailtrap::Client.new(api_key: ENV.fetch('MAILTRAP_API_KEY'))
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84c3cc9 and b86448a.

📒 Files selected for processing (1)
  • README.md (5 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md

27-27: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


28-28: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


29-29: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


31-31: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


32-32: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


33-33: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


34-34: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


35-35: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


37-37: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


38-38: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


39-39: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


41-41: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


42-42: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


43-43: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


44-44: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


45-45: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)


68-68: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


69-69: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


70-70: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)

@yanchuk yanchuk requested a review from IgorDobryn August 6, 2025 16:54
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.

Update Readme with Example and SDK functionality list
2 participants