mailblastr 5.0.1 → 5.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec78acb7d963058af8b922481262fcf7b3c1d6692876f304bdd373572b7a25b9
4
- data.tar.gz: 29f2b545a15086968ad83e8f6e687868d9d4c575e292839852c540a797897d1d
3
+ metadata.gz: a028b42e26c044b29d184717824743d50dc909638a11f26182373c29f39a801e
4
+ data.tar.gz: 9bc74f8a2d2dd6b8c795bde5c92e6fa3490e9e9aa4fe14ff87cca1d3ca3fe710
5
5
  SHA512:
6
- metadata.gz: d3d399fe4c0db84908d49c0aa590dadc869ef661dabf0a9b3efea01ca106ec4a36bb5050d1ac760e5bd875ebaa85117750b9d8df8607f069a303391bc4763402
7
- data.tar.gz: 8be077ef5c686252a518edf896002f48af3e6ac07450b1fbd3f18cf3fdf252cb05b05d186e502d342b8a00a8e40d67ec2ee9fca11fc74889527720810d61dbfa
6
+ metadata.gz: e9c966eea358f8d09c5f2087a7f209e9d78d642ccdff1a8e8a38b510ed0df4b32074474cfa06d8b4dc14743af868878f837d249be2303c3c53b017ebb8f3c236
7
+ data.tar.gz: '082c972bf7ed332f0b6b1ae5d851718ec0dab54c9ca2b9746da27047cb263bd19640a03b77f3ee7de18b618fde84d00adbeae9b8fa0936536b065c97c7c1a367'
data/README.md CHANGED
@@ -182,6 +182,8 @@ Mailblastr::Contacts.list({ audience_id: aud_id, segment_id: seg_id })
182
182
 
183
183
  # Bulk import
184
184
  Mailblastr::Contacts.batch({ audience_id: aud_id, contacts: [{ email: "a@b.com" }], on_conflict: "skip" })
185
+ # Domain-first: import straight into a domain's pool, no audience id needed.
186
+ Mailblastr::Contacts.batch({ domain: "yourdomain.com", contacts: [{ email: "a@b.com" }] })
185
187
  Mailblastr::Contacts.import({ audience_id: aud_id, csv: "email,company\na@b.com,Acme" })
186
188
 
187
189
  # CSV too big to inline (5 MB / 10,000 rows)? Upload it directly, then import by key.
@@ -81,19 +81,31 @@ module Mailblastr
81
81
  end
82
82
 
83
83
  # Bulk-import contacts from an array (upsert by email; max 10,000).
84
- # POST /audiences/:id/contacts/batch
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)
88
93
  query = {}
89
94
  on_conflict = Client.opt(params, :on_conflict)
90
95
  query[:on_conflict] = on_conflict if on_conflict
91
- Client.request(
96
+ body = { contacts: Client.opt(params, :contacts) }
97
+ return Client.request(
92
98
  :post,
93
99
  "/audiences/#{Client.path_escape(audience_id)}/contacts/batch",
94
- body: { contacts: Client.opt(params, :contacts) },
100
+ body: body,
95
101
  query: query
96
- )
102
+ ) if audience_id
103
+
104
+ # The nested route derives its pool from the path; only the flat route
105
+ # takes :domain (in the body, same as POST /contacts).
106
+ domain = Client.opt(params, :domain)
107
+ body[:domain] = domain unless domain.nil?
108
+ Client.request(:post, "/contacts/batch", body: body, query: query)
97
109
  end
98
110
 
99
111
  # Bulk-import contacts from CSV (header row optional; upsert by email).
@@ -33,7 +33,7 @@ module Mailblastr
33
33
  # `search` is absent. GET /emails
34
34
  def list(params = {})
35
35
  query = Client.pagination(params).merge(
36
- Client.filters(params, :campaign_id, :automation_id, :source, :domain_id, :status, :search, :q)
36
+ Client.filters(params, :campaign_id, :automation_id, :source, :domain_id, :status, :search, :q, :folder)
37
37
  )
38
38
  Client.request(:get, "/emails", query: query)
39
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mailblastr
4
- VERSION = "5.0.1"
4
+ VERSION = "5.1.0"
5
5
  end
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.0.1
4
+ version: 5.1.0
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-20 00:00:00.000000000 Z
11
+ date: 2026-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest