mailinator_client 1.0.7 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.agent/rules/tdd.md +7 -0
- data/.agent/tdd-flow/skill.md +15 -0
- data/.env.example +14 -1
- data/.github/copilot-instructions.md +7 -0
- data/AGENTS.md +17 -0
- data/CHANGELOG.md +33 -6
- data/README.md +9 -3
- data/ROADMAP.md +51 -17
- data/docs/openapi-maintenance.md +150 -0
- data/lib/mailinator_client/client.rb +13 -1
- data/lib/mailinator_client/domains.rb +2 -2
- data/lib/mailinator_client/messages.rb +442 -25
- data/lib/mailinator_client/rules.rb +6 -6
- data/lib/mailinator_client/version.rb +1 -1
- data/lib/mailinator_client/webhooks.rb +1 -0
- data/mailinator_client.gemspec +6 -5
- data/test/messages_api_test.rb +205 -67
- data/test/messages_headers_api_test.rb +30 -0
- data/test/messages_query_params_test.rb +58 -36
- data/test/messages_stream_domain_api_test.rb +39 -0
- data/test/messages_stream_inbox_api_test.rb +40 -0
- data/test/messages_summary_api_test.rb +28 -0
- data/test/messages_text_api_test.rb +28 -0
- data/test/messages_texthtml_api_test.rb +28 -0
- data/test/messages_textplain_api_test.rb +28 -0
- data/test/webhooks_api_test.rb +3 -3
- metadata +54 -16
- data/AI_INSTRUCTIONS.md +0 -194
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
require "json"
|
|
2
|
+
require "net/http"
|
|
3
|
+
require "uri"
|
|
2
4
|
|
|
3
5
|
module MailinatorClient
|
|
4
6
|
|
|
@@ -16,7 +18,7 @@ module MailinatorClient
|
|
|
16
18
|
# access token to call this action.
|
|
17
19
|
#
|
|
18
20
|
# Parameters:
|
|
19
|
-
# * {string} domainId - The Domain name or
|
|
21
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
20
22
|
# * {string} inbox - The Inbox name
|
|
21
23
|
# * {number} skip - [Optional] Skip this many emails in your Private Domain
|
|
22
24
|
# * {number} limit - [Optional] Number of emails to fetch from your Private Domain
|
|
@@ -25,7 +27,6 @@ module MailinatorClient
|
|
|
25
27
|
# * {string} cursor - [Optional] Pagination cursor for large result sets (obtained from previous response)
|
|
26
28
|
# * {boolean} full - [Optional] Return full email content with body/attachments (true) or just metadata (false). Default: false
|
|
27
29
|
# * {string} delete - [Optional] Auto-delete message after retrieval (e.g., "10s" = 10 seconds, "5m" = 5 minutes)
|
|
28
|
-
# * {string} wait - [Optional] Maximum time to wait for new messages (e.g., "30s" = 30 seconds)
|
|
29
30
|
#
|
|
30
31
|
# Responses:
|
|
31
32
|
# * Collection of messages (https://manybrain.github.io/m8rdocs/#fetch-inbox-aka-fetch-message-summaries)
|
|
@@ -45,16 +46,17 @@ module MailinatorClient
|
|
|
45
46
|
query_params[:cursor] = params[:cursor] if params.has_key?(:cursor)
|
|
46
47
|
query_params[:full] = params[:full] if params.has_key?(:full)
|
|
47
48
|
query_params[:delete] = params[:delete] if params.has_key?(:delete)
|
|
48
|
-
query_params[:wait] = params[:wait] if params.has_key?(:wait)
|
|
49
49
|
|
|
50
50
|
path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}"
|
|
51
51
|
|
|
52
|
-
@client.request(
|
|
52
|
+
response = @client.request(
|
|
53
53
|
method: :get,
|
|
54
54
|
path: path,
|
|
55
55
|
query: query_params,
|
|
56
56
|
headers: headers,
|
|
57
57
|
body: body)
|
|
58
|
+
|
|
59
|
+
response
|
|
58
60
|
end
|
|
59
61
|
|
|
60
62
|
# Retrieves a specific message by id for specific inbox.
|
|
@@ -64,7 +66,7 @@ module MailinatorClient
|
|
|
64
66
|
# access token to call this action.
|
|
65
67
|
#
|
|
66
68
|
# Parameters:
|
|
67
|
-
# * {string} domainId - The Domain name or
|
|
69
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
68
70
|
# * {string} inbox - The Inbox name
|
|
69
71
|
# * {string} messageId - The Message id
|
|
70
72
|
# * {string} delete - [Optional] Auto-delete message after retrieval (e.g., "10s" = 10 seconds, "5m" = 5 minutes)
|
|
@@ -100,12 +102,12 @@ module MailinatorClient
|
|
|
100
102
|
# access token to call this action.
|
|
101
103
|
#
|
|
102
104
|
# Parameters:
|
|
103
|
-
# * {string} domainId - The Domain name or
|
|
105
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
104
106
|
# * {string} messageId - The Message id
|
|
105
107
|
# * {string} delete - [Optional] Auto-delete message after retrieval (e.g., "10s" = 10 seconds, "5m" = 5 minutes)
|
|
106
108
|
#
|
|
107
109
|
# Responses:
|
|
108
|
-
# * Message (https://
|
|
110
|
+
# * Message (https://www.mailinator.com/documentation/docs/api/get-domain-message/index.html)
|
|
109
111
|
def fetch_message(params = {})
|
|
110
112
|
params = Utils.symbolize_hash_keys(params)
|
|
111
113
|
query_params = { }
|
|
@@ -127,6 +129,421 @@ module MailinatorClient
|
|
|
127
129
|
body: body)
|
|
128
130
|
end
|
|
129
131
|
|
|
132
|
+
# Retrieves the summary for a specific message by id.
|
|
133
|
+
#
|
|
134
|
+
# Authentication:
|
|
135
|
+
# The client must be configured with a valid api
|
|
136
|
+
# access token to call this action.
|
|
137
|
+
#
|
|
138
|
+
# Parameters:
|
|
139
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
140
|
+
# * {string} messageId - The Message id
|
|
141
|
+
#
|
|
142
|
+
# Responses:
|
|
143
|
+
# * Message summary
|
|
144
|
+
def fetch_message_summary(params = {})
|
|
145
|
+
params = Utils.symbolize_hash_keys(params)
|
|
146
|
+
query_params = { }
|
|
147
|
+
headers = {}
|
|
148
|
+
body = nil
|
|
149
|
+
|
|
150
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
|
151
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
|
152
|
+
|
|
153
|
+
path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}/summary"
|
|
154
|
+
|
|
155
|
+
@client.request(
|
|
156
|
+
method: :get,
|
|
157
|
+
path: path,
|
|
158
|
+
query: query_params,
|
|
159
|
+
headers: headers,
|
|
160
|
+
body: body)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Retrieves text content for a specific message by id.
|
|
164
|
+
#
|
|
165
|
+
# Authentication:
|
|
166
|
+
# The client must be configured with a valid api
|
|
167
|
+
# access token to call this action.
|
|
168
|
+
#
|
|
169
|
+
# Parameters:
|
|
170
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
171
|
+
# * {string} messageId - The Message id
|
|
172
|
+
#
|
|
173
|
+
# Responses:
|
|
174
|
+
# * Message text response
|
|
175
|
+
def fetch_message_text(params = {})
|
|
176
|
+
params = Utils.symbolize_hash_keys(params)
|
|
177
|
+
query_params = { }
|
|
178
|
+
headers = {}
|
|
179
|
+
body = nil
|
|
180
|
+
|
|
181
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
|
182
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
|
183
|
+
|
|
184
|
+
path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}/text"
|
|
185
|
+
|
|
186
|
+
@client.request(
|
|
187
|
+
method: :get,
|
|
188
|
+
path: path,
|
|
189
|
+
query: query_params,
|
|
190
|
+
headers: headers,
|
|
191
|
+
body: body)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Retrieves text/plain content for a specific message by id.
|
|
195
|
+
#
|
|
196
|
+
# Authentication:
|
|
197
|
+
# The client must be configured with a valid api
|
|
198
|
+
# access token to call this action.
|
|
199
|
+
#
|
|
200
|
+
# Parameters:
|
|
201
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
202
|
+
# * {string} messageId - The Message id
|
|
203
|
+
#
|
|
204
|
+
# Responses:
|
|
205
|
+
# * Message text/plain response
|
|
206
|
+
def fetch_message_textplain(params = {})
|
|
207
|
+
params = Utils.symbolize_hash_keys(params)
|
|
208
|
+
query_params = { }
|
|
209
|
+
headers = {}
|
|
210
|
+
body = nil
|
|
211
|
+
|
|
212
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
|
213
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
|
214
|
+
|
|
215
|
+
path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}/textplain"
|
|
216
|
+
|
|
217
|
+
@client.request(
|
|
218
|
+
method: :get,
|
|
219
|
+
path: path,
|
|
220
|
+
query: query_params,
|
|
221
|
+
headers: headers,
|
|
222
|
+
body: body)
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Retrieves text/html content for a specific message by id.
|
|
226
|
+
#
|
|
227
|
+
# Authentication:
|
|
228
|
+
# The client must be configured with a valid api
|
|
229
|
+
# access token to call this action.
|
|
230
|
+
#
|
|
231
|
+
# Parameters:
|
|
232
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
233
|
+
# * {string} messageId - The Message id
|
|
234
|
+
#
|
|
235
|
+
# Responses:
|
|
236
|
+
# * Message text/html response
|
|
237
|
+
def fetch_message_texthtml(params = {})
|
|
238
|
+
params = Utils.symbolize_hash_keys(params)
|
|
239
|
+
query_params = { }
|
|
240
|
+
headers = {}
|
|
241
|
+
body = nil
|
|
242
|
+
|
|
243
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
|
244
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
|
245
|
+
|
|
246
|
+
path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}/texthtml"
|
|
247
|
+
|
|
248
|
+
@client.request(
|
|
249
|
+
method: :get,
|
|
250
|
+
path: path,
|
|
251
|
+
query: query_params,
|
|
252
|
+
headers: headers,
|
|
253
|
+
body: body)
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Retrieves headers for a specific message by id.
|
|
257
|
+
#
|
|
258
|
+
# Authentication:
|
|
259
|
+
# The client must be configured with a valid api
|
|
260
|
+
# access token to call this action.
|
|
261
|
+
#
|
|
262
|
+
# Parameters:
|
|
263
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
264
|
+
# * {string} messageId - The Message id
|
|
265
|
+
#
|
|
266
|
+
# Responses:
|
|
267
|
+
# * Message headers response
|
|
268
|
+
def fetch_message_headers(params = {})
|
|
269
|
+
params = Utils.symbolize_hash_keys(params)
|
|
270
|
+
query_params = { }
|
|
271
|
+
headers = {}
|
|
272
|
+
body = nil
|
|
273
|
+
|
|
274
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
|
275
|
+
raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
|
|
276
|
+
|
|
277
|
+
path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}/headers"
|
|
278
|
+
|
|
279
|
+
@client.request(
|
|
280
|
+
method: :get,
|
|
281
|
+
path: path,
|
|
282
|
+
query: query_params,
|
|
283
|
+
headers: headers,
|
|
284
|
+
body: body)
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Streams all messages from a domain.
|
|
288
|
+
#
|
|
289
|
+
# Authentication:
|
|
290
|
+
# The client must be configured with a valid api
|
|
291
|
+
# access token to call this action.
|
|
292
|
+
#
|
|
293
|
+
# Parameters:
|
|
294
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
295
|
+
# * {boolean} full - [Optional] Return full email content with body/attachments (true) or just metadata (false). Default: false
|
|
296
|
+
# * {number} limit - [Optional] Number of messages to fetch
|
|
297
|
+
# * {number} throttleInterval - [Optional] Throttle interval in milliseconds
|
|
298
|
+
# * {string} delete - [Optional] Auto-delete message after retrieval (e.g., "10s" = 10 seconds, "5m" = 5 minutes)
|
|
299
|
+
#
|
|
300
|
+
# Responses:
|
|
301
|
+
# * Message stream response
|
|
302
|
+
def stream_domain_messages(params = {})
|
|
303
|
+
params = Utils.symbolize_hash_keys(params)
|
|
304
|
+
query_params = { }
|
|
305
|
+
headers = {}
|
|
306
|
+
body = nil
|
|
307
|
+
|
|
308
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
|
309
|
+
|
|
310
|
+
query_params[:full] = params[:full] if params.has_key?(:full)
|
|
311
|
+
query_params[:limit] = params[:limit] if params.has_key?(:limit)
|
|
312
|
+
query_params[:throttleInterval] = params[:throttleInterval] if params.has_key?(:throttleInterval)
|
|
313
|
+
query_params[:delete] = params[:delete] if params.has_key?(:delete)
|
|
314
|
+
|
|
315
|
+
path = "/domains/#{params[:domain]}/stream"
|
|
316
|
+
|
|
317
|
+
uri = URI.parse(@client.url + path)
|
|
318
|
+
query = Utils.fix_query_arrays(query_params)
|
|
319
|
+
uri.query = URI.encode_www_form(query) unless query.nil? || query.empty?
|
|
320
|
+
|
|
321
|
+
headers["Accept"] = "application/json"
|
|
322
|
+
headers["Content-Type"] = "application/json"
|
|
323
|
+
headers["User-Agent"] = "Mailinator SDK - Ruby V#{MailinatorClient::VERSION}"
|
|
324
|
+
headers["Authorization"] = @client.auth_token if @client.auth_token
|
|
325
|
+
|
|
326
|
+
response_body = +""
|
|
327
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
328
|
+
http.use_ssl = uri.scheme == "https"
|
|
329
|
+
http.read_timeout = 20
|
|
330
|
+
|
|
331
|
+
request = Net::HTTP::Get.new(uri)
|
|
332
|
+
headers.each { |key, value| request[key] = value }
|
|
333
|
+
|
|
334
|
+
http.request(request) do |response|
|
|
335
|
+
if response.code.to_i >= 400
|
|
336
|
+
raise ResponseError.new(response.code.to_i, nil, response.body)
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
catch(:done) do
|
|
340
|
+
response.read_body do |chunk|
|
|
341
|
+
response_body << chunk
|
|
342
|
+
if response_body.include?("\n\n") || response_body.include?("}\n") || response_body.strip.end_with?("}")
|
|
343
|
+
throw :done
|
|
344
|
+
end
|
|
345
|
+
end
|
|
346
|
+
end
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
payload = response_body.strip
|
|
350
|
+
if payload.start_with?("data:")
|
|
351
|
+
payload_line = payload.lines.find { |line| line.start_with?("data:") }
|
|
352
|
+
payload = payload_line.to_s.sub(/^data:\\s*/, "").strip
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
parsed = begin
|
|
356
|
+
JSON.parse(payload)
|
|
357
|
+
rescue JSON::ParserError
|
|
358
|
+
cleaned = payload.encode("UTF-8", invalid: :replace, undef: :replace, replace: "")
|
|
359
|
+
candidate = cleaned
|
|
360
|
+
if candidate.include?("data:")
|
|
361
|
+
data_line = candidate.lines.find { |line| line.start_with?("data:") }
|
|
362
|
+
candidate = data_line.to_s.sub(/^data:\s*/, "")
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
in_string = false
|
|
366
|
+
escape = false
|
|
367
|
+
depth = 0
|
|
368
|
+
start_idx = nil
|
|
369
|
+
end_idx = nil
|
|
370
|
+
|
|
371
|
+
candidate.each_char.with_index do |ch, idx|
|
|
372
|
+
if start_idx.nil?
|
|
373
|
+
if ch == "{"
|
|
374
|
+
start_idx = idx
|
|
375
|
+
depth = 1
|
|
376
|
+
end
|
|
377
|
+
next
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
if in_string
|
|
381
|
+
if escape
|
|
382
|
+
escape = false
|
|
383
|
+
elsif ch == "\\"
|
|
384
|
+
escape = true
|
|
385
|
+
elsif ch == "\""
|
|
386
|
+
in_string = false
|
|
387
|
+
end
|
|
388
|
+
else
|
|
389
|
+
case ch
|
|
390
|
+
when "\""
|
|
391
|
+
in_string = true
|
|
392
|
+
when "{"
|
|
393
|
+
depth += 1
|
|
394
|
+
when "}"
|
|
395
|
+
depth -= 1
|
|
396
|
+
if depth == 0
|
|
397
|
+
end_idx = idx
|
|
398
|
+
break
|
|
399
|
+
end
|
|
400
|
+
end
|
|
401
|
+
end
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
if start_idx && end_idx && end_idx >= start_idx
|
|
405
|
+
JSON.parse(candidate[start_idx..end_idx])
|
|
406
|
+
end
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
raise ResponseError.new(500, nil, payload) if parsed.nil?
|
|
410
|
+
|
|
411
|
+
return parsed if parsed.is_a?(Hash) && parsed.key?("domain") && parsed.key?("msgs")
|
|
412
|
+
return { "domain" => parsed["domain"], "to" => parsed["to"], "msgs" => [parsed] } if parsed.is_a?(Hash)
|
|
413
|
+
parsed
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
# Streams all messages from an inbox.
|
|
417
|
+
#
|
|
418
|
+
# Authentication:
|
|
419
|
+
# The client must be configured with a valid api
|
|
420
|
+
# access token to call this action.
|
|
421
|
+
#
|
|
422
|
+
# Parameters:
|
|
423
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
424
|
+
# * {string} inbox - The Inbox name
|
|
425
|
+
# * {boolean} full - [Optional] Return full email content with body/attachments (true) or just metadata (false). Default: false
|
|
426
|
+
# * {number} limit - [Optional] Number of messages to fetch
|
|
427
|
+
# * {number} throttleInterval - [Optional] Throttle interval in milliseconds
|
|
428
|
+
# * {string} delete - [Optional] Auto-delete message after retrieval (e.g., "10s" = 10 seconds, "5m" = 5 minutes)
|
|
429
|
+
#
|
|
430
|
+
# Responses:
|
|
431
|
+
# * Message stream response
|
|
432
|
+
def stream_inbox_messages(params = {})
|
|
433
|
+
params = Utils.symbolize_hash_keys(params)
|
|
434
|
+
query_params = { }
|
|
435
|
+
headers = {}
|
|
436
|
+
body = nil
|
|
437
|
+
|
|
438
|
+
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
|
439
|
+
raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
|
|
440
|
+
|
|
441
|
+
query_params[:full] = params[:full] if params.has_key?(:full)
|
|
442
|
+
query_params[:limit] = params[:limit] if params.has_key?(:limit)
|
|
443
|
+
query_params[:throttleInterval] = params[:throttleInterval] if params.has_key?(:throttleInterval)
|
|
444
|
+
query_params[:delete] = params[:delete] if params.has_key?(:delete)
|
|
445
|
+
|
|
446
|
+
path = "/domains/#{params[:domain]}/stream/#{params[:inbox]}"
|
|
447
|
+
|
|
448
|
+
uri = URI.parse(@client.url + path)
|
|
449
|
+
query = Utils.fix_query_arrays(query_params)
|
|
450
|
+
uri.query = URI.encode_www_form(query) unless query.nil? || query.empty?
|
|
451
|
+
|
|
452
|
+
headers["Accept"] = "application/json"
|
|
453
|
+
headers["Content-Type"] = "application/json"
|
|
454
|
+
headers["User-Agent"] = "Mailinator SDK - Ruby V#{MailinatorClient::VERSION}"
|
|
455
|
+
headers["Authorization"] = @client.auth_token if @client.auth_token
|
|
456
|
+
|
|
457
|
+
response_body = +""
|
|
458
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
459
|
+
http.use_ssl = uri.scheme == "https"
|
|
460
|
+
http.read_timeout = 20
|
|
461
|
+
|
|
462
|
+
request = Net::HTTP::Get.new(uri)
|
|
463
|
+
headers.each { |key, value| request[key] = value }
|
|
464
|
+
|
|
465
|
+
http.request(request) do |response|
|
|
466
|
+
if response.code.to_i >= 400
|
|
467
|
+
raise ResponseError.new(response.code.to_i, nil, response.body)
|
|
468
|
+
end
|
|
469
|
+
|
|
470
|
+
catch(:done) do
|
|
471
|
+
response.read_body do |chunk|
|
|
472
|
+
response_body << chunk
|
|
473
|
+
if response_body.include?("\n\n") || response_body.include?("}\n") || response_body.strip.end_with?("}")
|
|
474
|
+
throw :done
|
|
475
|
+
end
|
|
476
|
+
end
|
|
477
|
+
end
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
payload = response_body.strip
|
|
481
|
+
if payload.start_with?("data:")
|
|
482
|
+
payload_line = payload.lines.find { |line| line.start_with?("data:") }
|
|
483
|
+
payload = payload_line.to_s.sub(/^data:\\s*/, "").strip
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
parsed = begin
|
|
487
|
+
JSON.parse(payload)
|
|
488
|
+
rescue JSON::ParserError
|
|
489
|
+
cleaned = payload.encode("UTF-8", invalid: :replace, undef: :replace, replace: "")
|
|
490
|
+
candidate = cleaned
|
|
491
|
+
if candidate.include?("data:")
|
|
492
|
+
data_line = candidate.lines.find { |line| line.start_with?("data:") }
|
|
493
|
+
candidate = data_line.to_s.sub(/^data:\s*/, "")
|
|
494
|
+
end
|
|
495
|
+
|
|
496
|
+
in_string = false
|
|
497
|
+
escape = false
|
|
498
|
+
depth = 0
|
|
499
|
+
start_idx = nil
|
|
500
|
+
end_idx = nil
|
|
501
|
+
|
|
502
|
+
candidate.each_char.with_index do |ch, idx|
|
|
503
|
+
if start_idx.nil?
|
|
504
|
+
if ch == "{"
|
|
505
|
+
start_idx = idx
|
|
506
|
+
depth = 1
|
|
507
|
+
end
|
|
508
|
+
next
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
if in_string
|
|
512
|
+
if escape
|
|
513
|
+
escape = false
|
|
514
|
+
elsif ch == "\\"
|
|
515
|
+
escape = true
|
|
516
|
+
elsif ch == "\""
|
|
517
|
+
in_string = false
|
|
518
|
+
end
|
|
519
|
+
else
|
|
520
|
+
case ch
|
|
521
|
+
when "\""
|
|
522
|
+
in_string = true
|
|
523
|
+
when "{"
|
|
524
|
+
depth += 1
|
|
525
|
+
when "}"
|
|
526
|
+
depth -= 1
|
|
527
|
+
if depth == 0
|
|
528
|
+
end_idx = idx
|
|
529
|
+
break
|
|
530
|
+
end
|
|
531
|
+
end
|
|
532
|
+
end
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
if start_idx && end_idx && end_idx >= start_idx
|
|
536
|
+
JSON.parse(candidate[start_idx..end_idx])
|
|
537
|
+
end
|
|
538
|
+
end
|
|
539
|
+
|
|
540
|
+
raise ResponseError.new(500, nil, payload) if parsed.nil?
|
|
541
|
+
|
|
542
|
+
return parsed if parsed.is_a?(Hash) && parsed.key?("domain") && parsed.key?("msgs")
|
|
543
|
+
return { "domain" => parsed["domain"], "to" => parsed["to"], "msgs" => [parsed] } if parsed.is_a?(Hash)
|
|
544
|
+
parsed
|
|
545
|
+
end
|
|
546
|
+
|
|
130
547
|
# Retrieves a specific SMS message by sms number.
|
|
131
548
|
#
|
|
132
549
|
# Authentication:
|
|
@@ -134,7 +551,7 @@ module MailinatorClient
|
|
|
134
551
|
# access token to call this action.
|
|
135
552
|
#
|
|
136
553
|
# Parameters:
|
|
137
|
-
# * {string} domainId - The Domain name or
|
|
554
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
138
555
|
# * {string} teamSmsNumber - The Team sms number
|
|
139
556
|
# * {number} skip - [Optional] Skip this many emails in your Private Domain
|
|
140
557
|
# * {number} limit - [Optional] Number of emails to fetch from your Private Domain
|
|
@@ -183,7 +600,7 @@ module MailinatorClient
|
|
|
183
600
|
# access token to call this action.
|
|
184
601
|
#
|
|
185
602
|
# Parameters:
|
|
186
|
-
# * {string} domainId - The Domain name or
|
|
603
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
187
604
|
# * {string} inbox - The Inbox name
|
|
188
605
|
# * {string} messageId - The Message id
|
|
189
606
|
#
|
|
@@ -216,7 +633,7 @@ module MailinatorClient
|
|
|
216
633
|
# access token to call this action.
|
|
217
634
|
#
|
|
218
635
|
# Parameters:
|
|
219
|
-
# * {string} domainId - The Domain name or
|
|
636
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
220
637
|
# * {string} messageId - The Message id
|
|
221
638
|
#
|
|
222
639
|
# Responses:
|
|
@@ -247,7 +664,7 @@ module MailinatorClient
|
|
|
247
664
|
# access token to call this action.
|
|
248
665
|
#
|
|
249
666
|
# Parameters:
|
|
250
|
-
# * {string} domainId - The Domain name or
|
|
667
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
251
668
|
# * {string} inbox - The Inbox name
|
|
252
669
|
# * {string} messageId - The Message id
|
|
253
670
|
# * {string} attachmentId - The Attachment id
|
|
@@ -282,7 +699,7 @@ module MailinatorClient
|
|
|
282
699
|
# access token to call this action.
|
|
283
700
|
#
|
|
284
701
|
# Parameters:
|
|
285
|
-
# * {string} domainId - The Domain name or
|
|
702
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
286
703
|
# * {string} messageId - The Message id
|
|
287
704
|
# * {string} attachmentId - The Attachment id
|
|
288
705
|
#
|
|
@@ -315,7 +732,7 @@ module MailinatorClient
|
|
|
315
732
|
# access token to call this action.
|
|
316
733
|
#
|
|
317
734
|
# Parameters:
|
|
318
|
-
# * {string} domainId - The Domain name or
|
|
735
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
319
736
|
# * {string} messageId - The Message id
|
|
320
737
|
#
|
|
321
738
|
# Responses:
|
|
@@ -346,7 +763,7 @@ module MailinatorClient
|
|
|
346
763
|
# access token to call this action.
|
|
347
764
|
#
|
|
348
765
|
# Parameters:
|
|
349
|
-
# * {string} domainId - The Domain name or
|
|
766
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
350
767
|
# * {string} messageId - The Message id
|
|
351
768
|
#
|
|
352
769
|
# Responses:
|
|
@@ -377,7 +794,7 @@ module MailinatorClient
|
|
|
377
794
|
# access token to call this action.
|
|
378
795
|
#
|
|
379
796
|
# Parameters:
|
|
380
|
-
# * {string} domainId - The Domain name or
|
|
797
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
381
798
|
# * {string} inbox - The Inbox name
|
|
382
799
|
# * {string} messageId - The Message id
|
|
383
800
|
#
|
|
@@ -410,7 +827,7 @@ module MailinatorClient
|
|
|
410
827
|
# access token to call this action.
|
|
411
828
|
#
|
|
412
829
|
# Parameters:
|
|
413
|
-
# * {string} domainId - The Domain name or
|
|
830
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
414
831
|
#
|
|
415
832
|
# Responses:
|
|
416
833
|
# * Status and count of removed messages (https://manybrain.github.io/m8rdocs/#delete-all-messages-by-domain)
|
|
@@ -439,7 +856,7 @@ module MailinatorClient
|
|
|
439
856
|
# access token to call this action.
|
|
440
857
|
#
|
|
441
858
|
# Parameters:
|
|
442
|
-
# * {string} domainId - The Domain name or
|
|
859
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
443
860
|
# * {string} inbox - The Inbox name
|
|
444
861
|
#
|
|
445
862
|
# Responses:
|
|
@@ -470,7 +887,7 @@ module MailinatorClient
|
|
|
470
887
|
# access token to call this action.
|
|
471
888
|
#
|
|
472
889
|
# Parameters:
|
|
473
|
-
# * {string} domainId - The Domain name or
|
|
890
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
474
891
|
# * {string} inbox - The Inbox name
|
|
475
892
|
# * {string} messageId - The Message id
|
|
476
893
|
#
|
|
@@ -503,7 +920,7 @@ module MailinatorClient
|
|
|
503
920
|
# access token to call this action.
|
|
504
921
|
#
|
|
505
922
|
# Parameters:
|
|
506
|
-
# * {string} domainId - The Domain name or
|
|
923
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
507
924
|
# * {string} inbox - The Inbox name
|
|
508
925
|
# * {string} messageToPost - The Message object (https://manybrain.github.io/m8rdocs/#inject-a-message-http-post-messages)
|
|
509
926
|
#
|
|
@@ -538,7 +955,7 @@ module MailinatorClient
|
|
|
538
955
|
# access token to call this action.
|
|
539
956
|
#
|
|
540
957
|
# Parameters:
|
|
541
|
-
# * {string} domainId - The Domain name or
|
|
958
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
542
959
|
# * {string} messageId - The Message id
|
|
543
960
|
#
|
|
544
961
|
# Responses:
|
|
@@ -569,7 +986,7 @@ module MailinatorClient
|
|
|
569
986
|
# access token to call this action.
|
|
570
987
|
#
|
|
571
988
|
# Parameters:
|
|
572
|
-
# * {string} domainId - The Domain name or
|
|
989
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
573
990
|
# * {string} inbox - The Inbox name
|
|
574
991
|
# * {string} messageId - The Message id
|
|
575
992
|
#
|
|
@@ -602,7 +1019,7 @@ module MailinatorClient
|
|
|
602
1019
|
# access token to call this action.
|
|
603
1020
|
#
|
|
604
1021
|
# Parameters:
|
|
605
|
-
# * {string} domainId - The Domain name or
|
|
1022
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
606
1023
|
# * {string} messageId - The Message id
|
|
607
1024
|
#
|
|
608
1025
|
# Responses:
|
|
@@ -633,7 +1050,7 @@ module MailinatorClient
|
|
|
633
1050
|
# access token to call this action.
|
|
634
1051
|
#
|
|
635
1052
|
# Parameters:
|
|
636
|
-
# * {string} domainId - The Domain name or
|
|
1053
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
637
1054
|
# * {string} inbox - The Inbox name
|
|
638
1055
|
# * {string} messageId - The Message id
|
|
639
1056
|
#
|
|
@@ -666,7 +1083,7 @@ module MailinatorClient
|
|
|
666
1083
|
# access token to call this action.
|
|
667
1084
|
#
|
|
668
1085
|
# Parameters:
|
|
669
|
-
# * {string} domainId - The Domain name or
|
|
1086
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
670
1087
|
#
|
|
671
1088
|
# Responses:
|
|
672
1089
|
# * Collection of latest messages (https://manybrain.github.io/m8rdocs/#fetch-latest-messages)
|
|
@@ -695,7 +1112,7 @@ module MailinatorClient
|
|
|
695
1112
|
# access token to call this action.
|
|
696
1113
|
#
|
|
697
1114
|
# Parameters:
|
|
698
|
-
# * {string} domainId - The Domain name or
|
|
1115
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
699
1116
|
# * {string} inbox - The Inbox name
|
|
700
1117
|
#
|
|
701
1118
|
# Responses:
|
|
@@ -17,7 +17,7 @@ module MailinatorClient
|
|
|
17
17
|
# access token to call this action.
|
|
18
18
|
#
|
|
19
19
|
# Parameters:
|
|
20
|
-
# * {string} domainId - The Domain name or
|
|
20
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
21
21
|
# * {string} ruleToPost - The Rule object (https://manybrain.github.io/m8rdocs/#create-rule)
|
|
22
22
|
#
|
|
23
23
|
# Responses:
|
|
@@ -51,7 +51,7 @@ module MailinatorClient
|
|
|
51
51
|
# access token to call this action.
|
|
52
52
|
#
|
|
53
53
|
# Parameters:
|
|
54
|
-
# * {string} domainId - The Domain name or
|
|
54
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
55
55
|
# * {string} ruleId - The Rule id
|
|
56
56
|
#
|
|
57
57
|
# Responses:
|
|
@@ -83,7 +83,7 @@ module MailinatorClient
|
|
|
83
83
|
# access token to call this action.
|
|
84
84
|
#
|
|
85
85
|
# Parameters:
|
|
86
|
-
# * {string} domainId - The Domain name or
|
|
86
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
87
87
|
# * {string} ruleId - The Rule id
|
|
88
88
|
#
|
|
89
89
|
# Responses:
|
|
@@ -115,7 +115,7 @@ module MailinatorClient
|
|
|
115
115
|
# access token to call this action.
|
|
116
116
|
#
|
|
117
117
|
# Parameters:
|
|
118
|
-
# * {string} domainId - The Domain name or
|
|
118
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
119
119
|
#
|
|
120
120
|
# Responses:
|
|
121
121
|
# * Collection of rules (https://manybrain.github.io/m8rdocs/#get-all-rules)
|
|
@@ -145,7 +145,7 @@ module MailinatorClient
|
|
|
145
145
|
# access token to call this action.
|
|
146
146
|
#
|
|
147
147
|
# Parameters:
|
|
148
|
-
# * {string} domainId - The Domain name or
|
|
148
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
149
149
|
# * {string} ruleId - The Domain name or the Rule id
|
|
150
150
|
#
|
|
151
151
|
# Responses:
|
|
@@ -177,7 +177,7 @@ module MailinatorClient
|
|
|
177
177
|
# access token to call this action.
|
|
178
178
|
#
|
|
179
179
|
# Parameters:
|
|
180
|
-
# * {string} domainId - The Domain name or
|
|
180
|
+
# * {string} domainId - The Domain name or simply 'private'
|
|
181
181
|
# * {string} ruleId - The Rule id
|
|
182
182
|
#
|
|
183
183
|
# Responses:
|