unitpost 0.1.0 → 0.2.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 -3
- data/lib/unitpost/client.rb +4 -8
- data/lib/unitpost/generated/operations.rb +410 -410
- data/lib/unitpost/resources.rb +55 -45
- data/lib/unitpost/version.rb +1 -1
- metadata +2 -2
data/lib/unitpost/resources.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Unitpost
|
|
|
7
7
|
# Resource surface — the hand-written, ergonomic layer (our own style).
|
|
8
8
|
#
|
|
9
9
|
# Each resource is a small class with explicit methods mirroring the Node and
|
|
10
|
-
# Python SDKs (
|
|
10
|
+
# Python SDKs (email.send, email.templates.list, contacts.create, ...). The
|
|
11
11
|
# codegen "surface coverage" check fails CI if a spec operation has no method
|
|
12
12
|
# here. Every method returns a Unitpost::Result and never raises for an API
|
|
13
13
|
# error. Bodies/params are plain Hashes.
|
|
@@ -46,12 +46,22 @@ module Unitpost
|
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
class
|
|
49
|
+
class Email < Base
|
|
50
|
+
attr_reader :topics, :campaigns, :templates, :domains
|
|
51
|
+
|
|
52
|
+
def initialize(http)
|
|
53
|
+
super
|
|
54
|
+
@topics = Topics.new(http)
|
|
55
|
+
@campaigns = Campaigns.new(http)
|
|
56
|
+
@templates = Templates.new(http)
|
|
57
|
+
@domains = Domains.new(http)
|
|
58
|
+
end
|
|
59
|
+
|
|
50
60
|
# Send or schedule a transactional email. When no idempotency_key is
|
|
51
61
|
# given the SDK generates one so a transient retry can't double-send; pass
|
|
52
62
|
# your own to dedupe across separate send calls.
|
|
53
63
|
def send(body, idempotency_key: nil)
|
|
54
|
-
@http.request("POST", "/
|
|
64
|
+
@http.request("POST", "/email", body: body, idempotency_key: idempotency_key || SecureRandom.uuid)
|
|
55
65
|
end
|
|
56
66
|
|
|
57
67
|
# Send up to 100 emails in one request (all-or-nothing validation). Like
|
|
@@ -60,49 +70,49 @@ module Unitpost
|
|
|
60
70
|
# replays the original result instead of re-sending. Pass your own to
|
|
61
71
|
# dedupe across separate batch calls.
|
|
62
72
|
def batch(body, idempotency_key: nil)
|
|
63
|
-
@http.request("POST", "/
|
|
73
|
+
@http.request("POST", "/email/batch", body: body, idempotency_key: idempotency_key || SecureRandom.uuid)
|
|
64
74
|
end
|
|
65
75
|
|
|
66
76
|
def get_batch(id)
|
|
67
|
-
@http.request("GET", "/
|
|
77
|
+
@http.request("GET", "/email/batches/#{enc(id)}")
|
|
68
78
|
end
|
|
69
79
|
|
|
70
80
|
def cancel_batch(id)
|
|
71
|
-
@http.request("POST", "/
|
|
81
|
+
@http.request("POST", "/email/batches/#{enc(id)}/cancel")
|
|
72
82
|
end
|
|
73
83
|
|
|
74
84
|
def list(limit: nil, after: nil, before: nil, **filters)
|
|
75
|
-
@http.request("GET", "/
|
|
85
|
+
@http.request("GET", "/email", query: list_params(limit: limit, after: after, before: before, **filters))
|
|
76
86
|
end
|
|
77
87
|
|
|
78
88
|
def list_all(**params)
|
|
79
|
-
paginate("/
|
|
89
|
+
paginate("/email", params)
|
|
80
90
|
end
|
|
81
91
|
|
|
82
92
|
def get(id)
|
|
83
|
-
@http.request("GET", "/
|
|
93
|
+
@http.request("GET", "/email/#{enc(id)}")
|
|
84
94
|
end
|
|
85
95
|
|
|
86
96
|
def update(id, body)
|
|
87
|
-
@http.request("PATCH", "/
|
|
97
|
+
@http.request("PATCH", "/email/#{enc(id)}", body: body)
|
|
88
98
|
end
|
|
89
99
|
|
|
90
100
|
# Deliverability/engagement aggregates over a rolling window (days: 1–365,
|
|
91
101
|
# defaults to 30 server-side).
|
|
92
102
|
def stats(days: nil)
|
|
93
|
-
@http.request("GET", "/
|
|
103
|
+
@http.request("GET", "/email/stats", query: { days: days })
|
|
94
104
|
end
|
|
95
105
|
|
|
96
106
|
def received_list(limit: nil, after: nil, before: nil)
|
|
97
|
-
@http.request("GET", "/
|
|
107
|
+
@http.request("GET", "/email/received", query: list_params(limit: limit, after: after, before: before))
|
|
98
108
|
end
|
|
99
109
|
|
|
100
110
|
def received_get(id)
|
|
101
|
-
@http.request("GET", "/
|
|
111
|
+
@http.request("GET", "/email/received/#{enc(id)}")
|
|
102
112
|
end
|
|
103
113
|
|
|
104
114
|
def received_attachment_url(id, attachment_id)
|
|
105
|
-
@http.request("GET", "/
|
|
115
|
+
@http.request("GET", "/email/received/#{enc(id)}/attachments/#{enc(attachment_id)}")
|
|
106
116
|
end
|
|
107
117
|
end
|
|
108
118
|
|
|
@@ -214,27 +224,27 @@ module Unitpost
|
|
|
214
224
|
|
|
215
225
|
class Topics < Base
|
|
216
226
|
def list(limit: nil, after: nil, before: nil)
|
|
217
|
-
@http.request("GET", "/topics", query: list_params(limit: limit, after: after, before: before))
|
|
227
|
+
@http.request("GET", "/email/topics", query: list_params(limit: limit, after: after, before: before))
|
|
218
228
|
end
|
|
219
229
|
|
|
220
230
|
def list_all(**params)
|
|
221
|
-
paginate("/topics", params)
|
|
231
|
+
paginate("/email/topics", params)
|
|
222
232
|
end
|
|
223
233
|
|
|
224
234
|
def create(body)
|
|
225
|
-
@http.request("POST", "/topics", body: body)
|
|
235
|
+
@http.request("POST", "/email/topics", body: body)
|
|
226
236
|
end
|
|
227
237
|
|
|
228
238
|
def get(id)
|
|
229
|
-
@http.request("GET", "/topics/#{enc(id)}")
|
|
239
|
+
@http.request("GET", "/email/topics/#{enc(id)}")
|
|
230
240
|
end
|
|
231
241
|
|
|
232
242
|
def update(id, body)
|
|
233
|
-
@http.request("PATCH", "/topics/#{enc(id)}", body: body)
|
|
243
|
+
@http.request("PATCH", "/email/topics/#{enc(id)}", body: body)
|
|
234
244
|
end
|
|
235
245
|
|
|
236
246
|
def delete(id)
|
|
237
|
-
@http.request("DELETE", "/topics/#{enc(id)}")
|
|
247
|
+
@http.request("DELETE", "/email/topics/#{enc(id)}")
|
|
238
248
|
end
|
|
239
249
|
|
|
240
250
|
def list_topics(contact_id, limit: nil, after: nil, before: nil)
|
|
@@ -248,77 +258,77 @@ module Unitpost
|
|
|
248
258
|
|
|
249
259
|
class Campaigns < Base
|
|
250
260
|
def list(limit: nil, after: nil, before: nil)
|
|
251
|
-
@http.request("GET", "/campaigns", query: list_params(limit: limit, after: after, before: before))
|
|
261
|
+
@http.request("GET", "/email/campaigns", query: list_params(limit: limit, after: after, before: before))
|
|
252
262
|
end
|
|
253
263
|
|
|
254
264
|
def list_all(**params)
|
|
255
|
-
paginate("/campaigns", params)
|
|
265
|
+
paginate("/email/campaigns", params)
|
|
256
266
|
end
|
|
257
267
|
|
|
258
268
|
def create(body)
|
|
259
|
-
@http.request("POST", "/campaigns", body: body)
|
|
269
|
+
@http.request("POST", "/email/campaigns", body: body)
|
|
260
270
|
end
|
|
261
271
|
|
|
262
272
|
def get(id)
|
|
263
|
-
@http.request("GET", "/campaigns/#{enc(id)}")
|
|
273
|
+
@http.request("GET", "/email/campaigns/#{enc(id)}")
|
|
264
274
|
end
|
|
265
275
|
|
|
266
276
|
def update(id, body)
|
|
267
|
-
@http.request("PATCH", "/campaigns/#{enc(id)}", body: body)
|
|
277
|
+
@http.request("PATCH", "/email/campaigns/#{enc(id)}", body: body)
|
|
268
278
|
end
|
|
269
279
|
|
|
270
280
|
def delete(id)
|
|
271
|
-
@http.request("DELETE", "/campaigns/#{enc(id)}")
|
|
281
|
+
@http.request("DELETE", "/email/campaigns/#{enc(id)}")
|
|
272
282
|
end
|
|
273
283
|
|
|
274
284
|
def send(id)
|
|
275
|
-
@http.request("POST", "/campaigns/#{enc(id)}/send")
|
|
285
|
+
@http.request("POST", "/email/campaigns/#{enc(id)}/send")
|
|
276
286
|
end
|
|
277
287
|
|
|
278
288
|
def cancel(id)
|
|
279
|
-
@http.request("POST", "/campaigns/#{enc(id)}/cancel")
|
|
289
|
+
@http.request("POST", "/email/campaigns/#{enc(id)}/cancel")
|
|
280
290
|
end
|
|
281
291
|
|
|
282
292
|
def pause(id)
|
|
283
|
-
@http.request("POST", "/campaigns/#{enc(id)}/pause")
|
|
293
|
+
@http.request("POST", "/email/campaigns/#{enc(id)}/pause")
|
|
284
294
|
end
|
|
285
295
|
|
|
286
296
|
def resume(id)
|
|
287
|
-
@http.request("POST", "/campaigns/#{enc(id)}/resume")
|
|
297
|
+
@http.request("POST", "/email/campaigns/#{enc(id)}/resume")
|
|
288
298
|
end
|
|
289
299
|
|
|
290
300
|
def reschedule(id, body)
|
|
291
|
-
@http.request("POST", "/campaigns/#{enc(id)}/reschedule", body: body)
|
|
301
|
+
@http.request("POST", "/email/campaigns/#{enc(id)}/reschedule", body: body)
|
|
292
302
|
end
|
|
293
303
|
|
|
294
304
|
def validate(id)
|
|
295
|
-
@http.request("GET", "/campaigns/#{enc(id)}/validate")
|
|
305
|
+
@http.request("GET", "/email/campaigns/#{enc(id)}/validate")
|
|
296
306
|
end
|
|
297
307
|
end
|
|
298
308
|
|
|
299
309
|
class Templates < Base
|
|
300
310
|
def list(limit: nil, after: nil, before: nil)
|
|
301
|
-
@http.request("GET", "/templates", query: list_params(limit: limit, after: after, before: before))
|
|
311
|
+
@http.request("GET", "/email/templates", query: list_params(limit: limit, after: after, before: before))
|
|
302
312
|
end
|
|
303
313
|
|
|
304
314
|
def list_all(**params)
|
|
305
|
-
paginate("/templates", params)
|
|
315
|
+
paginate("/email/templates", params)
|
|
306
316
|
end
|
|
307
317
|
|
|
308
318
|
def create(body)
|
|
309
|
-
@http.request("POST", "/templates", body: body)
|
|
319
|
+
@http.request("POST", "/email/templates", body: body)
|
|
310
320
|
end
|
|
311
321
|
|
|
312
322
|
def get(id)
|
|
313
|
-
@http.request("GET", "/templates/#{enc(id)}")
|
|
323
|
+
@http.request("GET", "/email/templates/#{enc(id)}")
|
|
314
324
|
end
|
|
315
325
|
|
|
316
326
|
def update(id, body)
|
|
317
|
-
@http.request("PATCH", "/templates/#{enc(id)}", body: body)
|
|
327
|
+
@http.request("PATCH", "/email/templates/#{enc(id)}", body: body)
|
|
318
328
|
end
|
|
319
329
|
|
|
320
330
|
def delete(id)
|
|
321
|
-
@http.request("DELETE", "/templates/#{enc(id)}")
|
|
331
|
+
@http.request("DELETE", "/email/templates/#{enc(id)}")
|
|
322
332
|
end
|
|
323
333
|
end
|
|
324
334
|
|
|
@@ -337,31 +347,31 @@ module Unitpost
|
|
|
337
347
|
|
|
338
348
|
class Domains < Base
|
|
339
349
|
def list(limit: nil, after: nil, before: nil)
|
|
340
|
-
@http.request("GET", "/domains", query: list_params(limit: limit, after: after, before: before))
|
|
350
|
+
@http.request("GET", "/email/domains", query: list_params(limit: limit, after: after, before: before))
|
|
341
351
|
end
|
|
342
352
|
|
|
343
353
|
def list_all(**params)
|
|
344
|
-
paginate("/domains", params)
|
|
354
|
+
paginate("/email/domains", params)
|
|
345
355
|
end
|
|
346
356
|
|
|
347
357
|
def create(body)
|
|
348
|
-
@http.request("POST", "/domains", body: body)
|
|
358
|
+
@http.request("POST", "/email/domains", body: body)
|
|
349
359
|
end
|
|
350
360
|
|
|
351
361
|
def get(id)
|
|
352
|
-
@http.request("GET", "/domains/#{enc(id)}")
|
|
362
|
+
@http.request("GET", "/email/domains/#{enc(id)}")
|
|
353
363
|
end
|
|
354
364
|
|
|
355
365
|
def delete(id)
|
|
356
|
-
@http.request("DELETE", "/domains/#{enc(id)}")
|
|
366
|
+
@http.request("DELETE", "/email/domains/#{enc(id)}")
|
|
357
367
|
end
|
|
358
368
|
|
|
359
369
|
def update(id, body)
|
|
360
|
-
@http.request("PATCH", "/domains/#{enc(id)}", body: body)
|
|
370
|
+
@http.request("PATCH", "/email/domains/#{enc(id)}", body: body)
|
|
361
371
|
end
|
|
362
372
|
|
|
363
373
|
def verify(id)
|
|
364
|
-
@http.request("POST", "/domains/#{enc(id)}/verify")
|
|
374
|
+
@http.request("POST", "/email/domains/#{enc(id)}/verify")
|
|
365
375
|
end
|
|
366
376
|
end
|
|
367
377
|
|
data/lib/unitpost/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: unitpost
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Unitpost
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|