sendmux-sdk
Umbrella Ruby SDK package for Sendmux.
Documentation
- Ruby SDK guide: https://sendmux.ai/docs/sdks/ruby
- Source: https://github.com/Sendmux/sendmux-sdk/tree/main/packages/ruby/sdk
- Changelog: https://github.com/Sendmux/sendmux-sdk/blob/main/packages/ruby/sdk/CHANGELOG.md
Requirements
- Ruby 3.1 or newer.
- A send-capable
smx_mbx_key or owner-approved Sending-resourcesmx_agent_token for sending clients. - A mailbox-scoped key beginning with
smx_mbx_or scoped token beginning withsmx_agent_for mailbox clients. - A root key beginning with
smx_root_for management clients.
Installation
gem install sendmux-sdk
Or add it to your Gemfile:
gem "sendmux-sdk", "~> 1.0"
Usage
Use the umbrella gem when you want all Ruby SDK surfaces in one install.
require "sendmux/sdk"
sending = Sendmux::SDK.sending(
api_key: ENV.fetch("SENDMUX_MAILBOX_KEY")
)
mailbox = Sendmux::SDK.mailbox(
api_key: ENV.fetch("SENDMUX_MAILBOX_KEY")
)
management = Sendmux::SDK.management(
api_key: ENV.fetch("SENDMUX_ROOT_KEY")
)
puts sending.emails.class
puts mailbox.mailbox_api.class
puts management.mailboxes.class
Sendmux::Sdk is available as an alias for Sendmux::SDK.
Surface clients
The umbrella package installs and re-exports:
sendmux-coresendmux-sendingsendmux-mailboxsendmux-management
The helper methods return the same clients exposed by the surface gems:
Sendmux::SDK.sending(...)returnsSendmux::Sending::Client.Sendmux::SDK.mailbox(...)returnsSendmux::Mailbox::Client.Sendmux::SDK.management(...)returnsSendmux::Management::Client.
Retries, pagination, and errors
Pass Sendmux::Core::RetryOptions through any umbrella helper. Use Sendmux::Core.each_cursor and Sendmux::Core::Headers with the generated operation methods exactly as you would with the surface gems.
= Sendmux::Core::RetryOptions.new(max_attempts: 4)
management = Sendmux::SDK.management(
api_key: ENV.fetch("SENDMUX_ROOT_KEY"),
retry_options:
)
pager = Sendmux::Core.each_cursor(lambda do |opts|
management.mailboxes.management_list_mailboxes(opts.merge(limit: 50))
end)
pager.each { |mailbox| puts mailbox.id }
Generated API errors are mapped to Sendmux::Core::ApiError.
Support
- Documentation: https://sendmux.ai/docs
- Contact: contact@sendmux.ai
Licence
MIT licence. See https://github.com/Sendmux/sendmux-sdk/blob/main/LICENSE.