mailersend-ruby 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +122 -0
- data/lib/mailersend/domains/domains.rb +8 -0
- data/lib/mailersend/email/email.rb +9 -2
- data/lib/mailersend/inbound_routing/inbound_routing.rb +42 -0
- data/lib/mailersend/scheduled_messages/scheduled_messages.rb +34 -0
- data/lib/mailersend/version.rb +1 -1
- data/lib/mailersend.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8d67b989e26722f62ec3b556872643721be50947b67392f899f75115bb5dd9b
|
4
|
+
data.tar.gz: 5b9ee2fe25d34a07f71f38ff5a88137abcf22cfd1619b88b4505646e1f8facc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f59c4b41f8134c36df9e0dd8c3365444719d942a6a6c57e1643bd58c3973dfbb768c922b3df2291eb1e2fbb8d99df14df40e3a4dd26ebb0caade3c999cb45d0
|
7
|
+
data.tar.gz: ebcb98375a4a56f3d6033dd93fecd22bef6019ac58d2338701aaa061a6579306ccf44311a202df5194a142ac0ae55f2bc880aa6595f98e09774503ce2359a298
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
## [Released]
|
2
2
|
|
3
|
+
## [1.1.0] - 2022-02-18
|
4
|
+
|
5
|
+
- Domains endpoint improvements
|
6
|
+
- Added schedule an email parameter
|
7
|
+
- Added inbound routes endpoint
|
8
|
+
- Added scheduled messages endpoint
|
9
|
+
|
3
10
|
## [1.0.1] - 2022-02-16
|
4
11
|
|
5
12
|
- Removed puts from request response
|
data/README.md
CHANGED
@@ -28,15 +28,27 @@ MailerSend Ruby SDK
|
|
28
28
|
- [Opens by country](#opens-by-country)
|
29
29
|
- [Opens by user-agent name](#opens-by-user-agent-name)
|
30
30
|
- [Opens by reading environment](#opens-by-reading-environment)
|
31
|
+
- [Inbound Routes](#inbound-routes)
|
32
|
+
- [Get a list of inbound routes](#get-a-list-of-inbound-routes)
|
33
|
+
- [Get a single inbound route](#get-a-single-inbound-route)
|
34
|
+
- [Add an inbound route](#add-an-inbound-route)
|
35
|
+
- [Update an inbound route](#update-an-inbound-route)
|
36
|
+
- [Delete an inbound route](#delete-an-inbound-route)
|
31
37
|
- [Domains](#domains)
|
32
38
|
- [Get a list of domains](#get-a-list-of-domains)
|
33
39
|
- [Get a single domain](#get-a-single-domain)
|
34
40
|
- [Delete a domain](#delete-a-domain)
|
35
41
|
- [Get recipients for a domain](#get-recipients-for-a-domain)
|
36
42
|
- [Update domain settings](#update-domain-settings)
|
43
|
+
- [Get DNS Records](#get-dns-records)
|
44
|
+
- [Get verification status](#get-verification-status)
|
37
45
|
- [Messages](#messages)
|
38
46
|
- [Get a list of messages](#get-a-list-of-messages)
|
39
47
|
- [Get info for a single message](#get-info-for-a-single-message)
|
48
|
+
- [Scheduled Messages](#scheduled-messages)
|
49
|
+
- [Get a list of scheduled messages](#get-a-list-of-scheduled-messages)
|
50
|
+
- [Get a single scheduled message](#get-a-single-scheduled-message)
|
51
|
+
- [Delete a scheduled message](#delete-a-scheduled-message)
|
40
52
|
- [Recipients](#recipients)
|
41
53
|
- [Get recipients](#get-recipients)
|
42
54
|
- [Get a single recipient](#get-a-single-recipient)
|
@@ -328,6 +340,69 @@ ms_analytics = Mailersend::Analytics.new
|
|
328
340
|
ms_analytics.ua_type(date_from: 1620643567, date_to: 1623321967)
|
329
341
|
```
|
330
342
|
|
343
|
+
## Inbound Routes
|
344
|
+
|
345
|
+
### Get a list of inbound routes
|
346
|
+
|
347
|
+
```ruby
|
348
|
+
require "mailersend-ruby"
|
349
|
+
|
350
|
+
ms_inbound_routes = Mailersend::InboundRouting.new
|
351
|
+
ms_inbound_routes.get_inbound_routes
|
352
|
+
```
|
353
|
+
|
354
|
+
### Get a single inbound route
|
355
|
+
|
356
|
+
```ruby
|
357
|
+
require "mailersend-ruby"
|
358
|
+
|
359
|
+
ms_inbound_routes = Mailersend::InboundRouting.new
|
360
|
+
ms_inbound_routes.get_single_route(inbound_id: 'idofroute12412')
|
361
|
+
```
|
362
|
+
|
363
|
+
### Add an inbound route
|
364
|
+
|
365
|
+
```ruby
|
366
|
+
require "mailersend-ruby"
|
367
|
+
|
368
|
+
ms_inbound_routes = Mailersend::InboundRouting.new
|
369
|
+
ms_inbound_routes.settings =
|
370
|
+
{
|
371
|
+
'domain_id' => 'yourdomainid',
|
372
|
+
'name' => 'inbound_name',
|
373
|
+
'domain_enabled' => false,
|
374
|
+
'match_filter' => { 'type' => 'match_all' },
|
375
|
+
'forwards' => [{ 'type' => 'webhook', 'value' => 'https://example.com' }]
|
376
|
+
}
|
377
|
+
puts ms_inbound_routes.add_inbound_route
|
378
|
+
```
|
379
|
+
|
380
|
+
### Update an inbound route
|
381
|
+
|
382
|
+
```ruby
|
383
|
+
require "mailersend-ruby"
|
384
|
+
|
385
|
+
ms_inbound_routes = Mailersend::InboundRouting.new
|
386
|
+
ms_inbound_routes.settings =
|
387
|
+
{
|
388
|
+
'domain_id' => 'yourdomainid',
|
389
|
+
'name' => 'inbound_updated',
|
390
|
+
'domain_enabled' => false,
|
391
|
+
'match_filter' => { 'type' => 'match_all' },
|
392
|
+
'forwards' => [{ 'type' => 'webhook', 'value' => 'https://example.com' }]
|
393
|
+
}
|
394
|
+
puts ms_inbound_routes.update_inbound_route(inbound_id: 'idofroute12412')
|
395
|
+
```
|
396
|
+
|
397
|
+
### Delete an inbound route
|
398
|
+
|
399
|
+
```ruby
|
400
|
+
require "mailersend-ruby"
|
401
|
+
|
402
|
+
ms_inbound_routes = Mailersend::InboundRouting.new
|
403
|
+
ms_inbound_routes.delete_route(inbound_id: 'idofroute12412')
|
404
|
+
```
|
405
|
+
|
331
406
|
## Domains
|
332
407
|
|
333
408
|
### Get a list of domains
|
@@ -375,6 +450,24 @@ ms_domains = Mailersend::Domains.new
|
|
375
450
|
ms_domains.settings(domain_id: "idofdomain12412", track_clicks: true, track_unsubscribe: false)
|
376
451
|
```
|
377
452
|
|
453
|
+
### Get DNS Records
|
454
|
+
|
455
|
+
```ruby
|
456
|
+
require "mailersend-ruby"
|
457
|
+
|
458
|
+
ms_domains = Mailersend::Domains.new
|
459
|
+
ms_domains.dns(domain_id: "idofdomain12412")
|
460
|
+
```
|
461
|
+
|
462
|
+
### Get verification status
|
463
|
+
|
464
|
+
```ruby
|
465
|
+
require "mailersend-ruby"
|
466
|
+
|
467
|
+
ms_domains = Mailersend::Domains.new
|
468
|
+
ms_domains.verify(domain_id: "idofdomain12412")
|
469
|
+
```
|
470
|
+
|
378
471
|
## Messages
|
379
472
|
|
380
473
|
### Get a list of messages
|
@@ -395,6 +488,35 @@ ms_messages = Mailersend::Messages.new
|
|
395
488
|
ms_messages.single(message_id: "mess11454")
|
396
489
|
```
|
397
490
|
|
491
|
+
## Scheduled Messages
|
492
|
+
|
493
|
+
### Get a list of scheduled messages
|
494
|
+
|
495
|
+
```ruby
|
496
|
+
require "mailersend-ruby"
|
497
|
+
|
498
|
+
ms_scheduled_messages = Mailersend::ScheduledMessages.new
|
499
|
+
ms_scheduled_messages.get_list
|
500
|
+
```
|
501
|
+
|
502
|
+
### Get a single scheduled message
|
503
|
+
|
504
|
+
```ruby
|
505
|
+
require "mailersend-ruby"
|
506
|
+
|
507
|
+
ms_scheduled_messages = Mailersend::ScheduledMessages.new
|
508
|
+
ms_scheduled_messages.get_signle(message_id: 'mess11454')
|
509
|
+
```
|
510
|
+
|
511
|
+
### Delete a scheduled message
|
512
|
+
|
513
|
+
```ruby
|
514
|
+
require "mailersend-ruby"
|
515
|
+
|
516
|
+
ms_scheduled_messages = Mailersend::ScheduledMessages.new
|
517
|
+
ms_scheduled_messages.delete(message_id: 'mess11454')
|
518
|
+
```
|
519
|
+
|
398
520
|
## Recipients
|
399
521
|
|
400
522
|
### Get recipients
|
@@ -64,5 +64,13 @@ module Mailersend
|
|
64
64
|
}
|
65
65
|
client.http.put("#{API_URL}/domains/#{domain_id}/settings", json: hash.compact)
|
66
66
|
end
|
67
|
+
|
68
|
+
def dns(domain_id:)
|
69
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/domains/#{domain_id}/dns-records"))
|
70
|
+
end
|
71
|
+
|
72
|
+
def verify(domain_id:)
|
73
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/domains/#{domain_id}/verify"))
|
74
|
+
end
|
67
75
|
end
|
68
76
|
end
|
@@ -18,7 +18,8 @@ module Mailersend
|
|
18
18
|
:template_id,
|
19
19
|
:tags,
|
20
20
|
:variables,
|
21
|
-
:personalization
|
21
|
+
:personalization,
|
22
|
+
:send_at
|
22
23
|
|
23
24
|
def initialize(client = Mailersend::Client.new)
|
24
25
|
@client = client
|
@@ -34,6 +35,7 @@ module Mailersend
|
|
34
35
|
@personalization = []
|
35
36
|
@attachments = []
|
36
37
|
@tags = []
|
38
|
+
@send_at = send_at
|
37
39
|
end
|
38
40
|
|
39
41
|
def add_recipients(recipients)
|
@@ -93,6 +95,10 @@ module Mailersend
|
|
93
95
|
}
|
94
96
|
end
|
95
97
|
|
98
|
+
def add_send_at(send_at)
|
99
|
+
@send_at = send_at
|
100
|
+
end
|
101
|
+
|
96
102
|
def send
|
97
103
|
message = {
|
98
104
|
'from' => @from,
|
@@ -106,7 +112,8 @@ module Mailersend
|
|
106
112
|
'variables' => @variables,
|
107
113
|
'personalization' => @personalization,
|
108
114
|
'template_id' => @template_id,
|
109
|
-
'attachments' => @attachments
|
115
|
+
'attachments' => @attachments,
|
116
|
+
'send_at' => @send_at
|
110
117
|
}
|
111
118
|
|
112
119
|
client.http.post("#{API_URL}/email", json: message.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {} })
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mailersend
|
4
|
+
# Inbound routing endpoint from MailerSend API.
|
5
|
+
class InboundRouting
|
6
|
+
attr_accessor :client,
|
7
|
+
:domain_id,
|
8
|
+
:page,
|
9
|
+
:limit,
|
10
|
+
:inbound_id,
|
11
|
+
:settings
|
12
|
+
|
13
|
+
def initialize(client = Mailersend::Client.new)
|
14
|
+
@client = client
|
15
|
+
@domain_id = domain_id
|
16
|
+
@page = page
|
17
|
+
@limit = limit
|
18
|
+
@inbound_id = inbound_id
|
19
|
+
@settings = []
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_inbound_routes(*)
|
23
|
+
client.http.get("#{API_URL}/inbound")
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_single_route(inbound_id:)
|
27
|
+
client.http.get("#{API_URL}/inbound/#{inbound_id}")
|
28
|
+
end
|
29
|
+
|
30
|
+
def add_inbound_route
|
31
|
+
client.http.post("#{API_URL}/inbound", json: @settings)
|
32
|
+
end
|
33
|
+
|
34
|
+
def update_inbound_route(inbound_id:)
|
35
|
+
client.http.put("#{API_URL}/inbound/#{inbound_id}", json: @settings)
|
36
|
+
end
|
37
|
+
|
38
|
+
def delete_route(inbound_id:)
|
39
|
+
client.http.delete("#{API_URL}/inbound/#{inbound_id}")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mailersend
|
4
|
+
# Scheduled messages endpoint from MailerSend API.
|
5
|
+
class ScheduledMessages
|
6
|
+
attr_accessor :client,
|
7
|
+
:domain_id,
|
8
|
+
:status,
|
9
|
+
:page,
|
10
|
+
:limit,
|
11
|
+
:message_id
|
12
|
+
|
13
|
+
def initialize(client = Mailersend::Client.new)
|
14
|
+
@client = client
|
15
|
+
@domain_id = domain_id
|
16
|
+
@status = status
|
17
|
+
@page = page
|
18
|
+
@limit = limit
|
19
|
+
@message_id = message_id
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_list(*)
|
23
|
+
client.http.get("#{API_URL}/message-schedules")
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_signle(message_id:)
|
27
|
+
client.http.get("#{API_URL}/message-schedules/#{message_id}")
|
28
|
+
end
|
29
|
+
|
30
|
+
def delete(message_id:)
|
31
|
+
client.http.delete("#{API_URL}/message-schedules/#{message_id}")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/mailersend/version.rb
CHANGED
data/lib/mailersend.rb
CHANGED
@@ -7,8 +7,10 @@ require_relative 'mailersend/analytics/analytics'
|
|
7
7
|
require_relative 'mailersend/bulk_email/bulk_email'
|
8
8
|
require_relative 'mailersend/domains/domains'
|
9
9
|
require_relative 'mailersend/email/email'
|
10
|
+
require_relative 'mailersend/inbound_routing/inbound_routing'
|
10
11
|
require_relative 'mailersend/messages/messages'
|
11
12
|
require_relative 'mailersend/recipients/recipients'
|
13
|
+
require_relative 'mailersend/scheduled_messages/scheduled_messages'
|
12
14
|
require_relative 'mailersend/suppressions/suppressions'
|
13
15
|
require_relative 'mailersend/templates/templates'
|
14
16
|
require_relative 'mailersend/tokens/tokens'
|
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: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikola Milojević
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -138,8 +138,10 @@ files:
|
|
138
138
|
- lib/mailersend/client.rb
|
139
139
|
- lib/mailersend/domains/domains.rb
|
140
140
|
- lib/mailersend/email/email.rb
|
141
|
+
- lib/mailersend/inbound_routing/inbound_routing.rb
|
141
142
|
- lib/mailersend/messages/messages.rb
|
142
143
|
- lib/mailersend/recipients/recipients.rb
|
144
|
+
- lib/mailersend/scheduled_messages/scheduled_messages.rb
|
143
145
|
- lib/mailersend/suppressions/suppressions.rb
|
144
146
|
- lib/mailersend/templates/templates.rb
|
145
147
|
- lib/mailersend/tokens/tokens.rb
|