mailersend-ruby 1.5.2 → 2.0.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 +4 -4
- data/.github/workflows/main.yml +10 -3
- data/.github/workflows/publish_gem.yml +12 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile +3 -3
- data/README.md +288 -84
- data/lib/mailersend/client.rb +3 -4
- data/lib/mailersend/domains/domains.rb +15 -2
- data/lib/mailersend/sender_identity/sender_identity.rb +27 -0
- data/lib/mailersend/version.rb +1 -1
- data/mailersend-ruby.gemspec +1 -2
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 968822d3ad903e00f17ed9f621a5aef8b44864b8ae978fe0a7add39c90d0b49c
|
4
|
+
data.tar.gz: af1f6618fea59168f002e35e3dbf1fed804636d98232fa97b1d443573b45f20b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86652332997ef19fb218761ca2b9233442ce3637c031e96786e490d282e2757235ad56231d6450d2cd7a490a88b2cb5bf7e4749522a1f521b98d4060c42f076b
|
7
|
+
data.tar.gz: 25bc20a08ff764455e0079b9d981752eb55369a0a9328ba1a366945dd3d574ea0f2d36d133ed8fa83d0f8344430bd4c70c0d3ad6c2a4a86e32ff0eb560f788f5
|
data/.github/workflows/main.yml
CHANGED
@@ -6,11 +6,18 @@ jobs:
|
|
6
6
|
build:
|
7
7
|
runs-on: ubuntu-latest
|
8
8
|
steps:
|
9
|
-
- uses: actions/checkout@
|
9
|
+
- uses: actions/checkout@v4
|
10
|
+
|
10
11
|
- name: Set up Ruby
|
11
|
-
uses:
|
12
|
+
uses: actions/setup-ruby@v1
|
12
13
|
with:
|
13
14
|
ruby-version: 3.0
|
14
|
-
|
15
|
+
|
16
|
+
- name: Install Bundler
|
17
|
+
run: gem install bundler -v 2.4.22
|
18
|
+
|
19
|
+
- name: Install dependencies
|
20
|
+
run: bundle _2.4.22_ install
|
21
|
+
|
15
22
|
- name: Run the default task
|
16
23
|
run: bundle exec rake
|
@@ -9,7 +9,18 @@ jobs:
|
|
9
9
|
runs-on: ubuntu-latest
|
10
10
|
|
11
11
|
steps:
|
12
|
-
- uses: actions/checkout@
|
12
|
+
- uses: actions/checkout@v4
|
13
|
+
|
14
|
+
- name: Set up Ruby
|
15
|
+
uses: actions/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: 3.0
|
18
|
+
|
19
|
+
- name: Install Bundler
|
20
|
+
run: gem install bundler -v 2.4.22
|
21
|
+
|
22
|
+
- name: Install dependencies
|
23
|
+
run: bundle _2.4.22_ install
|
13
24
|
|
14
25
|
- name: Release Gem
|
15
26
|
if: contains(github.ref, 'refs/tags/v')
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
## [Released]
|
2
2
|
|
3
|
+
## [2.0.0] - 2023-12-18
|
4
|
+
|
5
|
+
- *BREAKING CHANGE* - Please check the README file, MailerSend API token is now defined inside your application.
|
6
|
+
|
7
|
+
## [1.6.0] - 2023-06-22
|
8
|
+
|
9
|
+
- Sender identities by email
|
10
|
+
|
11
|
+
## [1.5.2] - 2023-06-20
|
12
|
+
|
13
|
+
- Removed uninitialized variable
|
14
|
+
|
3
15
|
## [1.5.1] - 2023-05-09
|
4
16
|
|
5
17
|
- Added supports for base64 attachment
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -37,6 +37,7 @@ MailerSend Ruby SDK
|
|
37
37
|
- [Domains](#domains)
|
38
38
|
- [Get a list of domains](#get-a-list-of-domains)
|
39
39
|
- [Get a single domain](#get-a-single-domain)
|
40
|
+
- [Add a domain](#add-a-domain)
|
40
41
|
- [Delete a domain](#delete-a-domain)
|
41
42
|
- [Get recipients for a domain](#get-recipients-for-a-domain)
|
42
43
|
- [Update domain settings](#update-domain-settings)
|
@@ -45,9 +46,12 @@ MailerSend Ruby SDK
|
|
45
46
|
- [Sender Identities](#sender-identities)
|
46
47
|
- [Get a list of sender identities](#get-a-list-of-sender-identities)
|
47
48
|
- [Get a single sender identity](#get-a-single-sender-identity)
|
49
|
+
- [Get a single sender identity by email](#get-a-single-sender-identity-by-email)
|
48
50
|
- [Add a sender identity](#add-a-sender-identity)
|
49
51
|
- [Update a sender identity](#update-a-sender-identity)
|
52
|
+
- [Update a sender identity by email](#update-a-sender-identity-by-email)
|
50
53
|
- [Delete a sender identity](#delete-a-sender-identity)
|
54
|
+
- [Delete a sender identity by email](#delete-a-sender-identity-by-email)
|
51
55
|
- [Messages](#messages)
|
52
56
|
- [Get a list of messages](#get-a-list-of-messages)
|
53
57
|
- [Get info for a single message](#get-info-for-a-single-message)
|
@@ -122,10 +126,6 @@ gem install mailersend-ruby
|
|
122
126
|
|
123
127
|
You will have to initalize it in your Ruby file with `require "mailersend-ruby"`.
|
124
128
|
|
125
|
-
# Usage
|
126
|
-
|
127
|
-
This SDK requires that you either have `.env` file with `MAILERSEND_API_TOKEN` env variable or that your variable is enabled system wide (useful for Docker/Kubernetes). The example of how `MAILERSEND_API_TOKEN` should look like is in `.env.example`.
|
128
|
-
|
129
129
|
## Email
|
130
130
|
|
131
131
|
### Send an email
|
@@ -133,8 +133,10 @@ This SDK requires that you either have `.env` file with `MAILERSEND_API_TOKEN` e
|
|
133
133
|
```ruby
|
134
134
|
require "mailersend-ruby"
|
135
135
|
|
136
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
137
|
+
|
136
138
|
# Intialize the email class
|
137
|
-
ms_email = Mailersend::Email.new
|
139
|
+
ms_email = Mailersend::Email.new(ms_client)
|
138
140
|
|
139
141
|
# Add parameters
|
140
142
|
ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
|
@@ -153,8 +155,10 @@ ms_email.send
|
|
153
155
|
```ruby
|
154
156
|
require "mailersend-ruby"
|
155
157
|
|
158
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
159
|
+
|
156
160
|
# Intialize the email class
|
157
|
-
ms_email = Mailersend::Email.new
|
161
|
+
ms_email = Mailersend::Email.new(ms_client)
|
158
162
|
|
159
163
|
# Add parameters
|
160
164
|
ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
|
@@ -175,8 +179,10 @@ ms_email.send
|
|
175
179
|
```ruby
|
176
180
|
require "mailersend-ruby"
|
177
181
|
|
182
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
183
|
+
|
178
184
|
# Intialize the email class
|
179
|
-
ms_email = Mailersend::Email.new
|
185
|
+
ms_email = Mailersend::Email.new(ms_client)
|
180
186
|
|
181
187
|
# Add parameters
|
182
188
|
ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
|
@@ -194,8 +200,10 @@ ms_email.send
|
|
194
200
|
```ruby
|
195
201
|
require "mailersend-ruby"
|
196
202
|
|
203
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
204
|
+
|
197
205
|
# Intialize the email class
|
198
|
-
ms_email = Mailersend::Email.new
|
206
|
+
ms_email = Mailersend::Email.new(ms_client)
|
199
207
|
|
200
208
|
# Add parameters
|
201
209
|
ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
|
@@ -221,8 +229,10 @@ ms_email.send
|
|
221
229
|
```ruby
|
222
230
|
require "mailersend-ruby"
|
223
231
|
|
232
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
233
|
+
|
224
234
|
# Intialize the email class
|
225
|
-
ms_email = Mailersend::Email.new
|
235
|
+
ms_email = Mailersend::Email.new(ms_client)
|
226
236
|
|
227
237
|
# Add parameters
|
228
238
|
ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
|
@@ -252,7 +262,9 @@ ms_email.send
|
|
252
262
|
```ruby
|
253
263
|
require "mailersend-ruby"
|
254
264
|
|
255
|
-
|
265
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
266
|
+
|
267
|
+
ms_bulk_email = Mailersend::BulkEmail.new(ms_client)
|
256
268
|
|
257
269
|
ms_bulk_email.messages = [
|
258
270
|
{
|
@@ -278,7 +290,9 @@ ms_bulk_email.send
|
|
278
290
|
```ruby
|
279
291
|
require "mailersend-ruby"
|
280
292
|
|
281
|
-
|
293
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
294
|
+
|
295
|
+
ms_bulk_email = Mailersend::BulkEmail.new(ms_client)
|
282
296
|
ms_bulk_email.get_bulk_status(bulk_email_id: 'yourbulkemailid')
|
283
297
|
```
|
284
298
|
|
@@ -288,7 +302,9 @@ ms_bulk_email.get_bulk_status(bulk_email_id: 'yourbulkemailid')
|
|
288
302
|
```ruby
|
289
303
|
require "mailersend-ruby"
|
290
304
|
|
291
|
-
|
305
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
306
|
+
|
307
|
+
ms_tokens = Mailersend::Tokens.new(ms_client)
|
292
308
|
ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ], domain_id: "yourdomainid")
|
293
309
|
```
|
294
310
|
|
@@ -296,7 +312,9 @@ ms_tokens.create(name: "Very nice token", scopes: %w[ email_full domains_read ],
|
|
296
312
|
```ruby
|
297
313
|
require "mailersend-ruby"
|
298
314
|
|
299
|
-
|
315
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
316
|
+
|
317
|
+
ms_tokens = Mailersend::Tokens.new(ms_client)
|
300
318
|
ms_tokens.update(token_id: "d2220fx04", status: "paused")
|
301
319
|
```
|
302
320
|
|
@@ -304,7 +322,9 @@ ms_tokens.update(token_id: "d2220fx04", status: "paused")
|
|
304
322
|
```ruby
|
305
323
|
require "mailersend-ruby"
|
306
324
|
|
307
|
-
|
325
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
326
|
+
|
327
|
+
ms_tokens = Mailersend::Tokens.new(ms_client)
|
308
328
|
ms_tokens.delete(token_id: "d2220fx04")
|
309
329
|
```
|
310
330
|
|
@@ -313,8 +333,10 @@ ms_tokens.delete(token_id: "d2220fx04")
|
|
313
333
|
```ruby
|
314
334
|
require "mailersend-ruby"
|
315
335
|
|
336
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
337
|
+
|
316
338
|
# Intialize the email class
|
317
|
-
ms_email = Mailersend::Email.new
|
339
|
+
ms_email = Mailersend::Email.new(ms_client)
|
318
340
|
|
319
341
|
# Add parameters
|
320
342
|
ms_email.add_recipients("email" => "ron@parksandrec.com", "name" => "Ron")
|
@@ -340,7 +362,9 @@ ms_email.send
|
|
340
362
|
```ruby
|
341
363
|
require "mailersend-ruby"
|
342
364
|
|
343
|
-
|
365
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
366
|
+
|
367
|
+
ms_activity = Mailersend::Activity.new(ms_client)
|
344
368
|
ms_activity.get(domain_id: "xxx2241ll", page: 3, limit: 5, date_from: 1620643567, date_to: 1623321967)
|
345
369
|
```
|
346
370
|
|
@@ -351,7 +375,9 @@ ms_activity.get(domain_id: "xxx2241ll", page: 3, limit: 5, date_from: 1620643567
|
|
351
375
|
```ruby
|
352
376
|
require "mailersend-ruby"
|
353
377
|
|
354
|
-
|
378
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
379
|
+
|
380
|
+
ms_analytics = Mailersend::Analytics.new(ms_client)
|
355
381
|
ms_analytics.date(date_from: 1620643567, date_to: 1623321967, events: %w[sent queued])
|
356
382
|
```
|
357
383
|
|
@@ -360,7 +386,9 @@ ms_analytics.date(date_from: 1620643567, date_to: 1623321967, events: %w[sent qu
|
|
360
386
|
```ruby
|
361
387
|
require "mailersend-ruby"
|
362
388
|
|
363
|
-
|
389
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
390
|
+
|
391
|
+
ms_analytics = Mailersend::Analytics.new(ms_client)
|
364
392
|
ms_analytics.country(date_from: 1620643567, date_to: 1623321967)
|
365
393
|
```
|
366
394
|
|
@@ -369,7 +397,9 @@ ms_analytics.country(date_from: 1620643567, date_to: 1623321967)
|
|
369
397
|
```ruby
|
370
398
|
require "mailersend-ruby"
|
371
399
|
|
372
|
-
|
400
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
401
|
+
|
402
|
+
ms_analytics = Mailersend::Analytics.new(ms_client)
|
373
403
|
ms_analytics.ua_name(date_from: 1620643567, date_to: 1623321967)
|
374
404
|
```
|
375
405
|
|
@@ -378,7 +408,9 @@ ms_analytics.ua_name(date_from: 1620643567, date_to: 1623321967)
|
|
378
408
|
```ruby
|
379
409
|
require "mailersend-ruby"
|
380
410
|
|
381
|
-
|
411
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
412
|
+
|
413
|
+
ms_analytics = Mailersend::Analytics.new(ms_client)
|
382
414
|
ms_analytics.ua_type(date_from: 1620643567, date_to: 1623321967)
|
383
415
|
```
|
384
416
|
|
@@ -389,7 +421,9 @@ ms_analytics.ua_type(date_from: 1620643567, date_to: 1623321967)
|
|
389
421
|
```ruby
|
390
422
|
require "mailersend-ruby"
|
391
423
|
|
392
|
-
|
424
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
425
|
+
|
426
|
+
ms_inbound_routes = Mailersend::InboundRouting.new(ms_client)
|
393
427
|
ms_inbound_routes.get_inbound_routes
|
394
428
|
```
|
395
429
|
|
@@ -398,7 +432,9 @@ ms_inbound_routes.get_inbound_routes
|
|
398
432
|
```ruby
|
399
433
|
require "mailersend-ruby"
|
400
434
|
|
401
|
-
|
435
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
436
|
+
|
437
|
+
ms_inbound_routes = Mailersend::InboundRouting.new(ms_client)
|
402
438
|
ms_inbound_routes.get_single_route(inbound_id: 'idofroute12412')
|
403
439
|
```
|
404
440
|
|
@@ -407,7 +443,9 @@ ms_inbound_routes.get_single_route(inbound_id: 'idofroute12412')
|
|
407
443
|
```ruby
|
408
444
|
require "mailersend-ruby"
|
409
445
|
|
410
|
-
|
446
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
447
|
+
|
448
|
+
ms_inbound_routes = Mailersend::InboundRouting.new(ms_client)
|
411
449
|
ms_inbound_routes.settings =
|
412
450
|
{
|
413
451
|
'domain_id' => 'yourdomainid',
|
@@ -424,7 +462,9 @@ puts ms_inbound_routes.add_inbound_route
|
|
424
462
|
```ruby
|
425
463
|
require "mailersend-ruby"
|
426
464
|
|
427
|
-
|
465
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
466
|
+
|
467
|
+
ms_inbound_routes = Mailersend::InboundRouting.new(ms_client)
|
428
468
|
ms_inbound_routes.settings =
|
429
469
|
{
|
430
470
|
'domain_id' => 'yourdomainid',
|
@@ -441,7 +481,9 @@ puts ms_inbound_routes.update_inbound_route(inbound_id: 'idofroute12412')
|
|
441
481
|
```ruby
|
442
482
|
require "mailersend-ruby"
|
443
483
|
|
444
|
-
|
484
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
485
|
+
|
486
|
+
ms_inbound_routes = Mailersend::InboundRouting.new(ms_client)
|
445
487
|
ms_inbound_routes.delete_route(inbound_id: 'idofroute12412')
|
446
488
|
```
|
447
489
|
|
@@ -452,7 +494,9 @@ ms_inbound_routes.delete_route(inbound_id: 'idofroute12412')
|
|
452
494
|
```ruby
|
453
495
|
require "mailersend-ruby"
|
454
496
|
|
455
|
-
|
497
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
498
|
+
|
499
|
+
ms_domains = Mailersend::Domains.new(ms_client)
|
456
500
|
ms_domains.list
|
457
501
|
```
|
458
502
|
|
@@ -461,16 +505,31 @@ ms_domains.list
|
|
461
505
|
```ruby
|
462
506
|
require "mailersend-ruby"
|
463
507
|
|
464
|
-
|
508
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
509
|
+
|
510
|
+
ms_domains = Mailersend::Domains.new(ms_client)
|
465
511
|
ms_domains.single(domain_id: "idofdomain12412")
|
466
512
|
```
|
467
513
|
|
514
|
+
### Add a domain
|
515
|
+
|
516
|
+
```ruby
|
517
|
+
require "mailersend-ruby"
|
518
|
+
|
519
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
520
|
+
|
521
|
+
ms_domains = Mailersend::Domains.new(ms_client)
|
522
|
+
ms_domains.add(name: 'yourdomain')
|
523
|
+
```
|
524
|
+
|
468
525
|
### Delete a domain
|
469
526
|
|
470
527
|
```ruby
|
471
528
|
require "mailersend-ruby"
|
472
529
|
|
473
|
-
|
530
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
531
|
+
|
532
|
+
ms_domains = Mailersend::Domains.new(ms_client)
|
474
533
|
ms_domains.delete(domain_id: "idofdomain12412")
|
475
534
|
```
|
476
535
|
|
@@ -479,7 +538,9 @@ ms_domains.delete(domain_id: "idofdomain12412")
|
|
479
538
|
```ruby
|
480
539
|
require "mailersend-ruby"
|
481
540
|
|
482
|
-
|
541
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
542
|
+
|
543
|
+
ms_domains = Mailersend::Domains.new(ms_client)
|
483
544
|
ms_domains.recipients(domain_id: "idofdomain12412")
|
484
545
|
```
|
485
546
|
|
@@ -488,7 +549,9 @@ ms_domains.recipients(domain_id: "idofdomain12412")
|
|
488
549
|
```ruby
|
489
550
|
require "mailersend-ruby"
|
490
551
|
|
491
|
-
|
552
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
553
|
+
|
554
|
+
ms_domains = Mailersend::Domains.new(ms_client)
|
492
555
|
ms_domains.settings(domain_id: "idofdomain12412", track_clicks: true, track_unsubscribe: false)
|
493
556
|
```
|
494
557
|
|
@@ -497,7 +560,9 @@ ms_domains.settings(domain_id: "idofdomain12412", track_clicks: true, track_unsu
|
|
497
560
|
```ruby
|
498
561
|
require "mailersend-ruby"
|
499
562
|
|
500
|
-
|
563
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
564
|
+
|
565
|
+
ms_domains = Mailersend::Domains.new(ms_client)
|
501
566
|
ms_domains.dns(domain_id: "idofdomain12412")
|
502
567
|
```
|
503
568
|
|
@@ -506,7 +571,9 @@ ms_domains.dns(domain_id: "idofdomain12412")
|
|
506
571
|
```ruby
|
507
572
|
require "mailersend-ruby"
|
508
573
|
|
509
|
-
|
574
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
575
|
+
|
576
|
+
ms_domains = Mailersend::Domains.new(ms_client)
|
510
577
|
ms_domains.verify(domain_id: "idofdomain12412")
|
511
578
|
```
|
512
579
|
|
@@ -517,7 +584,9 @@ ms_domains.verify(domain_id: "idofdomain12412")
|
|
517
584
|
```ruby
|
518
585
|
require "mailersend-ruby"
|
519
586
|
|
520
|
-
|
587
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
588
|
+
|
589
|
+
ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
|
521
590
|
ms_sender_identity.list
|
522
591
|
```
|
523
592
|
|
@@ -526,16 +595,31 @@ ms_sender_identity.list
|
|
526
595
|
```ruby
|
527
596
|
require "mailersend-ruby"
|
528
597
|
|
529
|
-
|
598
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
599
|
+
|
600
|
+
ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
|
530
601
|
ms_sender_identity.single(identity_id: 'idofidentity123')
|
531
602
|
```
|
532
603
|
|
604
|
+
### Get a single sender identity by email
|
605
|
+
|
606
|
+
```ruby
|
607
|
+
require "mailersend-ruby"
|
608
|
+
|
609
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
610
|
+
|
611
|
+
ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
|
612
|
+
ms_sender_identity.single_by_email(email: 'example@email.com')
|
613
|
+
```
|
614
|
+
|
533
615
|
### Add a sender identity
|
534
616
|
|
535
617
|
```ruby
|
536
618
|
require "mailersend-ruby"
|
537
619
|
|
538
|
-
|
620
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
621
|
+
|
622
|
+
ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
|
539
623
|
ms_sender_identity.add(domain_id: 'idofdomain12412', name: 'yourname', email: 'youremail')
|
540
624
|
```
|
541
625
|
|
@@ -544,19 +628,45 @@ ms_sender_identity.add(domain_id: 'idofdomain12412', name: 'yourname', email: 'y
|
|
544
628
|
```ruby
|
545
629
|
require "mailersend-ruby"
|
546
630
|
|
547
|
-
|
631
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
632
|
+
|
633
|
+
ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
|
548
634
|
ms_sender_identity.update(identity_id: 'idofidentity123', reply_to_email: 'replyemail', reply_to_name: 'replyname')
|
549
635
|
```
|
550
636
|
|
637
|
+
### Update a sender identity by email
|
638
|
+
|
639
|
+
```ruby
|
640
|
+
require "mailersend-ruby"
|
641
|
+
|
642
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
643
|
+
|
644
|
+
ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
|
645
|
+
ms_sender_identity.update_by_email(email: 'example@email.com', reply_to_email: 'replyemail', reply_to_name: 'replyname')
|
646
|
+
```
|
647
|
+
|
551
648
|
### Delete a sender identity
|
552
649
|
|
553
650
|
```ruby
|
554
651
|
require "mailersend-ruby"
|
555
652
|
|
556
|
-
|
653
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
654
|
+
|
655
|
+
ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
|
557
656
|
ms_sender_identity.delete(identity_id: 'idofidentity123')
|
558
657
|
```
|
559
658
|
|
659
|
+
### Delete a sender identity by email
|
660
|
+
|
661
|
+
```ruby
|
662
|
+
require "mailersend-ruby"
|
663
|
+
|
664
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
665
|
+
|
666
|
+
ms_sender_identity = Mailersend::SenderIdentity.new(ms_client)
|
667
|
+
ms_sender_identity.delete_by_email(email: 'example@email.com')
|
668
|
+
```
|
669
|
+
|
560
670
|
## Messages
|
561
671
|
|
562
672
|
### Get a list of messages
|
@@ -564,7 +674,9 @@ ms_sender_identity.delete(identity_id: 'idofidentity123')
|
|
564
674
|
```ruby
|
565
675
|
require "mailersend-ruby"
|
566
676
|
|
567
|
-
|
677
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
678
|
+
|
679
|
+
ms_messages = Mailersend::Messages.new(ms_client)
|
568
680
|
ms_messages.list(page: 1, limit: 10)
|
569
681
|
```
|
570
682
|
|
@@ -573,7 +685,9 @@ ms_messages.list(page: 1, limit: 10)
|
|
573
685
|
```ruby
|
574
686
|
require "mailersend-ruby"
|
575
687
|
|
576
|
-
|
688
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
689
|
+
|
690
|
+
ms_messages = Mailersend::Messages.new(ms_client)
|
577
691
|
ms_messages.single(message_id: "mess11454")
|
578
692
|
```
|
579
693
|
|
@@ -584,7 +698,9 @@ ms_messages.single(message_id: "mess11454")
|
|
584
698
|
```ruby
|
585
699
|
require "mailersend-ruby"
|
586
700
|
|
587
|
-
|
701
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
702
|
+
|
703
|
+
ms_scheduled_messages = Mailersend::ScheduledMessages.new(ms_client)
|
588
704
|
ms_scheduled_messages.get_list
|
589
705
|
```
|
590
706
|
|
@@ -593,7 +709,9 @@ ms_scheduled_messages.get_list
|
|
593
709
|
```ruby
|
594
710
|
require "mailersend-ruby"
|
595
711
|
|
596
|
-
|
712
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
713
|
+
|
714
|
+
ms_scheduled_messages = Mailersend::ScheduledMessages.new(ms_client)
|
597
715
|
ms_scheduled_messages.get_signle(message_id: 'mess11454')
|
598
716
|
```
|
599
717
|
|
@@ -602,7 +720,9 @@ ms_scheduled_messages.get_signle(message_id: 'mess11454')
|
|
602
720
|
```ruby
|
603
721
|
require "mailersend-ruby"
|
604
722
|
|
605
|
-
|
723
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
724
|
+
|
725
|
+
ms_scheduled_messages = Mailersend::ScheduledMessages.new(ms_client)
|
606
726
|
ms_scheduled_messages.delete(message_id: 'mess11454')
|
607
727
|
```
|
608
728
|
|
@@ -613,7 +733,9 @@ ms_scheduled_messages.delete(message_id: 'mess11454')
|
|
613
733
|
```ruby
|
614
734
|
require "mailersend-ruby"
|
615
735
|
|
616
|
-
|
736
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
737
|
+
|
738
|
+
ms_recipients = Mailersend::Recipients.new(ms_client)
|
617
739
|
ms_recipients.list(page: 1, limit: 10)
|
618
740
|
```
|
619
741
|
|
@@ -622,7 +744,9 @@ ms_recipients.list(page: 1, limit: 10)
|
|
622
744
|
```ruby
|
623
745
|
require "mailersend-ruby"
|
624
746
|
|
625
|
-
|
747
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
748
|
+
|
749
|
+
ms_recipients = Mailersend::Recipients.new(ms_client)
|
626
750
|
ms_recipients.single(recipient_id: "id124")
|
627
751
|
```
|
628
752
|
|
@@ -631,7 +755,9 @@ ms_recipients.single(recipient_id: "id124")
|
|
631
755
|
```ruby
|
632
756
|
require "mailersend-ruby"
|
633
757
|
|
634
|
-
|
758
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
759
|
+
|
760
|
+
ms_recipients = Mailersend::Recipients.new(ms_client)
|
635
761
|
ms_recipients.delete(recipient_id: "id124")
|
636
762
|
```
|
637
763
|
|
@@ -642,7 +768,9 @@ ms_recipients.delete(recipient_id: "id124")
|
|
642
768
|
```ruby
|
643
769
|
require "mailersend-ruby"
|
644
770
|
|
645
|
-
|
771
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
772
|
+
|
773
|
+
ms_suppressions = Mailersend::Suppressions.new(ms_client)
|
646
774
|
|
647
775
|
// List from Blocklist
|
648
776
|
ms_suppressions.get_from_blocklist(domain_id: "xxx2241ll")
|
@@ -662,7 +790,9 @@ ms_suppressions.get_unsubscribes(domain_id: "xxx2241ll")
|
|
662
790
|
```ruby
|
663
791
|
require "mailersend-ruby"
|
664
792
|
|
665
|
-
|
793
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
794
|
+
|
795
|
+
ms_suppressions = Mailersend::Suppressions.new(ms_client)
|
666
796
|
|
667
797
|
// Add Recipient to Block List using recipients
|
668
798
|
ms_suppressions.add_to_blocklist(domain_id: "xxx2241ll", recipients: ["blocked@client.com"])
|
@@ -685,7 +815,9 @@ ms_suppressions.add_to_unsubscribers(domain_id: "xxx2241ll", recipients: ["bounc
|
|
685
815
|
```ruby
|
686
816
|
require "mailersend-ruby"
|
687
817
|
|
688
|
-
|
818
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
819
|
+
|
820
|
+
ms_suppressions = Mailersend::Suppressions.new(ms_client)
|
689
821
|
|
690
822
|
// Delete from Block List
|
691
823
|
ms_suppressions.delete_from_blocklist(domain_id: 'yourdomainid', ids: ["xxx2241ll"])
|
@@ -706,7 +838,9 @@ ms_suppressions.delete_from_unsubscribers(domain_id: 'yourdomainid', ids: ["xxx2
|
|
706
838
|
```ruby
|
707
839
|
require "mailersend-ruby"
|
708
840
|
|
709
|
-
|
841
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
842
|
+
|
843
|
+
ms_webhooks = Mailersend::Webhooks.new(ms_client)
|
710
844
|
ms_webhooks.list(domain_id: "xxx2241ll")
|
711
845
|
```
|
712
846
|
|
@@ -714,7 +848,9 @@ ms_webhooks.list(domain_id: "xxx2241ll")
|
|
714
848
|
```ruby
|
715
849
|
require "mailersend-ruby"
|
716
850
|
|
717
|
-
|
851
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
852
|
+
|
853
|
+
ms_webhooks = Mailersend::Webhooks.new(ms_client)
|
718
854
|
ms_webhooks.single(webhook_id: "zzz2241ll")
|
719
855
|
```
|
720
856
|
|
@@ -722,7 +858,9 @@ ms_webhooks.single(webhook_id: "zzz2241ll")
|
|
722
858
|
```ruby
|
723
859
|
require "mailersend-ruby"
|
724
860
|
|
725
|
-
|
861
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
862
|
+
|
863
|
+
ms_webhooks = Mailersend::Webhooks.new(ms_client)
|
726
864
|
ms_webhooks.create(domain_id: "xxx2241ll", url: "https://domain.com/hook", name: "Webhook", events: ["activity.sent", "activity.delivered"], enabled: true)
|
727
865
|
```
|
728
866
|
|
@@ -730,7 +868,9 @@ ms_webhooks.create(domain_id: "xxx2241ll", url: "https://domain.com/hook", name:
|
|
730
868
|
```ruby
|
731
869
|
require "mailersend-ruby"
|
732
870
|
|
733
|
-
|
871
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
872
|
+
|
873
|
+
ms_webhooks = Mailersend::Webhooks.new(ms_client)
|
734
874
|
ms_webhooks.update(webhook_id: "zzz2241ll", enabled: false)
|
735
875
|
```
|
736
876
|
|
@@ -738,7 +878,9 @@ ms_webhooks.update(webhook_id: "zzz2241ll", enabled: false)
|
|
738
878
|
```ruby
|
739
879
|
require "mailersend-ruby"
|
740
880
|
|
741
|
-
|
881
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
882
|
+
|
883
|
+
ms_webhooks = Mailersend::Webhooks.new(ms_client)
|
742
884
|
ms_webhooks.delete(webhook_id: "zzz2241ll")
|
743
885
|
```
|
744
886
|
|
@@ -749,7 +891,9 @@ ms_webhooks.delete(webhook_id: "zzz2241ll")
|
|
749
891
|
```ruby
|
750
892
|
require "mailersend-ruby"
|
751
893
|
|
752
|
-
|
894
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
895
|
+
|
896
|
+
ms_templates = Mailersend::Templates.new(ms_client)
|
753
897
|
ms_templates.list(domain_id: "aax455lll", page: 1, limit: 10)
|
754
898
|
```
|
755
899
|
|
@@ -758,7 +902,9 @@ ms_templates.list(domain_id: "aax455lll", page: 1, limit: 10)
|
|
758
902
|
```ruby
|
759
903
|
require "mailersend-ruby"
|
760
904
|
|
761
|
-
|
905
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
906
|
+
|
907
|
+
ms_templates = Mailersend::Templates.new(ms_client)
|
762
908
|
ms_templates.single(template_id: "id124")
|
763
909
|
```
|
764
910
|
|
@@ -767,7 +913,9 @@ ms_templates.single(template_id: "id124")
|
|
767
913
|
```ruby
|
768
914
|
require "mailersend-ruby"
|
769
915
|
|
770
|
-
|
916
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
917
|
+
|
918
|
+
ms_templates = Mailersend::Templates.new(ms_client)
|
771
919
|
ms_templates.delete(template_id: "id124")
|
772
920
|
```
|
773
921
|
|
@@ -778,7 +926,9 @@ ms_templates.delete(template_id: "id124")
|
|
778
926
|
```ruby
|
779
927
|
require "mailersend-ruby"
|
780
928
|
|
781
|
-
|
929
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
930
|
+
|
931
|
+
ms_email_verification = Mailersend::EmailVerification.new(ms_client)
|
782
932
|
ms_email_verification.verify_an_email(email: 'example@email.com')
|
783
933
|
```
|
784
934
|
|
@@ -787,7 +937,9 @@ ms_email_verification.verify_an_email(email: 'example@email.com')
|
|
787
937
|
```ruby
|
788
938
|
require "mailersend-ruby"
|
789
939
|
|
790
|
-
|
940
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
941
|
+
|
942
|
+
ms_email_verification = Mailersend::EmailVerification.new(ms_client)
|
791
943
|
ms_email_verification.list(page: 1, limit: 10)
|
792
944
|
```
|
793
945
|
|
@@ -796,7 +948,9 @@ ms_email_verification.list(page: 1, limit: 10)
|
|
796
948
|
```ruby
|
797
949
|
require "mailersend-ruby"
|
798
950
|
|
799
|
-
|
951
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
952
|
+
|
953
|
+
ms_email_verification = Mailersend::EmailVerification.new(ms_client)
|
800
954
|
ms_email_verification.get_single_list(email_verification_id: 'your-email-verification-id')
|
801
955
|
```
|
802
956
|
|
@@ -805,7 +959,9 @@ ms_email_verification.get_single_list(email_verification_id: 'your-email-verific
|
|
805
959
|
```ruby
|
806
960
|
require "mailersend-ruby"
|
807
961
|
|
808
|
-
|
962
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
963
|
+
|
964
|
+
ms_email_verification = Mailersend::EmailVerification.new(ms_client)
|
809
965
|
ms_email_verification.create_a_list(name: "name-your-list", emails: ["example@email.com"])
|
810
966
|
```
|
811
967
|
|
@@ -814,7 +970,9 @@ ms_email_verification.create_a_list(name: "name-your-list", emails: ["example@em
|
|
814
970
|
```ruby
|
815
971
|
require "mailersend-ruby"
|
816
972
|
|
817
|
-
|
973
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
974
|
+
|
975
|
+
ms_email_verification = Mailersend::EmailVerification.new(ms_client)
|
818
976
|
ms_email_verification.verify_a_list(email_verification_id: 'your-email-verification-id')
|
819
977
|
```
|
820
978
|
|
@@ -823,7 +981,9 @@ ms_email_verification.verify_a_list(email_verification_id: 'your-email-verificat
|
|
823
981
|
```ruby
|
824
982
|
require "mailersend-ruby"
|
825
983
|
|
826
|
-
|
984
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
985
|
+
|
986
|
+
ms_email_verification = Mailersend::EmailVerification.new(ms_client)
|
827
987
|
ms_email_verification.get_list_results(email_verification_id: 'your-email-verification-id')
|
828
988
|
```
|
829
989
|
|
@@ -834,8 +994,10 @@ ms_email_verification.get_list_results(email_verification_id: 'your-email-verifi
|
|
834
994
|
```ruby
|
835
995
|
require "mailersend-ruby"
|
836
996
|
|
997
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
998
|
+
|
837
999
|
# Intialize the SMS class
|
838
|
-
ms_sms = Mailersend::SMS.new
|
1000
|
+
ms_sms = Mailersend::SMS.new(ms_client)
|
839
1001
|
|
840
1002
|
# Add parameters
|
841
1003
|
ms_sms.add_from('your-number')
|
@@ -860,8 +1022,10 @@ ms_sms.send
|
|
860
1022
|
```ruby
|
861
1023
|
require "mailersend-ruby"
|
862
1024
|
|
1025
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1026
|
+
|
863
1027
|
# Intialize the SMS Messages class
|
864
|
-
ms_sms_messages = Mailersend::SMSMessages.new
|
1028
|
+
ms_sms_messages = Mailersend::SMSMessages.new(ms_client)
|
865
1029
|
|
866
1030
|
# Add parameters
|
867
1031
|
ms_sms_messages.list(page: 1, limit: 10)
|
@@ -872,8 +1036,10 @@ ms_sms_messages.list(page: 1, limit: 10)
|
|
872
1036
|
```ruby
|
873
1037
|
require "mailersend-ruby"
|
874
1038
|
|
1039
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1040
|
+
|
875
1041
|
# Intialize the SMS Messages class
|
876
|
-
ms_sms_messages = Mailersend::SMSMessages.new
|
1042
|
+
ms_sms_messages = Mailersend::SMSMessages.new(ms_client)
|
877
1043
|
|
878
1044
|
# Add parameters
|
879
1045
|
ms_sms_messages.get_single_route(sms_message_id: 'your-sms-message-id')
|
@@ -886,8 +1052,10 @@ ms_sms_messages.get_single_route(sms_message_id: 'your-sms-message-id')
|
|
886
1052
|
```ruby
|
887
1053
|
require "mailersend-ruby"
|
888
1054
|
|
1055
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1056
|
+
|
889
1057
|
# Intialize the SMS Recipient class
|
890
|
-
ms_sms_activity = Mailersend::SMSActivity.new
|
1058
|
+
ms_sms_activity = Mailersend::SMSActivity.new(ms_client)
|
891
1059
|
|
892
1060
|
# Add parameters
|
893
1061
|
ms_sms_activity.list(page: 1, limit: 10)
|
@@ -900,8 +1068,10 @@ ms_sms_activity.list(page: 1, limit: 10)
|
|
900
1068
|
```ruby
|
901
1069
|
require "mailersend-ruby"
|
902
1070
|
|
1071
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1072
|
+
|
903
1073
|
# Intialize the SMS Recipient class
|
904
|
-
ms_sms_number = Mailersend::SMSNumber.new
|
1074
|
+
ms_sms_number = Mailersend::SMSNumber.new(ms_client)
|
905
1075
|
|
906
1076
|
# Add parameters
|
907
1077
|
ms_sms_number.list(page: 1, limit: 10)
|
@@ -912,8 +1082,10 @@ ms_sms_number.list(page: 1, limit: 10)
|
|
912
1082
|
```ruby
|
913
1083
|
require "mailersend-ruby"
|
914
1084
|
|
1085
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1086
|
+
|
915
1087
|
# Intialize the SMS Recipient class
|
916
|
-
ms_sms_number = Mailersend::SMSNumber.new
|
1088
|
+
ms_sms_number = Mailersend::SMSNumber.new(ms_client)
|
917
1089
|
|
918
1090
|
# Add parameters
|
919
1091
|
ms_sms_number.get(sms_number_id: 'your-sms-number-id')
|
@@ -924,8 +1096,10 @@ ms_sms_number.get(sms_number_id: 'your-sms-number-id')
|
|
924
1096
|
```ruby
|
925
1097
|
require "mailersend-ruby"
|
926
1098
|
|
1099
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1100
|
+
|
927
1101
|
# Intialize the SMS Recipient class
|
928
|
-
ms_sms_number = Mailersend::SMSNumber.new
|
1102
|
+
ms_sms_number = Mailersend::SMSNumber.new(ms_client)
|
929
1103
|
|
930
1104
|
# Add parameters
|
931
1105
|
ms_sms_number.update(sms_number_id: 'your-sms-number-id', paused: false)
|
@@ -936,8 +1110,10 @@ ms_sms_number.update(sms_number_id: 'your-sms-number-id', paused: false)
|
|
936
1110
|
```ruby
|
937
1111
|
require "mailersend-ruby"
|
938
1112
|
|
1113
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1114
|
+
|
939
1115
|
# Intialize the SMS Recipient class
|
940
|
-
ms_sms_number = Mailersend::SMSNumber.new
|
1116
|
+
ms_sms_number = Mailersend::SMSNumber.new(ms_client)
|
941
1117
|
|
942
1118
|
# Add parameters
|
943
1119
|
ms_sms_number.delete(sms_number_id: 'your-sms-number-id')
|
@@ -950,8 +1126,10 @@ ms_sms_number.delete(sms_number_id: 'your-sms-number-id')
|
|
950
1126
|
```ruby
|
951
1127
|
require "mailersend-ruby"
|
952
1128
|
|
1129
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1130
|
+
|
953
1131
|
# Intialize the SMS Recipient class
|
954
|
-
ms_sms_recipient = Mailersend::SMSRecipient.new
|
1132
|
+
ms_sms_recipient = Mailersend::SMSRecipient.new(ms_client)
|
955
1133
|
|
956
1134
|
# Add parameters
|
957
1135
|
ms_sms_recipient.list(page: 1, limit: 10)
|
@@ -962,8 +1140,10 @@ ms_sms_recipient.list(page: 1, limit: 10)
|
|
962
1140
|
```ruby
|
963
1141
|
require "mailersend-ruby"
|
964
1142
|
|
1143
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1144
|
+
|
965
1145
|
# Intialize the SMS Recipient class
|
966
|
-
ms_sms_recipient = Mailersend::SMSRecipient.new
|
1146
|
+
ms_sms_recipient = Mailersend::SMSRecipient.new(ms_client)
|
967
1147
|
|
968
1148
|
# Add parameters
|
969
1149
|
ms_sms_recipient.get(sms_recipient_id: 'your-sms-recipient-id')
|
@@ -974,8 +1154,10 @@ ms_sms_recipient.get(sms_recipient_id: 'your-sms-recipient-id')
|
|
974
1154
|
```ruby
|
975
1155
|
require "mailersend-ruby"
|
976
1156
|
|
1157
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1158
|
+
|
977
1159
|
# Intialize the SMS Recipient class
|
978
|
-
ms_sms_recipient = Mailersend::SMSRecipient.new
|
1160
|
+
ms_sms_recipient = Mailersend::SMSRecipient.new(ms_client)
|
979
1161
|
|
980
1162
|
# Add parameters
|
981
1163
|
ms_sms_recipient.update(sms_recipient_id: 'your-sms-recipient-id', status: 'opt_out')
|
@@ -988,8 +1170,10 @@ ms_sms_recipient.update(sms_recipient_id: 'your-sms-recipient-id', status: 'opt_
|
|
988
1170
|
```ruby
|
989
1171
|
require "mailersend-ruby"
|
990
1172
|
|
1173
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1174
|
+
|
991
1175
|
# Intialize the SMS Inbounds class
|
992
|
-
ms_sms_inbounds = Mailersend::SMSInbounds.new
|
1176
|
+
ms_sms_inbounds = Mailersend::SMSInbounds.new(ms_client)
|
993
1177
|
|
994
1178
|
ms_sms_inbounds.list
|
995
1179
|
```
|
@@ -999,8 +1183,10 @@ ms_sms_inbounds.list
|
|
999
1183
|
```ruby
|
1000
1184
|
require "mailersend-ruby"
|
1001
1185
|
|
1186
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1187
|
+
|
1002
1188
|
# Intialize the SMS Inbounds class
|
1003
|
-
ms_sms_inbounds = Mailersend::SMSInbounds.new
|
1189
|
+
ms_sms_inbounds = Mailersend::SMSInbounds.new(ms_client)
|
1004
1190
|
|
1005
1191
|
# Add parameters
|
1006
1192
|
ms_sms_inbounds.get_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-id')
|
@@ -1011,8 +1197,10 @@ ms_sms_inbounds.get_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-id')
|
|
1011
1197
|
```ruby
|
1012
1198
|
require "mailersend-ruby"
|
1013
1199
|
|
1200
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1201
|
+
|
1014
1202
|
# Intialize the SMS Inbounds class
|
1015
|
-
ms_sms_inbounds = Mailersend::SMSInbounds.new
|
1203
|
+
ms_sms_inbounds = Mailersend::SMSInbounds.new(ms_client)
|
1016
1204
|
|
1017
1205
|
# Add parameters
|
1018
1206
|
ms_sms_inbounds.settings =
|
@@ -1030,8 +1218,10 @@ puts ms_sms_inbounds.add_sms_inbound_route
|
|
1030
1218
|
```ruby
|
1031
1219
|
require "mailersend-ruby"
|
1032
1220
|
|
1221
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1222
|
+
|
1033
1223
|
# Intialize the SMS Inbounds class
|
1034
|
-
ms_sms_inbounds = Mailersend::SMSInbounds.new
|
1224
|
+
ms_sms_inbounds = Mailersend::SMSInbounds.new(ms_client)
|
1035
1225
|
|
1036
1226
|
# Add parameters
|
1037
1227
|
ms_sms_inbounds.settings =
|
@@ -1049,8 +1239,10 @@ puts ms_sms_inbounds.update_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-
|
|
1049
1239
|
```ruby
|
1050
1240
|
require "mailersend-ruby"
|
1051
1241
|
|
1242
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1243
|
+
|
1052
1244
|
# Intialize the SMS Inbounds class
|
1053
|
-
ms_sms_inbounds = Mailersend::SMSInbounds.new
|
1245
|
+
ms_sms_inbounds = Mailersend::SMSInbounds.new(ms_client)
|
1054
1246
|
|
1055
1247
|
# Add parameters
|
1056
1248
|
ms_sms_inbounds.delete_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-id')
|
@@ -1063,8 +1255,10 @@ ms_sms_inbounds.delete_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-id')
|
|
1063
1255
|
```ruby
|
1064
1256
|
require "mailersend-ruby"
|
1065
1257
|
|
1258
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1259
|
+
|
1066
1260
|
# Intialize the SMS Webhooks class
|
1067
|
-
ms_sms_webhooks = Mailersend::SMSWebhooks.new
|
1261
|
+
ms_sms_webhooks = Mailersend::SMSWebhooks.new(ms_client)
|
1068
1262
|
|
1069
1263
|
# Add parameters
|
1070
1264
|
ms_sms_webhooks.list(sms_number_id: 'your-sms-number-id')
|
@@ -1075,8 +1269,10 @@ ms_sms_webhooks.list(sms_number_id: 'your-sms-number-id')
|
|
1075
1269
|
```ruby
|
1076
1270
|
require "mailersend-ruby"
|
1077
1271
|
|
1272
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1273
|
+
|
1078
1274
|
# Intialize the SMS Webhooks class
|
1079
|
-
ms_sms_webhooks = Mailersend::SMSWebhooks.new
|
1275
|
+
ms_sms_webhooks = Mailersend::SMSWebhooks.new(ms_client)
|
1080
1276
|
|
1081
1277
|
# Add parameters
|
1082
1278
|
ms_sms_webhooks.get_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
|
@@ -1087,8 +1283,10 @@ ms_sms_webhooks.get_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
|
|
1087
1283
|
```ruby
|
1088
1284
|
require "mailersend-ruby"
|
1089
1285
|
|
1286
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1287
|
+
|
1090
1288
|
# Intialize the SMS Webhooks class
|
1091
|
-
ms_sms_webhooks = Mailersend::SMSWebhooks.new
|
1289
|
+
ms_sms_webhooks = Mailersend::SMSWebhooks.new(ms_client)
|
1092
1290
|
|
1093
1291
|
# Add parameters
|
1094
1292
|
ms_sms_webhooks.settings =
|
@@ -1106,8 +1304,10 @@ puts ms_sms_webhooks.add_sms_webhook_route
|
|
1106
1304
|
```ruby
|
1107
1305
|
require "mailersend-ruby"
|
1108
1306
|
|
1307
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1308
|
+
|
1109
1309
|
# Intialize the SMS Webhooks class
|
1110
|
-
ms_sms_webhooks = Mailersend::SMSWebhooks.new
|
1310
|
+
ms_sms_webhooks = Mailersend::SMSWebhooks.new(ms_client)
|
1111
1311
|
|
1112
1312
|
# Add parameters
|
1113
1313
|
ms_sms_webhooks.settings =
|
@@ -1125,8 +1325,10 @@ puts ms_sms_webhooks.update_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-
|
|
1125
1325
|
```ruby
|
1126
1326
|
require "mailersend-ruby"
|
1127
1327
|
|
1328
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1329
|
+
|
1128
1330
|
# Intialize the SMS Webhooks class
|
1129
|
-
ms_sms_webhooks = Mailersend::SMSWebhooks.new
|
1331
|
+
ms_sms_webhooks = Mailersend::SMSWebhooks.new(ms_client)
|
1130
1332
|
|
1131
1333
|
# Add parameters
|
1132
1334
|
ms_sms_webhooks.delete_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
|
@@ -1139,8 +1341,10 @@ ms_sms_webhooks.delete_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
|
|
1139
1341
|
```ruby
|
1140
1342
|
require "mailersend-ruby"
|
1141
1343
|
|
1344
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
1345
|
+
|
1142
1346
|
# Intialize the API Quota class
|
1143
|
-
ms_api_quota = Mailersend::APIQuota.new
|
1347
|
+
ms_api_quota = Mailersend::APIQuota.new(ms_client)
|
1144
1348
|
|
1145
1349
|
# Add parameters
|
1146
1350
|
ms_api_quota.get_api_quota
|
data/lib/mailersend/client.rb
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'http'
|
4
|
-
require 'dotenv/load'
|
5
4
|
|
6
5
|
API_URL = 'https://api.mailersend.com/v1'
|
7
6
|
API_BASE_HOST = 'api.mailersend.com'
|
8
7
|
|
9
|
-
Dotenv.require_keys('MAILERSEND_API_TOKEN')
|
10
|
-
|
11
8
|
# mailersend-ruby is a gem that integrates all endpoints from MailerSend API
|
12
9
|
module Mailersend
|
13
10
|
attr_reader :api_token
|
14
11
|
|
15
12
|
# Inits the client.
|
16
13
|
class Client
|
17
|
-
def initialize(api_token = ENV
|
14
|
+
def initialize(api_token = ENV.fetch('MAILERSEND_API_TOKEN', nil))
|
15
|
+
raise ArgumentError, 'API token is not provided' if api_token.nil?
|
16
|
+
|
18
17
|
@api_token = api_token
|
19
18
|
end
|
20
19
|
|
@@ -7,6 +7,7 @@ module Mailersend
|
|
7
7
|
:domain_id,
|
8
8
|
:page,
|
9
9
|
:limit,
|
10
|
+
:name,
|
10
11
|
:verified
|
11
12
|
|
12
13
|
def initialize(client = Mailersend::Client.new)
|
@@ -14,6 +15,7 @@ module Mailersend
|
|
14
15
|
@domain_id = domain_id
|
15
16
|
@page = page
|
16
17
|
@limit = limit
|
18
|
+
@name = name
|
17
19
|
@verified = verified
|
18
20
|
end
|
19
21
|
|
@@ -37,6 +39,16 @@ module Mailersend
|
|
37
39
|
query: URI.encode_www_form(hash.compact)))
|
38
40
|
end
|
39
41
|
|
42
|
+
def add(name: nil, return_path_subdomain: nil, custom_tracking_subdomain: nil, inbound_routing_subdomain: nil)
|
43
|
+
hash = {
|
44
|
+
'name' => name,
|
45
|
+
'return_path_subdomain' => return_path_subdomain,
|
46
|
+
'custom_tracking_subdomain' => custom_tracking_subdomain,
|
47
|
+
'inbound_routing_subdomain' => inbound_routing_subdomain
|
48
|
+
}
|
49
|
+
client.http.post("#{API_URL}/domains", json: hash.compact)
|
50
|
+
end
|
51
|
+
|
40
52
|
def delete(domain_id:)
|
41
53
|
client.http.delete(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/domains/#{domain_id}"))
|
42
54
|
end
|
@@ -50,7 +62,7 @@ module Mailersend
|
|
50
62
|
query: URI.encode_www_form(hash.compact)))
|
51
63
|
end
|
52
64
|
|
53
|
-
def settings(domain_id:, send_paused: nil, track_clicks: nil, track_opens: nil, track_unsubscribe: nil, track_unsubscribe_html: nil, track_unsubscribe_plain: nil, track_content: nil, custom_tracking_enabled: nil, custom_tracking_subdomain: nil)
|
65
|
+
def settings(domain_id:, send_paused: nil, track_clicks: nil, track_opens: nil, track_unsubscribe: nil, track_unsubscribe_html: nil, track_unsubscribe_plain: nil, track_content: nil, custom_tracking_enabled: nil, custom_tracking_subdomain: nil, precedence_bulk: nil)
|
54
66
|
hash = {
|
55
67
|
'send_paused' => send_paused,
|
56
68
|
'track_clicks' => track_clicks,
|
@@ -60,7 +72,8 @@ module Mailersend
|
|
60
72
|
'track_unsubscribe_plain' => track_unsubscribe_plain,
|
61
73
|
'track_content' => track_content,
|
62
74
|
'custom_tracking_enabled' => custom_tracking_enabled,
|
63
|
-
'custom_tracking_subdomain' => custom_tracking_subdomain
|
75
|
+
'custom_tracking_subdomain' => custom_tracking_subdomain,
|
76
|
+
'precedence_bulk' => precedence_bulk
|
64
77
|
}
|
65
78
|
client.http.put("#{API_URL}/domains/#{domain_id}/settings", json: hash.compact)
|
66
79
|
end
|
@@ -6,6 +6,7 @@ module Mailersend
|
|
6
6
|
attr_accessor :client,
|
7
7
|
:domain_id,
|
8
8
|
:identity_id,
|
9
|
+
:email,
|
9
10
|
:page,
|
10
11
|
:limit
|
11
12
|
|
@@ -13,6 +14,7 @@ module Mailersend
|
|
13
14
|
@client = client
|
14
15
|
@domain_id = domain_id
|
15
16
|
@identity_id = identity_id
|
17
|
+
@email = email
|
16
18
|
@page = page
|
17
19
|
@limit = limit
|
18
20
|
end
|
@@ -35,6 +37,14 @@ module Mailersend
|
|
35
37
|
query: URI.encode_www_form(hash.compact)))
|
36
38
|
end
|
37
39
|
|
40
|
+
def single_by_email(email:)
|
41
|
+
hash = {
|
42
|
+
'email' => email
|
43
|
+
}
|
44
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/identities/email/#{email}",
|
45
|
+
query: URI.encode_www_form(hash.compact)))
|
46
|
+
end
|
47
|
+
|
38
48
|
def add(domain_id: nil, name: nil, email: nil, reply_to_email: nil, reply_to_name: nil, add_note: nil, personal_note: nil)
|
39
49
|
hash = {
|
40
50
|
'domain_id' => domain_id,
|
@@ -61,8 +71,25 @@ module Mailersend
|
|
61
71
|
client.http.put("#{API_URL}/identities/#{identity_id}", json: hash.compact)
|
62
72
|
end
|
63
73
|
|
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)
|
75
|
+
hash = {
|
76
|
+
'domain_id' => domain_id,
|
77
|
+
'name' => name,
|
78
|
+
'email' => email,
|
79
|
+
'reply_to_email' => reply_to_email,
|
80
|
+
'reply_to_name' => reply_to_name,
|
81
|
+
'add_note' => add_note,
|
82
|
+
'personal_note' => personal_note
|
83
|
+
}
|
84
|
+
client.http.put("#{API_URL}/identities/email/#{email}", json: hash.compact)
|
85
|
+
end
|
86
|
+
|
64
87
|
def delete(identity_id:)
|
65
88
|
client.http.delete(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/identities/#{identity_id}"))
|
66
89
|
end
|
90
|
+
|
91
|
+
def delete_by_email(email:)
|
92
|
+
client.http.delete(URI::HTTPS.build(host: API_BASE_HOST, path: "/v1/identities/email/#{email}"))
|
93
|
+
end
|
67
94
|
end
|
68
95
|
end
|
data/lib/mailersend/version.rb
CHANGED
data/mailersend-ruby.gemspec
CHANGED
@@ -27,8 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
|
30
|
-
spec.add_dependency 'dotenv', '~> 2.7'
|
31
30
|
spec.add_dependency 'http', '~> 5.0'
|
32
31
|
spec.add_dependency 'json', '~> 2.5'
|
33
|
-
spec.add_dependency 'uri', '~> 0.12.
|
32
|
+
spec.add_dependency 'uri', '~> 0.12.2'
|
34
33
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailersend-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.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: 2023-
|
11
|
+
date: 2023-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: dotenv
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.7'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.7'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: http
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +44,14 @@ dependencies:
|
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.12.
|
47
|
+
version: 0.12.2
|
62
48
|
type: :runtime
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.12.
|
54
|
+
version: 0.12.2
|
69
55
|
description: MailerSend's official Ruby SDK. Interacts with all endpoints at MailerSend
|
70
56
|
API.
|
71
57
|
email:
|