mailslurp_client 15.18.3 → 15.18.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: 4a3d854c7947e6140195b387c32c31c7adad41172f636190b0e5abed10f7e452
4
- data.tar.gz: f66d3b6bee01938de729576cf447038226dbee67bfc9768da540c91aadca98a8
3
+ metadata.gz: ed313a19e0624c0e3a672c95efd493057e607db56e8d5431160f7ac8de3526f8
4
+ data.tar.gz: 5f37dedf55ec71aaf7a7b25123fd4b31d6254a2349a19a363e26c708e4a608ba
5
5
  SHA512:
6
- metadata.gz: fc7304431e62fc1f9f7bc69e27d2045089877facf6ad7c174b9aebeb3bec1a149e3a1d7ab29b908461b81f975ca4b9c3d0df19facaa9d7d179a70ba933d36cd3
7
- data.tar.gz: c756a03a72e3777329d3c9c67bfb9a983ca5c36fb24197887b66a54d9362e993134258d20e554ab86c7913575779a167ebabab8fdcba74a6ea400b899b91888f
6
+ metadata.gz: 1de0d33b238d1c01d094ca5ae4f14cbad29b66197cafb404412e1d050e210cfa33ce091dab1adacb1047e6bdda970ae8a6d842471232c775196ecc37f4f1bf21
7
+ data.tar.gz: 23b68015f53717f1983db6ee6a3b3eef6b0a42d71190b1d2b45c328a382dcd373b44f39db59a066094b794999a5927a7b8b04a140569516136aa5e5224bf5c0d
data/README.md CHANGED
@@ -50,7 +50,12 @@ gem install mailslurp_client
50
50
 
51
51
  Or in your `Gemfile`:
52
52
 
53
- {{<gen_ruby_ruby_minitest_gemspec>}}
53
+ ```ruby
54
+ source "https://rubygems.org"
55
+
56
+ gem 'mailslurp_client'
57
+ gem 'typhoeus'
58
+ ```
54
59
 
55
60
  And then run bundler install:
56
61
 
@@ -67,15 +72,22 @@ You may need to install `typhoeus` if you encounter libcurl errors.
67
72
  gem 'typhoeus'
68
73
  ```
69
74
 
70
-
71
75
  ### Configure the client
72
76
 
73
- {{<gen_ruby_ruby_minitest_configure>}}
77
+ ```ruby
78
+ require 'mailslurp_client'
79
+
80
+ MailSlurpClient.configure do |config|
81
+ config.api_key['x-api-key'] = ENV['API_KEY']
82
+ end
83
+ ```
74
84
 
75
85
  ### Create controllers
76
86
  To call the API create a controller like this:
77
87
 
78
- {{<gen_ruby_ruby_minitest_create_controller>}}
88
+ ```ruby
89
+ inbox_controller = MailSlurpClient::InboxControllerApi.new
90
+ ```
79
91
 
80
92
  ## Common uses
81
93
 
@@ -87,7 +99,14 @@ Here are some common uses:
87
99
 
88
100
  To use MailSlurp you need to create inboxes. These are email accounts that have an ID and a real email address. See methods on the [inbox controller](https://ruby.mailslurp.com/MailSlurpClient/InboxControllerApi.html) for more information.
89
101
 
90
- {{<gen_ruby_ruby_minitest_create_inbox>}}
102
+ ```ruby
103
+ options = {
104
+ name: "My test inbox",
105
+ inboxType: "SMTP_INBOX"
106
+ }
107
+ inbox = inbox_controller.create_inbox_with_options(options)
108
+ assert_match /@mailslurp/, inbox.email_address
109
+ ```
91
110
 
92
111
  In a test:
93
112
 
@@ -199,7 +218,13 @@ end
199
218
 
200
219
  You can send HTML emails easily with the inbox controller. First create an inbox then use its ID with the `send_email` method.
201
220
 
202
- {{<gen_ruby_ruby_minitest_send_email>}}
221
+ ```ruby
222
+ inbox_controller.send_email(inbox.id, {
223
+ to: [inbox.email_address],
224
+ subject: "Hello",
225
+ body: "Welcome. Your code is: 123456",
226
+ })
227
+ ```
203
228
 
204
229
  To send attachments see the [Method Documentation](https://ruby.mailslurp.com/).
205
230
 
@@ -242,7 +267,27 @@ inbox_controller.send_email(inbox_1.id, opts)
242
267
 
243
268
  ### Send with SMTP
244
269
 
245
- {{<gen_ruby_ruby_minitest_smtp_send>}}
270
+ ```ruby
271
+ require 'net/smtp'
272
+ access_details = inbox_controller.get_imap_smtp_access(inbox_id: inbox.id)
273
+ Net::SMTP.start(
274
+ address= access_details.secure_smtp_server_host,
275
+ port= access_details.secure_smtp_server_port,
276
+ helo= inbox.email_address.match(/@(.+)/)[1],
277
+ user= access_details.secure_smtp_username,
278
+ secret= access_details.secure_smtp_password,
279
+ authtype= :plain
280
+ ) do |smtp|
281
+ message = <<EOF
282
+ Subject: SMTP test
283
+
284
+ This is my body
285
+ EOF
286
+ smtp.send_message message, inbox.email_address, inbox.email_address
287
+ smtp.finish
288
+ end
289
+
290
+ ```
246
291
 
247
292
  ### Receive emails
248
293
 
@@ -250,11 +295,23 @@ To read already existing emails use the [Email Controller](https://ruby.mailslur
250
295
  You can use MailSlurp to wait for at least 1 unread email in an inbox and return it.
251
296
  If a timeout is exceeded it will throw an error instead:
252
297
 
253
- {{<gen_ruby_ruby_minitest_receive_email>}}
298
+ ```ruby
299
+ wait_for_controller = MailSlurpClient::WaitForControllerApi.new
300
+ wait_options = {
301
+ inbox_id: inbox.id,
302
+ timeout: 120000,
303
+ unread_only: true
304
+ }
305
+ email = wait_for_controller.wait_for_latest_email(wait_options)
306
+ assert_match /Welcome/, email.body
307
+ ```
254
308
 
255
309
  ### Extract email content
256
310
 
257
- {{<gen_ruby_ruby_minitest_extract_code>}}
311
+ ```ruby
312
+ code = email.body.match(/Your code is: ([0-9]{6})/)[1]
313
+ assert_equal code, '123456'
314
+ ```
258
315
 
259
316
  To parse an email and extract content use regex patterns like so:
260
317
 
@@ -11,5 +11,5 @@ OpenAPI Generator version: 4.3.1
11
11
  =end
12
12
 
13
13
  module MailSlurpClient
14
- VERSION = '15.18.3'
14
+ VERSION = '15.18.4'
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailslurp_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.18.3
4
+ version: 15.18.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - mailslurp