unitpost 0.1.0 → 0.3.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: fffb836d80d04f7e9a1fc9491451022bdd6f6349aceb18751b5bb8963c02db76
4
- data.tar.gz: 1265d40f0d6c6da34a464f402eb54d12f02261459cd286d8980cc9cbae4907f4
3
+ metadata.gz: 4ccb9dc0f9caf498bb805032a619f66af911365a8b6d86454280d0ff704c6069
4
+ data.tar.gz: 1922fba2d0f9002330c0543ed981eb9118575ce97419f1e67b06057223ff4393
5
5
  SHA512:
6
- metadata.gz: 6f785497b63324e0398ea4d0c9e4c087b695c9c4bd59669722e2a8e340084837e480cbaf783b9b96b903f1ff44cf6cfcc689dd94da6ece8508233182e3c9decc
7
- data.tar.gz: 4e4c44b15c5f38125a5c9206be4f55a6eac770ea1a594be4fd4f9bf80b1a665df09bda598101bed833c643179ab69acb9b2ae48f83054f9bd03b0e10df2cd384
6
+ metadata.gz: cc977b4a7c69424813876f8d2f26cc4ccafe10f83b51eb5ff16cb350ef925b9866bb7f1b52767184c1fbdc60f6ad41932c8c1ae15e8577dc52f8fb5e5e5fbc6a
7
+ data.tar.gz: 3d8468ab42ad6550efb43cd1a79de8b4939ee82f1a602736499c6c41d287b2eb202d8a54678127d642323367f8f25394f4d6fec5cb3f153517cb49198665c783
data/README.md CHANGED
@@ -24,7 +24,7 @@ require "unitpost"
24
24
 
25
25
  unitpost = Unitpost::Client.new # reads UNITPOST_API_KEY (or pass api_key:)
26
26
 
27
- result = unitpost.emails.send({
27
+ result = unitpost.email.send({
28
28
  from: "Acme <you@yourdomain.com>", # bare address works too
29
29
  to: "customer@example.com",
30
30
  subject: "Hello",
@@ -51,15 +51,15 @@ key at [unitpost.com → Settings → API keys](https://www.unitpost.com).
51
51
 
52
52
  | Accessor | Covers |
53
53
  | --- | --- |
54
- | `emails` | Send, batch, list, get, update, stats, inbound (`received_*`) |
54
+ | `email` | Send, batch, list, get, update, stats, inbound (`received_*`) |
55
+ | `email.topics` | Topics + contact topic prefs |
56
+ | `email.campaigns` | Draft, schedule, send, pause/resume |
57
+ | `email.templates` | Template CRUD |
58
+ | `email.domains` | Domains + verify |
55
59
  | `contacts` | CRUD, import jobs |
56
60
  | `contact_fields` | Custom field definitions |
57
61
  | `segments` | Segments + membership |
58
- | `topics` | Topics + contact topic prefs |
59
- | `campaigns` | Draft, schedule, send, pause/resume |
60
- | `templates` | Template CRUD |
61
62
  | `brand_kits` | Brand kit |
62
- | `domains` | Domains + verify |
63
63
  | `webhooks` | Endpoints + `verify` |
64
64
  | `api_keys` | API key management |
65
65
  | `suppressions` | Suppression list |
@@ -112,13 +112,13 @@ event = client.webhooks.verify(payload: raw_body, secret: secret, headers: reque
112
112
 
113
113
  ## Idempotency
114
114
 
115
- `emails.send` and `emails.batch` are safe to retry by default — when you don't
115
+ `email.send` and `email.batch` are safe to retry by default — when you don't
116
116
  pass `idempotency_key:`, the SDK generates one so an automatic retry can't
117
117
  double-send. Pass your own to dedupe across separate calls:
118
118
 
119
119
  ```ruby
120
- unitpost.emails.send({ ... }, idempotency_key: SecureRandom.uuid)
121
- unitpost.emails.batch([ ... ], idempotency_key: SecureRandom.uuid)
120
+ unitpost.email.send({ ... }, idempotency_key: SecureRandom.uuid)
121
+ unitpost.email.batch([ ... ], idempotency_key: SecureRandom.uuid)
122
122
  ```
123
123
 
124
124
  > The server dedupes on `(workspace, idempotency key)` for 24h and replays the
@@ -132,7 +132,7 @@ Transient failures are retried automatically: `429`, `5xx`, and transport errors
132
132
  `Retry-After` is honored; otherwise exponential backoff with full jitter is used.
133
133
  Client errors (`401`/`403`/`404`/`409`/`422`) are never retried. Only requests
134
134
  safe to replay are retried: `GET`s and writes carrying an idempotency key (which
135
- `emails.send` and `emails.batch` always do); any other keyless write is never
135
+ `email.send` and `email.batch` always do); any other keyless write is never
136
136
  auto-retried.
137
137
 
138
138
  ```ruby
@@ -8,15 +8,15 @@ module Unitpost
8
8
  #
9
9
  # require "unitpost"
10
10
  # unitpost = Unitpost::Client.new # reads UNITPOST_API_KEY
11
- # result = unitpost.emails.send(from: ..., to: ..., subject: ..., html: ...)
11
+ # result = unitpost.email.send(from: ..., to: ..., subject: ..., html: ...)
12
12
  # if result.error
13
13
  # warn "#{result.error.code}: #{result.error.message}"
14
14
  # else
15
15
  # puts result.data["id"]
16
16
  # end
17
17
  class Client
18
- attr_reader :emails, :contacts, :contact_fields, :segments, :topics,
19
- :campaigns, :templates, :brand_kits, :domains, :webhooks, :api_keys, :suppressions,
18
+ attr_reader :email, :contacts, :contact_fields, :segments,
19
+ :brand_kits, :webhooks, :api_keys, :suppressions,
20
20
  :usage
21
21
 
22
22
  def initialize(api_key: nil, base_url: nil, timeout: 30, headers: {}, adapter: nil, stubs: nil,
@@ -33,15 +33,11 @@ module Unitpost
33
33
  max_retry_delay: max_retry_delay,
34
34
  sleeper: sleeper
35
35
  )
36
- @emails = Resources::Emails.new(http)
36
+ @email = Resources::Email.new(http)
37
37
  @contacts = Resources::Contacts.new(http)
38
38
  @contact_fields = Resources::ContactFields.new(http)
39
39
  @segments = Resources::Segments.new(http)
40
- @topics = Resources::Topics.new(http)
41
- @campaigns = Resources::Campaigns.new(http)
42
- @templates = Resources::Templates.new(http)
43
40
  @brand_kits = Resources::BrandKits.new(http)
44
- @domains = Resources::Domains.new(http)
45
41
  @webhooks = Resources::Webhooks.new(http)
46
42
  @api_keys = Resources::ApiKeys.new(http)
47
43
  @suppressions = Resources::Suppressions.new(http)