mailkite 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailkite.rb +112 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a20b1eccf548161ab6465617e8575de9ecb1a9f99d1adbc3391461f6d2b81462
4
- data.tar.gz: 2e8cf7aff2c4ed5a8baa85b2d570671f2e48dd0438c7cacefc547ae8947a1431
3
+ metadata.gz: a4b8b0706aa98435dc195e58ee8c548e762e5fff84819432b96741de752ef32a
4
+ data.tar.gz: b5ab6561c1750cd702b7f4e545001bd25d8a0c75996a930eae70b691e2500bc4
5
5
  SHA512:
6
- metadata.gz: 28eacd06c017ad6386a8ceedede3f5817283f463d13514842cb0b833362b777022a268fbcfcf75e9188deae873254a6150aa1d34f1ad6945c543588d2352793f
7
- data.tar.gz: e135e827740708030d5f0f080f058149130b2781e34f0061c21358b856c88b7c87e207d8275738bab8178d540524fd04bcca115a35a89c866087d75d741953e3
6
+ metadata.gz: 6c599c0cc4f9efc6c94e5701d7adca5b508bf6fb94a7cc6c2747ad5c23649c362014664acaa402de2086af7507e757c686959681fdc3ce147f136cdfe515af34
7
+ data.tar.gz: 79b945cbac587203ea1c2a9613a9eb76ef98bfc357572ed2767c861c880ffbb341753f58aab10abda130aa65923928d403cbc62a7840c5a8c1ea115b1c7e0360
data/lib/mailkite.rb CHANGED
@@ -15,7 +15,7 @@ require "base64"
15
15
  require "cgi"
16
16
 
17
17
  module Mailkite
18
- VERSION = "0.16.0"
18
+ VERSION = "0.18.0"
19
19
  DEFAULT_BASE_URL = "https://api.mailkite.dev"
20
20
  # Reject webhook events older than this (ms) to block replays. Pass 0 to disable.
21
21
  DEFAULT_TOLERANCE_MS = 5 * 60 * 1000
@@ -214,10 +214,29 @@ module Mailkite
214
214
  # message keys: from, to, text/html, etc. `subject` is optional when a
215
215
  # template supplies it. Pass `templateId` to render a stored template and
216
216
  # `templateData` (a hash) to fill its variables.
217
+ # Send an email. +message+ is a hash with "from", "to" and a body ("text"
218
+ # and/or "html"). Also accepted: "subject" (optional when a template
219
+ # supplies it), "cc"/"bcc" (string or array), "replyTo", "inReplyTo"
220
+ # (thread a reply), "attachments" (array of {filename, url|content,
221
+ # contentType}), "headers" (hash of extra raw MIME headers, e.g.
222
+ # List-Unsubscribe — immediate sends only), and "templateId" +
223
+ # "templateData" to render a stored template.
217
224
  def send(message)
218
225
  request("POST", "/v1/send", message)
219
226
  end
220
227
 
228
+ # Send one personalized message per recipient (up to 50) in a single call.
229
+ # +batch+ is a hash with "from" and "recipients" (array of {"to",
230
+ # "templateData", "headers"} — exactly one address each). Shared fields
231
+ # ("subject", "html"/"text", "templateId", "templateData", "headers", …)
232
+ # form the base message; per-recipient "templateData" and "headers" are
233
+ # merged over the shared ones (the recipient wins). Every message passes
234
+ # the same gates as send() and gets its own id — the response reports each
235
+ # recipient's outcome in order, so a batch can partially succeed.
236
+ def sendBatch(batch)
237
+ request("POST", "/v1/send/batch", batch)
238
+ end
239
+
221
240
  # Extension → MIME map for raw-binary attachment uploads (default
222
241
  # application/octet-stream when an extension is unknown).
223
242
  ATTACHMENT_MIME = {
@@ -332,6 +351,22 @@ module Mailkite
332
351
  request("DELETE", "/api/domains/#{id}/webhook")
333
352
  end
334
353
 
354
+ def setTrackingWebhook(id, body)
355
+ request("PUT", "/api/domains/#{id}/tracking-webhook", body)
356
+ end
357
+
358
+ def deleteTrackingWebhook(id)
359
+ request("DELETE", "/api/domains/#{id}/tracking-webhook")
360
+ end
361
+
362
+ def setWebhookEvents(id, body)
363
+ request("PUT", "/api/domains/#{id}/webhook-events", body)
364
+ end
365
+
366
+ def deleteWebhookEvents(id)
367
+ request("DELETE", "/api/domains/#{id}/webhook-events")
368
+ end
369
+
335
370
  def testWebhook(id)
336
371
  request("POST", "/api/domains/#{id}/webhook/test")
337
372
  end
@@ -456,6 +491,82 @@ module Mailkite
456
491
  request("POST", "/api/broadcasts/#{id}/send", body)
457
492
  end
458
493
 
494
+ # --- Account ----------------------------------------------------------
495
+ # Create a MailKite account from just an email — no password. +body+ is a
496
+ # hash with "email" (required) and optional "channel", "ref" and
497
+ # "referrer". Returns the new account's API key immediately; a
498
+ # verification link is emailed, and SENDING stays blocked until the
499
+ # address is verified (poll me()). An existing email returns 409
500
+ # account_exists with no credentials. PUBLIC — no API key required.
501
+ def register(body)
502
+ request("POST", "/api/v1/provision", body)
503
+ end
504
+
505
+ # The account behind this credential: email, whether it is verified
506
+ # (sending is blocked until it is), and plan. Use to poll verification
507
+ # state after register().
508
+ def me
509
+ request("GET", "/v1/me")
510
+ end
511
+
512
+ # Get the account's unrestricted API key (mk_live_…). Read-or-create: the
513
+ # first call mints it.
514
+ def getApiKey
515
+ request("GET", "/api/keys")
516
+ end
517
+
518
+ # Rotate the account API key: the old key stops working immediately and a
519
+ # fresh one is returned. The plaintext is only shown here.
520
+ def rotateApiKey
521
+ request("POST", "/api/keys/rotate")
522
+ end
523
+
524
+ # List the account's domain-scoped API keys. A scoped key can send and
525
+ # manage only its one domain — hand one to each site or CI job so a leak
526
+ # burns only that surface.
527
+ def listScopedKeys
528
+ request("GET", "/api/keys/scoped")
529
+ end
530
+
531
+ # Create a key scoped to one domain. +body+ is a hash with "domainId"
532
+ # (required) and optional "name". Ideal for per-site installs (e.g. a
533
+ # WordPress plugin) — the site never holds the account master key.
534
+ def createScopedKey(body)
535
+ request("POST", "/api/keys/scoped", body)
536
+ end
537
+
538
+ # Revoke a domain-scoped key. Takes effect immediately.
539
+ def deleteScopedKey(id)
540
+ request("DELETE", "/api/keys/scoped/#{id}")
541
+ end
542
+
543
+ # Current billing-period usage: emails used vs the plan's included bucket
544
+ # (null = unlimited), AI actions, and the overage state that gates
545
+ # sending. Powers quota meters in dashboards and integrations.
546
+ def getUsage
547
+ request("GET", "/api/billing/usage")
548
+ end
549
+
550
+ # --- Suppressions -----------------------------------------------------
551
+ # List suppressed addresses (unsubscribes, hard bounces, spam complaints,
552
+ # manual). Sends to a suppressed address are dropped before delivery.
553
+ def listSuppressions
554
+ request("GET", "/api/contacts/suppressions")
555
+ end
556
+
557
+ # Suppress an address so this account never sends to it again. +body+ is
558
+ # a hash with "email" (required) and optional "reason" (defaults to
559
+ # manual) and "note".
560
+ def addSuppression(body)
561
+ request("POST", "/api/contacts/suppressions", body)
562
+ end
563
+
564
+ # Remove an address from the suppression list. Removing an unsuppressed
565
+ # address is a no-op success.
566
+ def removeSuppression(email)
567
+ request("DELETE", "/api/contacts/suppressions/#{CGI.escape(email)}")
568
+ end
569
+
459
570
  # --- Docs -----------------------------------------------------------
460
571
  # Semantic search over the MailKite docs. PUBLIC — no auth required.
461
572
  # Returns { "query" => ..., "matches" => [...] }.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailkite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MailKite
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-29 00:00:00.000000000 Z
11
+ date: 2026-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail