mailosaur 8.0.0 → 8.1.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: 674d6a0fc698cb9f2e2e94de63b60ebd2e7af23b676b285e939f7128277ed815
4
- data.tar.gz: e32afa6f593799fb13873b8c4e1c53b6aaaa2803b9a9269f42680b1308b5665f
3
+ metadata.gz: 3f9e68987fc63770ca61c94a5091b02ea932bb765ea6dfa1d2d3ca8603e58867
4
+ data.tar.gz: 8683c7bb7ffe561fc491867bb2000437cd3b0541cec1c738d9733c649c6c2d1d
5
5
  SHA512:
6
- metadata.gz: fe6f0bdaff74715b4f2ca3962673036e23f406aa06d990b471f9617c7ce99b63ac26ffc5adaa1a34c4c8b908045b7ab8a4aff3cae156b9679c3b69fd03bbdb98
7
- data.tar.gz: 7204f062d34fa6c35f4219f293a6cfa5b50f03fecd31d9cc54da5dedda1e91c653dd0da19f9f87f5121ca5bd7cd6e27986517db7e999d7391c9038cdb01cd19b
6
+ metadata.gz: abb3db223ad672d31099e11284a928679c3a3c9db15b9e727c2fbd68119a23fe424bd75116b54b35c6a1b25ce9edb47f7a956baf444835b626a9acf904824bf0
7
+ data.tar.gz: 7a556665627605e074ce413a02be0d839032454445e5592de4367ee1d05707c193205726940a20545edd752926b277da7801e6b1dac9db14b0f738402110a065
data/README.md CHANGED
@@ -11,6 +11,10 @@ Mailosaur lets you automate email and SMS tests as part of software development
11
11
  This guide provides several key sections:
12
12
 
13
13
  - [Get Started](#get-started)
14
+ - [Installation](#installation)
15
+ - [Set your API key](#set-your-api-key)
16
+ - [Create your code](#create-your-code)
17
+ - [API Reference](#api-reference)
14
18
  - [Creating an account](#creating-an-account)
15
19
  - [Test email addresses with Mailosaur](#test-email-addresses-with-mailosaur)
16
20
  - [Find an email](#find-an-email)
@@ -32,11 +36,21 @@ If you get stuck, just contact us at support@mailosaur.com.
32
36
  gem install mailosaur
33
37
  ```
34
38
 
35
- Then import the library into your code. The value for `YOUR_API_KEY` is covered in the next step ([creating an account](#creating-an-account)):
39
+ ### Set your API key
40
+
41
+ Get your API key from the Mailosaur Dashboard and set it as an environment variable:
42
+
43
+ ```sh
44
+ export MAILOSAUR_API_KEY='your-api-key-here'
45
+ ```
46
+
47
+ ### Create your code
48
+
49
+ Then import the library into your code:
36
50
 
37
51
  ```ruby
38
52
  require 'mailosaur'
39
- mailosaur = Mailosaur::MailosaurClient.new("YOUR_API_KEY")
53
+ mailosaur = Mailosaur::MailosaurClient.new()
40
54
  ```
41
55
 
42
56
  ### API Reference
@@ -79,7 +93,7 @@ In automated tests you will want to wait for a new email to arrive. This library
79
93
  ```ruby
80
94
  require 'mailosaur'
81
95
 
82
- mailosaur = Mailosaur::MailosaurClient.new("API_KEY")
96
+ mailosaur = Mailosaur::MailosaurClient.new()
83
97
 
84
98
  # See https://mailosaur.com/app/project/api
85
99
  server_id = "abc123"
@@ -95,7 +109,7 @@ puts(email.subject) # "Hello world!"
95
109
 
96
110
  ### What is this code doing?
97
111
 
98
- 1. Sets up an instance of `MailosaurClient` with your API key.
112
+ 1. Sets up an instance of `MailosaurClient` using the `MAILOSAUR_API_KEY` environment variable.
99
113
  2. Waits for an email to arrive at the server with ID `abc123`.
100
114
  3. Outputs the subject line of the email.
101
115
 
@@ -108,7 +122,7 @@ If your account has [SMS testing](https://mailosaur.com/sms-testing/) enabled, y
108
122
  ```ruby
109
123
  require 'mailosaur'
110
124
 
111
- mailosaur = Mailosaur::MailosaurClient.new("API_KEY")
125
+ mailosaur = Mailosaur::MailosaurClient.new()
112
126
 
113
127
  server_id = "abc123"
114
128
 
@@ -1,3 +1,3 @@
1
1
  module Mailosaur
2
- VERSION = '8.0.0'.freeze
2
+ VERSION = '8.1.0'.freeze
3
3
  end
data/lib/mailosaur.rb CHANGED
@@ -65,11 +65,15 @@ module Mailosaur
65
65
  class MailosaurClient
66
66
  #
67
67
  # Creates initializes a new instance of the MailosaurClient class.
68
- # @param api_key [String] your Mailosaur API key.
68
+ # @param api_key [String] Optional API key. Overrides the MAILOSAUR_API_KEY environment variable if set.
69
69
  # @param base_url [String] the base URI of the service.
70
70
  #
71
- def initialize(api_key, base_url = 'https://mailosaur.com/')
72
- @api_key = api_key
71
+ def initialize(api_key = nil, base_url: 'https://mailosaur.com/')
72
+ resolved_api_key = api_key || ENV['MAILOSAUR_API_KEY']
73
+
74
+ raise ArgumentError, "'api_key' must be set. Set the MAILOSAUR_API_KEY environment variable or pass it to the MailosaurClient constructor." unless resolved_api_key
75
+
76
+ @api_key = resolved_api_key
73
77
  @base_url = base_url
74
78
  end
75
79
 
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailosaur
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0
4
+ version: 8.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mailosaur
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-03-06 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: faraday
@@ -201,6 +202,7 @@ metadata:
201
202
  github_repo: ssh://github.com/mailosaur/mailosaur-ruby
202
203
  homepage_uri: https://mailosaur.com/
203
204
  source_code_uri: https://github.com/mailosaur/mailosaur-ruby
205
+ post_install_message:
204
206
  rdoc_options: []
205
207
  require_paths:
206
208
  - lib
@@ -215,7 +217,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
217
  - !ruby/object:Gem::Version
216
218
  version: '0'
217
219
  requirements: []
218
- rubygems_version: 3.6.9
220
+ rubygems_version: 3.1.6
221
+ signing_key:
219
222
  specification_version: 4
220
223
  summary: The Mailosaur Ruby library
221
224
  test_files: []