mailinator_client 1.0.3 → 1.0.4
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/LICENSE +1 -1
- data/README.md +13 -1
- data/docs/domains.md +26 -0
- data/docs/messages.md +170 -14
- data/lib/mailinator_client/client.rb +12 -2
- data/lib/mailinator_client/domains.rb +60 -1
- data/lib/mailinator_client/error.rb +1 -1
- data/lib/mailinator_client/messages.rb +327 -16
- data/lib/mailinator_client/rules.rb +1 -1
- data/lib/mailinator_client/stats.rb +1 -1
- data/lib/mailinator_client/utils.rb +1 -1
- data/lib/mailinator_client/version.rb +2 -2
- data/lib/mailinator_client.rb +3 -1
- data/test/mailinator_client_api_test.rb +125 -25
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3e1ec11068d686d886639d80e6a17e17fd991341367ad61f929990d61724ffa
|
4
|
+
data.tar.gz: 07e57ad2cb1d9ebf07bcf785b5a61ee5e8627225eac1cff501d65767e5ad1edf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9900dcb42cd529cf13e37ebf6cec0a3f06a6a31d5efd712f460d39c243ac55606d40ba2b186d9a80d373142bef38e6e0400b61f58051f2755e2e4c716b528eff
|
7
|
+
data.tar.gz: b31c3de9304ed10adebb2e21a1693be58bc0141c79bf741538b235650e0a4b740dc69c029d4b3653088ea663870ed9c7d9ec58f9bfc38236ac8f25691351383f
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -45,6 +45,9 @@ The ``Client()`` initializer takes the following arguments:
|
|
45
45
|
|
46
46
|
Each of the following is a method on the client object, and returns a wrapper for the actions against that particular resource. See each resource documentation file for more information.
|
47
47
|
|
48
|
+
* [authenticators](docs/authenticators.md)
|
49
|
+
Contains all of the actions that can be performed against the set of [Authenticators](https://manybrain.github.io/m8rdocs/#authenticators-api) that the currently authenticated user has access to - such as listing the authenticators.
|
50
|
+
|
48
51
|
* [domains](docs/domains.md)
|
49
52
|
Contains all of the actions that can be performed against the set of [Domains](https://manybrain.github.io/m8rdocs/#domains-api) that the currently authenticated user has access to - such as listing the domains.
|
50
53
|
|
@@ -56,6 +59,9 @@ Each of the following is a method on the client object, and returns a wrapper fo
|
|
56
59
|
|
57
60
|
* [messages](docs/messages.md)
|
58
61
|
Contains all of the actions that can be performed against the set of [Messages](https://manybrain.github.io/m8rdocs/#message-api) that the currently authenticated user has access to - such as listing the messages or injecting a new message.
|
62
|
+
|
63
|
+
* [webhooks](docs/webhooks.md)
|
64
|
+
Contains all of the actions that can be performed against the set of [Webhooks](https://manybrain.github.io/m8rdocs/#webhooks-api) that the currently user has access to - such as listing the webhooks.
|
59
65
|
|
60
66
|
<br/>
|
61
67
|
|
@@ -92,10 +98,16 @@ Most of the tests require env variables with valid values. Visit tests source co
|
|
92
98
|
* `MAILINATOR_TEST_MESSAGE_WITH_ATTACHMENT_ID` - existing message id within inbox (see above) within private domain (see above); see also https://manybrain.github.io/m8rdocs/#fetch-message
|
93
99
|
* `MAILINATOR_TEST_ATTACHMENT_ID` - existing message id within inbox (see above) within private domain (see above); see also https://manybrain.github.io/m8rdocs/#fetch-message
|
94
100
|
* `MAILINATOR_TEST_DELETE_DOMAIN` - don't use it unless you are 100% sure what you are doing
|
101
|
+
* `MAILINATOR_TEST_WEBHOOKTOKEN_PRIVATEDOMAIN` - private domain for webhook token
|
102
|
+
* `MAILINATOR_TEST_WEBHOOKTOKEN_CUSTOMSERVICE` - custom service for webhook token
|
103
|
+
* `MAILINATOR_TEST_AUTH_SECRET` - authenticator secret
|
104
|
+
* `MAILINATOR_TEST_AUTH_ID` - authenticator id
|
105
|
+
* `MAILINATOR_TEST_WEBHOOK_INBOX` - inbox for webhook
|
106
|
+
* `MAILINATOR_TEST_WEBHOOK_CUSTOMSERVICE` - custom service for webhook
|
95
107
|
|
96
108
|
|
97
109
|
*****
|
98
110
|
|
99
|
-
Copyright (c)
|
111
|
+
Copyright (c) 2024 Manybrain, Inc
|
100
112
|
|
101
113
|
<https://www.mailinator.com/>
|
data/docs/domains.md
CHANGED
@@ -6,6 +6,8 @@ Details on the various actions that can be performed on the Domains resource, in
|
|
6
6
|
|
7
7
|
* [GetDomains](#getdomains)
|
8
8
|
* [GetDomain](#getdomain)
|
9
|
+
* [CreateDomain](#createdomain)
|
10
|
+
* [DeleteDomain](#deletedomain)
|
9
11
|
|
10
12
|
<br/>
|
11
13
|
|
@@ -30,3 +32,27 @@ result = client.domains.get_domain(domainId: my_domain_id)
|
|
30
32
|
|
31
33
|
puts result
|
32
34
|
```
|
35
|
+
|
36
|
+
<br/>
|
37
|
+
|
38
|
+
## CreateDomain
|
39
|
+
|
40
|
+
This endpoint creates a private domain attached to your account. Note, the domain must be unique to the system and you must have not reached your maximum number of Private Domains.
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
result = client.domains.create_domain(domainId: my_domain_id)
|
44
|
+
|
45
|
+
puts result
|
46
|
+
```
|
47
|
+
|
48
|
+
<br/>
|
49
|
+
|
50
|
+
## DeleteDomain
|
51
|
+
|
52
|
+
This endpoint deletes a Private Domain
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
result = client.domains.delete_domain(domainId: my_domain_id)
|
56
|
+
|
57
|
+
puts result
|
58
|
+
```
|
data/docs/messages.md
CHANGED
@@ -5,15 +5,25 @@ Details on the various actions that can be performed on the Messages resource, i
|
|
5
5
|
##### Contents
|
6
6
|
|
7
7
|
* [FetchInbox](#fetchinbox)
|
8
|
+
* [FetchInboxMessage](#fetchinboxmessage)
|
8
9
|
* [FetchMessage](#fetchmessage)
|
9
10
|
* [FetchSMSMessage](#fetchsmsmessage)
|
10
|
-
* [
|
11
|
-
* [
|
11
|
+
* [FetchInboxMessageAttachments](#fetchinboxmessageattachments)
|
12
|
+
* [FetchMessageAttachments](#fetchmessageattachments)
|
13
|
+
* [FetchInboxMessageAttachment](#fetchinboxmessageattachment)
|
14
|
+
* [FetchMessageAttachment](#fetchmessageattachment)
|
12
15
|
* [FetchMessageLinks](#fetchmessagelinks)
|
16
|
+
* [FetchInboxMessageLinks](#fetchinboxmessagelinks)
|
13
17
|
* [DeleteAllDomainMessages](#deletealldomainmessages)
|
14
18
|
* [DeleteAllInboxMessages](#deleteallinboxmessages)
|
15
19
|
* [DeleteMessage](#deletemessage)
|
16
|
-
* [
|
20
|
+
* [PostMessage](#postmessage)
|
21
|
+
* [FetchMessageSmtpLog](#fetchmessagesmtplog)
|
22
|
+
* [FetchInboxMessageSmtpLog](#fetchinboxmessagesmtplog)
|
23
|
+
* [FetchMessageRaw](#fetchmessageraw)
|
24
|
+
* [FetchInboxMessageRaw](#fetchinboxmessageraw)
|
25
|
+
* [FetchLatestMessages](#fetchlatestmessages)
|
26
|
+
* [FetchLatestInboxMessages](#fetchlatestinboxmessages)
|
17
27
|
|
18
28
|
<br/>
|
19
29
|
|
@@ -35,12 +45,12 @@ puts result
|
|
35
45
|
|
36
46
|
<br/>
|
37
47
|
|
38
|
-
##
|
48
|
+
## FetchInboxMessage
|
39
49
|
|
40
|
-
Retrieves a specific message by id
|
50
|
+
Retrieves a specific message by id for specific inbox
|
41
51
|
|
42
52
|
```ruby
|
43
|
-
result = client.messages.
|
53
|
+
result = client.messages.fetch_inbox_message(
|
44
54
|
domainId: my_domain_id
|
45
55
|
inbox: my_inbox
|
46
56
|
messageId: my_message_id)
|
@@ -50,6 +60,19 @@ puts result
|
|
50
60
|
|
51
61
|
<br/>
|
52
62
|
|
63
|
+
## FetchMessage
|
64
|
+
|
65
|
+
Retrieves a specific message by id
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
result = client.messages.fetch_message(
|
69
|
+
domainId: my_domain_id
|
70
|
+
messageId: my_message_id)
|
71
|
+
|
72
|
+
puts result
|
73
|
+
```
|
74
|
+
|
75
|
+
<br/>
|
53
76
|
|
54
77
|
## FetchSMSMessage
|
55
78
|
|
@@ -67,12 +90,12 @@ puts result
|
|
67
90
|
<br/>
|
68
91
|
|
69
92
|
|
70
|
-
##
|
93
|
+
## FetchInboxMessageAttachments
|
71
94
|
|
72
|
-
Retrieves a list of attachments for a message
|
95
|
+
Retrieves a list of attachments for a message for specific inbox
|
73
96
|
|
74
97
|
```ruby
|
75
|
-
result = client.messages.
|
98
|
+
result = client.messages.fetch_inbox_message_attachments(
|
76
99
|
domainId: my_domain_id
|
77
100
|
inbox: my_inbox
|
78
101
|
messageId: my_message_id)
|
@@ -82,13 +105,27 @@ puts result
|
|
82
105
|
|
83
106
|
<br/>
|
84
107
|
|
108
|
+
## FetchMessageAttachments
|
85
109
|
|
86
|
-
|
110
|
+
Retrieves a list of attachments for a message
|
87
111
|
|
88
|
-
|
112
|
+
```ruby
|
113
|
+
result = client.messages.fetch_message_attachments(
|
114
|
+
domainId: my_domain_id
|
115
|
+
messageId: my_message_id)
|
116
|
+
|
117
|
+
puts result
|
118
|
+
```
|
119
|
+
|
120
|
+
<br/>
|
121
|
+
|
122
|
+
|
123
|
+
## FetchInboxMessageAttachment
|
124
|
+
|
125
|
+
Retrieves a specific attachment for specific inbox
|
89
126
|
|
90
127
|
```ruby
|
91
|
-
result = client.messages.
|
128
|
+
result = client.messages.fetch_inbox_message_attachment(
|
92
129
|
domainId: my_domain_id
|
93
130
|
inbox: my_inbox
|
94
131
|
messageId: my_message_id
|
@@ -99,6 +136,21 @@ puts result
|
|
99
136
|
|
100
137
|
<br/>
|
101
138
|
|
139
|
+
## FetchMessageAttachment
|
140
|
+
|
141
|
+
Retrieves a specific attachment
|
142
|
+
|
143
|
+
```ruby
|
144
|
+
result = client.messages.fetch_message_attachment(
|
145
|
+
domainId: my_domain_id
|
146
|
+
messageId: my_message_id
|
147
|
+
attachmentId: my_attachment_id)
|
148
|
+
|
149
|
+
puts result
|
150
|
+
```
|
151
|
+
|
152
|
+
<br/>
|
153
|
+
|
102
154
|
|
103
155
|
## FetchMessageLinks
|
104
156
|
|
@@ -106,6 +158,20 @@ Retrieves all links found within a given email
|
|
106
158
|
|
107
159
|
```ruby
|
108
160
|
result = client.messages.fetch_message_links(
|
161
|
+
domainId: my_domain_id
|
162
|
+
messageId: my_message_id)
|
163
|
+
|
164
|
+
puts result
|
165
|
+
```
|
166
|
+
|
167
|
+
<br/>
|
168
|
+
|
169
|
+
## FetchInboxMessageLinks
|
170
|
+
|
171
|
+
Retrieves all links found within a given email for specific inbox
|
172
|
+
|
173
|
+
```ruby
|
174
|
+
result = client.messages.fetch_inbox_message_links(
|
109
175
|
domainId: my_domain_id
|
110
176
|
inbox: my_inbox
|
111
177
|
messageId: my_message_id)
|
@@ -162,15 +228,105 @@ puts result
|
|
162
228
|
<br/>
|
163
229
|
|
164
230
|
|
165
|
-
##
|
231
|
+
## PostMessage
|
166
232
|
|
167
233
|
Deliver a JSON message into your private domain
|
168
234
|
|
169
235
|
```ruby
|
170
|
-
result = client.messages.
|
236
|
+
result = client.messages.post_message(
|
171
237
|
domainId: my_domain_id
|
172
238
|
inbox: my_inbox
|
173
239
|
messageToPost: my_message_to_post)
|
174
240
|
|
175
241
|
puts result
|
176
242
|
```
|
243
|
+
|
244
|
+
<br/>
|
245
|
+
|
246
|
+
|
247
|
+
## FetchMessageSmtpLog
|
248
|
+
|
249
|
+
Retrieves all smtp log found within a given email
|
250
|
+
|
251
|
+
```ruby
|
252
|
+
result = client.messages.fetch_message_smtp_log(
|
253
|
+
domainId: my_domain_id
|
254
|
+
messageId: my_message_id)
|
255
|
+
|
256
|
+
puts result
|
257
|
+
```
|
258
|
+
|
259
|
+
<br/>
|
260
|
+
|
261
|
+
## FetchInboxMessageSmtpLog
|
262
|
+
|
263
|
+
Retrieves all smtp log found within a given email for specific inbox
|
264
|
+
|
265
|
+
```ruby
|
266
|
+
result = client.messages.fetch_inbox_message_smtp_log(
|
267
|
+
domainId: my_domain_id
|
268
|
+
inbox: my_inbox
|
269
|
+
messageId: my_message_id)
|
270
|
+
|
271
|
+
puts result
|
272
|
+
```
|
273
|
+
|
274
|
+
<br/>
|
275
|
+
|
276
|
+
|
277
|
+
## FetchMessageRaw
|
278
|
+
|
279
|
+
Retrieves all raw data found within a given email
|
280
|
+
|
281
|
+
```ruby
|
282
|
+
result = client.messages.fetch_message_raw(
|
283
|
+
domainId: my_domain_id
|
284
|
+
messageId: my_message_id)
|
285
|
+
|
286
|
+
puts result
|
287
|
+
```
|
288
|
+
|
289
|
+
<br/>
|
290
|
+
|
291
|
+
## FetchInboxMessageLinks
|
292
|
+
|
293
|
+
Retrieves all raw data found within a given email for specific inbox
|
294
|
+
|
295
|
+
```ruby
|
296
|
+
result = client.messages.fetch_inbox_message_raw(
|
297
|
+
domainId: my_domain_id
|
298
|
+
inbox: my_inbox
|
299
|
+
messageId: my_message_id)
|
300
|
+
|
301
|
+
puts result
|
302
|
+
```
|
303
|
+
|
304
|
+
<br/>
|
305
|
+
|
306
|
+
|
307
|
+
## FetchLatestMessages
|
308
|
+
|
309
|
+
That fetches the latest 5 FULL messages
|
310
|
+
|
311
|
+
```ruby
|
312
|
+
result = client.messages.fetch_latest_messages(
|
313
|
+
domainId: my_domain_id
|
314
|
+
messageId: my_message_id)
|
315
|
+
|
316
|
+
puts result
|
317
|
+
```
|
318
|
+
|
319
|
+
<br/>
|
320
|
+
|
321
|
+
## FetchLatestInboxMessages
|
322
|
+
|
323
|
+
That fetches the latest 5 FULL messages for specific inbox
|
324
|
+
|
325
|
+
```ruby
|
326
|
+
result = client.messages.fetch_latest_inbox_messages(
|
327
|
+
domainId: my_domain_id
|
328
|
+
inbox: my_inbox
|
329
|
+
messageId: my_message_id)
|
330
|
+
|
331
|
+
puts result
|
332
|
+
```
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2024 Manybrain, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -23,6 +23,7 @@
|
|
23
23
|
require "httparty"
|
24
24
|
|
25
25
|
module MailinatorClient
|
26
|
+
require_relative 'version'
|
26
27
|
# Mailinator API
|
27
28
|
#
|
28
29
|
# User API for accessing Mailinator data
|
@@ -31,7 +32,11 @@ module MailinatorClient
|
|
31
32
|
|
32
33
|
def initialize(options = {})
|
33
34
|
@auth_token = options.fetch(:auth_token, nil)
|
34
|
-
@url = "https://mailinator.com/api/v2"
|
35
|
+
@url = "https://api.mailinator.com/api/v2"
|
36
|
+
end
|
37
|
+
|
38
|
+
def authenticators
|
39
|
+
@authenticators ||= Authenticators.new(self)
|
35
40
|
end
|
36
41
|
|
37
42
|
def domains
|
@@ -50,12 +55,17 @@ module MailinatorClient
|
|
50
55
|
@rules ||= Rules.new(self)
|
51
56
|
end
|
52
57
|
|
58
|
+
def webhooks
|
59
|
+
@webhooks ||= Webhooks.new(self)
|
60
|
+
end
|
61
|
+
|
53
62
|
def request(options = {})
|
54
63
|
headers = options.fetch(:headers, {})
|
55
64
|
method = options.fetch(:method, :get)
|
56
65
|
|
57
66
|
headers["Accept"] = "application/json"
|
58
67
|
headers["Content-Type"] = "application/json"
|
68
|
+
headers["User-Agent"] = "Mailinator SDK - Ruby V#{MailinatorClient::VERSION}"
|
59
69
|
headers["Authorization"] = @auth_token if @auth_token
|
60
70
|
path = @url + options.fetch(:path, "")
|
61
71
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2024 Manybrain, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -83,5 +83,64 @@ module MailinatorClient
|
|
83
83
|
body: body)
|
84
84
|
end
|
85
85
|
|
86
|
+
# This endpoint creates a private domain attached to your account.
|
87
|
+
# Note, the domain must be unique to the system and you must have not reached your maximum number of Private Domains.
|
88
|
+
#
|
89
|
+
# Authentication:
|
90
|
+
# The client must be configured with a valid api
|
91
|
+
# access token to call this action.
|
92
|
+
#
|
93
|
+
# Parameters:
|
94
|
+
# * {string} domainId - The Domain name
|
95
|
+
#
|
96
|
+
# Responses:
|
97
|
+
# * Status (https://manybrain.github.io/m8rdocs/#create-domain)
|
98
|
+
def create_domain(params = {})
|
99
|
+
params = Utils.symbolize_hash_keys(params)
|
100
|
+
query_params = { }
|
101
|
+
headers = {}
|
102
|
+
body = nil
|
103
|
+
|
104
|
+
raise ArgumentError.new("domain id is required") unless params.has_key?(:domainId)
|
105
|
+
|
106
|
+
path = "/domains/#{params[:domainId]}"
|
107
|
+
|
108
|
+
@client.request(
|
109
|
+
method: :post,
|
110
|
+
path: path,
|
111
|
+
query: query_params,
|
112
|
+
headers: headers,
|
113
|
+
body: body)
|
114
|
+
end
|
115
|
+
|
116
|
+
# This endpoint deletes a Private Domain
|
117
|
+
#
|
118
|
+
# Authentication:
|
119
|
+
# The client must be configured with a valid api
|
120
|
+
# access token to call this action.
|
121
|
+
#
|
122
|
+
# Parameters:
|
123
|
+
# * {string} domainId - The Domain name or the Domain id
|
124
|
+
#
|
125
|
+
# Responses:
|
126
|
+
# * Status (https://manybrain.github.io/m8rdocs/#delete-domain)
|
127
|
+
def delete_domain(params = {})
|
128
|
+
params = Utils.symbolize_hash_keys(params)
|
129
|
+
query_params = { }
|
130
|
+
headers = {}
|
131
|
+
body = nil
|
132
|
+
|
133
|
+
raise ArgumentError.new("domain id is required") unless params.has_key?(:domainId)
|
134
|
+
|
135
|
+
path = "/domains/#{params[:domainId]}"
|
136
|
+
|
137
|
+
@client.request(
|
138
|
+
method: :delete,
|
139
|
+
path: path,
|
140
|
+
query: query_params,
|
141
|
+
headers: headers,
|
142
|
+
body: body)
|
143
|
+
end
|
144
|
+
|
86
145
|
end
|
87
146
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2024 Manybrain, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2024 Manybrain, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -71,7 +71,7 @@ module MailinatorClient
|
|
71
71
|
body: body)
|
72
72
|
end
|
73
73
|
|
74
|
-
# Retrieves a specific message by id.
|
74
|
+
# Retrieves a specific message by id for specific inbox.
|
75
75
|
#
|
76
76
|
# Authentication:
|
77
77
|
# The client must be configured with a valid api
|
@@ -83,8 +83,8 @@ module MailinatorClient
|
|
83
83
|
# * {string} messageId - The Message id
|
84
84
|
#
|
85
85
|
# Responses:
|
86
|
-
# * Message (https://manybrain.github.io/m8rdocs/#fetch-message)
|
87
|
-
def
|
86
|
+
# * Message (https://manybrain.github.io/m8rdocs/#fetch-inbox-message)
|
87
|
+
def fetch_inbox_message(params = {})
|
88
88
|
params = Utils.symbolize_hash_keys(params)
|
89
89
|
query_params = { }
|
90
90
|
headers = {}
|
@@ -104,6 +104,37 @@ module MailinatorClient
|
|
104
104
|
body: body)
|
105
105
|
end
|
106
106
|
|
107
|
+
# Retrieves a specific message by id.
|
108
|
+
#
|
109
|
+
# Authentication:
|
110
|
+
# The client must be configured with a valid api
|
111
|
+
# access token to call this action.
|
112
|
+
#
|
113
|
+
# Parameters:
|
114
|
+
# * {string} domainId - The Domain name or the Domain id
|
115
|
+
# * {string} messageId - The Message id
|
116
|
+
#
|
117
|
+
# Responses:
|
118
|
+
# * Message (https://manybrain.github.io/m8rdocs/#fetch-message)
|
119
|
+
def fetch_message(params = {})
|
120
|
+
params = Utils.symbolize_hash_keys(params)
|
121
|
+
query_params = { }
|
122
|
+
headers = {}
|
123
|
+
body = nil
|
124
|
+
|
125
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
126
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
127
|
+
|
128
|
+
path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}"
|
129
|
+
|
130
|
+
@client.request(
|
131
|
+
method: :get,
|
132
|
+
path: path,
|
133
|
+
query: query_params,
|
134
|
+
headers: headers,
|
135
|
+
body: body)
|
136
|
+
end
|
137
|
+
|
107
138
|
# Retrieves a specific SMS message by sms number.
|
108
139
|
#
|
109
140
|
# Authentication:
|
@@ -112,7 +143,6 @@ module MailinatorClient
|
|
112
143
|
#
|
113
144
|
# Parameters:
|
114
145
|
# * {string} domainId - The Domain name or the Domain id
|
115
|
-
# * {string} inbox - The Inbox name
|
116
146
|
# * {string} teamSmsNumber - The Team sms number
|
117
147
|
#
|
118
148
|
# Responses:
|
@@ -124,10 +154,9 @@ module MailinatorClient
|
|
124
154
|
body = nil
|
125
155
|
|
126
156
|
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
127
|
-
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
|
128
157
|
raise ArgumentError.new("team sms number is required") unless params.has_key?(:teamSmsNumber)
|
129
158
|
|
130
|
-
path = "/domains/#{params[:domain]}/inboxes/#{params[:
|
159
|
+
path = "/domains/#{params[:domain]}/inboxes/#{params[:teamSmsNumber]}"
|
131
160
|
|
132
161
|
@client.request(
|
133
162
|
method: :get,
|
@@ -137,7 +166,7 @@ module MailinatorClient
|
|
137
166
|
body: body)
|
138
167
|
end
|
139
168
|
|
140
|
-
# Retrieves a list of attachments for a message. Note attachments are expected to be in Email format.
|
169
|
+
# Retrieves a list of attachments for a message for specific inbox. Note attachments are expected to be in Email format.
|
141
170
|
#
|
142
171
|
# Authentication:
|
143
172
|
# The client must be configured with a valid api
|
@@ -149,8 +178,8 @@ module MailinatorClient
|
|
149
178
|
# * {string} messageId - The Message id
|
150
179
|
#
|
151
180
|
# Responses:
|
152
|
-
# * Collection of attachments (https://manybrain.github.io/m8rdocs/#fetch-list-of-attachments)
|
153
|
-
def
|
181
|
+
# * Collection of attachments (https://manybrain.github.io/m8rdocs/#fetch-inbox-message-list-of-attachments)
|
182
|
+
def fetch_inbox_message_attachments(params = {})
|
154
183
|
params = Utils.symbolize_hash_keys(params)
|
155
184
|
query_params = { }
|
156
185
|
headers = {}
|
@@ -170,8 +199,38 @@ module MailinatorClient
|
|
170
199
|
body: body)
|
171
200
|
end
|
172
201
|
|
202
|
+
# Retrieves a list of attachments for a message. Note attachments are expected to be in Email format.
|
203
|
+
#
|
204
|
+
# Authentication:
|
205
|
+
# The client must be configured with a valid api
|
206
|
+
# access token to call this action.
|
207
|
+
#
|
208
|
+
# Parameters:
|
209
|
+
# * {string} domainId - The Domain name or the Domain id
|
210
|
+
# * {string} messageId - The Message id
|
211
|
+
#
|
212
|
+
# Responses:
|
213
|
+
# * Collection of attachments (https://manybrain.github.io/m8rdocs/#fetch-list-of-attachments)
|
214
|
+
def fetch_message_attachments(params = {})
|
215
|
+
params = Utils.symbolize_hash_keys(params)
|
216
|
+
query_params = { }
|
217
|
+
headers = {}
|
218
|
+
body = nil
|
173
219
|
|
174
|
-
|
220
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
221
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
222
|
+
|
223
|
+
path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}/attachments"
|
224
|
+
|
225
|
+
@client.request(
|
226
|
+
method: :get,
|
227
|
+
path: path,
|
228
|
+
query: query_params,
|
229
|
+
headers: headers,
|
230
|
+
body: body)
|
231
|
+
end
|
232
|
+
|
233
|
+
# Retrieves a specific attachment for specific inbox.
|
175
234
|
#
|
176
235
|
# Authentication:
|
177
236
|
# The client must be configured with a valid api
|
@@ -184,8 +243,8 @@ module MailinatorClient
|
|
184
243
|
# * {string} attachmentId - The Attachment id
|
185
244
|
#
|
186
245
|
# Responses:
|
187
|
-
# * Attachment (https://manybrain.github.io/m8rdocs/#fetch-attachment)
|
188
|
-
def
|
246
|
+
# * Attachment (https://manybrain.github.io/m8rdocs/#fetch-inbox-message-attachment)
|
247
|
+
def fetch_inbox_message_attachment(params = {})
|
189
248
|
params = Utils.symbolize_hash_keys(params)
|
190
249
|
query_params = { }
|
191
250
|
headers = {}
|
@@ -206,6 +265,39 @@ module MailinatorClient
|
|
206
265
|
body: body)
|
207
266
|
end
|
208
267
|
|
268
|
+
# Retrieves a specific attachment.
|
269
|
+
#
|
270
|
+
# Authentication:
|
271
|
+
# The client must be configured with a valid api
|
272
|
+
# access token to call this action.
|
273
|
+
#
|
274
|
+
# Parameters:
|
275
|
+
# * {string} domainId - The Domain name or the Domain id
|
276
|
+
# * {string} messageId - The Message id
|
277
|
+
# * {string} attachmentId - The Attachment id
|
278
|
+
#
|
279
|
+
# Responses:
|
280
|
+
# * Attachment (https://manybrain.github.io/m8rdocs/#fetch-attachment)
|
281
|
+
def fetch_message_attachment(params = {})
|
282
|
+
params = Utils.symbolize_hash_keys(params)
|
283
|
+
query_params = { }
|
284
|
+
headers = {}
|
285
|
+
body = nil
|
286
|
+
|
287
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
288
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
289
|
+
raise ArgumentError.new("attachment id is required") unless params.has_key?(:attachmentId)
|
290
|
+
|
291
|
+
path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}/attachments/#{params[:attachmentId]}"
|
292
|
+
|
293
|
+
@client.request(
|
294
|
+
method: :get,
|
295
|
+
path: path,
|
296
|
+
query: query_params,
|
297
|
+
headers: headers,
|
298
|
+
body: body)
|
299
|
+
end
|
300
|
+
|
209
301
|
# Retrieves all links found within a given email.
|
210
302
|
#
|
211
303
|
# Authentication:
|
@@ -214,7 +306,6 @@ module MailinatorClient
|
|
214
306
|
#
|
215
307
|
# Parameters:
|
216
308
|
# * {string} domainId - The Domain name or the Domain id
|
217
|
-
# * {string} inbox - The Inbox name
|
218
309
|
# * {string} messageId - The Message id
|
219
310
|
#
|
220
311
|
# Responses:
|
@@ -225,6 +316,38 @@ module MailinatorClient
|
|
225
316
|
headers = {}
|
226
317
|
body = nil
|
227
318
|
|
319
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
320
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
321
|
+
|
322
|
+
path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}/links"
|
323
|
+
|
324
|
+
@client.request(
|
325
|
+
method: :get,
|
326
|
+
path: path,
|
327
|
+
query: query_params,
|
328
|
+
headers: headers,
|
329
|
+
body: body)
|
330
|
+
end
|
331
|
+
|
332
|
+
# Retrieves all links found within a given email for specific inbox.
|
333
|
+
#
|
334
|
+
# Authentication:
|
335
|
+
# The client must be configured with a valid api
|
336
|
+
# access token to call this action.
|
337
|
+
#
|
338
|
+
# Parameters:
|
339
|
+
# * {string} domainId - The Domain name or the Domain id
|
340
|
+
# * {string} inbox - The Inbox name
|
341
|
+
# * {string} messageId - The Message id
|
342
|
+
#
|
343
|
+
# Responses:
|
344
|
+
# * Collection of links (https://manybrain.github.io/m8rdocs/#fetch-inbox-message-links)
|
345
|
+
def fetch_inbox_message_links(params = {})
|
346
|
+
params = Utils.symbolize_hash_keys(params)
|
347
|
+
query_params = { }
|
348
|
+
headers = {}
|
349
|
+
body = nil
|
350
|
+
|
228
351
|
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
229
352
|
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
|
230
353
|
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
@@ -344,8 +467,8 @@ module MailinatorClient
|
|
344
467
|
# * {string} messageToPost - The Message object (https://manybrain.github.io/m8rdocs/#inject-a-message-http-post-messages)
|
345
468
|
#
|
346
469
|
# Responses:
|
347
|
-
# * Status, Id and RulesToFired info (https://manybrain.github.io/m8rdocs/#
|
348
|
-
def
|
470
|
+
# * Status, Id and RulesToFired info (https://manybrain.github.io/m8rdocs/#post-message)
|
471
|
+
def post_message(params = {})
|
349
472
|
params = Utils.symbolize_hash_keys(params)
|
350
473
|
query_params = { }
|
351
474
|
headers = {}
|
@@ -367,5 +490,193 @@ module MailinatorClient
|
|
367
490
|
body: body)
|
368
491
|
end
|
369
492
|
|
493
|
+
# Retrieves all smtp log found within a given email.
|
494
|
+
#
|
495
|
+
# Authentication:
|
496
|
+
# The client must be configured with a valid api
|
497
|
+
# access token to call this action.
|
498
|
+
#
|
499
|
+
# Parameters:
|
500
|
+
# * {string} domainId - The Domain name or the Domain id
|
501
|
+
# * {string} messageId - The Message id
|
502
|
+
#
|
503
|
+
# Responses:
|
504
|
+
# * Collection of smtp logs (https://manybrain.github.io/m8rdocs/#fetch-message-smtp-log)
|
505
|
+
def fetch_message_smtp_log(params = {})
|
506
|
+
params = Utils.symbolize_hash_keys(params)
|
507
|
+
query_params = { }
|
508
|
+
headers = {}
|
509
|
+
body = nil
|
510
|
+
|
511
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
512
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
513
|
+
|
514
|
+
path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}/smtplog"
|
515
|
+
|
516
|
+
@client.request(
|
517
|
+
method: :get,
|
518
|
+
path: path,
|
519
|
+
query: query_params,
|
520
|
+
headers: headers,
|
521
|
+
body: body)
|
522
|
+
end
|
523
|
+
|
524
|
+
# Retrieves all smtp log found within a given email for specific inbox.
|
525
|
+
#
|
526
|
+
# Authentication:
|
527
|
+
# The client must be configured with a valid api
|
528
|
+
# access token to call this action.
|
529
|
+
#
|
530
|
+
# Parameters:
|
531
|
+
# * {string} domainId - The Domain name or the Domain id
|
532
|
+
# * {string} inbox - The Inbox name
|
533
|
+
# * {string} messageId - The Message id
|
534
|
+
#
|
535
|
+
# Responses:
|
536
|
+
# * Collection of smtp log (https://manybrain.github.io/m8rdocs/#fetch-inbox-message-smtp-log)
|
537
|
+
def fetch_inbox_message_smtp_log(params = {})
|
538
|
+
params = Utils.symbolize_hash_keys(params)
|
539
|
+
query_params = { }
|
540
|
+
headers = {}
|
541
|
+
body = nil
|
542
|
+
|
543
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
544
|
+
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
|
545
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
546
|
+
|
547
|
+
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}/messages/#{params[:messageId]}/smtplog"
|
548
|
+
|
549
|
+
@client.request(
|
550
|
+
method: :get,
|
551
|
+
path: path,
|
552
|
+
query: query_params,
|
553
|
+
headers: headers,
|
554
|
+
body: body)
|
555
|
+
end
|
556
|
+
|
557
|
+
# Retrieves all raw data found within a given email.
|
558
|
+
#
|
559
|
+
# Authentication:
|
560
|
+
# The client must be configured with a valid api
|
561
|
+
# access token to call this action.
|
562
|
+
#
|
563
|
+
# Parameters:
|
564
|
+
# * {string} domainId - The Domain name or the Domain id
|
565
|
+
# * {string} messageId - The Message id
|
566
|
+
#
|
567
|
+
# Responses:
|
568
|
+
# * Raw Data (https://manybrain.github.io/m8rdocs/#fetch-message-raw)
|
569
|
+
def fetch_message_raw(params = {})
|
570
|
+
params = Utils.symbolize_hash_keys(params)
|
571
|
+
query_params = { }
|
572
|
+
headers = {}
|
573
|
+
body = nil
|
574
|
+
|
575
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
576
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
577
|
+
|
578
|
+
path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}/raw"
|
579
|
+
|
580
|
+
@client.request(
|
581
|
+
method: :get,
|
582
|
+
path: path,
|
583
|
+
query: query_params,
|
584
|
+
headers: headers,
|
585
|
+
body: body)
|
586
|
+
end
|
587
|
+
|
588
|
+
# Retrieves all raw data found within a given email for specific inbox.
|
589
|
+
#
|
590
|
+
# Authentication:
|
591
|
+
# The client must be configured with a valid api
|
592
|
+
# access token to call this action.
|
593
|
+
#
|
594
|
+
# Parameters:
|
595
|
+
# * {string} domainId - The Domain name or the Domain id
|
596
|
+
# * {string} inbox - The Inbox name
|
597
|
+
# * {string} messageId - The Message id
|
598
|
+
#
|
599
|
+
# Responses:
|
600
|
+
# * Raw Data (https://manybrain.github.io/m8rdocs/#fetch-inbox-message-raw)
|
601
|
+
def fetch_inbox_message_raw(params = {})
|
602
|
+
params = Utils.symbolize_hash_keys(params)
|
603
|
+
query_params = { }
|
604
|
+
headers = {}
|
605
|
+
body = nil
|
606
|
+
|
607
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
608
|
+
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
|
609
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
610
|
+
|
611
|
+
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}/messages/#{params[:messageId]}/raw"
|
612
|
+
|
613
|
+
@client.request(
|
614
|
+
method: :get,
|
615
|
+
path: path,
|
616
|
+
query: query_params,
|
617
|
+
headers: headers,
|
618
|
+
body: body)
|
619
|
+
end
|
620
|
+
|
621
|
+
# That fetches the latest 5 FULL messages.
|
622
|
+
#
|
623
|
+
# Authentication:
|
624
|
+
# The client must be configured with a valid api
|
625
|
+
# access token to call this action.
|
626
|
+
#
|
627
|
+
# Parameters:
|
628
|
+
# * {string} domainId - The Domain name or the Domain id
|
629
|
+
#
|
630
|
+
# Responses:
|
631
|
+
# * Collection of latest messages (https://manybrain.github.io/m8rdocs/#fetch-latest-messages)
|
632
|
+
def fetch_latest_messages(params = {})
|
633
|
+
params = Utils.symbolize_hash_keys(params)
|
634
|
+
query_params = { }
|
635
|
+
headers = {}
|
636
|
+
body = nil
|
637
|
+
|
638
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
639
|
+
|
640
|
+
path = "/domains/#{params[:domain]}/messages/*"
|
641
|
+
|
642
|
+
@client.request(
|
643
|
+
method: :get,
|
644
|
+
path: path,
|
645
|
+
query: query_params,
|
646
|
+
headers: headers,
|
647
|
+
body: body)
|
648
|
+
end
|
649
|
+
|
650
|
+
# That fetches the latest 5 FULL messages for specific inbox.
|
651
|
+
#
|
652
|
+
# Authentication:
|
653
|
+
# The client must be configured with a valid api
|
654
|
+
# access token to call this action.
|
655
|
+
#
|
656
|
+
# Parameters:
|
657
|
+
# * {string} domainId - The Domain name or the Domain id
|
658
|
+
# * {string} inbox - The Inbox name
|
659
|
+
#
|
660
|
+
# Responses:
|
661
|
+
# * Collection of latest messages (https://manybrain.github.io/m8rdocs/#fetch-latest-inbox-messages)
|
662
|
+
def fetch_latest_inbox_messages(params = {})
|
663
|
+
params = Utils.symbolize_hash_keys(params)
|
664
|
+
query_params = { }
|
665
|
+
headers = {}
|
666
|
+
body = nil
|
667
|
+
|
668
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
669
|
+
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
|
670
|
+
|
671
|
+
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}/messages/*"
|
672
|
+
|
673
|
+
@client.request(
|
674
|
+
method: :get,
|
675
|
+
path: path,
|
676
|
+
query: query_params,
|
677
|
+
headers: headers,
|
678
|
+
body: body)
|
679
|
+
end
|
680
|
+
|
370
681
|
end
|
371
682
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2024 Manybrain, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2024 Manybrain, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2024 Manybrain, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2024 Manybrain, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -21,5 +21,5 @@
|
|
21
21
|
# SOFTWARE.
|
22
22
|
|
23
23
|
module MailinatorClient
|
24
|
-
VERSION = "1.0.
|
24
|
+
VERSION = "1.0.4"
|
25
25
|
end
|
data/lib/mailinator_client.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License (MIT)
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2024 Manybrain, Inc.
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -23,10 +23,12 @@
|
|
23
23
|
require_relative "mailinator_client/version"
|
24
24
|
require_relative "mailinator_client/error"
|
25
25
|
require_relative "mailinator_client/utils"
|
26
|
+
require_relative "mailinator_client/authenticators"
|
26
27
|
require_relative "mailinator_client/domains"
|
27
28
|
require_relative "mailinator_client/stats"
|
28
29
|
require_relative "mailinator_client/messages"
|
29
30
|
require_relative "mailinator_client/rules"
|
31
|
+
require_relative "mailinator_client/webhooks"
|
30
32
|
require_relative "mailinator_client/client"
|
31
33
|
|
32
34
|
module MailinatorClient
|
@@ -11,12 +11,33 @@ class MailinatorClientApiTest < MiniTest::Test
|
|
11
11
|
@messageIdWithAttachment = "MAILINATOR_TEST_MESSAGE_WITH_ATTACHMENT_ID"
|
12
12
|
@attachmentId = "MAILINATOR_TEST_ATTACHMENT_ID"
|
13
13
|
@deleteDomain = "MAILINATOR_TEST_DELETE_DOMAIN"
|
14
|
+
@webhookTokenPrivateDomain= "MAILINATOR_TEST_WEBHOOKTOKEN_PRIVATEDOMAIN"
|
15
|
+
@webhookTokenCustomService = "MAILINATOR_TEST_WEBHOOKTOKEN_CUSTOMSERVICE"
|
16
|
+
@authSecret = "MAILINATOR_TEST_AUTH_SECRET"
|
17
|
+
@authId = "MAILINATOR_TEST_AUTH_ID"
|
18
|
+
@webhookInbox = "MAILINATOR_TEST_WEBHOOK_INBOX"
|
19
|
+
@webhookCustomService = "MAILINATOR_TEST_WEBHOOK_CUSTOMSERVICE"
|
14
20
|
end
|
15
21
|
|
16
22
|
it "should correctly do manipulation with mailinator data" do
|
17
23
|
|
18
24
|
client = MailinatorClient::Client.new(auth_token: @auth_token)
|
19
25
|
|
26
|
+
response = client.authenticators.instant_totp_2fa_code(totpSecretKey: @authSecret)
|
27
|
+
assert response != nil, "Expected instant totp 2fa code response to not be nil"
|
28
|
+
|
29
|
+
response = client.authenticators.get_authenticators()
|
30
|
+
assert response != nil, "Expected get authenticators response to not be nil"
|
31
|
+
|
32
|
+
response = client.authenticators.get_authenticators_by_id(id: @authId)
|
33
|
+
assert response != nil, "Expected get authenticators by id response to not be nil"
|
34
|
+
|
35
|
+
response = client.authenticators.get_authenticator()
|
36
|
+
assert response != nil, "Expected get authenticator response to not be nil"
|
37
|
+
|
38
|
+
response = client.authenticators.get_authenticator_by_id(id: @authId)
|
39
|
+
assert response != nil, "Expected get authenticator by id response to not be nil"
|
40
|
+
|
20
41
|
response = client.domains.get_domains
|
21
42
|
assert response != nil, "Expected get domains response to not be nil"
|
22
43
|
assert response["domains"] != nil, "Expected response domains to not be nil"
|
@@ -24,13 +45,24 @@ class MailinatorClientApiTest < MiniTest::Test
|
|
24
45
|
@domainId = @domain["_id"]
|
25
46
|
@domainName = @domain["name"]
|
26
47
|
|
27
|
-
response = client.domains.get_domain(domainId:@
|
48
|
+
response = client.domains.get_domain(domainId:@domainName)
|
28
49
|
assert response != nil, "Expected get domain response to not be nil"
|
29
50
|
|
51
|
+
@domainNameToAdd = "testruby.testinator.com"
|
52
|
+
|
53
|
+
response = client.domains.create_domain(domainId:@domainNameToAdd)
|
54
|
+
assert response != nil, "Expected create domain response to not be nil"
|
55
|
+
#assert response["status"] == "ok", "Expected create domain response to be ok"
|
56
|
+
|
57
|
+
response = client.domains.delete_domain(domainId:@domainNameToAdd)
|
58
|
+
assert response != nil, "Expected delete domain response to not be nil"
|
59
|
+
#assert response["status"] == "ok", "Expected delete domain response to be ok"
|
60
|
+
|
61
|
+
random_string = SecureRandom.hex(4)
|
30
62
|
ruleToPost = {
|
31
|
-
name: "
|
63
|
+
name: "RuleName_RubyTest_#{random_string}",
|
32
64
|
priority: 15,
|
33
|
-
description: "
|
65
|
+
description: "Description_RubyTest_#{random_string}",
|
34
66
|
conditions: [
|
35
67
|
{
|
36
68
|
operation: "PREFIX",
|
@@ -52,54 +84,94 @@ class MailinatorClientApiTest < MiniTest::Test
|
|
52
84
|
]
|
53
85
|
}
|
54
86
|
|
55
|
-
response = client.rules.create_rule(domainId:@
|
87
|
+
response = client.rules.create_rule(domainId:@domainName, ruleToPost: ruleToPost)
|
56
88
|
assert response != nil, "Expected get create rule response to not be nil"
|
57
89
|
assert response["_id"] != nil, "Expected response rule id to not be nil"
|
58
90
|
|
59
|
-
response = client.rules.get_all_rules(domainId:@
|
91
|
+
response = client.rules.get_all_rules(domainId:@domainName)
|
60
92
|
assert response != nil, "Expected get all rules response to not be nil"
|
61
93
|
assert response["rules"] != nil, "Expected response rules to not be nil"
|
62
94
|
@rule = response["rules"][0]
|
63
95
|
@ruleId = @rule["_id"]
|
64
96
|
|
65
|
-
response = client.rules.enable_rule(domainId:@
|
97
|
+
response = client.rules.enable_rule(domainId:@domainName, ruleId: @ruleId)
|
66
98
|
assert response != nil, "Expected enable rule response to not be nil"
|
67
99
|
assert response["status"] == "ok", "Expected enable rule response to be ok"
|
68
100
|
|
69
|
-
response = client.rules.disable_rule(domainId:@
|
101
|
+
response = client.rules.disable_rule(domainId:@domainName, ruleId: @ruleId)
|
70
102
|
assert response != nil, "Expected disable rule response to not be nil"
|
71
103
|
assert response["status"] == "ok", "Expected disable rule response to be ok"
|
72
104
|
|
73
|
-
response = client.rules.get_rule(domainId:@
|
105
|
+
response = client.rules.get_rule(domainId:@domainName, ruleId: @ruleId)
|
74
106
|
assert response != nil, "Expected disable rule response to not be nil"
|
75
|
-
assert response["_id"] != nil, "Expected get rule response to not be nil"
|
107
|
+
assert response["_id"] != nil, "Expected get rule response id to not be nil"
|
76
108
|
|
77
109
|
response = client.rules.delete_rule(domainId:@deleteDomain, ruleId: @ruleId)
|
78
110
|
assert response != nil, "Expected delete rule response to not be nil"
|
79
111
|
assert response["status"] == "ok", "Expected delete rule response to be ok"
|
80
112
|
|
113
|
+
messageToPost = {
|
114
|
+
subject:"Testing ruby message",
|
115
|
+
from:"test_email_ruby@test.com",
|
116
|
+
text:"I love Ruby!"
|
117
|
+
}
|
118
|
+
response = client.messages.post_message(domain:@domainName, inbox: @inboxAll, messageToPost: messageToPost)
|
119
|
+
assert response != nil, "Expected post message response to not be nil"
|
120
|
+
assert response["status"] == "ok", "Expected post message response to be ok"
|
121
|
+
|
81
122
|
response = client.messages.fetch_inbox(domain:@domainName, inbox: @inboxAll, skip: 0, limit: 50, sort: "ascending", decodeSubject: false)
|
82
123
|
assert response != nil, "Expected fetch inbox response to not be nil"
|
83
124
|
assert response["msgs"] != nil, "Expected response fetch inbox messages to not be nil"
|
84
125
|
@message = response["msgs"][0]
|
85
126
|
@messageId = @message["id"]
|
86
127
|
|
87
|
-
response = client.messages.
|
128
|
+
response = client.messages.fetch_inbox_message(domain:@domainName, inbox: @inboxAll, messageId: @messageId)
|
129
|
+
assert response != nil, "Expected fetch inbox message response to not be nil"
|
130
|
+
|
131
|
+
response = client.messages.fetch_message(domain:@domainName, messageId: @messageId)
|
88
132
|
assert response != nil, "Expected fetch message response to not be nil"
|
89
133
|
|
90
|
-
response = client.messages.fetch_sms_message(domain:@domainName,
|
134
|
+
response = client.messages.fetch_sms_message(domain:@domainName, teamSmsNumber: @teamSMSNumber)
|
91
135
|
assert response != nil, "Expected fetch sms message response to not be nil"
|
92
136
|
|
93
|
-
response = client.messages.
|
94
|
-
assert response != nil, "Expected fetch attachments response to not be nil"
|
137
|
+
response = client.messages.fetch_inbox_message_attachments(domain:@domainName, inbox: @inbox, messageId: @messageIdWithAttachment)
|
138
|
+
assert response != nil, "Expected fetch inbox message attachments response to not be nil"
|
139
|
+
|
140
|
+
response = client.messages.fetch_message_attachments(domain:@domainName, messageId: @messageIdWithAttachment)
|
141
|
+
assert response != nil, "Expected fetch message attachments response to not be nil"
|
95
142
|
|
96
|
-
response = client.messages.
|
97
|
-
assert response != nil, "Expected fetch attachment response to not be nil"
|
143
|
+
response = client.messages.fetch_inbox_message_attachment(domain:@domainName, inbox: @inbox, messageId: @messageIdWithAttachment, attachmentId: @attachmentId)
|
144
|
+
assert response != nil, "Expected fetch inbox message attachment response to not be nil"
|
98
145
|
|
99
|
-
response = client.messages.
|
146
|
+
response = client.messages.fetch_message_attachment(domain:@domainName, messageId: @messageIdWithAttachment, attachmentId: @attachmentId)
|
147
|
+
assert response != nil, "Expected fetch message attachment response to not be nil"
|
148
|
+
|
149
|
+
response = client.messages.fetch_message_links(domain:@domainName, messageId: @messageId)
|
100
150
|
assert response != nil, "Expected fetch message links response to not be nil"
|
101
151
|
assert response["links"] != nil, "Expected fetch message links links response to not be nil"
|
152
|
+
|
153
|
+
response = client.messages.fetch_inbox_message_links(domain:@domainName, inbox: @inboxAll, messageId: @messageId)
|
154
|
+
assert response != nil, "Expected fetch inbox message links response to not be nil"
|
155
|
+
assert response["links"] != nil, "Expected fetch inbox message links links response to not be nil"
|
102
156
|
|
157
|
+
response = client.messages.fetch_message_smtp_log(domain:@domainName, messageId: @messageId)
|
158
|
+
assert response != nil, "Expected fetch message smtp log response to not be nil"
|
159
|
+
|
160
|
+
response = client.messages.fetch_inbox_message_smtp_log(domain:@domainName, inbox: @inboxAll, messageId: @messageId)
|
161
|
+
assert response != nil, "Expected fetch inbox message smtp log response to not be nil"
|
162
|
+
|
163
|
+
response = client.messages.fetch_message_raw(domain:@domainName, messageId: @messageId)
|
164
|
+
assert response != nil, "Expected fetch message raw response to not be nil"
|
165
|
+
|
166
|
+
response = client.messages.fetch_inbox_message_raw(domain:@domainName, inbox: @inboxAll, messageId: @messageId)
|
167
|
+
assert response != nil, "Expected fetch inbox message raw response to not be nil"
|
168
|
+
|
169
|
+
response = client.messages.fetch_latest_messages(domain:@domainName)
|
170
|
+
assert response != nil, "Expected fetch latest messages response to not be nil"
|
171
|
+
|
172
|
+
response = client.messages.fetch_latest_inbox_messages(domain:@domainName, inbox: @inboxAll)
|
173
|
+
assert response != nil, "Expected fetch latest inbox message response to not be nil"
|
174
|
+
|
103
175
|
response = client.messages.delete_message(domain:@deleteDomain, inbox: @inbox, messageId: @messageId)
|
104
176
|
assert response != nil, "Expected delete message response to not be nil"
|
105
177
|
assert response["status"] == "ok", "Expected delete message response to be ok"
|
@@ -112,21 +184,49 @@ class MailinatorClientApiTest < MiniTest::Test
|
|
112
184
|
assert response != nil, "Expected delete all domain messages response to not be nil"
|
113
185
|
assert response["status"] == "ok", "Expected delete all domain messages response to be ok"
|
114
186
|
|
115
|
-
messageToPost = {
|
116
|
-
subject:"Testing ruby message",
|
117
|
-
from:"test_email_ruby@test.com",
|
118
|
-
text:"I love Ruby!"
|
119
|
-
}
|
120
|
-
response = client.messages.inject_message(domain:@domainName, inbox: @inboxAll, messageToPost: messageToPost)
|
121
|
-
assert response != nil, "Expected inject message response to not be nil"
|
122
|
-
assert response["status"] == "ok", "Expected inject message response to be ok"
|
123
|
-
|
124
187
|
response = client.stats.get_team_stats
|
125
188
|
assert response != nil, "Expected response to not be nil"
|
126
189
|
assert response["stats"] != nil, "Expected response stats to not be nil"
|
127
190
|
|
128
191
|
response = client.stats.get_team
|
129
192
|
assert response != nil, "Expected response to not be nil"
|
193
|
+
|
194
|
+
webhook = {
|
195
|
+
from:"MyMailinatorRubyTest",
|
196
|
+
subject:"testing message",
|
197
|
+
text:"hello world",
|
198
|
+
to:"jack"
|
199
|
+
}
|
200
|
+
|
201
|
+
clientWithoutAuthToken = MailinatorClient::Client.new()
|
202
|
+
response = clientWithoutAuthToken.webhooks.public_webhook(webhook:webhook)
|
203
|
+
assert response != nil, "Expected public webhook response to not be nil"
|
204
|
+
assert response["status"] == "ok", "Expected public webhook response to be ok"
|
205
|
+
|
206
|
+
response = clientWithoutAuthToken.webhooks.public_inbox_webhook(inbox: @webhookInbox, webhook:webhook)
|
207
|
+
assert response != nil, "Expected public inbox webhook response to not be nil"
|
208
|
+
assert response["status"] == "ok", "Expected public inbox webhook response to be ok"
|
209
|
+
|
210
|
+
response = clientWithoutAuthToken.webhooks.public_custom_service_webhook(customService: @webhookCustomService, webhook:webhook)
|
211
|
+
#assert response != nil, "Expected public custom service webhook response to not be nil"
|
212
|
+
|
213
|
+
response = clientWithoutAuthToken.webhooks.public_custom_service_inbox_webhook(customService: @webhookCustomService, inbox: @webhookInbox, webhook:webhook)
|
214
|
+
#assert response != nil, "Expected public custom service inbox webhook response to not be nil"
|
215
|
+
|
216
|
+
response = clientWithoutAuthToken.webhooks.private_webhook(whToken: @webhookTokenPrivateDomain, webhook:webhook)
|
217
|
+
assert response != nil, "Expected private webhook status response to not be nil"
|
218
|
+
assert response["status"] == "ok", "Expected private webhook response to be ok"
|
219
|
+
|
220
|
+
response = clientWithoutAuthToken.webhooks.private_inbox_webhook(whToken: @webhookTokenPrivateDomain, inbox: @webhookInbox, webhook:webhook)
|
221
|
+
assert response != nil, "Expected private inbox webhook response to not be nil"
|
222
|
+
assert response["status"] == "ok", "Expected private inbox webhook response to be ok"
|
223
|
+
|
224
|
+
response = clientWithoutAuthToken.webhooks.private_custom_service_webhook(whToken: @webhookTokenPrivateDomain, customService: @webhookCustomService, webhook:webhook)
|
225
|
+
#assert response != nil, "Expected private custom service webhook response to not be nil"
|
226
|
+
|
227
|
+
response = clientWithoutAuthToken.webhooks.private_custom_service_inbox_webhook(whToken: @webhookTokenPrivateDomain, customService: @webhookCustomService, inbox: @webhookInbox, webhook:webhook)
|
228
|
+
#assert response != nil, "Expected private custom service inbox webhook response to not be nil"
|
229
|
+
|
130
230
|
end
|
131
231
|
end
|
132
232
|
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.4
|
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: 2024-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
|
-
rubygems_version: 3.4.
|
119
|
+
rubygems_version: 3.4.19
|
120
120
|
signing_key:
|
121
121
|
specification_version: 4
|
122
122
|
summary: Provides a simple ruby wrapper around the Mailinator REST API
|