-
Notifications
You must be signed in to change notification settings - Fork 7
Update readme for similar format to other Mailtrap SDKs #79
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
DagonWat
wants to merge
3
commits into
add-projects-api
Choose a base branch
from
update-readme-for-similar-format
base: add-projects-api
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,21 @@ | ||
| # Mailtrap Ruby client - Official | ||
|
|
||
|  | ||
| [](https://github.com/mailtrap/mailtrap-ruby/actions/workflows/main.yml) | ||
| [](https://rubydoc.info/gems/mailtrap) | ||
| [](https://rubygems.org/gems/mailtrap) | ||
| [](https://rubygems.org/gems/mailtrap) | ||
|
|
||
| This client uses API v2, for v1 refer to [this documentation](https://mailtrap.docs.apiary.io/) | ||
|
|
||
|
|
||
| # Official Mailtrap Ruby client | ||
| ## Prerequisites | ||
|
|
||
| This Ruby gem offers integration with the [official API](https://api-docs.mailtrap.io/) for [Mailtrap](https://mailtrap.io). | ||
| To get the most out of this official Mailtrap.io Ruby SDK: | ||
|
|
||
| Quickly add email sending functionality to your Ruby application with Mailtrap. | ||
| - [Create a Mailtrap account](https://mailtrap.io/signup) | ||
|
|
||
| (This client uses API v2, for v1 refer to [this documentation](https://mailtrap.docs.apiary.io/)) | ||
| - [Verify your domain](https://mailtrap.io/sending/domains) | ||
|
|
||
| ## Installation | ||
|
|
||
|
|
@@ -105,16 +109,26 @@ client.send_batch( | |
| ) | ||
| ``` | ||
|
|
||
| ### Usage Examples | ||
| ### Sandbox Sending | ||
|
|
||
| Refer to the [`examples`](examples) folder for more examples: | ||
| Send emails to your Sandbox for testing purposes: | ||
|
|
||
| ```ruby | ||
| require 'mailtrap' | ||
|
|
||
| - [Full](examples/full.rb) | ||
| - [Email template](examples/email_template.rb) | ||
| - [Batch Sending](examples/batch.rb) | ||
| - [ActionMailer](examples/action_mailer.rb) | ||
| - [Email Templates API](examples/email_templates_api.rb) | ||
| - [Projects API](examples/projects_api.rb) | ||
| client = Mailtrap::Client.new(api_key: 'your-api-key', sandbox: true, inbox_id: YOUR_INBOX_ID) | ||
| client.send(mail) | ||
|
|
||
| # You can also pass the request parameters directly | ||
| client.send( | ||
| from: { email: '[email protected]', name: 'Mailtrap Test' }, | ||
| to: [ | ||
| { email: '[email protected]' } | ||
| ], | ||
| subject: 'You are awesome!', | ||
| text: 'Congrats for sending test email with Mailtrap!' | ||
| ) | ||
| ``` | ||
|
|
||
| ### Content-Transfer-Encoding | ||
|
|
||
|
|
@@ -134,7 +148,7 @@ configuration example. | |
|
|
||
| You can configure two Mailtrap clients to operate simultaneously. This setup is | ||
| particularly useful when you need to send emails using both the transactional | ||
| and bulk APIs. Refer to the configuration example below: | ||
| and bulk APIs. Refer to the configuration examples below. | ||
|
|
||
| ```ruby | ||
| # config/application.rb | ||
|
|
@@ -154,12 +168,39 @@ config.action_mailer.mailtrap_bulk_settings = { | |
| mail(delivery_method: :mailtrap_bulk) | ||
| ``` | ||
|
|
||
| ## Supported functionality & Examples | ||
|
|
||
| Refer to the [`examples`](examples) folder for more examples: | ||
|
|
||
| Email API: | ||
| - Full email sending – [`full.rb`](examples/full.rb) | ||
|
|
||
| - Batch sending – [`batch.rb`](examples/batch.rb) | ||
|
|
||
| Email Sandbox (Testing): | ||
|
|
||
| - Project management CRUD – [`projects_api.rb`](examples/projects_api.rb) | ||
|
|
||
| Contact management: | ||
|
|
||
| - Contacts CRUD & listing – [`contacts_api.rb`](examples/contacts_api.rb) | ||
|
|
||
| General API: | ||
|
|
||
| - Templates CRUD – [`email_templates_api.rb`](examples/email_templates_api.rb) | ||
|
|
||
| - Action Mailer – [`action_mailer.rb`](examples/action_mailer.rb) | ||
|
|
||
| ## Migration guide v1 → v2 | ||
|
|
||
| Change `Mailtrap::Sending::Client` to `Mailtrap::Client`. | ||
|
|
||
| If you use classes which have `Sending` namespace, remove the namespace like in the example above. | ||
|
|
||
| ## Contributing | ||
|
|
||
| Bug reports and pull requests are welcome on [GitHub](https://github.com/railsware/mailtrap-ruby). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](CODE_OF_CONDUCT.md). | ||
|
|
||
| ## Development | ||
|
|
||
| After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. | ||
|
|
@@ -168,18 +209,18 @@ To install this gem onto your local machine, run `bundle exec rake install`. | |
|
|
||
| To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). | ||
|
|
||
| ## Contributing | ||
|
|
||
| Bug reports and pull requests are welcome on [GitHub](https://github.com/mailtrap/mailtrap-ruby). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](CODE_OF_CONDUCT.md). | ||
|
|
||
| All contributions are required to have rspec tests covering its functionality. | ||
|
|
||
| Please be sure to update [README](README.md) with new examples and features when applicable. | ||
|
|
||
| ## License | ||
|
|
||
| The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). | ||
| The package is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). | ||
|
|
||
| ## Code of Conduct | ||
|
|
||
| Everyone interacting in the Mailtrap project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md). | ||
| Everyone interacting in the Mailtrap project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md). | ||
|
|
||
| ## Compatibility with previous releases | ||
|
|
||
| Versions of this package up to 2.0.2 were an [unofficial client](https://github.com/vchin/mailtrap-client) developed by [@vchin](https://github.com/vchin). Package version 3 is a completely new package. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.