mailersend-ruby 1.0.1 → 1.3.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 +1 -1
- data/.github/workflows/publish_gem.yml +1 -1
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +22 -0
- data/README.md +507 -0
- data/lib/mailersend/domains/domains.rb +8 -0
- data/lib/mailersend/email/email.rb +9 -2
- data/lib/mailersend/email_verification/email_verification.rb +47 -0
- data/lib/mailersend/inbound_routing/inbound_routing.rb +42 -0
- data/lib/mailersend/scheduled_messages/scheduled_messages.rb +34 -0
- data/lib/mailersend/sms/sms.rb +48 -0
- data/lib/mailersend/sms_activity/sms_activity.rb +26 -0
- data/lib/mailersend/sms_inbounds/sms_inbounds.rb +48 -0
- data/lib/mailersend/sms_messages/sms_messages.rb +32 -0
- data/lib/mailersend/sms_number/sms_number.rb +45 -0
- data/lib/mailersend/sms_recipient/sms_recipient.rb +43 -0
- data/lib/mailersend/sms_webhooks/sms_webhooks.rb +44 -0
- data/lib/mailersend/version.rb +1 -1
- data/lib/mailersend.rb +10 -0
- metadata +13 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 06fb33a6d3379015ec34d916945369c1b2604caa3f51a5fad5a20f0f22fc65ad
|
|
4
|
+
data.tar.gz: b14667b2ebade1bff4934506709593c5193ff8cccf5edcc68d4e61df8e4a43d9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 365e01c2144cc33fad981c05f4d53f708a20d020071906fc85a1f3b714fc650e434528a7f0199316abe560dbce444d464e17d0446e30d0cdfe84f5d56ab9ee20
|
|
7
|
+
data.tar.gz: a94ad79bfbf227265baeb848abe11fd3755e99416a41384b71786e98ca597c468cada072a4d6bcb330a08be4219ae916ea6215542cad6082027f878f1eef0535
|
data/.github/workflows/main.yml
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
## [Released]
|
|
2
2
|
|
|
3
|
+
## [1.3.0] - 2022-08-03
|
|
4
|
+
|
|
5
|
+
- SMS Personalization
|
|
6
|
+
- SMS Messages
|
|
7
|
+
- SMS Inbounds
|
|
8
|
+
- SMS Webhooks
|
|
9
|
+
- Email Verification
|
|
10
|
+
|
|
11
|
+
## [1.2.0] - 2022-06-15
|
|
12
|
+
|
|
13
|
+
- SMS Sending
|
|
14
|
+
- SMS Activity
|
|
15
|
+
- SMS Phone Numbers
|
|
16
|
+
- SMS Recipients
|
|
17
|
+
|
|
18
|
+
## [1.1.0] - 2022-02-18
|
|
19
|
+
|
|
20
|
+
- Domains endpoint improvements
|
|
21
|
+
- Added schedule an email parameter
|
|
22
|
+
- Added inbound routes endpoint
|
|
23
|
+
- Added scheduled messages endpoint
|
|
24
|
+
|
|
3
25
|
## [1.0.1] - 2022-02-16
|
|
4
26
|
|
|
5
27
|
- 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)
|
|
@@ -55,6 +67,39 @@ MailerSend Ruby SDK
|
|
|
55
67
|
- [Get templates](#get-templates)
|
|
56
68
|
- [Get a single template](#get-a-single-template)
|
|
57
69
|
- [Delete template](#delete-template)
|
|
70
|
+
- [Email Verification](#email-verification)
|
|
71
|
+
- [Get all email verification lists](#get-all-email-verification-lists)
|
|
72
|
+
- [Get an email verification list](#get-an-email-verification-list)
|
|
73
|
+
- [Create an email verification list](#create-an-email-verification-list)
|
|
74
|
+
- [Verify an email list](#verify-an-email-list)
|
|
75
|
+
- [Get email verification list results](#get-email-verification-list-results)
|
|
76
|
+
- [SMS](#sms)
|
|
77
|
+
- [SMS Messages](#sms-messages)
|
|
78
|
+
- [Get a list of SMS messages](#get-a-list-of-sms-messages)
|
|
79
|
+
- [Get info on an SMS message](#get-info-on-an-sms-message)
|
|
80
|
+
- [SMS Activity](#sms-activity)
|
|
81
|
+
- [Get a list of sms activities](#get-a-list-of-sms-activities)
|
|
82
|
+
- [SMS Phone Numbers](#sms-phone-numbers)
|
|
83
|
+
- [Get a list of SMS phone numbers](#get-a-list-of-sms-phone-numbers)
|
|
84
|
+
- [Get an SMS phone number](#get-an-sms-phone-number)
|
|
85
|
+
- [Update a single SMS phone number](#update-a-single-sms-phone-number)
|
|
86
|
+
- [Delete an SMS phone number](#delete-an-sms-phone-number)
|
|
87
|
+
- [SMS Recipients](#sms-recipients)
|
|
88
|
+
- [Get a list of SMS recipients](#get-a-list-of-sms-recipients)
|
|
89
|
+
- [Get an SMS recipient](#get-an-sms-recipient)
|
|
90
|
+
- [Update a single SMS recipient](#update-a-single-sms-recipient)
|
|
91
|
+
- [SMS Inbounds](#sms-inbounds)
|
|
92
|
+
- [Get a list of SMS inbound routes](#get-a-list-of-sms-inbound-routes)
|
|
93
|
+
- [Get a single SMS inbound route](#get-a-single-sms-inbound-route)
|
|
94
|
+
- [Create an SMS inbound route](#create-an-sms-inbound-route)
|
|
95
|
+
- [Update an SMS inbound route](#update-an-sms-inbound-route)
|
|
96
|
+
- [Delete an SMS inbound route](#delete-an-sms-inbound-route)
|
|
97
|
+
- [SMS Webhooks](#sms-webhooks)
|
|
98
|
+
- [Get a list of SMS webhooks](#get-a-list-of-sms-webhooks)
|
|
99
|
+
- [Get an SMS webhook](#get-an-sms-webhook)
|
|
100
|
+
- [Create an SMS webhook](#create-an-sms-webhook)
|
|
101
|
+
- [Update an SMS webhook](#update-an-sms-webhook)
|
|
102
|
+
- [Delete an SMS webhook](#delete-an-sms-webhook)
|
|
58
103
|
- [Support and Feedback](#support-and-feedback)
|
|
59
104
|
- [License](#license)
|
|
60
105
|
|
|
@@ -328,6 +373,69 @@ ms_analytics = Mailersend::Analytics.new
|
|
|
328
373
|
ms_analytics.ua_type(date_from: 1620643567, date_to: 1623321967)
|
|
329
374
|
```
|
|
330
375
|
|
|
376
|
+
## Inbound Routes
|
|
377
|
+
|
|
378
|
+
### Get a list of inbound routes
|
|
379
|
+
|
|
380
|
+
```ruby
|
|
381
|
+
require "mailersend-ruby"
|
|
382
|
+
|
|
383
|
+
ms_inbound_routes = Mailersend::InboundRouting.new
|
|
384
|
+
ms_inbound_routes.get_inbound_routes
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### Get a single inbound route
|
|
388
|
+
|
|
389
|
+
```ruby
|
|
390
|
+
require "mailersend-ruby"
|
|
391
|
+
|
|
392
|
+
ms_inbound_routes = Mailersend::InboundRouting.new
|
|
393
|
+
ms_inbound_routes.get_single_route(inbound_id: 'idofroute12412')
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Add an inbound route
|
|
397
|
+
|
|
398
|
+
```ruby
|
|
399
|
+
require "mailersend-ruby"
|
|
400
|
+
|
|
401
|
+
ms_inbound_routes = Mailersend::InboundRouting.new
|
|
402
|
+
ms_inbound_routes.settings =
|
|
403
|
+
{
|
|
404
|
+
'domain_id' => 'yourdomainid',
|
|
405
|
+
'name' => 'inbound_name',
|
|
406
|
+
'domain_enabled' => false,
|
|
407
|
+
'match_filter' => { 'type' => 'match_all' },
|
|
408
|
+
'forwards' => [{ 'type' => 'webhook', 'value' => 'https://example.com' }]
|
|
409
|
+
}
|
|
410
|
+
puts ms_inbound_routes.add_inbound_route
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Update an inbound route
|
|
414
|
+
|
|
415
|
+
```ruby
|
|
416
|
+
require "mailersend-ruby"
|
|
417
|
+
|
|
418
|
+
ms_inbound_routes = Mailersend::InboundRouting.new
|
|
419
|
+
ms_inbound_routes.settings =
|
|
420
|
+
{
|
|
421
|
+
'domain_id' => 'yourdomainid',
|
|
422
|
+
'name' => 'inbound_updated',
|
|
423
|
+
'domain_enabled' => false,
|
|
424
|
+
'match_filter' => { 'type' => 'match_all' },
|
|
425
|
+
'forwards' => [{ 'type' => 'webhook', 'value' => 'https://example.com' }]
|
|
426
|
+
}
|
|
427
|
+
puts ms_inbound_routes.update_inbound_route(inbound_id: 'idofroute12412')
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
### Delete an inbound route
|
|
431
|
+
|
|
432
|
+
```ruby
|
|
433
|
+
require "mailersend-ruby"
|
|
434
|
+
|
|
435
|
+
ms_inbound_routes = Mailersend::InboundRouting.new
|
|
436
|
+
ms_inbound_routes.delete_route(inbound_id: 'idofroute12412')
|
|
437
|
+
```
|
|
438
|
+
|
|
331
439
|
## Domains
|
|
332
440
|
|
|
333
441
|
### Get a list of domains
|
|
@@ -375,6 +483,24 @@ ms_domains = Mailersend::Domains.new
|
|
|
375
483
|
ms_domains.settings(domain_id: "idofdomain12412", track_clicks: true, track_unsubscribe: false)
|
|
376
484
|
```
|
|
377
485
|
|
|
486
|
+
### Get DNS Records
|
|
487
|
+
|
|
488
|
+
```ruby
|
|
489
|
+
require "mailersend-ruby"
|
|
490
|
+
|
|
491
|
+
ms_domains = Mailersend::Domains.new
|
|
492
|
+
ms_domains.dns(domain_id: "idofdomain12412")
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Get verification status
|
|
496
|
+
|
|
497
|
+
```ruby
|
|
498
|
+
require "mailersend-ruby"
|
|
499
|
+
|
|
500
|
+
ms_domains = Mailersend::Domains.new
|
|
501
|
+
ms_domains.verify(domain_id: "idofdomain12412")
|
|
502
|
+
```
|
|
503
|
+
|
|
378
504
|
## Messages
|
|
379
505
|
|
|
380
506
|
### Get a list of messages
|
|
@@ -395,6 +521,35 @@ ms_messages = Mailersend::Messages.new
|
|
|
395
521
|
ms_messages.single(message_id: "mess11454")
|
|
396
522
|
```
|
|
397
523
|
|
|
524
|
+
## Scheduled Messages
|
|
525
|
+
|
|
526
|
+
### Get a list of scheduled messages
|
|
527
|
+
|
|
528
|
+
```ruby
|
|
529
|
+
require "mailersend-ruby"
|
|
530
|
+
|
|
531
|
+
ms_scheduled_messages = Mailersend::ScheduledMessages.new
|
|
532
|
+
ms_scheduled_messages.get_list
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
### Get a single scheduled message
|
|
536
|
+
|
|
537
|
+
```ruby
|
|
538
|
+
require "mailersend-ruby"
|
|
539
|
+
|
|
540
|
+
ms_scheduled_messages = Mailersend::ScheduledMessages.new
|
|
541
|
+
ms_scheduled_messages.get_signle(message_id: 'mess11454')
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
### Delete a scheduled message
|
|
545
|
+
|
|
546
|
+
```ruby
|
|
547
|
+
require "mailersend-ruby"
|
|
548
|
+
|
|
549
|
+
ms_scheduled_messages = Mailersend::ScheduledMessages.new
|
|
550
|
+
ms_scheduled_messages.delete(message_id: 'mess11454')
|
|
551
|
+
```
|
|
552
|
+
|
|
398
553
|
## Recipients
|
|
399
554
|
|
|
400
555
|
### Get recipients
|
|
@@ -560,6 +715,358 @@ ms_templates = Mailersend::Templates.new
|
|
|
560
715
|
ms_templates.delete(template_id: "id124")
|
|
561
716
|
```
|
|
562
717
|
|
|
718
|
+
## Email Verification
|
|
719
|
+
|
|
720
|
+
### Get all email verification lists
|
|
721
|
+
|
|
722
|
+
```ruby
|
|
723
|
+
require "mailersend-ruby"
|
|
724
|
+
|
|
725
|
+
ms_email_verification = Mailersend::EmailVerification.new
|
|
726
|
+
ms_email_verification.list(page: 1, limit: 10)
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
### Get an email verification list
|
|
730
|
+
|
|
731
|
+
```ruby
|
|
732
|
+
require "mailersend-ruby"
|
|
733
|
+
|
|
734
|
+
ms_email_verification = Mailersend::EmailVerification.new
|
|
735
|
+
ms_email_verification.get_single_list(email_verification_id: 'your-email-verification-id')
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
### Create an email verification list
|
|
739
|
+
|
|
740
|
+
```ruby
|
|
741
|
+
require "mailersend-ruby"
|
|
742
|
+
|
|
743
|
+
ms_email_verification = Mailersend::EmailVerification.new
|
|
744
|
+
ms_email_verification.create_a_list(name: "name-your-list", emails: ["example@email.com"])
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
### Verify an email list
|
|
748
|
+
|
|
749
|
+
```ruby
|
|
750
|
+
require "mailersend-ruby"
|
|
751
|
+
|
|
752
|
+
ms_email_verification = Mailersend::EmailVerification.new
|
|
753
|
+
ms_email_verification.verify_a_list(email_verification_id: 'your-email-verification-id')
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
### Get email verification list results
|
|
757
|
+
|
|
758
|
+
```ruby
|
|
759
|
+
require "mailersend-ruby"
|
|
760
|
+
|
|
761
|
+
ms_email_verification = Mailersend::EmailVerification.new
|
|
762
|
+
ms_email_verification.get_list_results(email_verification_id: 'your-email-verification-id')
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
## SMS
|
|
766
|
+
|
|
767
|
+
### Send an SMS
|
|
768
|
+
|
|
769
|
+
```ruby
|
|
770
|
+
require "mailersend-ruby"
|
|
771
|
+
|
|
772
|
+
# Intialize the SMS class
|
|
773
|
+
ms_sms = Mailersend::SMS.new
|
|
774
|
+
|
|
775
|
+
# Add parameters
|
|
776
|
+
ms_sms.add_from('your-number')
|
|
777
|
+
ms_sms.add_to('client-number')
|
|
778
|
+
ms_sms.add_text('This is the message content')
|
|
779
|
+
personalization = {
|
|
780
|
+
phone_number: 'client-number',
|
|
781
|
+
data: {
|
|
782
|
+
test: 'Test Value'
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
ms_sms.add_personalization(personalization)
|
|
786
|
+
|
|
787
|
+
# Send the SMS
|
|
788
|
+
ms_sms.send
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
## SMS Messages
|
|
792
|
+
|
|
793
|
+
### Get a list of SMS messages
|
|
794
|
+
|
|
795
|
+
```ruby
|
|
796
|
+
require "mailersend-ruby"
|
|
797
|
+
|
|
798
|
+
# Intialize the SMS Messages class
|
|
799
|
+
ms_sms_messages = Mailersend::SMSMessages.new
|
|
800
|
+
|
|
801
|
+
# Add parameters
|
|
802
|
+
ms_sms_messages.list(page: 1, limit: 10)
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
### Get info on an SMS message
|
|
806
|
+
|
|
807
|
+
```ruby
|
|
808
|
+
require "mailersend-ruby"
|
|
809
|
+
|
|
810
|
+
# Intialize the SMS Messages class
|
|
811
|
+
ms_sms_messages = Mailersend::SMSMessages.new
|
|
812
|
+
|
|
813
|
+
# Add parameters
|
|
814
|
+
ms_sms_messages.get_single_route(sms_message_id: 'your-sms-message-id')
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
## SMS Activity
|
|
818
|
+
|
|
819
|
+
### Get a list of sms activities
|
|
820
|
+
|
|
821
|
+
```ruby
|
|
822
|
+
require "mailersend-ruby"
|
|
823
|
+
|
|
824
|
+
# Intialize the SMS Recipient class
|
|
825
|
+
ms_sms_activity = Mailersend::SMSActivity.new
|
|
826
|
+
|
|
827
|
+
# Add parameters
|
|
828
|
+
ms_sms_activity.list(page: 1, limit: 10)
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
## SMS phone numbers
|
|
832
|
+
|
|
833
|
+
### Get a list of SMS phone numbers
|
|
834
|
+
|
|
835
|
+
```ruby
|
|
836
|
+
require "mailersend-ruby"
|
|
837
|
+
|
|
838
|
+
# Intialize the SMS Recipient class
|
|
839
|
+
ms_sms_number = Mailersend::SMSNumber.new
|
|
840
|
+
|
|
841
|
+
# Add parameters
|
|
842
|
+
ms_sms_number.list(page: 1, limit: 10)
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
### Get an SMS phone number
|
|
846
|
+
|
|
847
|
+
```ruby
|
|
848
|
+
require "mailersend-ruby"
|
|
849
|
+
|
|
850
|
+
# Intialize the SMS Recipient class
|
|
851
|
+
ms_sms_number = Mailersend::SMSNumber.new
|
|
852
|
+
|
|
853
|
+
# Add parameters
|
|
854
|
+
ms_sms_number.get(sms_number_id: 'your-sms-number-id')
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
### Update a single SMS phone number
|
|
858
|
+
|
|
859
|
+
```ruby
|
|
860
|
+
require "mailersend-ruby"
|
|
861
|
+
|
|
862
|
+
# Intialize the SMS Recipient class
|
|
863
|
+
ms_sms_number = Mailersend::SMSNumber.new
|
|
864
|
+
|
|
865
|
+
# Add parameters
|
|
866
|
+
ms_sms_number.update(sms_number_id: 'your-sms-number-id', paused: false)
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
### Delete an SMS phone number
|
|
870
|
+
|
|
871
|
+
```ruby
|
|
872
|
+
require "mailersend-ruby"
|
|
873
|
+
|
|
874
|
+
# Intialize the SMS Recipient class
|
|
875
|
+
ms_sms_number = Mailersend::SMSNumber.new
|
|
876
|
+
|
|
877
|
+
# Add parameters
|
|
878
|
+
ms_sms_number.delete(sms_number_id: 'your-sms-number-id')
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
## SMS recipients
|
|
882
|
+
|
|
883
|
+
### Get a list of SMS recipients
|
|
884
|
+
|
|
885
|
+
```ruby
|
|
886
|
+
require "mailersend-ruby"
|
|
887
|
+
|
|
888
|
+
# Intialize the SMS Recipient class
|
|
889
|
+
ms_sms_recipient = Mailersend::SMSRecipient.new
|
|
890
|
+
|
|
891
|
+
# Add parameters
|
|
892
|
+
ms_sms_recipient.list(page: 1, limit: 10)
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
### Get an SMS recipient
|
|
896
|
+
|
|
897
|
+
```ruby
|
|
898
|
+
require "mailersend-ruby"
|
|
899
|
+
|
|
900
|
+
# Intialize the SMS Recipient class
|
|
901
|
+
ms_sms_recipient = Mailersend::SMSRecipient.new
|
|
902
|
+
|
|
903
|
+
# Add parameters
|
|
904
|
+
ms_sms_recipient.get(sms_recipient_id: 'your-sms-recipient-id')
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
### Update a single SMS recipient
|
|
908
|
+
|
|
909
|
+
```ruby
|
|
910
|
+
require "mailersend-ruby"
|
|
911
|
+
|
|
912
|
+
# Intialize the SMS Recipient class
|
|
913
|
+
ms_sms_recipient = Mailersend::SMSRecipient.new
|
|
914
|
+
|
|
915
|
+
# Add parameters
|
|
916
|
+
ms_sms_recipient.update(sms_recipient_id: 'your-sms-recipient-id', status: 'opt_out')
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
## SMS Inbounds
|
|
920
|
+
|
|
921
|
+
### Get a list of SMS inbound routes
|
|
922
|
+
|
|
923
|
+
```ruby
|
|
924
|
+
require "mailersend-ruby"
|
|
925
|
+
|
|
926
|
+
# Intialize the SMS Inbounds class
|
|
927
|
+
ms_sms_inbounds = Mailersend::SMSInbounds.new
|
|
928
|
+
|
|
929
|
+
ms_sms_inbounds.list
|
|
930
|
+
```
|
|
931
|
+
|
|
932
|
+
### Get a single SMS inbound route
|
|
933
|
+
|
|
934
|
+
```ruby
|
|
935
|
+
require "mailersend-ruby"
|
|
936
|
+
|
|
937
|
+
# Intialize the SMS Inbounds class
|
|
938
|
+
ms_sms_inbounds = Mailersend::SMSInbounds.new
|
|
939
|
+
|
|
940
|
+
# Add parameters
|
|
941
|
+
ms_sms_inbounds.get_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-id')
|
|
942
|
+
```
|
|
943
|
+
|
|
944
|
+
### Create an SMS inbound route
|
|
945
|
+
|
|
946
|
+
```ruby
|
|
947
|
+
require "mailersend-ruby"
|
|
948
|
+
|
|
949
|
+
# Intialize the SMS Inbounds class
|
|
950
|
+
ms_sms_inbounds = Mailersend::SMSInbounds.new
|
|
951
|
+
|
|
952
|
+
# Add parameters
|
|
953
|
+
ms_sms_inbounds.settings =
|
|
954
|
+
{
|
|
955
|
+
'forward_url' => 'https://your-forward-url',
|
|
956
|
+
'name' => 'name',
|
|
957
|
+
'events' => ['sms.sent', 'sms.delivered'],
|
|
958
|
+
'sms_number_id' => 'your-sms-number-id'
|
|
959
|
+
}
|
|
960
|
+
puts ms_sms_inbounds.add_sms_inbound_route
|
|
961
|
+
```
|
|
962
|
+
|
|
963
|
+
### Update an SMS inbound route
|
|
964
|
+
|
|
965
|
+
```ruby
|
|
966
|
+
require "mailersend-ruby"
|
|
967
|
+
|
|
968
|
+
# Intialize the SMS Inbounds class
|
|
969
|
+
ms_sms_inbounds = Mailersend::SMSInbounds.new
|
|
970
|
+
|
|
971
|
+
# Add parameters
|
|
972
|
+
ms_sms_inbounds.settings =
|
|
973
|
+
{
|
|
974
|
+
'forward_url' => 'https://your-forward-url',
|
|
975
|
+
'name' => 'name',
|
|
976
|
+
'events' => ['sms.sent', 'sms.delivered'],
|
|
977
|
+
'sms_number_id' => 'your-sms-number-id'
|
|
978
|
+
}
|
|
979
|
+
puts ms_sms_inbounds.update_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-id')
|
|
980
|
+
```
|
|
981
|
+
|
|
982
|
+
### Delete an SMS inbound route
|
|
983
|
+
|
|
984
|
+
```ruby
|
|
985
|
+
require "mailersend-ruby"
|
|
986
|
+
|
|
987
|
+
# Intialize the SMS Inbounds class
|
|
988
|
+
ms_sms_inbounds = Mailersend::SMSInbounds.new
|
|
989
|
+
|
|
990
|
+
# Add parameters
|
|
991
|
+
ms_sms_inbounds.delete_sms_inbound_route(sms_inbound_id: 'your-sms-inbound-id')
|
|
992
|
+
```
|
|
993
|
+
|
|
994
|
+
## SMS Webhooks
|
|
995
|
+
|
|
996
|
+
### Get a list of SMS webhooks
|
|
997
|
+
|
|
998
|
+
```ruby
|
|
999
|
+
require "mailersend-ruby"
|
|
1000
|
+
|
|
1001
|
+
# Intialize the SMS Webhooks class
|
|
1002
|
+
ms_sms_webhooks = Mailersend::SMSWebhooks.new
|
|
1003
|
+
|
|
1004
|
+
# Add parameters
|
|
1005
|
+
ms_sms_webhooks.list(sms_number_id: 'your-sms-number-id')
|
|
1006
|
+
```
|
|
1007
|
+
|
|
1008
|
+
### Get an SMS webhook
|
|
1009
|
+
|
|
1010
|
+
```ruby
|
|
1011
|
+
require "mailersend-ruby"
|
|
1012
|
+
|
|
1013
|
+
# Intialize the SMS Webhooks class
|
|
1014
|
+
ms_sms_webhooks = Mailersend::SMSWebhooks.new
|
|
1015
|
+
|
|
1016
|
+
# Add parameters
|
|
1017
|
+
ms_sms_webhooks.get_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1020
|
+
### Create an SMS webhook
|
|
1021
|
+
|
|
1022
|
+
```ruby
|
|
1023
|
+
require "mailersend-ruby"
|
|
1024
|
+
|
|
1025
|
+
# Intialize the SMS Webhooks class
|
|
1026
|
+
ms_sms_webhooks = Mailersend::SMSWebhooks.new
|
|
1027
|
+
|
|
1028
|
+
# Add parameters
|
|
1029
|
+
ms_sms_webhooks.settings =
|
|
1030
|
+
{
|
|
1031
|
+
'sms_number_id' => 'your-sms-number-id',
|
|
1032
|
+
'name' => 'your-name',
|
|
1033
|
+
'url' => 'https://your-url.com',
|
|
1034
|
+
'events' => ['sms.sent', 'sms.delivered']
|
|
1035
|
+
}
|
|
1036
|
+
puts ms_sms_webhooks.add_sms_webhook_route
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
### Update an SMS webhook
|
|
1040
|
+
|
|
1041
|
+
```ruby
|
|
1042
|
+
require "mailersend-ruby"
|
|
1043
|
+
|
|
1044
|
+
# Intialize the SMS Webhooks class
|
|
1045
|
+
ms_sms_webhooks = Mailersend::SMSWebhooks.new
|
|
1046
|
+
|
|
1047
|
+
# Add parameters
|
|
1048
|
+
ms_sms_webhooks.settings =
|
|
1049
|
+
{
|
|
1050
|
+
'sms_number_id' => 'your-sms-number-id',
|
|
1051
|
+
'name' => 'your-name',
|
|
1052
|
+
'url' => 'https://your-url.com',
|
|
1053
|
+
'events' => ['sms.sent', 'sms.delivered']
|
|
1054
|
+
}
|
|
1055
|
+
puts ms_sms_webhooks.update_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
### Delete an SMS webhook
|
|
1059
|
+
|
|
1060
|
+
```ruby
|
|
1061
|
+
require "mailersend-ruby"
|
|
1062
|
+
|
|
1063
|
+
# Intialize the SMS Webhooks class
|
|
1064
|
+
ms_sms_webhooks = Mailersend::SMSWebhooks.new
|
|
1065
|
+
|
|
1066
|
+
# Add parameters
|
|
1067
|
+
ms_sms_webhooks.delete_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
|
|
1068
|
+
```
|
|
1069
|
+
|
|
563
1070
|
# Support and Feedback
|
|
564
1071
|
|
|
565
1072
|
In case you find any bugs, submit an issue directly here in GitHub.
|
|
@@ -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,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailersend
|
|
4
|
+
# Email verification endpoint from MailerSend API.
|
|
5
|
+
class EmailVerification
|
|
6
|
+
attr_accessor :client,
|
|
7
|
+
:page,
|
|
8
|
+
:limit,
|
|
9
|
+
:email_verification_id
|
|
10
|
+
|
|
11
|
+
def initialize(client = Mailersend::Client.new)
|
|
12
|
+
@client = client
|
|
13
|
+
@page = page
|
|
14
|
+
@limit = limit
|
|
15
|
+
@email_verification_id = email_verification_id
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def list(page: nil, limit: nil)
|
|
19
|
+
hash = {
|
|
20
|
+
'page' => page,
|
|
21
|
+
'limit' => limit
|
|
22
|
+
}
|
|
23
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/email-verification',
|
|
24
|
+
query: URI.encode_www_form(hash)))
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def get_single_list(email_verification_id:)
|
|
28
|
+
client.http.get("#{API_URL}/email-verification/#{email_verification_id}")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def create_a_list(name: nil, emails: nil)
|
|
32
|
+
hash = {
|
|
33
|
+
'name' => name,
|
|
34
|
+
'emails' => emails
|
|
35
|
+
}
|
|
36
|
+
client.http.post("#{API_URL}/email-verification", json: hash.compact)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def verify_a_list(email_verification_id:)
|
|
40
|
+
client.http.get("#{API_URL}/email-verification/#{email_verification_id}/verify")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def get_list_results(email_verification_id:)
|
|
44
|
+
client.http.get("#{API_URL}/email-verification/#{email_verification_id}/results")
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -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
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailersend
|
|
4
|
+
# Send an SMS through MailerSend API
|
|
5
|
+
class SMS
|
|
6
|
+
attr_accessor :client,
|
|
7
|
+
:from,
|
|
8
|
+
:to,
|
|
9
|
+
:text,
|
|
10
|
+
:personalization
|
|
11
|
+
|
|
12
|
+
def initialize(client = Mailersend::Client.new)
|
|
13
|
+
@client = client
|
|
14
|
+
@from = {}
|
|
15
|
+
@to = []
|
|
16
|
+
@text = {}
|
|
17
|
+
@personalization = []
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def add_from(from)
|
|
21
|
+
@from = from
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def add_to(to)
|
|
25
|
+
@to << to
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def add_text(text)
|
|
29
|
+
@text = text
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def add_personalization(personalization)
|
|
33
|
+
@personalization << personalization
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def send
|
|
37
|
+
message = {
|
|
38
|
+
'from' => @from,
|
|
39
|
+
'to' => @to,
|
|
40
|
+
'text' => @text,
|
|
41
|
+
'personalization' => @personalization
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
response = client.http.post("#{API_URL}/sms", json: message.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {} })
|
|
45
|
+
puts response
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailersend
|
|
4
|
+
# SMS Activity endpoint from MailerSend API.
|
|
5
|
+
class SMSActivity
|
|
6
|
+
attr_accessor :client,
|
|
7
|
+
:page,
|
|
8
|
+
:limit
|
|
9
|
+
|
|
10
|
+
def initialize(client = Mailersend::Client.new)
|
|
11
|
+
@client = client
|
|
12
|
+
@page = page
|
|
13
|
+
@limit = limit
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def list(page: nil, limit: nil)
|
|
17
|
+
hash = {
|
|
18
|
+
'page' => page,
|
|
19
|
+
'limit' => limit
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/sms-activity',
|
|
23
|
+
query: URI.encode_www_form(hash)))
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailersend
|
|
4
|
+
# SMS Inbound endpoint from MailerSend API.
|
|
5
|
+
class SMSInbounds
|
|
6
|
+
attr_accessor :client,
|
|
7
|
+
:page,
|
|
8
|
+
:limit,
|
|
9
|
+
:sms_number_id,
|
|
10
|
+
:sms_inbound_id,
|
|
11
|
+
:settings
|
|
12
|
+
|
|
13
|
+
def initialize(client = Mailersend::Client.new)
|
|
14
|
+
@client = client
|
|
15
|
+
@page = page
|
|
16
|
+
@limit = limit
|
|
17
|
+
@sms_number_id = sms_number_id
|
|
18
|
+
@sms_inbound_id = sms_inbound_id
|
|
19
|
+
@settings = []
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def list(page: nil, limit: nil)
|
|
23
|
+
hash = {
|
|
24
|
+
'page' => page,
|
|
25
|
+
'limit' => limit
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/sms-inbounds',
|
|
29
|
+
query: URI.encode_www_form(hash)))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def get_sms_inbound_route(sms_inbound_id:)
|
|
33
|
+
client.http.get("#{API_URL}/sms-inbounds/#{sms_inbound_id}")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def add_sms_inbound_route
|
|
37
|
+
client.http.post("#{API_URL}/sms-inbounds", json: @settings)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def update_sms_inbound_route(sms_inbound_id:)
|
|
41
|
+
client.http.put("#{API_URL}/sms-inbounds/#{sms_inbound_id}", json: @settings)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def delete_sms_inbound_route(sms_inbound_id:)
|
|
45
|
+
client.http.delete("#{API_URL}/sms-inbounds/#{sms_inbound_id}")
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailersend
|
|
4
|
+
# SMS Messages endpoint from MailerSend API.
|
|
5
|
+
class SMSMessages
|
|
6
|
+
attr_accessor :client,
|
|
7
|
+
:page,
|
|
8
|
+
:limit,
|
|
9
|
+
:sms_message_id
|
|
10
|
+
|
|
11
|
+
def initialize(client = Mailersend::Client.new)
|
|
12
|
+
@client = client
|
|
13
|
+
@page = page
|
|
14
|
+
@limit = limit
|
|
15
|
+
@sms_message_id = sms_message_id
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def list(page: nil, limit: nil)
|
|
19
|
+
hash = {
|
|
20
|
+
'page' => page,
|
|
21
|
+
'limit' => limit
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/sms-messages',
|
|
25
|
+
query: URI.encode_www_form(hash)))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def get(sms_message_id:)
|
|
29
|
+
client.http.get_single_route("#{API_URL}/sms-messages/#{sms_message_id}")
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailersend
|
|
4
|
+
# SMS Number endpoint from MailerSend API.
|
|
5
|
+
class SMSNumber
|
|
6
|
+
attr_accessor :client,
|
|
7
|
+
:paused,
|
|
8
|
+
:page,
|
|
9
|
+
:limit,
|
|
10
|
+
:sms_number_id
|
|
11
|
+
|
|
12
|
+
def initialize(client = Mailersend::Client.new)
|
|
13
|
+
@client = client
|
|
14
|
+
@paused = paused
|
|
15
|
+
@page = page
|
|
16
|
+
@limit = limit
|
|
17
|
+
@sms_number_id = sms_number_id
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def list(page: nil, limit: nil)
|
|
21
|
+
hash = {
|
|
22
|
+
'page' => page,
|
|
23
|
+
'limit' => limit
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/sms-numbers',
|
|
27
|
+
query: URI.encode_www_form(hash)))
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def get(sms_number_id:)
|
|
31
|
+
client.http.get("#{API_URL}/sms-numbers/#{sms_number_id}")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def update(sms_number_id:, paused: nil)
|
|
35
|
+
hash = {
|
|
36
|
+
'paused' => paused
|
|
37
|
+
}
|
|
38
|
+
client.http.put("#{API_URL}/sms-numbers/#{sms_number_id}", json: hash.compact)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def delete(sms_number_id:)
|
|
42
|
+
client.http.delete("#{API_URL}/sms-numbers/#{sms_number_id}")
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailersend
|
|
4
|
+
# SMS Recipient endpoint from MailerSend API.
|
|
5
|
+
class SMSRecipient
|
|
6
|
+
attr_accessor :client,
|
|
7
|
+
:status,
|
|
8
|
+
:sms_number_id,
|
|
9
|
+
:sms_recipient_id,
|
|
10
|
+
:page,
|
|
11
|
+
:limit
|
|
12
|
+
|
|
13
|
+
def initialize(client = Mailersend::Client.new)
|
|
14
|
+
@client = client
|
|
15
|
+
@status = status
|
|
16
|
+
@sms_number_id = sms_number_id
|
|
17
|
+
@sms_recipient_id = sms_recipient_id
|
|
18
|
+
@page = page
|
|
19
|
+
@limit = limit
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def list(page: nil, limit: nil)
|
|
23
|
+
hash = {
|
|
24
|
+
'page' => page,
|
|
25
|
+
'limit' => limit
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/sms-recipients',
|
|
29
|
+
query: URI.encode_www_form(hash)))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def get(sms_recipient_id:)
|
|
33
|
+
client.http.get("#{API_URL}/sms-recipients/#{sms_recipient_id}")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def update(sms_recipient_id:, status: nil)
|
|
37
|
+
hash = {
|
|
38
|
+
'status' => status
|
|
39
|
+
}
|
|
40
|
+
client.http.put("#{API_URL}/sms-recipients/#{sms_recipient_id}", json: hash.compact)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailersend
|
|
4
|
+
# SMS Webhook endpoint from MailerSend API.
|
|
5
|
+
class SMSWebhooks
|
|
6
|
+
attr_accessor :client,
|
|
7
|
+
:page,
|
|
8
|
+
:limit,
|
|
9
|
+
:sms_webhook_id,
|
|
10
|
+
:settings
|
|
11
|
+
|
|
12
|
+
def initialize(client = Mailersend::Client.new)
|
|
13
|
+
@client = client
|
|
14
|
+
@page = page
|
|
15
|
+
@limit = limit
|
|
16
|
+
@sms_webhook_id = sms_webhook_id
|
|
17
|
+
@settings = []
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def list(sms_number_id:)
|
|
21
|
+
hash = {
|
|
22
|
+
'sms_number_id' => sms_number_id
|
|
23
|
+
}
|
|
24
|
+
client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/sms-webhooks',
|
|
25
|
+
query: URI.encode_www_form(hash)))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def get_sms_webhook_route(sms_webhook_id:)
|
|
29
|
+
client.http.get("#{API_URL}/sms-webhooks/#{sms_webhook_id}")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def add_sms_webhook_route
|
|
33
|
+
client.http.post("#{API_URL}/sms-webhooks", json: @settings)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def update_sms_webhook_route(sms_webhook_id:)
|
|
37
|
+
client.http.put("#{API_URL}/sms-webhooks/#{sms_webhook_id}", json: @settings)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def delete_sms_webhook_route(sms_webhook_id:)
|
|
41
|
+
client.http.delete("#{API_URL}/sms-webhooks/#{sms_webhook_id}")
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
data/lib/mailersend/version.rb
CHANGED
data/lib/mailersend.rb
CHANGED
|
@@ -7,8 +7,18 @@ 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/email_verification/email_verification'
|
|
11
|
+
require_relative 'mailersend/inbound_routing/inbound_routing'
|
|
10
12
|
require_relative 'mailersend/messages/messages'
|
|
11
13
|
require_relative 'mailersend/recipients/recipients'
|
|
14
|
+
require_relative 'mailersend/scheduled_messages/scheduled_messages'
|
|
15
|
+
require_relative 'mailersend/sms/sms'
|
|
16
|
+
require_relative 'mailersend/sms_activity/sms_activity'
|
|
17
|
+
require_relative 'mailersend/sms_messages/sms_messages'
|
|
18
|
+
require_relative 'mailersend/sms_number/sms_number'
|
|
19
|
+
require_relative 'mailersend/sms_recipient/sms_recipient'
|
|
20
|
+
require_relative 'mailersend/sms_inbounds/sms_inbounds'
|
|
21
|
+
require_relative 'mailersend/sms_webhooks/sms_webhooks'
|
|
12
22
|
require_relative 'mailersend/suppressions/suppressions'
|
|
13
23
|
require_relative 'mailersend/templates/templates'
|
|
14
24
|
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.3.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-
|
|
11
|
+
date: 2022-08-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -138,8 +138,18 @@ files:
|
|
|
138
138
|
- lib/mailersend/client.rb
|
|
139
139
|
- lib/mailersend/domains/domains.rb
|
|
140
140
|
- lib/mailersend/email/email.rb
|
|
141
|
+
- lib/mailersend/email_verification/email_verification.rb
|
|
142
|
+
- lib/mailersend/inbound_routing/inbound_routing.rb
|
|
141
143
|
- lib/mailersend/messages/messages.rb
|
|
142
144
|
- lib/mailersend/recipients/recipients.rb
|
|
145
|
+
- lib/mailersend/scheduled_messages/scheduled_messages.rb
|
|
146
|
+
- lib/mailersend/sms/sms.rb
|
|
147
|
+
- lib/mailersend/sms_activity/sms_activity.rb
|
|
148
|
+
- lib/mailersend/sms_inbounds/sms_inbounds.rb
|
|
149
|
+
- lib/mailersend/sms_messages/sms_messages.rb
|
|
150
|
+
- lib/mailersend/sms_number/sms_number.rb
|
|
151
|
+
- lib/mailersend/sms_recipient/sms_recipient.rb
|
|
152
|
+
- lib/mailersend/sms_webhooks/sms_webhooks.rb
|
|
143
153
|
- lib/mailersend/suppressions/suppressions.rb
|
|
144
154
|
- lib/mailersend/templates/templates.rb
|
|
145
155
|
- lib/mailersend/tokens/tokens.rb
|
|
@@ -171,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
171
181
|
- !ruby/object:Gem::Version
|
|
172
182
|
version: '0'
|
|
173
183
|
requirements: []
|
|
174
|
-
rubygems_version: 3.3.
|
|
184
|
+
rubygems_version: 3.3.7
|
|
175
185
|
signing_key:
|
|
176
186
|
specification_version: 4
|
|
177
187
|
summary: MailerSend's official Ruby SDK
|