mailinator_client 1.0.4 → 1.0.5
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/docs/authenticators.md +71 -0
- data/docs/webhooks.md +125 -0
- data/lib/mailinator_client/authenticators.rb +165 -0
- data/lib/mailinator_client/version.rb +1 -1
- data/lib/mailinator_client/webhooks.rb +281 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 638fc40bb2a36464b2442cc9043ce1cc44f1c6698c40276535cc6d92261619d8
|
4
|
+
data.tar.gz: c734c8e2d2eddc30bae2460d4909fa7cc0182036ee57dc657eb4d1d180ef5d15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 556e3cc614515b193e96ce8c1fcdaa45e290b7bed990ae28dd18885ae99127d1d24ee91cb81a0959c8a7685ea67b16386a505be6ec1bfc10377f14766f724749
|
7
|
+
data.tar.gz: e628f406a7276798b957d1481ddf90d00899f827d22a096ecf9d10724eaf83b6ea39c4292ca739162ed45c4a8f1e03284f363d950aa189bc65d3302dd7a7bb88
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# Authenticators Actions
|
2
|
+
|
3
|
+
Details on the various actions that can be performed on the Authenticators resource, including the expected parameters and the potential responses.
|
4
|
+
|
5
|
+
##### Contents
|
6
|
+
|
7
|
+
* [InstantTOTP2FACode](#instanttotp2facode)
|
8
|
+
* [GetAuthenticators](#getauthenticators)
|
9
|
+
* [GetAuthenticatorsById](#getauthenticatorsbyid)
|
10
|
+
* [GetAuthenticator](#getauthenticator)
|
11
|
+
* [GetAuthenticatorById](#getauthenticatorbyid)
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
## InstantTOTP2FACode
|
16
|
+
|
17
|
+
Instant TOTP 2FA code
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
result = client.authenticators.instant_totp_2fa_code()
|
21
|
+
|
22
|
+
puts result
|
23
|
+
```
|
24
|
+
|
25
|
+
<br/>
|
26
|
+
|
27
|
+
## GetAuthenticators
|
28
|
+
|
29
|
+
Fetch Authenticators
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
result = client.authenticators.get_authenticators()
|
33
|
+
|
34
|
+
puts result
|
35
|
+
```
|
36
|
+
|
37
|
+
<br/>
|
38
|
+
|
39
|
+
## GetAuthenticatorsById
|
40
|
+
|
41
|
+
Fetch the TOTP 2FA code from one of your saved Keys
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
result = client.authenticators.get_authenticators_by_id()
|
45
|
+
|
46
|
+
puts result
|
47
|
+
```
|
48
|
+
|
49
|
+
<br/>
|
50
|
+
|
51
|
+
## GetAuthenticator
|
52
|
+
|
53
|
+
Fetch Authenticator
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
result = client.authenticators.get_authenticator()
|
57
|
+
|
58
|
+
puts result
|
59
|
+
```
|
60
|
+
|
61
|
+
<br/>
|
62
|
+
|
63
|
+
## GetAuthenticatorById
|
64
|
+
|
65
|
+
Fetch Authenticator By Id
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
result = client.authenticators.get_authenticator_by_id()
|
69
|
+
|
70
|
+
puts result
|
71
|
+
```
|
data/docs/webhooks.md
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
# Webhooks Actions
|
2
|
+
|
3
|
+
Details on the various actions that can be performed on the Webhooks resource, including the expected parameters and the potential responses.
|
4
|
+
|
5
|
+
##### Contents
|
6
|
+
|
7
|
+
* [PublicWebhook](#publicwebhook)
|
8
|
+
* [PublicInboxWebhook](#publicinboxwebhook)
|
9
|
+
* [PublicCustomServiceWebhook](#publiccustomservicewebhook)
|
10
|
+
* [PublicCustomServiceInboxWebhook](#publiccustomserviceinboxwebhook)
|
11
|
+
* [PrivateWebhook](#privatewebhook)
|
12
|
+
* [PrivateInboxWebhook](#privateinboxwebhook)
|
13
|
+
* [PrivateCustomServiceWebhook](#privatecustomservicewebhook)
|
14
|
+
* [PrivateCustomServiceInboxWebhook](#privatecustomserviceinboxwebhook)
|
15
|
+
|
16
|
+
<br/>
|
17
|
+
|
18
|
+
## PublicWebhook
|
19
|
+
|
20
|
+
This command will deliver the message to the :to inbox that was set into request object
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
result = client.webhooks.public_webhook()
|
24
|
+
|
25
|
+
puts result
|
26
|
+
```
|
27
|
+
|
28
|
+
<br/>
|
29
|
+
|
30
|
+
## PublicInboxWebhook
|
31
|
+
|
32
|
+
This command will deliver the message to the :inbox inbox
|
33
|
+
Note that if the Mailinator system cannot determine the destination inbox via the URL or a "to" field in the payload, the message will be rejected.
|
34
|
+
If the message contains a "from" and "subject" field, these will be visible on the inbox page.
|
35
|
+
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
result = client.webhooks.public_inbox_webhook()
|
39
|
+
|
40
|
+
puts result
|
41
|
+
```
|
42
|
+
|
43
|
+
<br/>
|
44
|
+
|
45
|
+
## PublicCustomServiceWebhook
|
46
|
+
|
47
|
+
If you have a Twilio account which receives incoming SMS messages. You may direct those messages through this facility to inject those messages into the Mailinator system.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
result = client.webhooks.public_custom_service_webhook()
|
51
|
+
|
52
|
+
puts result
|
53
|
+
```
|
54
|
+
|
55
|
+
<br/>
|
56
|
+
|
57
|
+
## PublicCustomServiceInboxWebhook
|
58
|
+
|
59
|
+
The SMS message will arrive in the Public Mailinator inbox corresponding to the Twilio Phone Number. (only the digits, if a plus sign precedes the number it will be removed)
|
60
|
+
If you wish the message to arrive in a different inbox, you may append the destination inbox to the URL.
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
result = client.webhooks.public_custom_service_inbox_webhook()
|
64
|
+
|
65
|
+
puts result
|
66
|
+
```
|
67
|
+
|
68
|
+
<br/>
|
69
|
+
|
70
|
+
## PrivateWebhook
|
71
|
+
|
72
|
+
This command will Webhook messages into your Private Domain
|
73
|
+
The incoming Webhook will arrive in the inbox designated by the "to" field in the incoming request payload.
|
74
|
+
Webhooks into your Private System do NOT use your regular API Token.
|
75
|
+
This is because a typical use case is to enter the Webhook URL into 3rd-party systems(i.e.Twilio, Zapier, IFTTT, etc) and you should never give out your API Token.
|
76
|
+
Check your Team Settings where you can create "Webhook Tokens" designed for this purpose.
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
result = client.webhooks.private_webhook()
|
80
|
+
|
81
|
+
puts result
|
82
|
+
```
|
83
|
+
|
84
|
+
<br/>
|
85
|
+
|
86
|
+
## PrivatePublicInboxWebhook
|
87
|
+
|
88
|
+
This command will deliver the message to the :inbox inbox
|
89
|
+
Incoming Webhooks are delivered to Mailinator inboxes and from that point onward are not notably different than other messages in the system (i.e. emails).
|
90
|
+
As normal, Mailinator will list all messages in the Inbox page and via the Inbox API calls.
|
91
|
+
If the incoming JSON payload does not contain a "from" or "subject", then dummy values will be inserted in these fields.
|
92
|
+
You may retrieve such messages via the Web Interface, the API, or the Rule System
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
result = client.webhooks.private_inbox_webhook()
|
96
|
+
|
97
|
+
puts result
|
98
|
+
```
|
99
|
+
|
100
|
+
<br/>
|
101
|
+
|
102
|
+
## PrivateCustomServiceWebhook
|
103
|
+
|
104
|
+
If you have a Twilio account which receives incoming SMS messages. You may direct those messages through this facility to inject those messages into the Mailinator system.
|
105
|
+
Mailinator intends to apply specific mappings for certain services that commonly publish webhooks.
|
106
|
+
If you test incoming Messages to SMS numbers via Twilio, you may use this endpoint to correctly map "to", "from", and "subject" of those messages to the Mailinator system.By default, the destination inbox is the Twilio phone number.
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
result = client.webhooks.private_custom_service_webhook()
|
110
|
+
|
111
|
+
puts result
|
112
|
+
```
|
113
|
+
|
114
|
+
<br/>
|
115
|
+
|
116
|
+
## PrivateCustomServiceInboxWebhook
|
117
|
+
|
118
|
+
The SMS message will arrive in the Private Mailinator inbox corresponding to the Twilio Phone Number. (only the digits, if a plus sign precedes the number it will be removed)
|
119
|
+
If you wish the message to arrive in a different inbox, you may append the destination inbox to the URL.
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
result = client.webhooks.private_custom_service_inbox_webhook()
|
123
|
+
|
124
|
+
puts result
|
125
|
+
```
|
@@ -0,0 +1,165 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2024 Manybrain, Inc.
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require "json"
|
24
|
+
|
25
|
+
module MailinatorClient
|
26
|
+
|
27
|
+
# Class containing all the actions for the Authenticators Resource
|
28
|
+
class Authenticators
|
29
|
+
|
30
|
+
def initialize(client)
|
31
|
+
@client = client
|
32
|
+
end
|
33
|
+
|
34
|
+
# Instant TOTP 2FA code
|
35
|
+
#
|
36
|
+
# Authentication:
|
37
|
+
# The client must be configured with a valid api
|
38
|
+
# access token to call this action.
|
39
|
+
#
|
40
|
+
# Parameters:
|
41
|
+
# * {string} totpSecretKey - totp secret key
|
42
|
+
#
|
43
|
+
# Responses:
|
44
|
+
# * Instant TOTP 2FA Code info (https://manybrain.github.io/m8rdocs/#instant-totp-2fa-code)
|
45
|
+
def instant_totp_2fa_code(params = {})
|
46
|
+
query_params = {}
|
47
|
+
headers = {}
|
48
|
+
body = nil
|
49
|
+
|
50
|
+
raise ArgumentError.new("totpSecretKey is required") unless params.has_key?(:totpSecretKey)
|
51
|
+
|
52
|
+
path = "/totp/#{params[:totpSecretKey]}"
|
53
|
+
|
54
|
+
response = @client.request(
|
55
|
+
method: :get,
|
56
|
+
path: path,
|
57
|
+
query: query_params,
|
58
|
+
headers: headers,
|
59
|
+
body: body)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Fetch Authenticators
|
63
|
+
#
|
64
|
+
# Authentication:
|
65
|
+
# The client must be configured with a valid api
|
66
|
+
# access token to call this action.
|
67
|
+
#
|
68
|
+
# Responses:
|
69
|
+
# * Collection of passcodes (https://manybrain.github.io/m8rdocs/#fetch-authenticators)
|
70
|
+
def get_authenticators()
|
71
|
+
query_params = {}
|
72
|
+
headers = {}
|
73
|
+
body = nil
|
74
|
+
|
75
|
+
path = "/authenticators"
|
76
|
+
|
77
|
+
response = @client.request(
|
78
|
+
method: :get,
|
79
|
+
path: path,
|
80
|
+
query: query_params,
|
81
|
+
headers: headers,
|
82
|
+
body: body)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Fetch the TOTP 2FA code from one of your saved Keys
|
86
|
+
#
|
87
|
+
# Authentication:
|
88
|
+
# The client must be configured with a valid api
|
89
|
+
# access token to call this action.
|
90
|
+
#
|
91
|
+
# Parameters:
|
92
|
+
# * {string} id - authenticator id
|
93
|
+
#
|
94
|
+
# Responses:
|
95
|
+
# * Authenticator (https://manybrain.github.io/m8rdocs/#fetch-authenticators-by-id)
|
96
|
+
def get_authenticators_by_id(params = {})
|
97
|
+
query_params = {}
|
98
|
+
headers = {}
|
99
|
+
body = nil
|
100
|
+
|
101
|
+
raise ArgumentError.new("id is required") unless params.has_key?(:id)
|
102
|
+
|
103
|
+
path = "/authenticators/#{params[:id]}"
|
104
|
+
|
105
|
+
response = @client.request(
|
106
|
+
method: :get,
|
107
|
+
path: path,
|
108
|
+
query: query_params,
|
109
|
+
headers: headers,
|
110
|
+
body: body)
|
111
|
+
end
|
112
|
+
|
113
|
+
# Fetch Authenticator
|
114
|
+
#
|
115
|
+
# Authentication:
|
116
|
+
# The client must be configured with a valid api
|
117
|
+
# access token to call this action.
|
118
|
+
#
|
119
|
+
# Responses:
|
120
|
+
# * Collection of passcodes (https://manybrain.github.io/m8rdocs/#fetch-authenticator)
|
121
|
+
def get_authenticator()
|
122
|
+
query_params = {}
|
123
|
+
headers = {}
|
124
|
+
body = nil
|
125
|
+
|
126
|
+
path = "/authenticator"
|
127
|
+
|
128
|
+
response = @client.request(
|
129
|
+
method: :get,
|
130
|
+
path: path,
|
131
|
+
query: query_params,
|
132
|
+
headers: headers,
|
133
|
+
body: body)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Fetch Authenticator By Id
|
137
|
+
#
|
138
|
+
# Authentication:
|
139
|
+
# The client must be configured with a valid api
|
140
|
+
# access token to call this action.
|
141
|
+
#
|
142
|
+
# Parameters:
|
143
|
+
# * {string} id - authenticator id
|
144
|
+
#
|
145
|
+
# Responses:
|
146
|
+
# * Authenticator (https://manybrain.github.io/m8rdocs/#fetch-authenticator-by-id)
|
147
|
+
def get_authenticator_by_id(params = {})
|
148
|
+
query_params = {}
|
149
|
+
headers = {}
|
150
|
+
body = nil
|
151
|
+
|
152
|
+
raise ArgumentError.new("id is required") unless params.has_key?(:id)
|
153
|
+
|
154
|
+
path = "/authenticator/#{params[:id]}"
|
155
|
+
|
156
|
+
response = @client.request(
|
157
|
+
method: :get,
|
158
|
+
path: path,
|
159
|
+
query: query_params,
|
160
|
+
headers: headers,
|
161
|
+
body: body)
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
end
|
@@ -0,0 +1,281 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2024 Manybrain, Inc.
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require "json"
|
24
|
+
|
25
|
+
module MailinatorClient
|
26
|
+
|
27
|
+
# Class containing all the actions for the Webhooks Resource
|
28
|
+
class Webhooks
|
29
|
+
|
30
|
+
def initialize(client)
|
31
|
+
@client = client
|
32
|
+
end
|
33
|
+
|
34
|
+
# This command will deliver the message to the :to inbox that was set into request object
|
35
|
+
#
|
36
|
+
# Parameters:
|
37
|
+
# * {string} webhook - The Webhook object
|
38
|
+
#
|
39
|
+
# Responses:
|
40
|
+
# * PublicWebhookResponse (https://manybrain.github.io/m8rdocs/#public-webhook)
|
41
|
+
def public_webhook(params = {})
|
42
|
+
query_params = {}
|
43
|
+
headers = {}
|
44
|
+
body = nil
|
45
|
+
|
46
|
+
raise ArgumentError.new("webhook is required") unless params.has_key?(:webhook)
|
47
|
+
|
48
|
+
body = params[:webhook] if params.has_key?(:webhook)
|
49
|
+
|
50
|
+
path = "/domains/public/webhook"
|
51
|
+
|
52
|
+
response = @client.request(
|
53
|
+
method: :post,
|
54
|
+
path: path,
|
55
|
+
query: query_params,
|
56
|
+
headers: headers,
|
57
|
+
body: body)
|
58
|
+
end
|
59
|
+
|
60
|
+
# This command will deliver the message to the :inbox inbox
|
61
|
+
# Note that if the Mailinator system cannot determine the destination inbox via the URL or a "to" field in the payload, the message will be rejected.
|
62
|
+
# If the message contains a "from" and "subject" field, these will be visible on the inbox page.
|
63
|
+
#
|
64
|
+
# Parameters:
|
65
|
+
# * {string} inbox - inbox
|
66
|
+
# * {string} webhook - The Webhook object
|
67
|
+
#
|
68
|
+
# Responses:
|
69
|
+
# * PublicWebhookResponse (https://manybrain.github.io/m8rdocs/#public-inbox-webhook)
|
70
|
+
def public_inbox_webhook(params = {})
|
71
|
+
query_params = {}
|
72
|
+
headers = {}
|
73
|
+
body = nil
|
74
|
+
|
75
|
+
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
|
76
|
+
raise ArgumentError.new("webhook is required") unless params.has_key?(:webhook)
|
77
|
+
|
78
|
+
body = params[:webhook] if params.has_key?(:webhook)
|
79
|
+
|
80
|
+
path = "/domains/public/webhook/#{params[:inbox]}"
|
81
|
+
|
82
|
+
response = @client.request(
|
83
|
+
method: :post,
|
84
|
+
path: path,
|
85
|
+
query: query_params,
|
86
|
+
headers: headers,
|
87
|
+
body: body)
|
88
|
+
end
|
89
|
+
|
90
|
+
# If you have a Twilio account which receives incoming SMS messages. You may direct those messages through this facility to inject those messages into the Mailinator system.
|
91
|
+
#
|
92
|
+
# Parameters:
|
93
|
+
# * {string} customService - custom service name
|
94
|
+
# * {string} webhook - The Webhook object
|
95
|
+
#
|
96
|
+
# Responses:
|
97
|
+
# * PublicWebhookResponse (https://manybrain.github.io/m8rdocs/#public-custom-service-webhook)
|
98
|
+
def public_custom_service_webhook(params = {})
|
99
|
+
query_params = {}
|
100
|
+
headers = {}
|
101
|
+
body = nil
|
102
|
+
|
103
|
+
raise ArgumentError.new("customService is required") unless params.has_key?(:customService)
|
104
|
+
raise ArgumentError.new("webhook is required") unless params.has_key?(:webhook)
|
105
|
+
|
106
|
+
body = params[:webhook] if params.has_key?(:webhook)
|
107
|
+
|
108
|
+
path = "/domains/public/#{params[:customService]}"
|
109
|
+
|
110
|
+
response = @client.request(
|
111
|
+
method: :post,
|
112
|
+
path: path,
|
113
|
+
query: query_params,
|
114
|
+
headers: headers,
|
115
|
+
body: body)
|
116
|
+
end
|
117
|
+
|
118
|
+
# The SMS message will arrive in the Public Mailinator inbox corresponding to the Twilio Phone Number. (only the digits, if a plus sign precedes the number it will be removed)
|
119
|
+
# If you wish the message to arrive in a different inbox, you may append the destination inbox to the URL.
|
120
|
+
#
|
121
|
+
# Parameters:
|
122
|
+
# * {string} inbox - inbox
|
123
|
+
# * {string} customService - custom service name
|
124
|
+
# * {string} webhook - The Webhook object
|
125
|
+
#
|
126
|
+
# Responses:
|
127
|
+
# * PublicWebhookResponse (https://manybrain.github.io/m8rdocs/#public-custom-service-inbox-webhook)
|
128
|
+
def public_custom_service_inbox_webhook(params = {})
|
129
|
+
query_params = {}
|
130
|
+
headers = {}
|
131
|
+
body = nil
|
132
|
+
|
133
|
+
raise ArgumentError.new("customService is required") unless params.has_key?(:customService)
|
134
|
+
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
|
135
|
+
raise ArgumentError.new("webhook is required") unless params.has_key?(:webhook)
|
136
|
+
|
137
|
+
body = params[:webhook] if params.has_key?(:webhook)
|
138
|
+
|
139
|
+
path = "/domains/public/#{params[:customService]}/#{params[:inbox]}"
|
140
|
+
|
141
|
+
response = @client.request(
|
142
|
+
method: :post,
|
143
|
+
path: path,
|
144
|
+
query: query_params,
|
145
|
+
headers: headers,
|
146
|
+
body: body)
|
147
|
+
end
|
148
|
+
|
149
|
+
# This command will Webhook messages into your Private Domain
|
150
|
+
# The incoming Webhook will arrive in the inbox designated by the "to" field in the incoming request payload.
|
151
|
+
# Webhooks into your Private System do NOT use your regular API Token.
|
152
|
+
# This is because a typical use case is to enter the Webhook URL into 3rd-party systems(i.e.Twilio, Zapier, IFTTT, etc) and you should never give out your API Token.
|
153
|
+
# Check your Team Settings where you can create "Webhook Tokens" designed for this purpose.
|
154
|
+
#
|
155
|
+
# Parameters:
|
156
|
+
# * {string} whToken - webhook token
|
157
|
+
# * {string} webhook - The Webhook object
|
158
|
+
#
|
159
|
+
# Responses:
|
160
|
+
# * PrivateWebhookResponse (https://manybrain.github.io/m8rdocs/#private-webhook)
|
161
|
+
def private_webhook(params = {})
|
162
|
+
query_params = {}
|
163
|
+
headers = {}
|
164
|
+
body = nil
|
165
|
+
|
166
|
+
raise ArgumentError.new("whToken is required") unless params.has_key?(:whToken)
|
167
|
+
raise ArgumentError.new("webhook is required") unless params.has_key?(:webhook)
|
168
|
+
|
169
|
+
body = params[:webhook] if params.has_key?(:webhook)
|
170
|
+
|
171
|
+
path = "/domains/#{params[:whToken]}/webhook"
|
172
|
+
|
173
|
+
response = @client.request(
|
174
|
+
method: :post,
|
175
|
+
path: path,
|
176
|
+
query: query_params,
|
177
|
+
headers: headers,
|
178
|
+
body: body)
|
179
|
+
end
|
180
|
+
|
181
|
+
# This command will deliver the message to the :inbox inbox
|
182
|
+
# Incoming Webhooks are delivered to Mailinator inboxes and from that point onward are not notably different than other messages in the system (i.e. emails).
|
183
|
+
# As normal, Mailinator will list all messages in the Inbox page and via the Inbox API calls.
|
184
|
+
# If the incoming JSON payload does not contain a "from" or "subject", then dummy values will be inserted in these fields.
|
185
|
+
# You may retrieve such messages via the Web Interface, the API, or the Rule System
|
186
|
+
#
|
187
|
+
# Parameters:
|
188
|
+
# * {string} whToken - webhook token
|
189
|
+
# * {string} inbox - inbox
|
190
|
+
# * {string} webhook - The Webhook object
|
191
|
+
#
|
192
|
+
# Responses:
|
193
|
+
# * PrivateWebhookResponse (https://manybrain.github.io/m8rdocs/#private-inbox-webhook)
|
194
|
+
def private_inbox_webhook(params = {})
|
195
|
+
query_params = {}
|
196
|
+
headers = {}
|
197
|
+
body = nil
|
198
|
+
|
199
|
+
raise ArgumentError.new("whToken is required") unless params.has_key?(:whToken)
|
200
|
+
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
|
201
|
+
raise ArgumentError.new("webhook is required") unless params.has_key?(:webhook)
|
202
|
+
|
203
|
+
body = params[:webhook] if params.has_key?(:webhook)
|
204
|
+
|
205
|
+
path = "/domains/#{params[:whToken]}/webhook/#{params[:inbox]}"
|
206
|
+
|
207
|
+
response = @client.request(
|
208
|
+
method: :post,
|
209
|
+
path: path,
|
210
|
+
query: query_params,
|
211
|
+
headers: headers,
|
212
|
+
body: body)
|
213
|
+
end
|
214
|
+
|
215
|
+
# If you have a Twilio account which receives incoming SMS messages. You may direct those messages through this facility to inject those messages into the Mailinator system.
|
216
|
+
# Mailinator intends to apply specific mappings for certain services that commonly publish webhooks.
|
217
|
+
# If you test incoming Messages to SMS numbers via Twilio, you may use this endpoint to correctly map "to", "from", and "subject" of those messages to the Mailinator system.By default, the destination inbox is the Twilio phone number.
|
218
|
+
#
|
219
|
+
# Parameters:
|
220
|
+
# * {string} whToken - webhook token
|
221
|
+
# * {string} customService - custom service name
|
222
|
+
# * {string} webhook - The Webhook object
|
223
|
+
#
|
224
|
+
# Responses:
|
225
|
+
# * PrivateWebhookResponse (https://manybrain.github.io/m8rdocs/#private-custom-service-webhook)
|
226
|
+
def private_custom_service_webhook(params = {})
|
227
|
+
query_params = {}
|
228
|
+
headers = {}
|
229
|
+
body = nil
|
230
|
+
|
231
|
+
raise ArgumentError.new("whToken is required") unless params.has_key?(:whToken)
|
232
|
+
raise ArgumentError.new("customService is required") unless params.has_key?(:customService)
|
233
|
+
raise ArgumentError.new("webhook is required") unless params.has_key?(:webhook)
|
234
|
+
|
235
|
+
body = params[:webhook] if params.has_key?(:webhook)
|
236
|
+
|
237
|
+
path = "/domains/#{params[:whToken]}/#{params[:customService]}"
|
238
|
+
|
239
|
+
response = @client.request(
|
240
|
+
method: :post,
|
241
|
+
path: path,
|
242
|
+
query: query_params,
|
243
|
+
headers: headers,
|
244
|
+
body: body)
|
245
|
+
end
|
246
|
+
|
247
|
+
# The SMS message will arrive in the Private Mailinator inbox corresponding to the Twilio Phone Number. (only the digits, if a plus sign precedes the number it will be removed)
|
248
|
+
# If you wish the message to arrive in a different inbox, you may append the destination inbox to the URL.
|
249
|
+
#
|
250
|
+
# Parameters:
|
251
|
+
# * {string} whToken - webhook token
|
252
|
+
# * {string} inbox - inbox
|
253
|
+
# * {string} customService - custom service name
|
254
|
+
# * {string} webhook - The Webhook object
|
255
|
+
#
|
256
|
+
# Responses:
|
257
|
+
# * PrivateWebhookResponse (https://manybrain.github.io/m8rdocs/#private-custom-service-inbox-webhook)
|
258
|
+
def private_custom_service_inbox_webhook(params = {})
|
259
|
+
query_params = {}
|
260
|
+
headers = {}
|
261
|
+
body = nil
|
262
|
+
|
263
|
+
raise ArgumentError.new("whToken is required") unless params.has_key?(:whToken)
|
264
|
+
raise ArgumentError.new("customService is required") unless params.has_key?(:customService)
|
265
|
+
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
|
266
|
+
raise ArgumentError.new("webhook is required") unless params.has_key?(:webhook)
|
267
|
+
|
268
|
+
body = params[:webhook] if params.has_key?(:webhook)
|
269
|
+
|
270
|
+
path = "/domains/#{params[:whToken]}/#{params[:customService]}/#{params[:inbox]}"
|
271
|
+
|
272
|
+
response = @client.request(
|
273
|
+
method: :post,
|
274
|
+
path: path,
|
275
|
+
query: query_params,
|
276
|
+
headers: headers,
|
277
|
+
body: body)
|
278
|
+
end
|
279
|
+
|
280
|
+
end
|
281
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailinator_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marian Melnychuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -81,11 +81,14 @@ files:
|
|
81
81
|
- LICENSE
|
82
82
|
- README.md
|
83
83
|
- Rakefile
|
84
|
+
- docs/authenticators.md
|
84
85
|
- docs/domains.md
|
85
86
|
- docs/messages.md
|
86
87
|
- docs/rules.md
|
87
88
|
- docs/stats.md
|
89
|
+
- docs/webhooks.md
|
88
90
|
- lib/mailinator_client.rb
|
91
|
+
- lib/mailinator_client/authenticators.rb
|
89
92
|
- lib/mailinator_client/client.rb
|
90
93
|
- lib/mailinator_client/domains.rb
|
91
94
|
- lib/mailinator_client/error.rb
|
@@ -94,6 +97,7 @@ files:
|
|
94
97
|
- lib/mailinator_client/stats.rb
|
95
98
|
- lib/mailinator_client/utils.rb
|
96
99
|
- lib/mailinator_client/version.rb
|
100
|
+
- lib/mailinator_client/webhooks.rb
|
97
101
|
- mailinator_client.gemspec
|
98
102
|
- test/mailinator_client_api_test.rb
|
99
103
|
- test/test_helper.rb
|
@@ -116,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
120
|
- !ruby/object:Gem::Version
|
117
121
|
version: '0'
|
118
122
|
requirements: []
|
119
|
-
rubygems_version: 3.
|
123
|
+
rubygems_version: 3.3.3
|
120
124
|
signing_key:
|
121
125
|
specification_version: 4
|
122
126
|
summary: Provides a simple ruby wrapper around the Mailinator REST API
|