mailosaur 7.3.2 → 7.4.0

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: 056e993a519633fcca85156531e4eb18cc1643fa230d7f15f6239794b5529f97
4
- data.tar.gz: de2d43526a0512c7f92882fa5b23ca0d462852f7b2123ada28e34c42b0ad6b9b
3
+ metadata.gz: '0629407acde130c71828a35283ecc427f73881193164f236a970d6226fe4ed7d'
4
+ data.tar.gz: 66d6af0d7d7bd39d52f61c87c80acbf4524e2324c5ffe0c264397d8c99e4cdd0
5
5
  SHA512:
6
- metadata.gz: f10d8c30b5b44f8a1fa19e2305599f8d5c48ab1e00e1c903cf4380d992e4c892b6a5e7637fe09b86016023545d70c357d5603802cdb6fb8e2169051f4ffa3e6d
7
- data.tar.gz: b1a02d600af6526d11fffae86c94ea78c768a073489d3be996f803c943ba6f5a6223240933f2a6db07884fba239b633f95f87784b2d3ddb447c34b4a508805be
6
+ metadata.gz: 1754ac94d3a1566bf813e9adc6012ca42fa7be204dab7d733a2ae8bcc8d14b44a947f18a2795212ad49fd09406ebc3ba93c4cbc77b0ef57ecbf8c4f303cf4ea1
7
+ data.tar.gz: 511648f014115e7ab22f8cf2893ff87264a7355b8dddf193655c992b742ff48a30cc69d57f8ca44589e45e246fb6566cb17a503714fc9c30c013e712127a0817
@@ -170,5 +170,61 @@ module Mailosaur
170
170
  sleep(delay / 1000)
171
171
  end
172
172
  end
173
+
174
+ #
175
+ # Create a message.
176
+ #
177
+ # Creates a new message that can be sent to a verified email address. This is
178
+ # useful in scenarios where you want an email to trigger a workflow in your
179
+ # product
180
+ #
181
+ # @param server [String] The identifier of the server to create the message in.
182
+ # @param options [MessageCreateOptions] The options with which to create the message.
183
+ #
184
+ # @return [Message] operation result.
185
+ #
186
+ def create(server, message_create_options)
187
+ response = conn.post 'api/messages?server=' + server, message_create_options.to_json
188
+ @handle_http_error.call(response) unless response.status == 200
189
+ model = JSON.load(response.body)
190
+ Mailosaur::Models::Message.new(model)
191
+ end
192
+
193
+ #
194
+ # Forward an email.
195
+ #
196
+ # Forwards the specified email to a verified email address.
197
+ #
198
+ # @param id [String] The identifier of the email to forward.
199
+ # @param options [MessageForwardOptions] The options with which to forward the email.
200
+ # against.
201
+ #
202
+ # @return [Message] operation result.
203
+ #
204
+ def forward(id, message_forward_options)
205
+ response = conn.post 'api/messages/' + id + '/forward', message_forward_options.to_json
206
+ @handle_http_error.call(response) unless response.status == 200
207
+ model = JSON.load(response.body)
208
+ Mailosaur::Models::Message.new(model)
209
+ end
210
+
211
+ #
212
+ # Reply to an email.
213
+ #
214
+ # Sends a reply to the specified email. This is useful for when simulating a user
215
+ # replying to one of your emails.
216
+ #
217
+ # @param id [String] The identifier of the email to reply to.
218
+ # @param options [MessageReplyOptions] The options with which to reply to the email.
219
+ # against.
220
+ #
221
+ # @return [Message] operation result.
222
+ #
223
+ def reply(id, message_reply_options)
224
+ response = conn.post 'api/messages/' + id + '/reply', message_reply_options.to_json
225
+ @handle_http_error.call(response) unless response.status == 200
226
+ model = JSON.load(response.body)
227
+ Mailosaur::Models::Message.new(model)
228
+ end
173
229
  end
174
230
  end
@@ -0,0 +1,31 @@
1
+ module Mailosaur
2
+ module Models
3
+ class MessageCreateOptions < BaseModel
4
+ def initialize(data = {})
5
+ @to = data['to']
6
+ @send = data['send']
7
+ @subject = data['subject']
8
+ @text = data['text']
9
+ @html = data['html']
10
+ end
11
+
12
+ # @return [String] The email address to which the email will be sent.
13
+ # Must be a verified email address.
14
+ attr_accessor :to
15
+
16
+ # @return [Boolean] If true, email will be sent upon creation.
17
+ attr_accessor :send
18
+
19
+ # @return [String] The email subject line.
20
+ attr_accessor :subject
21
+
22
+ # @return [String] The plain text body of the email. Note that only
23
+ # text or html can be supplied, not both.
24
+ attr_accessor :text
25
+
26
+ # @return [String] The HTML body of the email. Note that only text
27
+ # or html can be supplied, not both.
28
+ attr_accessor :html
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,23 @@
1
+ module Mailosaur
2
+ module Models
3
+ class MessageForwardOptions < BaseModel
4
+ def initialize(data = {})
5
+ @to = data['to']
6
+ @text = data['text']
7
+ @html = data['html']
8
+ end
9
+
10
+ # @return [String] The email address to which the email will be sent.
11
+ # Must be a verified email address.
12
+ attr_accessor :to
13
+
14
+ # @return [String] Any additional plain text content to forward the
15
+ # email with. Note that only text or html can be supplied, not both.
16
+ attr_accessor :text
17
+
18
+ # @return [String] Any additional HTML content to forward the email
19
+ # with. Note that only html or text can be supplied, not both.
20
+ attr_accessor :html
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ module Mailosaur
2
+ module Models
3
+ class MessageReplyOptions < BaseModel
4
+ def initialize(data = {})
5
+ @text = data['text']
6
+ @html = data['html']
7
+ end
8
+
9
+ # @return [String] Any additional plain text content to include in
10
+ # the reply. Note that only text or html can be supplied, not both.
11
+ attr_accessor :text
12
+
13
+ # @return [String] Any additional HTML content to include in the
14
+ # reply. Note that only html or text can be supplied, not both.
15
+ attr_accessor :html
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Mailosaur
2
- VERSION = '7.3.2'.freeze
2
+ VERSION = '7.4.0'.freeze
3
3
  end
data/lib/mailosaur.rb CHANGED
@@ -26,6 +26,9 @@ module Mailosaur
26
26
  autoload :MessageSummary, 'Mailosaur/models/message_summary.rb'
27
27
  autoload :Image, 'Mailosaur/models/image.rb'
28
28
  autoload :MessageListResult, 'Mailosaur/models/message_list_result.rb'
29
+ autoload :MessageCreateOptions, 'Mailosaur/models/message_create_options.rb'
30
+ autoload :MessageForwardOptions, 'Mailosaur/models/message_forward_options.rb'
31
+ autoload :MessageReplyOptions, 'Mailosaur/models/message_reply_options.rb'
29
32
  autoload :Attachment, 'Mailosaur/models/attachment.rb'
30
33
  autoload :SearchCriteria, 'Mailosaur/models/search_criteria.rb'
31
34
  autoload :MessageContent, 'Mailosaur/models/message_content.rb'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailosaur
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.2
4
+ version: 7.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mailosaur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-10 00:00:00.000000000 Z
11
+ date: 2021-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -164,8 +164,11 @@ files:
164
164
  - lib/Mailosaur/models/message.rb
165
165
  - lib/Mailosaur/models/message_address.rb
166
166
  - lib/Mailosaur/models/message_content.rb
167
+ - lib/Mailosaur/models/message_create_options.rb
168
+ - lib/Mailosaur/models/message_forward_options.rb
167
169
  - lib/Mailosaur/models/message_header.rb
168
170
  - lib/Mailosaur/models/message_list_result.rb
171
+ - lib/Mailosaur/models/message_reply_options.rb
169
172
  - lib/Mailosaur/models/message_summary.rb
170
173
  - lib/Mailosaur/models/metadata.rb
171
174
  - lib/Mailosaur/models/search_criteria.rb