mailinator_client 1.0.5 → 1.0.7

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.
@@ -1,25 +1,3 @@
1
- # The MIT License (MIT)
2
- #
3
- # Copyright (c) 2024 Manybrain, Inc.
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
1
  require "json"
24
2
 
25
3
  module MailinatorClient
@@ -83,7 +61,8 @@ module MailinatorClient
83
61
  body: body)
84
62
  end
85
63
 
86
- # This endpoint creates a private domain attached to your account.
64
+ # @deprecated Create Domain is deprecated in this client.
65
+ # This endpoint creates a private domain attached to your account.
87
66
  # Note, the domain must be unique to the system and you must have not reached your maximum number of Private Domains.
88
67
  #
89
68
  # Authentication:
@@ -113,6 +92,7 @@ module MailinatorClient
113
92
  body: body)
114
93
  end
115
94
 
95
+ # @deprecated Delete Domain is deprecated in this client.
116
96
  # This endpoint deletes a Private Domain
117
97
  #
118
98
  # Authentication:
@@ -1,34 +1,20 @@
1
- # The MIT License (MIT)
2
- #
3
- # Copyright (c) 2024 Manybrain, Inc.
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
1
  module MailinatorClient
24
2
  class ResponseError < StandardError
25
3
  attr_reader :code
26
4
  attr_reader :type
27
5
 
28
- def initialize(code, result)
6
+ def initialize(code, result = nil, raw_body = nil)
7
+ result_hash = result.is_a?(Hash) ? result : {}
29
8
  @code = code
30
- @type = result["type"]
31
- super(result["message"])
9
+ @type = result_hash["type"] || result_hash[:type]
10
+
11
+ message = result_hash["message"] || result_hash[:message]
12
+ if (message.nil? || message.to_s.empty?) && !raw_body.nil?
13
+ message = raw_body.to_s.strip
14
+ end
15
+ message = "HTTP #{code}" if message.nil? || message.to_s.empty?
16
+
17
+ super(message)
32
18
  end
33
19
  end
34
20
  end
@@ -1,25 +1,3 @@
1
- # The MIT License (MIT)
2
- #
3
- # Copyright (c) 2024 Manybrain, Inc.
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
1
  require "json"
24
2
 
25
3
  module MailinatorClient
@@ -40,10 +18,14 @@ module MailinatorClient
40
18
  # Parameters:
41
19
  # * {string} domainId - The Domain name or the Domain id
42
20
  # * {string} inbox - The Inbox name
43
- # * {number} skip - Skip this many emails in your Private Domain
44
- # * {number} limit - Number of emails to fetch from your Private Domain
45
- # * {string} sort - Sort results by ascending or descending
46
- # * {boolean} decodeSubject - true: decode encoded subjects
21
+ # * {number} skip - [Optional] Skip this many emails in your Private Domain
22
+ # * {number} limit - [Optional] Number of emails to fetch from your Private Domain
23
+ # * {string} sort - [Optional] Sort results by ascending or descending
24
+ # * {boolean} decodeSubject - [Optional] true: decode encoded subjects
25
+ # * {string} cursor - [Optional] Pagination cursor for large result sets (obtained from previous response)
26
+ # * {boolean} full - [Optional] Return full email content with body/attachments (true) or just metadata (false). Default: false
27
+ # * {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)
47
29
  #
48
30
  # Responses:
49
31
  # * Collection of messages (https://manybrain.github.io/m8rdocs/#fetch-inbox-aka-fetch-message-summaries)
@@ -60,6 +42,10 @@ module MailinatorClient
60
42
  query_params[:limit] = params[:limit] if params.has_key?(:limit)
61
43
  query_params[:sort] = params[:sort] if params.has_key?(:sort)
62
44
  query_params[:decodeSubject] = params[:decodeSubject] if params.has_key?(:decodeSubject)
45
+ query_params[:cursor] = params[:cursor] if params.has_key?(:cursor)
46
+ query_params[:full] = params[:full] if params.has_key?(:full)
47
+ query_params[:delete] = params[:delete] if params.has_key?(:delete)
48
+ query_params[:wait] = params[:wait] if params.has_key?(:wait)
63
49
 
64
50
  path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}"
65
51
 
@@ -81,6 +67,7 @@ module MailinatorClient
81
67
  # * {string} domainId - The Domain name or the Domain id
82
68
  # * {string} inbox - The Inbox name
83
69
  # * {string} messageId - The Message id
70
+ # * {string} delete - [Optional] Auto-delete message after retrieval (e.g., "10s" = 10 seconds, "5m" = 5 minutes)
84
71
  #
85
72
  # Responses:
86
73
  # * Message (https://manybrain.github.io/m8rdocs/#fetch-inbox-message)
@@ -94,6 +81,8 @@ module MailinatorClient
94
81
  raise ArgumentError.new("inbox is required") unless params.has_key?(:inbox)
95
82
  raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
96
83
 
84
+ query_params[:delete] = params[:delete] if params.has_key?(:delete)
85
+
97
86
  path = "/domains/#{params[:domain]}/inboxes/#{params[:inbox]}/messages/#{params[:messageId]}"
98
87
 
99
88
  @client.request(
@@ -113,6 +102,7 @@ module MailinatorClient
113
102
  # Parameters:
114
103
  # * {string} domainId - The Domain name or the Domain id
115
104
  # * {string} messageId - The Message id
105
+ # * {string} delete - [Optional] Auto-delete message after retrieval (e.g., "10s" = 10 seconds, "5m" = 5 minutes)
116
106
  #
117
107
  # Responses:
118
108
  # * Message (https://manybrain.github.io/m8rdocs/#fetch-message)
@@ -125,6 +115,8 @@ module MailinatorClient
125
115
  raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
126
116
  raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
127
117
 
118
+ query_params[:delete] = params[:delete] if params.has_key?(:delete)
119
+
128
120
  path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}"
129
121
 
130
122
  @client.request(
@@ -144,18 +136,36 @@ module MailinatorClient
144
136
  # Parameters:
145
137
  # * {string} domainId - The Domain name or the Domain id
146
138
  # * {string} teamSmsNumber - The Team sms number
139
+ # * {number} skip - [Optional] Skip this many emails in your Private Domain
140
+ # * {number} limit - [Optional] Number of emails to fetch from your Private Domain
141
+ # * {string} sort - [Optional] Sort results by ascending or descending
142
+ # * {boolean} decode_subject - [Optional] true: decode encoded subjects
143
+ # * {string} cursor - [Optional] Pagination cursor for large result sets (obtained from previous response)
144
+ # * {boolean} full - [Optional] Return full email content with body/attachments (true) or just metadata (false). Default: false
145
+ # * {string} delete - [Optional] Auto-delete message after retrieval (e.g., "10s" = 10 seconds, "5m" = 5 minutes)
146
+ # * {string} wait - [Optional] Maximum time to wait for new messages (e.g., "30s" = 30 seconds)
147
147
  #
148
148
  # Responses:
149
149
  # * Collection of messages (https://manybrain.github.io/m8rdocs/#fetch-an-sms-messages)
150
150
  def fetch_sms_message(params = {})
151
151
  params = Utils.symbolize_hash_keys(params)
152
- query_params = { }
152
+ query_params = { skip: 0, limit: 50, sort: "ascending", decode_subject: false }
153
153
  headers = {}
154
154
  body = nil
155
155
 
156
156
  raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
157
157
  raise ArgumentError.new("team sms number is required") unless params.has_key?(:teamSmsNumber)
158
158
 
159
+ query_params[:skip] = params[:skip] if params.has_key?(:skip)
160
+ query_params[:limit] = params[:limit] if params.has_key?(:limit)
161
+ query_params[:sort] = params[:sort] if params.has_key?(:sort)
162
+ query_params[:decode_subject] = params[:decode_subject] if params.has_key?(:decode_subject)
163
+ query_params[:decode_subject] = params[:decodeSubject] if params.has_key?(:decodeSubject)
164
+ query_params[:cursor] = params[:cursor] if params.has_key?(:cursor)
165
+ query_params[:full] = params[:full] if params.has_key?(:full)
166
+ query_params[:delete] = params[:delete] if params.has_key?(:delete)
167
+ query_params[:wait] = params[:wait] if params.has_key?(:wait)
168
+
159
169
  path = "/domains/#{params[:domain]}/inboxes/#{params[:teamSmsNumber]}"
160
170
 
161
171
  @client.request(
@@ -298,6 +308,37 @@ module MailinatorClient
298
308
  body: body)
299
309
  end
300
310
 
311
+ # Retrieves all links full info found within a given email.
312
+ #
313
+ # Authentication:
314
+ # The client must be configured with a valid api
315
+ # access token to call this action.
316
+ #
317
+ # Parameters:
318
+ # * {string} domainId - The Domain name or the Domain id
319
+ # * {string} messageId - The Message id
320
+ #
321
+ # Responses:
322
+ # * Collection of links full (https://manybrain.github.io/m8rdocs/#fetch-links-full)
323
+ def fetch_message_links_full(params = {})
324
+ params = Utils.symbolize_hash_keys(params)
325
+ query_params = { }
326
+ headers = {}
327
+ body = nil
328
+
329
+ raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
330
+ raise ArgumentError.new("message id is required") unless params.has_key?(:messageId)
331
+
332
+ path = "/domains/#{params[:domain]}/messages/#{params[:messageId]}/linksfull"
333
+
334
+ @client.request(
335
+ method: :get,
336
+ path: path,
337
+ query: query_params,
338
+ headers: headers,
339
+ body: body)
340
+ end
341
+
301
342
  # Retrieves all links found within a given email.
302
343
  #
303
344
  # Authentication:
@@ -1,25 +1,3 @@
1
- # The MIT License (MIT)
2
- #
3
- # Copyright (c) 2024 Manybrain, Inc.
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
1
  require "json"
24
2
 
25
3
  module MailinatorClient
@@ -31,6 +9,7 @@ module MailinatorClient
31
9
  @client = client
32
10
  end
33
11
 
12
+ # @deprecated Rules endpoints are deprecated in this client.
34
13
  # Creates a Rule. Note that in the examples, ":domain_id" can be one of your private domains.
35
14
  #
36
15
  # Authentication:
@@ -64,6 +43,7 @@ module MailinatorClient
64
43
  body: body)
65
44
  end
66
45
 
46
+ # @deprecated Rules endpoints are deprecated in this client.
67
47
  # Enables an existing Rule
68
48
  #
69
49
  # Authentication:
@@ -95,6 +75,7 @@ module MailinatorClient
95
75
  body: body)
96
76
  end
97
77
 
78
+ # @deprecated Rules endpoints are deprecated in this client.
98
79
  # Disables an existing Rule
99
80
  #
100
81
  # Authentication:
@@ -126,6 +107,7 @@ module MailinatorClient
126
107
  body: body)
127
108
  end
128
109
 
110
+ # @deprecated Rules endpoints are deprecated in this client.
129
111
  # Fetches all Rules for a Domain.
130
112
  #
131
113
  # Authentication:
@@ -155,6 +137,7 @@ module MailinatorClient
155
137
  body: body)
156
138
  end
157
139
 
140
+ # @deprecated Rules endpoints are deprecated in this client.
158
141
  # Fetches a specific rule for a Domain.
159
142
  #
160
143
  # Authentication:
@@ -186,6 +169,7 @@ module MailinatorClient
186
169
  body: body)
187
170
  end
188
171
 
172
+ # @deprecated Rules endpoints are deprecated in this client.
189
173
  # Deletes a specific rule for a Domain.
190
174
  #
191
175
  # Authentication:
@@ -1,25 +1,3 @@
1
- # The MIT License (MIT)
2
- #
3
- # Copyright (c) 2024 Manybrain, Inc.
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
1
  require "json"
24
2
 
25
3
  module MailinatorClient
@@ -31,6 +9,29 @@ module MailinatorClient
31
9
  @client = client
32
10
  end
33
11
 
12
+ # Retrieves info of team
13
+ #
14
+ # Authentication:
15
+ # The client must be configured with a valid api
16
+ # access token to call this action.
17
+ #
18
+ # Responses:
19
+ # * Collection of team info (https://manybrain.github.io/m8rdocs/#stats-api)
20
+ def get_team_info()
21
+ query_params = { }
22
+ headers = {}
23
+ body = nil
24
+
25
+ path = "/teaminfo"
26
+
27
+ @client.request(
28
+ method: :get,
29
+ path: path,
30
+ query: query_params,
31
+ headers: headers,
32
+ body: body)
33
+ end
34
+
34
35
  # Retrieves stats of team
35
36
  #
36
37
  # Authentication:
@@ -38,7 +39,7 @@ module MailinatorClient
38
39
  # access token to call this action.
39
40
  #
40
41
  # Responses:
41
- # * Collection of team stats (https://manybrain.github.io/m8rdocs/#get-all-domains)
42
+ # * Collection of team stats (https://manybrain.github.io/m8rdocs/#stats-api)
42
43
  def get_team_stats()
43
44
  query_params = { }
44
45
  headers = {}
@@ -54,14 +55,14 @@ module MailinatorClient
54
55
  body: body)
55
56
  end
56
57
 
57
- # Retrieves team info
58
+ # Retrieves team stats
58
59
  #
59
60
  # Authentication:
60
61
  # The client must be configured with a valid api
61
62
  # access token to call this action.
62
63
  #
63
64
  # Responses:
64
- # * Team info (https://manybrain.github.io/m8rdocs/#stats-api)
65
+ # * Team stats (https://manybrain.github.io/m8rdocs/#stats-api)
65
66
  def get_team(params = {})
66
67
  params = Utils.symbolize_hash_keys(params)
67
68
  query_params = { }
@@ -1,25 +1,3 @@
1
- # The MIT License (MIT)
2
- #
3
- # Copyright (c) 2024 Manybrain, Inc.
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
1
  module MailinatorClient
24
2
  class Utils
25
3
  def self.symbolize_hash_keys(hash)
@@ -1,25 +1,3 @@
1
- # The MIT License (MIT)
2
- #
3
- # Copyright (c) 2024 Manybrain, Inc.
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
- module MailinatorClient
24
- VERSION = "1.0.5"
25
- end
1
+ module MailinatorClient
2
+ VERSION = "1.0.7"
3
+ end