mailinator_client 1.0.6 → 1.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.agent/rules/tdd.md +7 -0
  3. data/.agent/tdd-flow/skill.md +15 -0
  4. data/.env.example +25 -0
  5. data/.github/copilot-instructions.md +7 -0
  6. data/.gitignore +2 -0
  7. data/.ruby-version +1 -1
  8. data/AGENTS.md +9 -0
  9. data/AI_INSTRUCTIONS.md +205 -0
  10. data/CHANGELOG.md +65 -0
  11. data/EXAMPLES.md +11 -0
  12. data/README.md +18 -13
  13. data/ROADMAP.md +58 -0
  14. data/docs/domains.md +6 -0
  15. data/docs/rules.md +9 -6
  16. data/lib/mailinator_client/authenticators.rb +0 -22
  17. data/lib/mailinator_client/client.rb +14 -24
  18. data/lib/mailinator_client/domains.rb +5 -25
  19. data/lib/mailinator_client/error.rb +11 -25
  20. data/lib/mailinator_client/messages.rb +464 -48
  21. data/lib/mailinator_client/rules.rb +12 -28
  22. data/lib/mailinator_client/stats.rb +0 -22
  23. data/lib/mailinator_client/utils.rb +0 -22
  24. data/lib/mailinator_client/version.rb +3 -25
  25. data/lib/mailinator_client/webhooks.rb +1 -22
  26. data/lib/mailinator_client.rb +0 -22
  27. data/mailinator_client.gemspec +25 -25
  28. data/test/authenticators_api_test.rb +28 -0
  29. data/test/domains_api_test.rb +15 -0
  30. data/test/messages_api_test.rb +274 -0
  31. data/test/messages_headers_api_test.rb +30 -0
  32. data/test/messages_query_params_test.rb +76 -0
  33. data/test/messages_stream_domain_api_test.rb +39 -0
  34. data/test/messages_stream_inbox_api_test.rb +40 -0
  35. data/test/messages_summary_api_test.rb +28 -0
  36. data/test/messages_text_api_test.rb +28 -0
  37. data/test/messages_texthtml_api_test.rb +28 -0
  38. data/test/messages_textplain_api_test.rb +28 -0
  39. data/test/rules_api_test.rb +7 -0
  40. data/test/stats_api_test.rb +19 -0
  41. data/test/test_helper.rb +31 -1
  42. data/test/webhooks_api_test.rb +49 -0
  43. metadata +84 -23
  44. data/test/mailinator_client_api_test.rb +0 -246
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d61079f915251b975bf65147de21720b5fb852cc9c7bf332b1683180c0dfaec2
4
- data.tar.gz: 10a01b3d925703e33ac2b9273bd3c47d3e25488e0ae432fa39e8e758a9a97d48
3
+ metadata.gz: 842259c780481a4557f43335ae76aee7983c5d61f4c191e5513c73a8c513653d
4
+ data.tar.gz: c6581dbcda2131ac8673899a28589c7e19c4acbd52127835a6de24aff0a7e1f8
5
5
  SHA512:
6
- metadata.gz: ae1050498f67e632586b7ff037d9f37785119370819012c872a49aa30012cd02edd5e5715cf6979b3353442b4599d14f05797727c20792790f5903f942223a6a
7
- data.tar.gz: a782fc068b13f790c1974c48542435b73ce270edcec4f6087fe366e97c7e6cf7a3590a45d1b1fe3598de2c200d1d16d22f86cfd9cb722aa7c2b46dc40d822d9a
6
+ metadata.gz: 44ff3ba0a414f96920f357d0aa9c069f3bb957dedc7fba2a1d586f79f490867c99a8a2654575b7797a3249c79e9c51fadb0ea67e1034f54e976a49fe805ce86d
7
+ data.tar.gz: 4ca92063bd2a63fb5e97cf0b60d54d849c4e766f282ab06c89df4860d74c6716aca3a02e2cc92c490a57c63dc9e431d8cb154a78a353e066a38b499fb41f74ba
@@ -0,0 +1,7 @@
1
+ # TDD Protocol Rules
2
+ - **Scope:** These rules apply ONLY when the goal is "Feature Implementation" or "Bug Fix."
3
+ - **Passive Mode:** If I am manually editing a `*.test.*` or `*_test.*` file, switch to **Passive Mode**.
4
+ - **Passive Mode Behavior:** - Do not trigger the Red-Green-Refactor flow.
5
+ - Provide autocomplete and suggestions only.
6
+ - Do not ask for "Approval" to proceed.
7
+ - **Code Preservation:** Always enforced. Never delete implementation logic unless specifically told to "Clean up" or "Refactor."
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: tdd-flow
3
+ description: Strict Red-Green-Refactor agentic workflow.
4
+ triggers:
5
+ - user_mentions: ["$tdd", "implement", "build feature"]
6
+ ---
7
+
8
+ ## Workflow Steps
9
+ 1. **Red Phase:** Write ONE failing test. Explain the failure. **STOP.**
10
+ - Requirement: All tests generated in this phase must adhere to the Test Expectations defined in the ai_instruction file (specifically: No mocking, real HTTP requests, and semantic validation).
11
+ 2. **Green Phase:** Write the simplest possible implementation to pass that specific test. **STOP.**
12
+ 3. **Refactor Phase:** Suggest improvements to the implementation. Do not change tests.
13
+
14
+ ## Constraint
15
+ - Do not jump to Step 2 until the user confirms Step 1 passes (or fails correctly).
data/.env.example ADDED
@@ -0,0 +1,25 @@
1
+ # Mailinator API Configuration
2
+ # Documentation: https://www.mailinator.com/documentation/docs/api/index.html
3
+ # Visit https://www.mailinator.com/ to get your API token and configure domains
4
+
5
+ MAILINATOR_TEST_API_TOKEN=
6
+ MAILINATOR_TEST_INBOX=
7
+ MAILINATOR_TEST_PHONE_NUMBER=
8
+ MAILINATOR_TEST_MESSAGE_WITH_ATTACHMENT_ID=
9
+
10
+ # Delete domain (WARNING: use with caution - only if you are 100% sure)
11
+ MAILINATOR_TEST_DELETE_DOMAIN=
12
+
13
+ # Webhook token configuration
14
+ # This assumees you have multiple webhook tokens for different testing scenarios (e.g., private domain vs twilio). Adjust as needed based on your actual test setup.
15
+ MAILINATOR_TEST_WEBHOOKTOKEN_PRIVATEDOMAIN=
16
+ MAILINATOR_TEST_WEBHOOKTOKEN_CUSTOMSERVICE=
17
+
18
+ # Authenticator configuration
19
+ MAILINATOR_TEST_AUTH_SECRET=
20
+ MAILINATOR_TEST_AUTH_ID=
21
+
22
+ # Webhook configuration
23
+ # Custom service might be something like "twilio" or "sendgrid"
24
+ MAILINATOR_TEST_WEBHOOK_INBOX=
25
+ MAILINATOR_TEST_WEBHOOK_CUSTOMSERVICE=
@@ -0,0 +1,7 @@
1
+ # TDD Instructions for Copilot
2
+ Refer to the project standards in AGENTS.md and the rules in .agent/rules/tdd.md.
3
+
4
+ ## Critical Constraints:
5
+ 1. **Red-Green-Refactor:** When I ask for a feature, write a failing test FIRST. Stop and wait for me to run it. Do not provide implementation until I approve the test.
6
+ 2. **No Deletions:** Never remove implementation code, even if a test is skipped.
7
+ 3. **Minimalism:** Write only the assertions I ask for. Do not add boilerplate "safety" assertions.
data/.gitignore CHANGED
@@ -21,3 +21,5 @@ test/tmp
21
21
  test/version_tmp
22
22
  tmp
23
23
  Gemfile.lock
24
+
25
+ .env
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.6
1
+ 2.7.6
data/AGENTS.md ADDED
@@ -0,0 +1,9 @@
1
+ All AI agents (Codex, Copilot, Antigravity) must adhere to the rules defined in .agent/rules/ and this file.
2
+
3
+ # Project Standards & Agent Behavior
4
+
5
+ - **Primary Workflow:** We use the `tdd-flow` skill for all new feature development.
6
+ - **Test Style:** Focus on behavior-driven assertions. No mocking.
7
+ - **Anti-Pattern Guardrail:** Do not "hallucinate" implementation for skipped tests. If a test is ignored, the underlying code must remain untouched.
8
+ - **Language/Framework:** Ruby with RSpec for testing.
9
+ - **Spec-Strictness:** When generating tests for the SDK, only assert properties explicitly defined in the OpenAPI specification provided. Do not invent "common sense" validations that are not codified in the schema. Call out any ambiguities or gaps in the spec for human review instead of making assumptions.
@@ -0,0 +1,205 @@
1
+ # AI Instructions
2
+
3
+ This document explains the relationship between this Ruby client and the Mailinator OpenAPI specification.
4
+
5
+ **OpenAPI Specification:** [Found on GitHub](https://github.com/manybrain/mailinatordocs/blob/main/openapi/mailinator-api.yaml)
6
+
7
+ ## Codebase Structure
8
+
9
+ The codebase structure in `lib/mailinator_client/` reflects Mailinator API resource groups.
10
+
11
+ - **Entrypoints:**
12
+ - `lib/mailinator_client.rb` loads all components and provides module-level delegation to a singleton `Client`.
13
+ - `lib/mailinator_client/client.rb` defines the HTTP execution path and shared request behavior.
14
+ - **Resource wrappers:** API resources live in peer files under `lib/mailinator_client/`:
15
+ - `authenticators.rb` for authenticator endpoints.
16
+ - `domains.rb` for domain endpoints.
17
+ - `messages.rb` for inbox/message endpoints.
18
+ - `rules.rb` for rule endpoints.
19
+ - `stats.rb` for team/stat endpoints.
20
+ - `webhooks.rb` for webhook injection endpoints.
21
+ - **Support files:**
22
+ - `utils.rb` normalizes input/query structures.
23
+ - `error.rb` defines `ResponseError`.
24
+ - `version.rb` defines gem version metadata used in user agent headers.
25
+
26
+ ## Request Patterns
27
+
28
+ This client uses a **resource wrapper** pattern, not per-operation request classes.
29
+
30
+ - Each resource class exposes Ruby methods (for example, `fetch_inbox`, `get_domains`, `create_rule`) that:
31
+ - accept a params hash,
32
+ - validate required keys with `ArgumentError`,
33
+ - construct `path`, `query`, and optional `body`,
34
+ - call `@client.request(...)`.
35
+ - Method names are snake_case and generally map to one API operation each.
36
+ - Paths are resource-relative and are joined to the client base URL (`https://api.mailinator.com/api/v2`) inside `Client#request`.
37
+
38
+ ## Execution
39
+
40
+ Requests are executed through `MailinatorClient::Client#request`, which uses `HTTParty`.
41
+
42
+ ```ruby
43
+ client = MailinatorClient::Client.new(auth_token: "api_token")
44
+ response = client.messages.fetch_inbox(domain: "domain.com", inbox: "inbox_name")
45
+ ```
46
+
47
+ Execution flow:
48
+ - Resource method builds request inputs (`method`, `path`, `query`, `headers`, `body`).
49
+ - `Client#request` appends the path to `https://api.mailinator.com/api/v2`.
50
+ - `HTTParty.send` performs the HTTP call with JSON headers and optional authorization.
51
+ - Non-2xx/3xx responses raise `MailinatorClient::ResponseError`.
52
+
53
+ ## Entities
54
+
55
+ This Ruby SDK mostly returns parsed response hashes/arrays directly, rather than strongly typed model classes.
56
+
57
+ - API responses are returned as Ruby data structures from `HTTParty` (`Hash`/`Array`).
58
+ - Error responses are wrapped in `MailinatorClient::ResponseError` with:
59
+ - `code` (HTTP status),
60
+ - `type` (error type from API payload),
61
+ - exception message from the API response.
62
+ - Request inputs are plain Ruby hashes, typically normalized by `Utils.symbolize_hash_keys`.
63
+
64
+ ---
65
+
66
+ ## Gap Analysis Workflow
67
+
68
+ Use this workflow whenever you want to audit the SDK against the OpenAPI spec, identify missing or extra coverage, and bring the two into alignment.
69
+
70
+ ### Step 1 — Fetch the OpenAPI Specification
71
+
72
+ Retrieve the raw YAML from:
73
+
74
+ ```
75
+ https://raw.githubusercontent.com/manybrain/mailinatordocs/main/openapi/mailinator-api.yaml
76
+ ```
77
+
78
+ > The rendered GitHub page is at https://github.com/manybrain/mailinatordocs/blob/main/openapi/mailinator-api.yaml
79
+ > but always read the **raw** URL for machine parsing.
80
+
81
+ Extract every `paths` entry. For each path, record:
82
+ - The HTTP method (`get`, `post`, `put`, `delete`, etc.)
83
+ - The full path string (e.g. `/api/v2/domains/{domain}/inboxes/{inbox}`)
84
+ - The `operationId`
85
+ - The tag (maps to the SDK module directory)
86
+ - All query parameters defined under `parameters`
87
+
88
+ ### Step 2 — Catalog the SDK
89
+
90
+ For each resource file under `lib/mailinator_client/` (`messages.rb`, `domains.rb`, `rules.rb`, etc.):
91
+ 1. Enumerate every public method that issues `@client.request(...)`.
92
+ 2. Identify the HTTP method (`:get`, `:post`, `:put`, `:delete`).
93
+ 3. Extract the `path` template used by that method.
94
+ 4. Record query parameters populated in `query_params`.
95
+ 5. Note methods already marked deprecated in comments/docs.
96
+
97
+ Also map resource files to OpenAPI tags and check if any tag has no SDK wrapper.
98
+
99
+ ### Step 3 — Identify Gaps
100
+
101
+ Produce a gap report with four sections:
102
+
103
+ #### A. In the spec but missing from the SDK
104
+ List every `operationId` that has no corresponding Ruby method. This is what needs to be **added**.
105
+
106
+ #### B. In the SDK but not in the spec
107
+ List every SDK method whose path+method has no matching entry in the spec.
108
+ - If it is already marked deprecated, note that separately.
109
+ - If it is not deprecated but absent from the spec, flag it for clarification (it may be undocumented).
110
+
111
+ #### C. URL path mismatches
112
+ Compare the base path used by each SDK method against the spec.
113
+ - The spec base URL is `https://api.mailinator.com` and all paths start with `/api/v2/`.
114
+ - The SDK **must** use `/api/v2/` not `/v2/`. Flag any method/path using the wrong prefix.
115
+
116
+ #### D. Query parameter gaps
117
+ For each existing SDK method, compare sent query parameters against the spec's declared parameters for that operation. List any missing parameters.
118
+
119
+ #### Exception — Domain Listing
120
+ The OpenAPI operation `GET /api/v2/domains/{domain}/inboxes` (list domain messages) is considered **covered** by `messages.fetch_inbox` when called with `inbox: "*"`. Do not treat this as a missing SDK method in future gap analyses.
121
+
122
+ ### Step 4 — Build a Plan
123
+
124
+ Before making any changes, write out a plan that includes:
125
+
126
+ 1. **New methods to add** — one method per missing `operationId`, grouped by resource file.
127
+ 2. **URL fixes** — list every file where the prefix needs to change from `/v2/` to `/api/v2/`.
128
+ 3. **Query parameter additions** — list every file and which parameters to add.
129
+ 4. **Deprecated methods** — decide whether to keep and mark as deprecated or remove. Do not remove without confirmation.
130
+ 5. **Response/entity notes** — list response shape expectations or wrappers needed for consistency.
131
+
132
+ Present the plan to the user and wait for approval before proceeding.
133
+
134
+ ### Step 5 — Implement
135
+
136
+ Follow the existing patterns in the codebase:
137
+
138
+ #### Adding a new method
139
+
140
+ Use an existing method in the matching resource file as a template.
141
+
142
+ ```ruby
143
+ def get_example(params = {})
144
+ params = Utils.symbolize_hash_keys(params)
145
+ query_params = {}
146
+ headers = {}
147
+ body = nil
148
+
149
+ raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
150
+ raise ArgumentError.new("id is required") unless params.has_key?(:id)
151
+
152
+ path = "/domains/#{params[:domain]}/examples/#{params[:id]}"
153
+
154
+ @client.request(
155
+ method: :get,
156
+ path: path,
157
+ query: query_params,
158
+ headers: headers,
159
+ body: body
160
+ )
161
+ end
162
+ ```
163
+
164
+ Key rules:
165
+ - **Always** use `/api/v2/` as the path prefix — never `/v2/`.
166
+ - Keep methods in the appropriate resource file (`messages.rb`, `rules.rb`, etc.).
167
+ - Validate required params with `ArgumentError`.
168
+ - Use snake_case method names and preserve existing naming conventions in the file.
169
+
170
+ #### Fixing a URL prefix
171
+
172
+ If any hardcoded URL includes `/v2/`, change it to `/api/v2/`. Prefer resource-relative `path` values (`/domains/...`) and let `Client#request` prepend base URL.
173
+
174
+ #### Adding a missing query parameter
175
+
176
+ Add an assignment in the method's query assembly:
177
+ ```ruby
178
+ query_params[:my_param] = params[:myParam] if params.has_key?(:myParam)
179
+ ```
180
+ Then document the optional parameter in the method comment block.
181
+
182
+ ### Step 6 — Verify
183
+
184
+ After implementing:
185
+ 1. Run tests: `ruby -I test test/mailinator_client_api_test.rb` (with required env vars).
186
+ 2. Run lint/static checks if configured for this repo.
187
+ 3. Manually verify at least one changed method generates the exact spec path and sends expected query params.
188
+
189
+ ### Notes on SDK Conventions
190
+
191
+ | Convention | Detail |
192
+ |---|---|
193
+ | Version source | `lib/mailinator_client/version.rb` (`MailinatorClient::VERSION`), referenced by gemspec and user-agent string. |
194
+ | Auth header | Set in `Client#request` as `Authorization` when `auth_token` is provided. |
195
+ | No-token requests | Supported by instantiating `Client` without `auth_token` (used by some webhook flows). |
196
+ | Deprecation marker | Use Ruby/YARD style deprecation comments near method definitions and reflect in README/docs. |
197
+ | Entrypoint loading | `lib/mailinator_client.rb` requires resource/support files and delegates module methods to singleton client. |
198
+
199
+ ### Test Expectations
200
+
201
+ - Integration tests should exercise real HTTP requests to Mailinator endpoints. Do not use request-mocking tools (for example, `WebMock.stub_request`) for endpoint coverage tests.
202
+ - Assertions must validate response semantics, not just existence. Prefer checking:
203
+ - expected HTTP success behavior (or explicit failure with returned status code),
204
+ - expected JSON shape (required keys),
205
+ - important field-level values (for example, IDs or arrays) relevant to the endpoint contract.
data/CHANGELOG.md ADDED
@@ -0,0 +1,65 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project aims to follow [Semantic Versioning](https://semver.org/).
7
+
8
+ ## [1.1.0]
9
+
10
+ ### Changed
11
+
12
+ - Added `messages.fetch_message_summary` for `GET /api/v2/domains/{domain}/messages/{messageId}/summary`.
13
+ - Added `messages.fetch_message_text` for `GET /api/v2/domains/{domain}/messages/{messageId}/text`.
14
+ - Added `messages.fetch_message_textplain` for `GET /api/v2/domains/{domain}/messages/{messageId}/textplain`.
15
+ - Added `messages.fetch_message_texthtml` for `GET /api/v2/domains/{domain}/messages/{messageId}/texthtml`.
16
+ - Added `messages.fetch_message_headers` for `GET /api/v2/domains/{domain}/messages/{messageId}/headers`.
17
+ - Added `messages.stream_domain_messages` for `GET /api/v2/domains/{domain}/stream`.
18
+ - Added `messages.stream_inbox_messages` for `GET /api/v2/domains/{domain}/stream/{inbox}`.
19
+ - Removed `wait` query parameter from `messages.fetch_sms_message` because the endpoint does not support it.
20
+ - Removed `wait` query parameter from `messages.fetch_inbox`.
21
+ - Fixed `webhooks.private_webhook` to include the webhook payload in the request body.
22
+ - Debugging and test updates.
23
+ - Made attachment download tests derive attachment IDs from the attachments list, removing the need for `MAILINATOR_TEST_ATTACHMENT_ID`.
24
+ - Documented that `GET /domains/{domain}/inboxes` is covered by `messages.fetch_inbox` with `inbox: "*"`.
25
+
26
+ ## [1.0.7]
27
+
28
+ ### Added
29
+
30
+ - Optional `delete` query parameter support to `messages.fetch_inbox_message`.
31
+ - Inbox-list query parameters to `messages.fetch_sms_message` (`skip`, `limit`, `sort`, `decode_subject`, `cursor`, `full`, `delete`).
32
+ - `.env.example` with Mailinator integration test variables.
33
+ - Resource-scoped integration test files:
34
+ - `test/authenticators_api_test.rb`
35
+ - `test/domains_api_test.rb`
36
+ - `test/messages_api_test.rb`
37
+ - `test/rules_api_test.rb`
38
+ - `test/stats_api_test.rb`
39
+ - `test/webhooks_api_test.rb`
40
+ - Focused query-parameter regression tests in `test/messages_query_params_test.rb`.
41
+
42
+ ### Deprecated
43
+
44
+ - Marked all Rules endpoints as deprecated:
45
+ - `client.rules.create_rule`
46
+ - `client.rules.enable_rule`
47
+ - `client.rules.disable_rule`
48
+ - `client.rules.get_all_rules`
49
+ - `client.rules.get_rule`
50
+ - `client.rules.delete_rule`
51
+ - Marked Domain mutation endpoints as deprecated:
52
+ - `client.domains.create_domain`
53
+ - `client.domains.delete_domain`
54
+ - Added deprecation markers in code (`lib/mailinator_client/rules.rb`) and deprecation notices in docs (`docs/rules.md`, `README.md`).
55
+
56
+ ### Changed
57
+
58
+ - Updated dependency constraints:
59
+ - Runtime: `httparty` to `>= 0.21, < 0.22` (Ruby 2.6-compatible)
60
+ - Development: `minitest >= 5.25, < 7.0`, `rake >= 13.0, < 14.0`, `webmock >= 3.26, < 4.0`
61
+ - Updated integration testing structure by splitting the previous monolithic `test/mailinator_client_api_test.rb`.
62
+ - Added `.env` loading support in `test/test_helper.rb`.
63
+ - Hardened API error handling for non-JSON/empty error responses:
64
+ - `MailinatorClient::ResponseError` now handles `nil` parsed responses safely.
65
+ - `Client#request` now passes raw response body into `ResponseError`.
data/EXAMPLES.md ADDED
@@ -0,0 +1,11 @@
1
+ # Examples
2
+
3
+ This document will collect practical usage examples for the Mailinator Ruby client.
4
+
5
+ ## Planned Sections
6
+
7
+ - Authentication setup
8
+ - Domain and inbox operations
9
+ - Message retrieval and parsing
10
+ - Webhooks and rules
11
+ - Error handling patterns
data/README.md CHANGED
@@ -1,12 +1,17 @@
1
- # Mailinator Ruby REST API Client
1
+ # Mailinator Ruby SDK
2
2
 
3
- [![Build Status](https://travis-ci.org/manybrain/mailinator-ruby-client.svg?branch=master)](https://travis-ci.org/manybrain/mailinator-ruby-client) [![Gem Version](https://badge.fury.io/rb/mailinator_client.svg)](https://badge.fury.io/rb/mailinator_client)
3
+ The official Mailinator Ruby SDK. This REST API client is implemented as a thin wrapper around the [Mailinator API](https://www.mailinator.com/documentation/docs/api/index.html). The OpenAPI specification is the source of truth.
4
4
 
5
- The [Mailinator](https://www.mailinator.com/) REST API client provides a simple way to use the comprehensive Mailinator API.
5
+ [![Gem Version](https://badge.fury.io/rb/mailinator_client.svg)](https://badge.fury.io/rb/mailinator_client)
6
6
 
7
- This client works with Ruby 2.1 and higher. It uses [HTTParty](https://github.com/jnunemaker/httparty) under the covers for the actual HTTP communication.
7
+ > [!NOTE]
8
+ > This client works with Ruby 2.1 and higher. It uses [HTTParty](https://github.com/jnunemaker/httparty) under the covers for the actual HTTP communication.
8
9
 
9
- <br/>
10
+
11
+
12
+ ## API Reference
13
+
14
+ See [Mailinator's API Reference](https://www.mailinator.com/documentation/docs/api/index.html) for all of the currently available API endpoints.
10
15
 
11
16
  ## Installation
12
17
 
@@ -56,6 +61,7 @@ Each of the following is a method on the client object, and returns a wrapper fo
56
61
 
57
62
  * [rules](docs/rules.md)
58
63
  Contains all of the actions that can be performed against the set of [Rules](https://manybrain.github.io/m8rdocs/#rules-api) that the currently authenticated user has access to - such as listing the rules or creating a new rule.
64
+ **Deprecated:** Rules endpoints in this SDK are deprecated.
59
65
 
60
66
  * [messages](docs/messages.md)
61
67
  Contains all of the actions that can be performed against the set of [Messages](https://manybrain.github.io/m8rdocs/#message-api) that the currently authenticated user has access to - such as listing the messages or injecting a new message.
@@ -84,12 +90,18 @@ When the Mailinator API returns a unsuccessful response, an instance of Response
84
90
 
85
91
  ## Testing
86
92
 
87
- Run integration tests with real API Key.
93
+ Run individual integration tests with real API Key.
88
94
 
89
95
  ```ruby
90
96
  ruby -I test test/mailinator_client_api_test.rb
91
97
  ```
92
98
 
99
+ OR run them all:
100
+
101
+ ```ruby
102
+ bundle exec rake test
103
+ ```
104
+
93
105
  Most of the tests require env variables with valid values. Visit tests source code and review `mailinator_client_api_test.rb` file. The more env variables you set, the more tests are run.
94
106
 
95
107
  * `MAILINATOR_TEST_API_TOKEN` - API tokens for authentication; basic requirement across many tests;see also https://manybrain.github.io/m8rdocs/#api-authentication
@@ -104,10 +116,3 @@ Most of the tests require env variables with valid values. Visit tests source co
104
116
  * `MAILINATOR_TEST_AUTH_ID` - authenticator id
105
117
  * `MAILINATOR_TEST_WEBHOOK_INBOX` - inbox for webhook
106
118
  * `MAILINATOR_TEST_WEBHOOK_CUSTOMSERVICE` - custom service for webhook
107
-
108
-
109
- *****
110
-
111
- Copyright (c) 2024 Manybrain, Inc
112
-
113
- <https://www.mailinator.com/>
data/ROADMAP.md ADDED
@@ -0,0 +1,58 @@
1
+ # Roadmap
2
+
3
+ This document tracks completed work, current gaps, and planned improvements for the Mailinator Ruby client.
4
+
5
+ Gap analysis source of truth: Mailinator OpenAPI spec (`version: 2026-03-04`) from:
6
+ `https://raw.githubusercontent.com/manybrain/mailinatordocs/main/openapi/mailinator-api.yaml`
7
+
8
+ ## Hardening (Phase 3)
9
+
10
+ - [ ] Produce and maintain endpoint coverage matrix (OpenAPI operationId -> SDK method)
11
+ - [ ] Add CI check to detect future OpenAPI drift against SDK path+method map
12
+ - [ ] Define policy for operations present in SDK but missing from spec:
13
+ - [ ] keep + mark deprecated
14
+ - [ ] keep + annotate as undocumented
15
+ - [ ] remove in next major release (requires explicit approval)
16
+ - [ ] Define policy for flaky/500-prone integration flows (`messages.fetch_inbox` with `full`/`wait`, `webhooks.private_webhook`):
17
+ - [ ] gate by env vars and/or quarantine tags
18
+ - [ ] separate smoke and full integration suites
19
+
20
+ Webhooks (`lib/mailinator_client/webhooks.rb`):
21
+ - [ ] Add domain-scoped webhook methods matching spec routes
22
+ - [ ] Keep existing private-webhook methods for backward compatibility until deprecation decision is approved
23
+
24
+ - [ ] Fix messages_api_test.rb. Split up into multiple files if needed to isolate new test cases and avoid timeouts. Assert on the body of the responses.
25
+ - [ ] Fix integration test bug: use `MAILINATOR_TEST_WEBHOOKTOKEN_CUSTOMSERVICE` for custom-service webhook tests
26
+ - [ ] Add explicit assertions for custom-service webhook calls
27
+ - [ ] Update README/docs links to current API reference and remove stale `manybrain.github.io/m8rdocs` links
28
+ - [ ] Align docs arg naming with SDK (`domain`, `inbox`, `messageId`)
29
+
30
+
31
+ ## Completed (Phase 1)
32
+
33
+ - [x] Add structural docs (`ROADMAP.md`, `CHANGELOG.md`, `AI_INSTRUCTIONS.md`, `EXAMPLES.md`)
34
+ - [x] Update outdated dependencies (`rake` and `webmock`; `httparty` pinned to latest Ruby 2.6-compatible range)
35
+ - [x] Update version number (`1.0.7`)
36
+ - [x] Publish those changes (minor release)
37
+ - [x] Add optional query parameter support:
38
+ - `messages.fetch_inbox_message` supports optional `delete`
39
+ - `messages.fetch_sms_message` supports inbox listing query params (`skip`, `limit`, `sort`, `decode_subject`/`decodeSubject`, `cursor`, `full`, `wait`, `delete`)
40
+ - [x] Mark deprecated endpoints as deprecated in code/docs:
41
+ - Rules endpoints
42
+ - `client.domains.create_domain` and `client.domains.delete_domain`
43
+
44
+ ## Completed (Phase 2)
45
+
46
+ ### Added Missing Spec Endpoints
47
+
48
+ Messages (`lib/mailinator_client/messages.rb`):
49
+ - [x] Add `fetch_message_summary` for `GET /domains/{domain}/messages/{messageId}/summary`
50
+ - [x] Add `fetch_message_text` for `GET /domains/{domain}/messages/{messageId}/text`
51
+ - [x] Add `fetch_message_text_plain` for `GET /domains/{domain}/messages/{messageId}/textplain`
52
+ - [x] Add `fetch_message_text_html` for `GET /domains/{domain}/messages/{messageId}/texthtml`
53
+ - [x] Add `fetch_message_headers` for `GET /domains/{domain}/messages/{messageId}/headers`
54
+ - [x] Add `stream_domain_messages` for `GET /domains/{domain}/stream`
55
+ - [x] Add `stream_inbox_messages` for `GET /domains/{domain}/stream/{inbox}`
56
+ - [x] Add `list_domain_messages` for `GET /domains/{domain}/inboxes` (covered by `messages.fetch_inbox` with `inbox: "*"`)
57
+
58
+ Note: We are intentionally not adding a separate SDK method for `GET /domains/{domain}/inboxes`. The existing `messages.fetch_inbox` with `inbox: "*"` provides equivalent domain-wide listing. Future gap analyses should treat this as covered.
data/docs/domains.md CHANGED
@@ -37,6 +37,9 @@ puts result
37
37
 
38
38
  ## CreateDomain
39
39
 
40
+ > [!WARNING]
41
+ > Deprecated in this SDK.
42
+
40
43
  This endpoint creates a private domain attached to your account. Note, the domain must be unique to the system and you must have not reached your maximum number of Private Domains.
41
44
 
42
45
  ```ruby
@@ -49,6 +52,9 @@ puts result
49
52
 
50
53
  ## DeleteDomain
51
54
 
55
+ > [!WARNING]
56
+ > Deprecated in this SDK.
57
+
52
58
  This endpoint deletes a Private Domain
53
59
 
54
60
  ```ruby
data/docs/rules.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  Details on the various actions that can be performed on the Rules resource, including the expected parameters and the potential responses.
4
4
 
5
+ > [!WARNING]
6
+ > All Rules endpoints in this SDK are deprecated.
7
+
5
8
  ##### Contents
6
9
 
7
10
  * [CreateRule](#createrule)
@@ -13,7 +16,7 @@ Details on the various actions that can be performed on the Rules resource, incl
13
16
 
14
17
  <br/>
15
18
 
16
- ## CreateRule
19
+ ## CreateRule (Deprecated)
17
20
 
18
21
  Creates a Rule
19
22
 
@@ -28,7 +31,7 @@ puts result
28
31
 
29
32
  <br/>
30
33
 
31
- ## EnableRule
34
+ ## EnableRule (Deprecated)
32
35
 
33
36
  Enables an existing Rule
34
37
 
@@ -42,7 +45,7 @@ puts result
42
45
 
43
46
  <br/>
44
47
 
45
- ## DisableRule
48
+ ## DisableRule (Deprecated)
46
49
 
47
50
  Disables an existing Rule
48
51
 
@@ -56,7 +59,7 @@ puts result
56
59
 
57
60
  <br/>
58
61
 
59
- ## GetAllRules
62
+ ## GetAllRules (Deprecated)
60
63
 
61
64
  Fetches all Rules for a Domain
62
65
 
@@ -68,7 +71,7 @@ puts result
68
71
 
69
72
  <br/>
70
73
 
71
- ## GetRule
74
+ ## GetRule (Deprecated)
72
75
 
73
76
  Fetches a specific rule for a Domain
74
77
 
@@ -82,7 +85,7 @@ puts result
82
85
 
83
86
  <br/>
84
87
 
85
- ## DeleteRule
88
+ ## DeleteRule (Deprecated)
86
89
 
87
90
  Deletes a specific rule for a Domain
88
91
 
@@ -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