mailinator_client 1.0.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53dfb086987aa73902e4b5a513da720b17069e6fe0e376f5f7e39b5dc0e3ef08
4
- data.tar.gz: 67c036c5ba409c62a1357f2e1f2217632b6bccf7087c2959fadda5bdb2793b4e
3
+ metadata.gz: a3e1ec11068d686d886639d80e6a17e17fd991341367ad61f929990d61724ffa
4
+ data.tar.gz: 07e57ad2cb1d9ebf07bcf785b5a61ee5e8627225eac1cff501d65767e5ad1edf
5
5
  SHA512:
6
- metadata.gz: 9ba71db113ef295a23eee44d38e13470c9d7e2adc8fd85aa1dc2028f15455a9a5a283883666e9a32afe2d8fa583ec0cb0c0c833bf1da0f6073d1f9926b077da7
7
- data.tar.gz: 12527e9e153589ee1a8909c0c9390cafff8b357715318a081a70dbb53d14b5c6a234824bc7ee7e6cdab6d481096e6d9ec050a5ca6bea9571ef9c69de0c7c1cc7
6
+ metadata.gz: 9900dcb42cd529cf13e37ebf6cec0a3f06a6a31d5efd712f460d39c243ac55606d40ba2b186d9a80d373142bef38e6e0400b61f58051f2755e2e4c716b528eff
7
+ data.tar.gz: b31c3de9304ed10adebb2e21a1693be58bc0141c79bf741538b235650e0a4b740dc69c029d4b3653088ea663870ed9c7d9ec58f9bfc38236ac8f25691351383f
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.3
1
+ 2.7.6
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 Manybrain, Inc.
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
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) 2020 Manybrain, Inc
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
- * [FetchAttachments](#fetchattachments)
11
- * [FetchAttachment](#fetchattachment)
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
- * [InjectMessage](#injectmessage)
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
- ## FetchMessage
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.fetch_inbox(
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
- ## FetchAttachments
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.fetch_attachments(
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
- ## FetchAttachment
110
+ Retrieves a list of attachments for a message
87
111
 
88
- Retrieves a specific attachment
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.fetch_attachment(
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
- ## InjectMessage
231
+ ## PostMessage
166
232
 
167
233
  Deliver a JSON message into your private domain
168
234
 
169
235
  ```ruby
170
- result = client.messages.inject_message(
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) 2020 Manybrain, Inc.
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) 2020 Manybrain, Inc.
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) 2020 Manybrain, Inc.
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