mailersend-ruby 2.0.0 → 2.0.2
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/CHANGELOG.md +8 -0
- data/README.md +0 -33
- data/lib/mailersend/activity/activity.rb +1 -1
- data/lib/mailersend/analytics/analytics.rb +4 -4
- data/lib/mailersend/api_quota/api_quota.rb +1 -1
- data/lib/mailersend/bulk_email/bulk_email.rb +2 -2
- data/lib/mailersend/client.rb +2 -2
- data/lib/mailersend/domains/domains.rb +8 -8
- data/lib/mailersend/email/email.rb +1 -1
- data/lib/mailersend/email_verification/email_verification.rb +6 -6
- data/lib/mailersend/inbound_routing/inbound_routing.rb +5 -5
- data/lib/mailersend/messages/messages.rb +2 -2
- data/lib/mailersend/recipients/recipients.rb +3 -3
- data/lib/mailersend/scheduled_messages/scheduled_messages.rb +3 -3
- data/lib/mailersend/sender_identity/sender_identity.rb +8 -8
- data/lib/mailersend/sms/sms.rb +1 -1
- data/lib/mailersend/sms_activity/sms_activity.rb +1 -1
- data/lib/mailersend/sms_inbounds/sms_inbounds.rb +5 -5
- data/lib/mailersend/sms_messages/sms_messages.rb +2 -2
- data/lib/mailersend/sms_number/sms_number.rb +4 -4
- data/lib/mailersend/sms_recipient/sms_recipient.rb +3 -3
- data/lib/mailersend/sms_webhooks/sms_webhooks.rb +5 -5
- data/lib/mailersend/suppressions/suppressions.rb +12 -12
- data/lib/mailersend/templates/templates.rb +3 -3
- data/lib/mailersend/tokens/tokens.rb +3 -3
- data/lib/mailersend/version.rb +1 -1
- data/lib/mailersend/webhooks/webhooks.rb +5 -5
- data/mailersend-ruby.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d02e47d283b821eccea2d749a54c1a06573f4e71e6139bc18d80345c02dae861
|
|
4
|
+
data.tar.gz: 0161ddc5936f52cc0a29e9e1bc75f0dde6f8d8b23f5d68bd2872e54b18442810
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0cf9a7daaf97ae809ef3213978b0121c80bff468f020a92e1ef30f3d254f950a3d75739595b21f464972ad3e171310567927cf4693ed7fb955797926888e566f
|
|
7
|
+
data.tar.gz: 71b65ecc6b957585a3f593cb88527459fc99b10ceff45ca32add6a395248d11254c606a29ec67f4e688c392ef52599ac4778ee9858cf47501ffcfb88dafed10c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
## [Released]
|
|
2
2
|
|
|
3
|
+
## [2.0.2] - 2024-03-12
|
|
4
|
+
|
|
5
|
+
- Update constant name
|
|
6
|
+
|
|
7
|
+
## [2.0.1] - 2023-01-08
|
|
8
|
+
|
|
9
|
+
- Simple personalization removed
|
|
10
|
+
|
|
3
11
|
## [2.0.0] - 2023-12-18
|
|
4
12
|
|
|
5
13
|
- *BREAKING CHANGE* - Please check the README file, MailerSend API token is now defined inside your application.
|
data/README.md
CHANGED
|
@@ -12,7 +12,6 @@ MailerSend Ruby SDK
|
|
|
12
12
|
- [Add CC, BCC recipients](#add-cc-bcc-recipients)
|
|
13
13
|
- [Send a template-based email](#send-a-template-based-email)
|
|
14
14
|
- [Advanced personalization](#advanced-personalization)
|
|
15
|
-
- [Simple personalization](#simple-personalization)
|
|
16
15
|
- [Bulk Email](#bulk-email)
|
|
17
16
|
- [Send bulk email](#send-bulk-email)
|
|
18
17
|
- [Get bulk email status](#get-bulk-email-status)
|
|
@@ -224,38 +223,6 @@ ms_email.add_personalization(personalization)
|
|
|
224
223
|
ms_email.send
|
|
225
224
|
```
|
|
226
225
|
|
|
227
|
-
### Simple personalization
|
|
228
|
-
|
|
229
|
-
```ruby
|
|
230
|
-
require "mailersend-ruby"
|
|
231
|
-
|
|
232
|
-
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
233
|
-
|
|
234
|
-
# Intialize the email class
|
|
235
|
-
ms_email = Mailersend::Email.new(ms_client)
|
|
236
|
-
|
|
237
|
-
# Add parameters
|
|
238
|
-
ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
|
|
239
|
-
ms_email.add_from("email" => "april@parksandrec.com", "name" => "April")
|
|
240
|
-
ms_email.add_subject("Time {$test}")
|
|
241
|
-
ms_email.add_text("{$test} Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.")
|
|
242
|
-
ms_email.add_html("<b>{$test} Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.</b>")
|
|
243
|
-
|
|
244
|
-
variables = {
|
|
245
|
-
email: 'ron@parksandrec.com',
|
|
246
|
-
substitutions: [
|
|
247
|
-
{
|
|
248
|
-
var: 'test',
|
|
249
|
-
value: 'Test Value'
|
|
250
|
-
}
|
|
251
|
-
]
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
ms_email.add_variables(variables)
|
|
255
|
-
|
|
256
|
-
ms_email.send
|
|
257
|
-
```
|
|
258
|
-
|
|
259
226
|
## Bulk Email
|
|
260
227
|
|
|
261
228
|
### Send bulk email
|
|
@@ -27,7 +27,7 @@ module Mailersend
|
|
|
27
27
|
date_to: date_to
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
client.http.get(URI::HTTPS.build(host:
|
|
30
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/v1/activity/#{domain_id}",
|
|
31
31
|
query: URI.encode_www_form(hash.compact)))
|
|
32
32
|
end
|
|
33
33
|
end
|
|
@@ -34,7 +34,7 @@ module Mailersend
|
|
|
34
34
|
'tags[]' => tags
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
client.http.get(URI::HTTPS.build(host:
|
|
37
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/analytics/date',
|
|
38
38
|
query: URI.encode_www_form(hash.compact)))
|
|
39
39
|
end
|
|
40
40
|
|
|
@@ -47,7 +47,7 @@ module Mailersend
|
|
|
47
47
|
'tags[]': tags
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
client.http.get(URI::HTTPS.build(host:
|
|
50
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/analytics/country',
|
|
51
51
|
query: URI.encode_www_form(hash.compact)))
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -60,7 +60,7 @@ module Mailersend
|
|
|
60
60
|
'tags[]': tags
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
client.http.get(URI::HTTPS.build(host:
|
|
63
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/analytics/ua-name',
|
|
64
64
|
query: URI.encode_www_form(hash.compact)))
|
|
65
65
|
end
|
|
66
66
|
|
|
@@ -73,7 +73,7 @@ module Mailersend
|
|
|
73
73
|
'tags[]': tags
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
client.http.get(URI::HTTPS.build(host:
|
|
76
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/analytics/ua-type',
|
|
77
77
|
query: URI.encode_www_form(hash.compact)))
|
|
78
78
|
end
|
|
79
79
|
end
|
|
@@ -24,11 +24,11 @@ module Mailersend
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def send
|
|
27
|
-
client.http.post("#{
|
|
27
|
+
client.http.post("#{MAILERSEND_API_URL}/bulk-email", json: @messages)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def get_bulk_status(bulk_email_id:)
|
|
31
|
-
client.http.get(URI::HTTPS.build(host:
|
|
31
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/v1/bulk-email/#{bulk_email_id}"))
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
data/lib/mailersend/client.rb
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
require 'http'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
MAILERSEND_API_URL = 'https://api.mailersend.com/v1'
|
|
6
|
+
MAILERSEND_API_BASE_HOST = 'api.mailersend.com'
|
|
7
7
|
|
|
8
8
|
# mailersend-ruby is a gem that integrates all endpoints from MailerSend API
|
|
9
9
|
module Mailersend
|
|
@@ -25,7 +25,7 @@ module Mailersend
|
|
|
25
25
|
'limit' => limit,
|
|
26
26
|
'verified' => verified
|
|
27
27
|
}
|
|
28
|
-
client.http.get(URI::HTTPS.build(host:
|
|
28
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/domains',
|
|
29
29
|
query: URI.encode_www_form(hash.compact)))
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -35,7 +35,7 @@ module Mailersend
|
|
|
35
35
|
'limit' => limit,
|
|
36
36
|
'verified' => verified
|
|
37
37
|
}
|
|
38
|
-
client.http.get(URI::HTTPS.build(host:
|
|
38
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/v1/domains/#{domain_id}",
|
|
39
39
|
query: URI.encode_www_form(hash.compact)))
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -46,11 +46,11 @@ module Mailersend
|
|
|
46
46
|
'custom_tracking_subdomain' => custom_tracking_subdomain,
|
|
47
47
|
'inbound_routing_subdomain' => inbound_routing_subdomain
|
|
48
48
|
}
|
|
49
|
-
client.http.post("#{
|
|
49
|
+
client.http.post("#{MAILERSEND_API_URL}/domains", json: hash.compact)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def delete(domain_id:)
|
|
53
|
-
client.http.delete(URI::HTTPS.build(host:
|
|
53
|
+
client.http.delete(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/v1/domains/#{domain_id}"))
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def recipients(domain_id:)
|
|
@@ -58,7 +58,7 @@ module Mailersend
|
|
|
58
58
|
'page' => page,
|
|
59
59
|
'limit' => limit
|
|
60
60
|
}
|
|
61
|
-
client.http.get(URI::HTTPS.build(host:
|
|
61
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/v1/domains/#{domain_id}/recipients",
|
|
62
62
|
query: URI.encode_www_form(hash.compact)))
|
|
63
63
|
end
|
|
64
64
|
|
|
@@ -75,15 +75,15 @@ module Mailersend
|
|
|
75
75
|
'custom_tracking_subdomain' => custom_tracking_subdomain,
|
|
76
76
|
'precedence_bulk' => precedence_bulk
|
|
77
77
|
}
|
|
78
|
-
client.http.put("#{
|
|
78
|
+
client.http.put("#{MAILERSEND_API_URL}/domains/#{domain_id}/settings", json: hash.compact)
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
def dns(domain_id:)
|
|
82
|
-
client.http.get(URI::HTTPS.build(host:
|
|
82
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/v1/domains/#{domain_id}/dns-records"))
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def verify(domain_id:)
|
|
86
|
-
client.http.get(URI::HTTPS.build(host:
|
|
86
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/v1/domains/#{domain_id}/verify"))
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
end
|
|
@@ -124,7 +124,7 @@ module Mailersend
|
|
|
124
124
|
'tags' => @tags
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
client.http.post("#{
|
|
127
|
+
client.http.post("#{MAILERSEND_API_URL}/email", json: message.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {} })
|
|
128
128
|
end
|
|
129
129
|
end
|
|
130
130
|
end
|
|
@@ -19,7 +19,7 @@ module Mailersend
|
|
|
19
19
|
hash = {
|
|
20
20
|
'email' => email
|
|
21
21
|
}
|
|
22
|
-
client.http.post("#{
|
|
22
|
+
client.http.post("#{MAILERSEND_API_URL}/email-verification/verify", json: hash.compact)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def list(page: nil, limit: nil)
|
|
@@ -27,12 +27,12 @@ module Mailersend
|
|
|
27
27
|
'page' => page,
|
|
28
28
|
'limit' => limit
|
|
29
29
|
}
|
|
30
|
-
client.http.get(URI::HTTPS.build(host:
|
|
30
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/email-verification',
|
|
31
31
|
query: URI.encode_www_form(hash)))
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def get_single_list(email_verification_id:)
|
|
35
|
-
client.http.get("#{
|
|
35
|
+
client.http.get("#{MAILERSEND_API_URL}/email-verification/#{email_verification_id}")
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def create_a_list(name: nil, emails: nil)
|
|
@@ -40,15 +40,15 @@ module Mailersend
|
|
|
40
40
|
'name' => name,
|
|
41
41
|
'emails' => emails
|
|
42
42
|
}
|
|
43
|
-
client.http.post("#{
|
|
43
|
+
client.http.post("#{MAILERSEND_API_URL}/email-verification", json: hash.compact)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def verify_a_list(email_verification_id:)
|
|
47
|
-
client.http.get("#{
|
|
47
|
+
client.http.get("#{MAILERSEND_API_URL}/email-verification/#{email_verification_id}/verify")
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def get_list_results(email_verification_id:)
|
|
51
|
-
client.http.get("#{
|
|
51
|
+
client.http.get("#{MAILERSEND_API_URL}/email-verification/#{email_verification_id}/results")
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
end
|
|
@@ -20,23 +20,23 @@ module Mailersend
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def get_inbound_routes(*)
|
|
23
|
-
client.http.get("#{
|
|
23
|
+
client.http.get("#{MAILERSEND_API_URL}/inbound")
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def get_single_route(inbound_id:)
|
|
27
|
-
client.http.get("#{
|
|
27
|
+
client.http.get("#{MAILERSEND_API_URL}/inbound/#{inbound_id}")
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def add_inbound_route
|
|
31
|
-
client.http.post("#{
|
|
31
|
+
client.http.post("#{MAILERSEND_API_URL}/inbound", json: @settings)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def update_inbound_route(inbound_id:)
|
|
35
|
-
client.http.put("#{
|
|
35
|
+
client.http.put("#{MAILERSEND_API_URL}/inbound/#{inbound_id}", json: @settings)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def delete_route(inbound_id:)
|
|
39
|
-
client.http.delete("#{
|
|
39
|
+
client.http.delete("#{MAILERSEND_API_URL}/inbound/#{inbound_id}")
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -21,12 +21,12 @@ module Mailersend
|
|
|
21
21
|
'limit' => limit
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
client.http.get(URI::HTTPS.build(host:
|
|
24
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/messages',
|
|
25
25
|
query: URI.encode_www_form(hash)))
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def single(message_id:)
|
|
29
|
-
client.http.get("#{
|
|
29
|
+
client.http.get("#{MAILERSEND_API_URL}/messages/#{message_id}")
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -21,16 +21,16 @@ module Mailersend
|
|
|
21
21
|
'limit' => limit
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
client.http.get(URI::HTTPS.build(host:
|
|
24
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/recipients',
|
|
25
25
|
query: URI.encode_www_form(hash)))
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def single(recipient_id:)
|
|
29
|
-
client.http.get("#{
|
|
29
|
+
client.http.get("#{MAILERSEND_API_URL}/recipients/#{recipient_id}")
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def delete(recipient_id:)
|
|
33
|
-
client.http.delete("#{
|
|
33
|
+
client.http.delete("#{MAILERSEND_API_URL}/recipients/#{recipient_id}")
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -20,15 +20,15 @@ module Mailersend
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def get_list(*)
|
|
23
|
-
client.http.get("#{
|
|
23
|
+
client.http.get("#{MAILERSEND_API_URL}/message-schedules")
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def get_signle(message_id:)
|
|
27
|
-
client.http.get("#{
|
|
27
|
+
client.http.get("#{MAILERSEND_API_URL}/message-schedules/#{message_id}")
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def delete(message_id:)
|
|
31
|
-
client.http.delete("#{
|
|
31
|
+
client.http.delete("#{MAILERSEND_API_URL}/message-schedules/#{message_id}")
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -25,7 +25,7 @@ module Mailersend
|
|
|
25
25
|
'page' => page,
|
|
26
26
|
'limit' => limit
|
|
27
27
|
}
|
|
28
|
-
client.http.get(URI::HTTPS.build(host:
|
|
28
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/identities',
|
|
29
29
|
query: URI.encode_www_form(hash.compact)))
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -33,7 +33,7 @@ module Mailersend
|
|
|
33
33
|
hash = {
|
|
34
34
|
'identity_id' => identity_id
|
|
35
35
|
}
|
|
36
|
-
client.http.get(URI::HTTPS.build(host:
|
|
36
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/v1/identities/#{identity_id}",
|
|
37
37
|
query: URI.encode_www_form(hash.compact)))
|
|
38
38
|
end
|
|
39
39
|
|
|
@@ -41,7 +41,7 @@ module Mailersend
|
|
|
41
41
|
hash = {
|
|
42
42
|
'email' => email
|
|
43
43
|
}
|
|
44
|
-
client.http.get(URI::HTTPS.build(host:
|
|
44
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/v1/identities/email/#{email}",
|
|
45
45
|
query: URI.encode_www_form(hash.compact)))
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -55,7 +55,7 @@ module Mailersend
|
|
|
55
55
|
'add_note' => add_note,
|
|
56
56
|
'personal_note' => personal_note
|
|
57
57
|
}
|
|
58
|
-
client.http.post("#{
|
|
58
|
+
client.http.post("#{MAILERSEND_API_URL}/identities", json: hash.compact)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def update(identity_id:, domain_id: nil, name: nil, email: nil, reply_to_email: nil, reply_to_name: nil, add_note: nil, personal_note: nil)
|
|
@@ -68,7 +68,7 @@ module Mailersend
|
|
|
68
68
|
'add_note' => add_note,
|
|
69
69
|
'personal_note' => personal_note
|
|
70
70
|
}
|
|
71
|
-
client.http.put("#{
|
|
71
|
+
client.http.put("#{MAILERSEND_API_URL}/identities/#{identity_id}", json: hash.compact)
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
def update_by_email(email:, domain_id: nil, name: nil, reply_to_email: nil, reply_to_name: nil, add_note: nil, personal_note: nil)
|
|
@@ -81,15 +81,15 @@ module Mailersend
|
|
|
81
81
|
'add_note' => add_note,
|
|
82
82
|
'personal_note' => personal_note
|
|
83
83
|
}
|
|
84
|
-
client.http.put("#{
|
|
84
|
+
client.http.put("#{MAILERSEND_API_URL}/identities/email/#{email}", json: hash.compact)
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
def delete(identity_id:)
|
|
88
|
-
client.http.delete(URI::HTTPS.build(host:
|
|
88
|
+
client.http.delete(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/v1/identities/#{identity_id}"))
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def delete_by_email(email:)
|
|
92
|
-
client.http.delete(URI::HTTPS.build(host:
|
|
92
|
+
client.http.delete(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: "/v1/identities/email/#{email}"))
|
|
93
93
|
end
|
|
94
94
|
end
|
|
95
95
|
end
|
data/lib/mailersend/sms/sms.rb
CHANGED
|
@@ -41,7 +41,7 @@ module Mailersend
|
|
|
41
41
|
'personalization' => @personalization
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
response = client.http.post("#{
|
|
44
|
+
response = client.http.post("#{MAILERSEND_API_URL}/sms", json: message.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {} })
|
|
45
45
|
puts response
|
|
46
46
|
end
|
|
47
47
|
end
|
|
@@ -19,7 +19,7 @@ module Mailersend
|
|
|
19
19
|
'limit' => limit
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
client.http.get(URI::HTTPS.build(host:
|
|
22
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/sms-activity',
|
|
23
23
|
query: URI.encode_www_form(hash)))
|
|
24
24
|
end
|
|
25
25
|
end
|
|
@@ -25,24 +25,24 @@ module Mailersend
|
|
|
25
25
|
'limit' => limit
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
client.http.get(URI::HTTPS.build(host:
|
|
28
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/sms-inbounds',
|
|
29
29
|
query: URI.encode_www_form(hash)))
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def get_sms_inbound_route(sms_inbound_id:)
|
|
33
|
-
client.http.get("#{
|
|
33
|
+
client.http.get("#{MAILERSEND_API_URL}/sms-inbounds/#{sms_inbound_id}")
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def add_sms_inbound_route
|
|
37
|
-
client.http.post("#{
|
|
37
|
+
client.http.post("#{MAILERSEND_API_URL}/sms-inbounds", json: @settings)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def update_sms_inbound_route(sms_inbound_id:)
|
|
41
|
-
client.http.put("#{
|
|
41
|
+
client.http.put("#{MAILERSEND_API_URL}/sms-inbounds/#{sms_inbound_id}", json: @settings)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def delete_sms_inbound_route(sms_inbound_id:)
|
|
45
|
-
client.http.delete("#{
|
|
45
|
+
client.http.delete("#{MAILERSEND_API_URL}/sms-inbounds/#{sms_inbound_id}")
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -21,12 +21,12 @@ module Mailersend
|
|
|
21
21
|
'limit' => limit
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
client.http.get(URI::HTTPS.build(host:
|
|
24
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/sms-messages',
|
|
25
25
|
query: URI.encode_www_form(hash)))
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def get(sms_message_id:)
|
|
29
|
-
client.http.get_single_route("#{
|
|
29
|
+
client.http.get_single_route("#{MAILERSEND_API_URL}/sms-messages/#{sms_message_id}")
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -23,23 +23,23 @@ module Mailersend
|
|
|
23
23
|
'limit' => limit
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
client.http.get(URI::HTTPS.build(host:
|
|
26
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/sms-numbers',
|
|
27
27
|
query: URI.encode_www_form(hash)))
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def get(sms_number_id:)
|
|
31
|
-
client.http.get("#{
|
|
31
|
+
client.http.get("#{MAILERSEND_API_URL}/sms-numbers/#{sms_number_id}")
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def update(sms_number_id:, paused: nil)
|
|
35
35
|
hash = {
|
|
36
36
|
'paused' => paused
|
|
37
37
|
}
|
|
38
|
-
client.http.put("#{
|
|
38
|
+
client.http.put("#{MAILERSEND_API_URL}/sms-numbers/#{sms_number_id}", json: hash.compact)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def delete(sms_number_id:)
|
|
42
|
-
client.http.delete("#{
|
|
42
|
+
client.http.delete("#{MAILERSEND_API_URL}/sms-numbers/#{sms_number_id}")
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -25,19 +25,19 @@ module Mailersend
|
|
|
25
25
|
'limit' => limit
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
client.http.get(URI::HTTPS.build(host:
|
|
28
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/sms-recipients',
|
|
29
29
|
query: URI.encode_www_form(hash)))
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def get(sms_recipient_id:)
|
|
33
|
-
client.http.get("#{
|
|
33
|
+
client.http.get("#{MAILERSEND_API_URL}/sms-recipients/#{sms_recipient_id}")
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def update(sms_recipient_id:, status: nil)
|
|
37
37
|
hash = {
|
|
38
38
|
'status' => status
|
|
39
39
|
}
|
|
40
|
-
client.http.put("#{
|
|
40
|
+
client.http.put("#{MAILERSEND_API_URL}/sms-recipients/#{sms_recipient_id}", json: hash.compact)
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
end
|
|
@@ -21,24 +21,24 @@ module Mailersend
|
|
|
21
21
|
hash = {
|
|
22
22
|
'sms_number_id' => sms_number_id
|
|
23
23
|
}
|
|
24
|
-
client.http.get(URI::HTTPS.build(host:
|
|
24
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/sms-webhooks',
|
|
25
25
|
query: URI.encode_www_form(hash)))
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def get_sms_webhook_route(sms_webhook_id:)
|
|
29
|
-
client.http.get("#{
|
|
29
|
+
client.http.get("#{MAILERSEND_API_URL}/sms-webhooks/#{sms_webhook_id}")
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def add_sms_webhook_route
|
|
33
|
-
client.http.post("#{
|
|
33
|
+
client.http.post("#{MAILERSEND_API_URL}/sms-webhooks", json: @settings)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def update_sms_webhook_route(sms_webhook_id:)
|
|
37
|
-
client.http.put("#{
|
|
37
|
+
client.http.put("#{MAILERSEND_API_URL}/sms-webhooks/#{sms_webhook_id}", json: @settings)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def delete_sms_webhook_route(sms_webhook_id:)
|
|
41
|
-
client.http.delete("#{
|
|
41
|
+
client.http.delete("#{MAILERSEND_API_URL}/sms-webhooks/#{sms_webhook_id}")
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
end
|
|
@@ -16,19 +16,19 @@ module Mailersend
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def get_from_blocklist(*)
|
|
19
|
-
client.http.get("#{
|
|
19
|
+
client.http.get("#{MAILERSEND_API_URL}/suppressions/blocklist")
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def get_hard_bounces(*)
|
|
23
|
-
client.http.get("#{
|
|
23
|
+
client.http.get("#{MAILERSEND_API_URL}/suppressions/hard-bounces")
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def get_spam_complaints(*)
|
|
27
|
-
client.http.get("#{
|
|
27
|
+
client.http.get("#{MAILERSEND_API_URL}/suppressions/spam-complaints")
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def get_unsubscribes(*)
|
|
31
|
-
client.http.get("#{
|
|
31
|
+
client.http.get("#{MAILERSEND_API_URL}/suppressions/unsubscribes")
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def add_to_blocklist(recipients: nil, patterns: nil)
|
|
@@ -36,7 +36,7 @@ module Mailersend
|
|
|
36
36
|
'recipients' => recipients,
|
|
37
37
|
'patterns' => patterns
|
|
38
38
|
}
|
|
39
|
-
client.http.post("#{
|
|
39
|
+
client.http.post("#{MAILERSEND_API_URL}/suppressions/blocklist", json: hash.compact)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def delete_from_blocklist(domain_id: nil, ids: nil, all: nil)
|
|
@@ -45,7 +45,7 @@ module Mailersend
|
|
|
45
45
|
'ids' => ids,
|
|
46
46
|
'all' => all
|
|
47
47
|
}
|
|
48
|
-
client.http.delete("#{
|
|
48
|
+
client.http.delete("#{MAILERSEND_API_URL}/suppressions/blocklist", json: hash.compact)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def add_to_hard_bounces(domain_id: nil, recipients: nil)
|
|
@@ -53,7 +53,7 @@ module Mailersend
|
|
|
53
53
|
'domain_id' => domain_id,
|
|
54
54
|
'recipients' => recipients
|
|
55
55
|
}
|
|
56
|
-
client.http.post("#{
|
|
56
|
+
client.http.post("#{MAILERSEND_API_URL}/suppressions/hard-bounces", json: hash.compact)
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def delete_from_hard_bounces(domain_id: nil, ids: nil, all: nil)
|
|
@@ -62,7 +62,7 @@ module Mailersend
|
|
|
62
62
|
'ids' => ids,
|
|
63
63
|
'all' => all
|
|
64
64
|
}
|
|
65
|
-
client.http.delete("#{
|
|
65
|
+
client.http.delete("#{MAILERSEND_API_URL}/suppressions/hard-bounces", json: hash.compact)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def add_to_spam_complaints(domain_id: nil, recipients: nil)
|
|
@@ -70,7 +70,7 @@ module Mailersend
|
|
|
70
70
|
'domain_id' => domain_id,
|
|
71
71
|
'recipients' => recipients
|
|
72
72
|
}
|
|
73
|
-
client.http.post("#{
|
|
73
|
+
client.http.post("#{MAILERSEND_API_URL}/suppressions/spam-complaints", json: hash.compact)
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
def delete_from_spam_complaints(domain_id: nil, ids: nil, all: nil)
|
|
@@ -79,7 +79,7 @@ module Mailersend
|
|
|
79
79
|
'ids' => ids,
|
|
80
80
|
'all' => all
|
|
81
81
|
}
|
|
82
|
-
client.http.delete("#{
|
|
82
|
+
client.http.delete("#{MAILERSEND_API_URL}/suppressions/spam-complaints", json: hash.compact)
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def add_to_unsubscribers(domain_id: nil, recipients: nil)
|
|
@@ -87,7 +87,7 @@ module Mailersend
|
|
|
87
87
|
'domain_id' => domain_id,
|
|
88
88
|
'recipients' => recipients
|
|
89
89
|
}
|
|
90
|
-
client.http.post("#{
|
|
90
|
+
client.http.post("#{MAILERSEND_API_URL}/suppressions/unsubscribes", json: hash.compact)
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def delete_from_unsubscribers(domain_id: nil, ids: nil, all: nil)
|
|
@@ -96,7 +96,7 @@ module Mailersend
|
|
|
96
96
|
'ids' => ids,
|
|
97
97
|
'all' => all
|
|
98
98
|
}
|
|
99
|
-
client.http.delete("#{
|
|
99
|
+
client.http.delete("#{MAILERSEND_API_URL}/suppressions/unsubscribes", json: hash.compact)
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
end
|
|
@@ -22,16 +22,16 @@ module Mailersend
|
|
|
22
22
|
'limit' => limit
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
client.http.get(URI::HTTPS.build(host:
|
|
25
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/templates',
|
|
26
26
|
query: URI.encode_www_form(hash)))
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def single(template_id:)
|
|
30
|
-
client.http.get("#{
|
|
30
|
+
client.http.get("#{MAILERSEND_API_URL}/templates/#{template_id}")
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def delete(template_id:)
|
|
34
|
-
client.http.delete("#{
|
|
34
|
+
client.http.delete("#{MAILERSEND_API_URL}/templates/#{template_id}")
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
end
|
|
@@ -23,18 +23,18 @@ module Mailersend
|
|
|
23
23
|
'scopes' => scopes,
|
|
24
24
|
'domain_id' => domain_id
|
|
25
25
|
}
|
|
26
|
-
client.http.post("#{
|
|
26
|
+
client.http.post("#{MAILERSEND_API_URL}/token", json: json)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def update(token_id:, status:)
|
|
30
30
|
status = {
|
|
31
31
|
status: status
|
|
32
32
|
}
|
|
33
|
-
client.http.put("#{
|
|
33
|
+
client.http.put("#{MAILERSEND_API_URL}/token/#{token_id}/settings", json: status)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def delete(token_id:)
|
|
37
|
-
client.http.delete("#{
|
|
37
|
+
client.http.delete("#{MAILERSEND_API_URL}/token/#{token_id}")
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
end
|
data/lib/mailersend/version.rb
CHANGED
|
@@ -24,12 +24,12 @@ module Mailersend
|
|
|
24
24
|
hash = {
|
|
25
25
|
'domain_id' => domain_id
|
|
26
26
|
}
|
|
27
|
-
client.http.get(URI::HTTPS.build(host:
|
|
27
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/webhooks',
|
|
28
28
|
query: URI.encode_www_form(hash)))
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def single(webhook_id:)
|
|
32
|
-
client.http.get("#{
|
|
32
|
+
client.http.get("#{MAILERSEND_API_URL}/webhooks/#{webhook_id}")
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def create(url:, name:, events:, domain_id:, enabled: nil)
|
|
@@ -41,7 +41,7 @@ module Mailersend
|
|
|
41
41
|
'enabled' => enabled.to_s == 'true'
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
client.http.post("#{
|
|
44
|
+
client.http.post("#{MAILERSEND_API_URL}/webhooks", json: hash.compact)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def update(webhook_id:, url: nil, name: nil, events: nil, enabled: nil)
|
|
@@ -51,11 +51,11 @@ module Mailersend
|
|
|
51
51
|
'events' => events,
|
|
52
52
|
'enabled' => enabled.to_s == 'true'
|
|
53
53
|
}
|
|
54
|
-
client.http.put("#{
|
|
54
|
+
client.http.put("#{MAILERSEND_API_URL}/webhooks/#{webhook_id}", json: hash.compact)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def delete(webhook_id:)
|
|
58
|
-
client.http.delete("#{
|
|
58
|
+
client.http.delete("#{MAILERSEND_API_URL}/webhooks/#{webhook_id}")
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
end
|
data/mailersend-ruby.gemspec
CHANGED
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: 2.0.
|
|
4
|
+
version: 2.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nikola Milojević
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-03-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: http
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.
|
|
47
|
+
version: 0.13.0
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0.
|
|
54
|
+
version: 0.13.0
|
|
55
55
|
description: MailerSend's official Ruby SDK. Interacts with all endpoints at MailerSend
|
|
56
56
|
API.
|
|
57
57
|
email:
|
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
128
128
|
- !ruby/object:Gem::Version
|
|
129
129
|
version: '0'
|
|
130
130
|
requirements: []
|
|
131
|
-
rubygems_version: 3.
|
|
131
|
+
rubygems_version: 3.5.3
|
|
132
132
|
signing_key:
|
|
133
133
|
specification_version: 4
|
|
134
134
|
summary: MailerSend's official Ruby SDK
|