mailersend-ruby 1.2.0 → 1.3.1
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/CODEOWNERS +1 -0
- data/CHANGELOG.md +12 -0
- data/README.md +256 -5
- data/lib/mailersend/bulk_email/bulk_email.rb +3 -2
- data/lib/mailersend/email/email.rb +3 -2
- data/lib/mailersend/email_verification/email_verification.rb +47 -0
- data/lib/mailersend/sms/sms.rb +11 -3
- data/lib/mailersend/sms_inbounds/sms_inbounds.rb +48 -0
- data/lib/mailersend/sms_messages/sms_messages.rb +32 -0
- data/lib/mailersend/sms_webhooks/sms_webhooks.rb +44 -0
- data/lib/mailersend/version.rb +1 -1
- data/lib/mailersend.rb +4 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f95531e933a67ec27b789aa68008030393aceafd92f8a267ef6e69ea0684dba1
|
4
|
+
data.tar.gz: 8a292cb132a367a2d654a65dd9141faae370491614b87135ec442f3d9f04983d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33071f4961960a37b6732ab45905e3ea2060d82080d7289e793d72dea84014f91cfe245b12a8055800a85adfebdc44b28f4a2010d71b59bb3f04dda56077450f
|
7
|
+
data.tar.gz: 238d96acbe53f2d95b8326fe091baff168aef20eb7f3b64e68924fc6e53f4b5aa1620b92d88507ae151c4b5de1475cb7660403067d572b9f4769627a4b32af38
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @mailersend/ruby-sdk-maintainers
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
## [Released]
|
2
2
|
|
3
|
+
## [1.3.1] - 2022-09-28
|
4
|
+
|
5
|
+
- Added attachment content disposition
|
6
|
+
|
7
|
+
## [1.3.0] - 2022-08-03
|
8
|
+
|
9
|
+
- SMS Personalization
|
10
|
+
- SMS Messages
|
11
|
+
- SMS Inbounds
|
12
|
+
- SMS Webhooks
|
13
|
+
- Email Verification
|
14
|
+
|
3
15
|
## [1.2.0] - 2022-06-15
|
4
16
|
|
5
17
|
- SMS Sending
|
data/README.md
CHANGED
@@ -67,10 +67,18 @@ MailerSend Ruby SDK
|
|
67
67
|
- [Get templates](#get-templates)
|
68
68
|
- [Get a single template](#get-a-single-template)
|
69
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)
|
70
76
|
- [SMS](#sms)
|
71
|
-
|
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)
|
72
80
|
- [SMS Activity](#sms-activity)
|
73
|
-
- [Get a list of activities](#get-a-list-of-sms-activities)
|
81
|
+
- [Get a list of sms activities](#get-a-list-of-sms-activities)
|
74
82
|
- [SMS Phone Numbers](#sms-phone-numbers)
|
75
83
|
- [Get a list of SMS phone numbers](#get-a-list-of-sms-phone-numbers)
|
76
84
|
- [Get an SMS phone number](#get-an-sms-phone-number)
|
@@ -80,6 +88,18 @@ MailerSend Ruby SDK
|
|
80
88
|
- [Get a list of SMS recipients](#get-a-list-of-sms-recipients)
|
81
89
|
- [Get an SMS recipient](#get-an-sms-recipient)
|
82
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)
|
83
103
|
- [Support and Feedback](#support-and-feedback)
|
84
104
|
- [License](#license)
|
85
105
|
|
@@ -298,8 +318,8 @@ ms_email.add_text("Time is money, money is power, power is pizza, and pizza is k
|
|
298
318
|
ms_email.add_html("<b>Time is money, money is power, power is pizza, and pizza is knowledge. Let's go.</b>")
|
299
319
|
|
300
320
|
# You can add one or multiple attachments
|
301
|
-
ms.add_attachment(content: "/Users/Jerry/Desktop/doc.pdf", filename: "doc.pdf")
|
302
|
-
ms.add_attachment(content: "/Users/Jerry/Desktop/pic.png", filename: "pic.png")
|
321
|
+
ms.add_attachment(content: "/Users/Jerry/Desktop/doc.pdf", filename: "doc.pdf", disposition: "attachment")
|
322
|
+
ms.add_attachment(content: "/Users/Jerry/Desktop/pic.png", filename: "pic.png", disposition: "attachment")
|
303
323
|
|
304
324
|
ms_email.send
|
305
325
|
```
|
@@ -695,6 +715,53 @@ ms_templates = Mailersend::Templates.new
|
|
695
715
|
ms_templates.delete(template_id: "id124")
|
696
716
|
```
|
697
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
|
+
|
698
765
|
## SMS
|
699
766
|
|
700
767
|
### Send an SMS
|
@@ -709,14 +776,47 @@ ms_sms = Mailersend::SMS.new
|
|
709
776
|
ms_sms.add_from('your-number')
|
710
777
|
ms_sms.add_to('client-number')
|
711
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)
|
712
786
|
|
713
787
|
# Send the SMS
|
714
788
|
ms_sms.send
|
715
789
|
```
|
716
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
|
+
|
717
817
|
## SMS Activity
|
718
818
|
|
719
|
-
### Get a list of activities
|
819
|
+
### Get a list of sms activities
|
720
820
|
|
721
821
|
```ruby
|
722
822
|
require "mailersend-ruby"
|
@@ -816,6 +916,157 @@ ms_sms_recipient = Mailersend::SMSRecipient.new
|
|
816
916
|
ms_sms_recipient.update(sms_recipient_id: 'your-sms-recipient-id', status: 'opt_out')
|
817
917
|
```
|
818
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
|
+
|
819
1070
|
# Support and Feedback
|
820
1071
|
|
821
1072
|
In case you find any bugs, submit an issue directly here in GitHub.
|
@@ -13,12 +13,13 @@ module Mailersend
|
|
13
13
|
@messages = []
|
14
14
|
end
|
15
15
|
|
16
|
-
def add_attachment(content:, filename:)
|
16
|
+
def add_attachment(content:, filename:, disposition:)
|
17
17
|
data = File.read(content.to_s)
|
18
18
|
encoded = Base64.strict_encode64(data)
|
19
19
|
@attachments << {
|
20
20
|
'content' => encoded,
|
21
|
-
'filename' => filename
|
21
|
+
'filename' => filename,
|
22
|
+
'disposition' => disposition
|
22
23
|
}
|
23
24
|
end
|
24
25
|
|
@@ -86,12 +86,13 @@ module Mailersend
|
|
86
86
|
@tags << tags
|
87
87
|
end
|
88
88
|
|
89
|
-
def add_attachment(content:, filename:)
|
89
|
+
def add_attachment(content:, filename:, disposition:)
|
90
90
|
data = File.read(content.to_s)
|
91
91
|
encoded = Base64.strict_encode64(data)
|
92
92
|
@attachments << {
|
93
93
|
'content' => encoded,
|
94
|
-
'filename' => filename
|
94
|
+
'filename' => filename,
|
95
|
+
'disposition' => disposition
|
95
96
|
}
|
96
97
|
end
|
97
98
|
|
@@ -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
|
data/lib/mailersend/sms/sms.rb
CHANGED
@@ -6,13 +6,15 @@ module Mailersend
|
|
6
6
|
attr_accessor :client,
|
7
7
|
:from,
|
8
8
|
:to,
|
9
|
-
:text
|
9
|
+
:text,
|
10
|
+
:personalization
|
10
11
|
|
11
12
|
def initialize(client = Mailersend::Client.new)
|
12
13
|
@client = client
|
13
14
|
@from = {}
|
14
15
|
@to = []
|
15
16
|
@text = {}
|
17
|
+
@personalization = []
|
16
18
|
end
|
17
19
|
|
18
20
|
def add_from(from)
|
@@ -27,14 +29,20 @@ module Mailersend
|
|
27
29
|
@text = text
|
28
30
|
end
|
29
31
|
|
32
|
+
def add_personalization(personalization)
|
33
|
+
@personalization << personalization
|
34
|
+
end
|
35
|
+
|
30
36
|
def send
|
31
37
|
message = {
|
32
38
|
'from' => @from,
|
33
39
|
'to' => @to,
|
34
|
-
'text' => @text
|
40
|
+
'text' => @text,
|
41
|
+
'personalization' => @personalization
|
35
42
|
}
|
36
43
|
|
37
|
-
client.http.post("#{API_URL}/sms", json: message.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {} })
|
44
|
+
response = client.http.post("#{API_URL}/sms", json: message.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {} })
|
45
|
+
puts response
|
38
46
|
end
|
39
47
|
end
|
40
48
|
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,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,14 +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'
|
10
11
|
require_relative 'mailersend/inbound_routing/inbound_routing'
|
11
12
|
require_relative 'mailersend/messages/messages'
|
12
13
|
require_relative 'mailersend/recipients/recipients'
|
13
14
|
require_relative 'mailersend/scheduled_messages/scheduled_messages'
|
14
15
|
require_relative 'mailersend/sms/sms'
|
15
16
|
require_relative 'mailersend/sms_activity/sms_activity'
|
17
|
+
require_relative 'mailersend/sms_messages/sms_messages'
|
16
18
|
require_relative 'mailersend/sms_number/sms_number'
|
17
19
|
require_relative 'mailersend/sms_recipient/sms_recipient'
|
20
|
+
require_relative 'mailersend/sms_inbounds/sms_inbounds'
|
21
|
+
require_relative 'mailersend/sms_webhooks/sms_webhooks'
|
18
22
|
require_relative 'mailersend/suppressions/suppressions'
|
19
23
|
require_relative 'mailersend/templates/templates'
|
20
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.
|
4
|
+
version: 1.3.1
|
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-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,6 +119,7 @@ extensions: []
|
|
119
119
|
extra_rdoc_files: []
|
120
120
|
files:
|
121
121
|
- ".env.example"
|
122
|
+
- ".github/CODEOWNERS"
|
122
123
|
- ".github/workflows/main.yml"
|
123
124
|
- ".github/workflows/publish_gem.yml"
|
124
125
|
- ".gitignore"
|
@@ -138,14 +139,18 @@ files:
|
|
138
139
|
- lib/mailersend/client.rb
|
139
140
|
- lib/mailersend/domains/domains.rb
|
140
141
|
- lib/mailersend/email/email.rb
|
142
|
+
- lib/mailersend/email_verification/email_verification.rb
|
141
143
|
- lib/mailersend/inbound_routing/inbound_routing.rb
|
142
144
|
- lib/mailersend/messages/messages.rb
|
143
145
|
- lib/mailersend/recipients/recipients.rb
|
144
146
|
- lib/mailersend/scheduled_messages/scheduled_messages.rb
|
145
147
|
- lib/mailersend/sms/sms.rb
|
146
148
|
- lib/mailersend/sms_activity/sms_activity.rb
|
149
|
+
- lib/mailersend/sms_inbounds/sms_inbounds.rb
|
150
|
+
- lib/mailersend/sms_messages/sms_messages.rb
|
147
151
|
- lib/mailersend/sms_number/sms_number.rb
|
148
152
|
- lib/mailersend/sms_recipient/sms_recipient.rb
|
153
|
+
- lib/mailersend/sms_webhooks/sms_webhooks.rb
|
149
154
|
- lib/mailersend/suppressions/suppressions.rb
|
150
155
|
- lib/mailersend/templates/templates.rb
|
151
156
|
- lib/mailersend/tokens/tokens.rb
|