Skip to content

Repository files navigation

GoodSender SDK for Ruby

Official client library for the GoodSender email API. Gem: goodsender

Quick start

require'goodsender'GoodSender.configuredo |c|
c.scheme='https'c.host='api.goodsender.com'c.base_path=''c.access_token='YOUR_API_KEY'endemails=GoodSender::EmailsApi.newdomains=GoodSender::DomainsApi.newreq=GoodSender::SendEmailRequest.new(emails: [GoodSender::SendEmail.new(from: GoodSender::Address.new(email: 'sender@example.com'),to: [GoodSender::Address.new(email: 'recipient@example.com')],subject: 'Hello',text_content: 'Body')])res=emails.send_email(req)puts"sent=#{res.sent} declined=#{res.declined}"

Examples

Send via a template

req=GoodSender::TemplateEmailRequest.new(from: GoodSender::Address.new(email: 'sender@example.com'),to: GoodSender::Address.new(email: 'recipient@example.com'),subject: 'Your OTP',template: GoodSender::TemplateEmailRequestTemplate.new(template_id: 'otp_code',variables: {'code'=>'123456'}))res=emails.send_template_email(req)puts"status=#{res.status}"

List domains

res=domains.list_domains(limit: 50)puts"domains=#{res.domains.length}"

Check consent status

res=emails.get_email_consent_status('user@example.com',domain: 'example.com')puts"entries=#{res.length}"# List all consents for a domainres=emails.list_email_consents('example.com',limit: 50)puts"emails=#{(res.emails || []).length}"

Documentation

Development

  • Regenerate from spec: scripts/regen.sh (preserves tests/, .github/, and hand-curated files per .regen-ignore)
  • Run conformance tests against local mock: tests/run.sh mock
  • Run conformance against real dev API: tests/run.sh dev (requires tests/.env.dev)

License

MIT — see LICENSE.

About

Official GoodSender API client for Ruby

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages