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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e92552a542bfa040de967b8d88af9aba31d6edbd0001768633793263a0728bc2
|
|
4
|
+
data.tar.gz: 7b49579c2d34abdb8efb2d9b01382edb1b1f646467b1c7fe33573c65ce89176a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f35532690b25c113997d1b594db3bf849dc4f60853f2c290eadb95940958b3c5084c59ef71320486728a9a97f666b21a1541599a972edc5e670a609dc640fddf
|
|
7
|
+
data.tar.gz: d8d884f80928d12d3023886986c641de6221886a1b0bcde7ab9005a9971f48257aa8df58e8bc7ea5126d3213231dd08cb7ef6dbd41312489bf07127f08b947b9
|
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.
|
|
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",
|
|
@@ -117,8 +117,8 @@ 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.
|
|
121
|
-
unitpost.
|
|
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
|
data/lib/unitpost/client.rb
CHANGED
|
@@ -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.
|
|
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 :
|
|
19
|
-
:
|
|
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
|
-
@
|
|
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)
|