mailersend-ruby 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +108 -29
- data/lib/mailersend/email/email.rb +2 -2
- data/lib/mailersend/suppressions/suppressions.rb +110 -0
- data/lib/mailersend/version.rb +1 -1
- data/lib/mailersend.rb +11 -10
- data/renovate.json +5 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4207d4b81f4d12363f06fafb214a4b2d75dd2c0329376b3bafbe23a6b20fb97
|
4
|
+
data.tar.gz: 28f21d8500d4b7b07c0e6bddfa66ab08b522cd1040a1616858f81b03d422be86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5704c42a93de51701012a0ac5f55adeef0050b354ae1dff600c85f8f485645ecdf62c542847c60afe87a5655532faabd6551fac04900ee166ce5bae2f04783b1
|
7
|
+
data.tar.gz: f70b9d9fa4ab3c28d1a54d1769326833b0e5c154593f2bf339458d5fd33953af2ca1ade5e5d509e76142d18c5f7cbe33e5c03e777f5bad709c7ca75207534abf
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -11,12 +11,12 @@ MailerSend Ruby SDK
|
|
11
11
|
- [Send an email](#send-an-email)
|
12
12
|
- [Add CC, BCC recipients](#add-cc-bcc-recipients)
|
13
13
|
- [Send a template-based email](#send-a-template-based-email)
|
14
|
+
- [Advanced personalization](#advanced-personalization)
|
15
|
+
- [Simple personalization](#simple-personalization)
|
14
16
|
- [Tokens](#tokens)
|
15
17
|
- [Create a token](#create-a-token)
|
16
18
|
- [Update a token](#update-a-token)
|
17
19
|
- [Delete a token](#delete-a-token)
|
18
|
-
- [Advanced personalization](#advanced-personalization)
|
19
|
-
- [Simple personalization](#simple-personalization)
|
20
20
|
- [Send email with attachment](#send-email-with-attachment)
|
21
21
|
- [Activity](#activity)
|
22
22
|
- [Get a list of activities](#get-a-list-of-activities)
|
@@ -29,6 +29,7 @@ MailerSend Ruby SDK
|
|
29
29
|
- [Get a list of domains](#get-a-list-of-domains)
|
30
30
|
- [Get a single domain](#get-a-single-domain)
|
31
31
|
- [Delete a domain](#delete-a-domain)
|
32
|
+
- [Get recipients for a domain](#get-recipients-for-a-domain)
|
32
33
|
- [Update domain settings](#update-domain-settings)
|
33
34
|
- [Messages](#messages)
|
34
35
|
- [Get a list of messages](#get-a-list-of-messages)
|
@@ -37,6 +38,10 @@ MailerSend Ruby SDK
|
|
37
38
|
- [Get recipients](#get-recipients)
|
38
39
|
- [Get a single recipient](#get-a-single-recipient)
|
39
40
|
- [Delete a recipient](#delete-a-recipient)
|
41
|
+
- [Suppressions](#suppressions)
|
42
|
+
- [Get recipients from a suppression list](#get-recipients-from-a-suppression-list)
|
43
|
+
- [Add recipients to a suppression list](#add-recipients-to-a-suppression-list)
|
44
|
+
- [Delete recipients from a suppression list](#delete-recipients-from-a-suppression-list)
|
40
45
|
- [Webhooks](#webhooks)
|
41
46
|
- [List webhooks](#list-webhooks)
|
42
47
|
- [Get a webhook](#get-a-webhook)
|
@@ -127,32 +132,6 @@ ms_email.add_template_id(12415125)
|
|
127
132
|
ms_email.send
|
128
133
|
```
|
129
134
|
|
130
|
-
## Tokens
|
131
|
-
|
132
|
-
### Create a token
|
133
|
-
```ruby
|
134
|
-
require "mailersend-ruby"
|
135
|
-
|
136
|
-
ms_tokens = Mailersend::Tokens.new
|
137
|
-
ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ], domain_id: "yourdomainid")
|
138
|
-
```
|
139
|
-
|
140
|
-
### Update a token
|
141
|
-
```ruby
|
142
|
-
require "mailersend-ruby"
|
143
|
-
|
144
|
-
ms_tokens = Mailersend::Tokens.new
|
145
|
-
ms_tokens.update(token_id: "d2220fx04", status: "paused")
|
146
|
-
```
|
147
|
-
|
148
|
-
### Delete a token
|
149
|
-
```ruby
|
150
|
-
require "mailersend-ruby"
|
151
|
-
|
152
|
-
ms_tokens = Mailersend::Tokens.new
|
153
|
-
ms_tokens.delete(token_id: "d2220fx04")
|
154
|
-
```
|
155
|
-
|
156
135
|
### Advanced personalization
|
157
136
|
|
158
137
|
```ruby
|
@@ -210,6 +189,32 @@ ms_email.add_variables(variables)
|
|
210
189
|
ms_email.send
|
211
190
|
```
|
212
191
|
|
192
|
+
## Tokens
|
193
|
+
|
194
|
+
### Create a token
|
195
|
+
```ruby
|
196
|
+
require "mailersend-ruby"
|
197
|
+
|
198
|
+
ms_tokens = Mailersend::Tokens.new
|
199
|
+
ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ], domain_id: "yourdomainid")
|
200
|
+
```
|
201
|
+
|
202
|
+
### Update a token
|
203
|
+
```ruby
|
204
|
+
require "mailersend-ruby"
|
205
|
+
|
206
|
+
ms_tokens = Mailersend::Tokens.new
|
207
|
+
ms_tokens.update(token_id: "d2220fx04", status: "paused")
|
208
|
+
```
|
209
|
+
|
210
|
+
### Delete a token
|
211
|
+
```ruby
|
212
|
+
require "mailersend-ruby"
|
213
|
+
|
214
|
+
ms_tokens = Mailersend::Tokens.new
|
215
|
+
ms_tokens.delete(token_id: "d2220fx04")
|
216
|
+
```
|
217
|
+
|
213
218
|
### Send email with attachment
|
214
219
|
|
215
220
|
```ruby
|
@@ -313,6 +318,15 @@ ms_domains = Mailersend::Domains.new
|
|
313
318
|
ms_domains.delete(domain_id: "idofdomain12412")
|
314
319
|
```
|
315
320
|
|
321
|
+
### Get recipients for a domain
|
322
|
+
|
323
|
+
```ruby
|
324
|
+
require "mailersend-ruby"
|
325
|
+
|
326
|
+
ms_domains = Mailersend::Domains.new
|
327
|
+
ms_domains.recipients(domain_id: "idofdomain12412")
|
328
|
+
```
|
329
|
+
|
316
330
|
### Update domain settings
|
317
331
|
|
318
332
|
```ruby
|
@@ -371,6 +385,71 @@ ms_recipients = Mailersend::Recipients.new
|
|
371
385
|
ms_recipients.delete(recipient_id: "id124")
|
372
386
|
```
|
373
387
|
|
388
|
+
## Suppressions
|
389
|
+
|
390
|
+
### Get recipients from a suppression list
|
391
|
+
|
392
|
+
```ruby
|
393
|
+
require "mailersend-ruby"
|
394
|
+
|
395
|
+
ms_suppressions = Mailersend::Suppressions.new
|
396
|
+
|
397
|
+
// List from Blocklist
|
398
|
+
ms_suppressions.get_from_blocklist(domain_id: "xxx2241ll")
|
399
|
+
|
400
|
+
// List from Hard Bounces
|
401
|
+
ms_suppressions.get_hard_bounces(domain_id: "xxx2241ll")
|
402
|
+
|
403
|
+
// List from Spam Complaints
|
404
|
+
ms_suppressions.get_spam_complaints(domain_id: "xxx2241ll")
|
405
|
+
|
406
|
+
// List from Unsubscribers
|
407
|
+
ms_suppressions.get_unsubscribes(domain_id: "xxx2241ll")
|
408
|
+
```
|
409
|
+
|
410
|
+
### Add recipients to a suppression list
|
411
|
+
|
412
|
+
```ruby
|
413
|
+
require "mailersend-ruby"
|
414
|
+
|
415
|
+
ms_suppressions = Mailersend::Suppressions.new
|
416
|
+
|
417
|
+
// Add Recipient to Block List using recipients
|
418
|
+
ms_suppressions.add_to_blocklist(domain_id: "xxx2241ll", recipients: ["blocked@client.com"])
|
419
|
+
|
420
|
+
// Add Recipient to Block List using patterns
|
421
|
+
ms_suppressions.add_to_blocklist(domain_id: "xxx2241ll", patterns: ["*@client.com"])
|
422
|
+
|
423
|
+
// Add Recipient to Hard Bounces
|
424
|
+
ms_suppressions.add_to_hard_bounces(domain_id: "xxx2241ll", recipients: ["bounced@client.com"])
|
425
|
+
|
426
|
+
// Add Recipient to Spam Complaints
|
427
|
+
ms_suppressions.add_to_spam_complaints(domain_id: "xxx2241ll", recipients: ["bounced@client.com"])
|
428
|
+
|
429
|
+
// Add Recipient to Unsubscribes
|
430
|
+
ms_suppressions.add_to_unsubscribers(domain_id: "xxx2241ll", recipients: ["bounced@client.com"])
|
431
|
+
```
|
432
|
+
|
433
|
+
### Delete recipients from a suppression list
|
434
|
+
|
435
|
+
```ruby
|
436
|
+
require "mailersend-ruby"
|
437
|
+
|
438
|
+
ms_suppressions = Mailersend::Suppressions.new
|
439
|
+
|
440
|
+
// Delete from Block List
|
441
|
+
ms_suppressions.delete_from_blocklist(ids: ["xxx2241ll"])
|
442
|
+
|
443
|
+
// Delete from Hard Bounces
|
444
|
+
ms_suppressions.delete_from_hard_bounces(ids: ["xxx2241ll"])
|
445
|
+
|
446
|
+
// Delete from Spam Complaints
|
447
|
+
ms_suppressions.delete_from_spam_complaints(ids: ["xxx2241ll"])
|
448
|
+
|
449
|
+
// Delete from Unsubscribes
|
450
|
+
ms_suppressions.delete_from_unsubscribers(ids: ["xxx2241ll"])
|
451
|
+
```
|
452
|
+
|
374
453
|
## Webhooks
|
375
454
|
|
376
455
|
### List webhooks
|
@@ -454,4 +533,4 @@ The official documentation is at [https://developers.mailersend.com](https://dev
|
|
454
533
|
|
455
534
|
# License
|
456
535
|
|
457
|
-
[The MIT License (MIT)](LICENSE)
|
536
|
+
[The MIT License (MIT)](LICENSE)
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mailersend
|
4
|
+
# Suppressions endpoint from MailerSend API.
|
5
|
+
class Suppressions
|
6
|
+
attr_accessor :client,
|
7
|
+
:page,
|
8
|
+
:limit,
|
9
|
+
:recipient_id
|
10
|
+
|
11
|
+
def initialize(client = Mailersend::Client.new)
|
12
|
+
@client = client
|
13
|
+
@page = page
|
14
|
+
@limit = limit
|
15
|
+
@recipient_id = recipient_id
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_from_blocklist(*)
|
19
|
+
response = client.http.get("#{API_URL}/suppressions/blocklist")
|
20
|
+
puts response
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_hard_bounces(*)
|
24
|
+
response = client.http.get("#{API_URL}/suppressions/hard-bounces")
|
25
|
+
puts response
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_spam_complaints(*)
|
29
|
+
response = client.http.get("#{API_URL}/suppressions/spam-complaints")
|
30
|
+
puts response
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_unsubscribes(*)
|
34
|
+
response = client.http.get("#{API_URL}/suppressions/unsubscribes")
|
35
|
+
puts response
|
36
|
+
end
|
37
|
+
|
38
|
+
def add_to_blocklist(recipients: nil, patterns: nil)
|
39
|
+
hash = {
|
40
|
+
'recipients' => recipients,
|
41
|
+
'patterns' => patterns
|
42
|
+
}
|
43
|
+
response = client.http.post("#{API_URL}/suppressions/blocklist", json: hash.compact)
|
44
|
+
puts response
|
45
|
+
end
|
46
|
+
|
47
|
+
def delete_from_blocklist(ids: nil, all: nil)
|
48
|
+
hash = {
|
49
|
+
'ids' => ids,
|
50
|
+
'all' => all
|
51
|
+
}
|
52
|
+
response = client.http.delete("#{API_URL}/suppressions/blocklist", json: hash.compact)
|
53
|
+
puts response
|
54
|
+
end
|
55
|
+
|
56
|
+
def add_to_hard_bounces(domain_id: nil, recipients: nil)
|
57
|
+
hash = {
|
58
|
+
'domain_id' => domain_id,
|
59
|
+
'recipients' => recipients
|
60
|
+
}
|
61
|
+
response = client.http.post("#{API_URL}/suppressions/hard-bounces", json: hash.compact)
|
62
|
+
puts response
|
63
|
+
end
|
64
|
+
|
65
|
+
def delete_from_hard_bounces(ids: nil, all: nil)
|
66
|
+
hash = {
|
67
|
+
'ids' => ids,
|
68
|
+
'all' => all
|
69
|
+
}
|
70
|
+
response = client.http.delete("#{API_URL}/suppressions/hard-bounces", json: hash.compact)
|
71
|
+
puts response
|
72
|
+
end
|
73
|
+
|
74
|
+
def add_to_spam_complaints(domain_id: nil, recipients: nil)
|
75
|
+
hash = {
|
76
|
+
'domain_id' => domain_id,
|
77
|
+
'recipients' => recipients
|
78
|
+
}
|
79
|
+
response = client.http.post("#{API_URL}/suppressions/spam-complaints", json: hash.compact)
|
80
|
+
puts response
|
81
|
+
end
|
82
|
+
|
83
|
+
def delete_from_spam_complaints(ids: nil, all: nil)
|
84
|
+
hash = {
|
85
|
+
'ids' => ids,
|
86
|
+
'all' => all
|
87
|
+
}
|
88
|
+
response = client.http.delete("#{API_URL}/suppressions/spam-complaints", json: hash.compact)
|
89
|
+
puts response
|
90
|
+
end
|
91
|
+
|
92
|
+
def add_to_unsubscribers(domain_id: nil, recipients: nil)
|
93
|
+
hash = {
|
94
|
+
'domain_id' => domain_id,
|
95
|
+
'recipients' => recipients
|
96
|
+
}
|
97
|
+
response = client.http.post("#{API_URL}/suppressions/unsubscribes", json: hash.compact)
|
98
|
+
puts response
|
99
|
+
end
|
100
|
+
|
101
|
+
def delete_from_unsubscribers(ids: nil, all: nil)
|
102
|
+
hash = {
|
103
|
+
'ids' => ids,
|
104
|
+
'all' => all
|
105
|
+
}
|
106
|
+
response = client.http.delete("#{API_URL}/suppressions/unsubscribes", json: hash.compact)
|
107
|
+
puts response
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
data/lib/mailersend/version.rb
CHANGED
data/lib/mailersend.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
require_relative 'mailersend/client'
|
4
|
+
require_relative 'mailersend/activity/activity'
|
5
|
+
require_relative 'mailersend/analytics/analytics'
|
6
|
+
require_relative 'mailersend/domains/domains'
|
7
|
+
require_relative 'mailersend/email/email'
|
8
|
+
require_relative 'mailersend/messages/messages'
|
9
|
+
require_relative 'mailersend/recipients/recipients'
|
10
|
+
require_relative 'mailersend/suppressions/suppressions'
|
11
|
+
require_relative 'mailersend/templates/templates'
|
12
|
+
require_relative 'mailersend/tokens/tokens'
|
13
|
+
require_relative 'mailersend/webhooks/webhooks'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailersend-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikola Milojević
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -138,11 +138,13 @@ files:
|
|
138
138
|
- lib/mailersend/email/email.rb
|
139
139
|
- lib/mailersend/messages/messages.rb
|
140
140
|
- lib/mailersend/recipients/recipients.rb
|
141
|
+
- lib/mailersend/suppressions/suppressions.rb
|
141
142
|
- lib/mailersend/templates/templates.rb
|
142
143
|
- lib/mailersend/tokens/tokens.rb
|
143
144
|
- lib/mailersend/version.rb
|
144
145
|
- lib/mailersend/webhooks/webhooks.rb
|
145
146
|
- mailersend-ruby.gemspec
|
147
|
+
- renovate.json
|
146
148
|
homepage: https://www.mailersend.com
|
147
149
|
licenses:
|
148
150
|
- MIT
|
@@ -166,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
168
|
- !ruby/object:Gem::Version
|
167
169
|
version: '0'
|
168
170
|
requirements: []
|
169
|
-
rubygems_version: 3.2.
|
171
|
+
rubygems_version: 3.2.31
|
170
172
|
signing_key:
|
171
173
|
specification_version: 4
|
172
174
|
summary: MailerSend's official Ruby SDK
|