mailblastr 5.0.1 → 5.1.1
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.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/mailblastr/contacts.rb +19 -4
- data/lib/mailblastr/emails.rb +16 -7
- data/lib/mailblastr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4827370704c9533943a763c3797f16b472f80655940a911111abff606769fe71
|
|
4
|
+
data.tar.gz: 9a924fc0cc8bb4d7d29c78ef6a5b3e1290c82139dee33ea05fe0009b504b2a14
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 111d3d1c97ef0a2e4cf398b90327b48ac389de59f1dad3b80f8df34e16811f32385c2502c98a8672176339bdd7c5056a3467a8ed5a59f8dc14646803317c0dfc
|
|
7
|
+
data.tar.gz: 4ddd8faaba6b557b100c7177f15b9bbcdbf06df0a413088763ad8b174dc6f3fb6f69aac814445a7f8bd9dce1a4f22e2eed2ef324040de2503f63272e48db927b
|
data/README.md
CHANGED
|
@@ -104,6 +104,7 @@ That means `domain` (the sending domain, e.g. `"yourdomain.com"` — one of your
|
|
|
104
104
|
Mailblastr::Emails.send({ from: from, to: to, subject: subject, html: html })
|
|
105
105
|
Mailblastr::Emails.list({ limit: 20, after: cursor }) # cursor pagination
|
|
106
106
|
Mailblastr::Emails.list({ status: "bounced", search: "acme.com" }) # filters
|
|
107
|
+
Mailblastr::Emails.list({ folder: "scheduled" }) # one of outbox | sent | scheduled | failed — any other value is rejected (422)
|
|
107
108
|
Mailblastr::Emails.sources # per-campaign/automation send metrics
|
|
108
109
|
Mailblastr::Emails.get(email_id)
|
|
109
110
|
Mailblastr::Emails.list_attachments(email_id)
|
|
@@ -182,6 +183,8 @@ Mailblastr::Contacts.list({ audience_id: aud_id, segment_id: seg_id })
|
|
|
182
183
|
|
|
183
184
|
# Bulk import
|
|
184
185
|
Mailblastr::Contacts.batch({ audience_id: aud_id, contacts: [{ email: "a@b.com" }], on_conflict: "skip" })
|
|
186
|
+
# Domain-first: import straight into a domain's pool, no audience id needed.
|
|
187
|
+
Mailblastr::Contacts.batch({ domain: "yourdomain.com", contacts: [{ email: "a@b.com" }] })
|
|
185
188
|
Mailblastr::Contacts.import({ audience_id: aud_id, csv: "email,company\na@b.com,Acme" })
|
|
186
189
|
|
|
187
190
|
# CSV too big to inline (5 MB / 10,000 rows)? Upload it directly, then import by key.
|
data/lib/mailblastr/contacts.rb
CHANGED
|
@@ -81,19 +81,34 @@ module Mailblastr
|
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
# Bulk-import contacts from an array (upsert by email; max 10,000).
|
|
84
|
-
#
|
|
84
|
+
#
|
|
85
|
+
# Domain-first, like .create: pass :domain for the flat
|
|
86
|
+
# POST /contacts/batch, or :audience_id for POST /audiences/:id/contacts/batch.
|
|
87
|
+
# Prefer this over a .create loop for many contacts — one batch takes the
|
|
88
|
+
# account's contact-limit lock once, a loop takes it per contact.
|
|
89
|
+
# Contacts.batch({ domain: "yourdomain.com", contacts: [{ email: "a@b.com" }] })
|
|
85
90
|
# Contacts.batch({ audience_id: "aud_1", contacts: [{ email: "a@b.com" }], on_conflict: "skip" })
|
|
86
91
|
def batch(params)
|
|
87
92
|
audience_id = Client.opt(params, :audience_id)
|
|
93
|
+
# "" is truthy in Ruby but names no audience — treat it as absent and
|
|
94
|
+
# take the flat route, matching the other MailBlastr SDKs.
|
|
95
|
+
audience_id = nil if audience_id == ""
|
|
88
96
|
query = {}
|
|
89
97
|
on_conflict = Client.opt(params, :on_conflict)
|
|
90
98
|
query[:on_conflict] = on_conflict if on_conflict
|
|
91
|
-
Client.
|
|
99
|
+
body = { contacts: Client.opt(params, :contacts) }
|
|
100
|
+
return Client.request(
|
|
92
101
|
:post,
|
|
93
102
|
"/audiences/#{Client.path_escape(audience_id)}/contacts/batch",
|
|
94
|
-
body:
|
|
103
|
+
body: body,
|
|
95
104
|
query: query
|
|
96
|
-
)
|
|
105
|
+
) if audience_id
|
|
106
|
+
|
|
107
|
+
# The nested route derives its pool from the path; only the flat route
|
|
108
|
+
# takes :domain (in the body, same as POST /contacts).
|
|
109
|
+
domain = Client.opt(params, :domain)
|
|
110
|
+
body[:domain] = domain unless domain.nil?
|
|
111
|
+
Client.request(:post, "/contacts/batch", body: body, query: query)
|
|
97
112
|
end
|
|
98
113
|
|
|
99
114
|
# Bulk-import contacts from CSV (header row optional; upsert by email).
|
data/lib/mailblastr/emails.rb
CHANGED
|
@@ -27,19 +27,28 @@ module Mailblastr
|
|
|
27
27
|
|
|
28
28
|
# List sent emails (trimmed list items) — cursor pagination plus optional
|
|
29
29
|
# server-side filters: `campaign_id`, `automation_id`, `source`
|
|
30
|
-
# ("individual"
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
30
|
+
# ("individual" for all one-off sends with no campaign/automation origin,
|
|
31
|
+
# "api" for one-off sends made with an API key — which also covers mail
|
|
32
|
+
# sent before the send origin was recorded — or "dashboard" for one-off
|
|
33
|
+
# mail composed in the dashboard: the composer and inbox replies/forwards;
|
|
34
|
+
# honoured only when neither `campaign_id` nor `automation_id` is
|
|
35
|
+
# supplied), `domain_id`, `status` (matched case-insensitively
|
|
36
|
+
# against the row's `last_event`), `folder` (one of "outbox", "sent",
|
|
37
|
+
# "scheduled" or "failed" — any other value is rejected with a 422) and
|
|
38
|
+
# `search` (recipients, subject and sender). `q` is the server's alias
|
|
39
|
+
# for `search`, honoured only when `search` is absent. GET /emails
|
|
34
40
|
def list(params = {})
|
|
35
41
|
query = Client.pagination(params).merge(
|
|
36
|
-
Client.filters(params, :campaign_id, :automation_id, :source, :domain_id, :status, :search, :q)
|
|
42
|
+
Client.filters(params, :campaign_id, :automation_id, :source, :domain_id, :status, :search, :q, :folder)
|
|
37
43
|
)
|
|
38
44
|
Client.request(:get, "/emails", query: query)
|
|
39
45
|
end
|
|
40
46
|
|
|
41
|
-
# Per-source send metrics, one row per
|
|
42
|
-
#
|
|
47
|
+
# Per-source send metrics, one row per origin. `kind` is "campaign",
|
|
48
|
+
# "automation", "api" (one-off API-key sends, including mail sent before
|
|
49
|
+
# the send origin was recorded) or "individual" (dashboard-composed
|
|
50
|
+
# one-offs); `id`, `name`, `subject` and `status` are null for both the
|
|
51
|
+
# "api" and "individual" rows. Not paginated. GET /emails/sources
|
|
43
52
|
def sources
|
|
44
53
|
Client.request(:get, "/emails/sources")
|
|
45
54
|
end
|
data/lib/mailblastr/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mailblastr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- MailBlastr
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|