mailinator_client 1.0.7 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d662d2fd2a1518a00a7ac85cde34555f177765316ed9b388a7e8f9b0802fed4a
4
- data.tar.gz: 86a12779d39d7ba6fc7ca06a4db6128a2244e1987d56a5d82424c98f2faac972
3
+ metadata.gz: 842259c780481a4557f43335ae76aee7983c5d61f4c191e5513c73a8c513653d
4
+ data.tar.gz: c6581dbcda2131ac8673899a28589c7e19c4acbd52127835a6de24aff0a7e1f8
5
5
  SHA512:
6
- metadata.gz: 4e14a072c15f1704646c9896f7bb02d1f0ba80be1d808b878b0b2725ab41b3348c4fb570dcb95d1db846dde4b2701d52a2740114a233da7d927f27cf3234e18d
7
- data.tar.gz: 45bd500f1c146e4f087a5c3008dc08e41fa79d870d67cda8735cb793d81d7901ed4e67fcc63b9e2350559be5545cc280619e8f21bb2f78e227092800a05001de
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 CHANGED
@@ -1,12 +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
+
1
5
  MAILINATOR_TEST_API_TOKEN=
2
6
  MAILINATOR_TEST_INBOX=
3
7
  MAILINATOR_TEST_PHONE_NUMBER=
4
8
  MAILINATOR_TEST_MESSAGE_WITH_ATTACHMENT_ID=
5
- MAILINATOR_TEST_ATTACHMENT_ID=
9
+
10
+ # Delete domain (WARNING: use with caution - only if you are 100% sure)
6
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.
7
15
  MAILINATOR_TEST_WEBHOOKTOKEN_PRIVATEDOMAIN=
8
16
  MAILINATOR_TEST_WEBHOOKTOKEN_CUSTOMSERVICE=
17
+
18
+ # Authenticator configuration
9
19
  MAILINATOR_TEST_AUTH_SECRET=
10
20
  MAILINATOR_TEST_AUTH_ID=
21
+
22
+ # Webhook configuration
23
+ # Custom service might be something like "twilio" or "sendgrid"
11
24
  MAILINATOR_TEST_WEBHOOK_INBOX=
12
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/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.
data/AI_INSTRUCTIONS.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This document explains the relationship between this Ruby client and the Mailinator OpenAPI specification.
4
4
 
5
- **OpenAPI Specification:** [https://github.com/manybrain/mailinatordocs/blob/main/openapi/mailinator-api.yaml](https://github.com/manybrain/mailinatordocs/blob/main/openapi/mailinator-api.yaml)
5
+ **OpenAPI Specification:** [Found on GitHub](https://github.com/manybrain/mailinatordocs/blob/main/openapi/mailinator-api.yaml)
6
6
 
7
7
  ## Codebase Structure
8
8
 
@@ -85,7 +85,7 @@ Extract every `paths` entry. For each path, record:
85
85
  - The tag (maps to the SDK module directory)
86
86
  - All query parameters defined under `parameters`
87
87
 
88
- ### Step 2 — Catalogue the SDK
88
+ ### Step 2 — Catalog the SDK
89
89
 
90
90
  For each resource file under `lib/mailinator_client/` (`messages.rb`, `domains.rb`, `rules.rb`, etc.):
91
91
  1. Enumerate every public method that issues `@client.request(...)`.
@@ -116,6 +116,9 @@ Compare the base path used by each SDK method against the spec.
116
116
  #### D. Query parameter gaps
117
117
  For each existing SDK method, compare sent query parameters against the spec's declared parameters for that operation. List any missing parameters.
118
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
+
119
122
  ### Step 4 — Build a Plan
120
123
 
121
124
  Before making any changes, write out a plan that includes:
@@ -192,3 +195,11 @@ After implementing:
192
195
  | No-token requests | Supported by instantiating `Client` without `auth_token` (used by some webhook flows). |
193
196
  | Deprecation marker | Use Ruby/YARD style deprecation comments near method definitions and reflect in README/docs. |
194
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 CHANGED
@@ -5,10 +5,30 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project aims to follow [Semantic Versioning](https://semver.org/).
7
7
 
8
- ## [Unreleased]
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]
9
27
 
10
28
  ### Added
11
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`).
12
32
  - `.env.example` with Mailinator integration test variables.
13
33
  - Resource-scoped integration test files:
14
34
  - `test/authenticators_api_test.rb`
@@ -40,11 +60,6 @@ and this project aims to follow [Semantic Versioning](https://semver.org/).
40
60
  - Development: `minitest >= 5.25, < 7.0`, `rake >= 13.0, < 14.0`, `webmock >= 3.26, < 4.0`
41
61
  - Updated integration testing structure by splitting the previous monolithic `test/mailinator_client_api_test.rb`.
42
62
  - Added `.env` loading support in `test/test_helper.rb`.
43
-
44
- ### Fixed
45
-
46
- - Added optional `delete` query parameter support to `messages.fetch_inbox_message`.
47
- - Added inbox-list query parameters to `messages.fetch_sms_message` (`skip`, `limit`, `sort`, `decode_subject`, `cursor`, `full`, `wait`, `delete`).
48
63
  - Hardened API error handling for non-JSON/empty error responses:
49
64
  - `MailinatorClient::ResponseError` now handles `nil` parsed responses safely.
50
65
  - `Client#request` now passes raw response body into `ResponseError`.
data/README.md CHANGED
@@ -90,12 +90,18 @@ When the Mailinator API returns a unsuccessful response, an instance of Response
90
90
 
91
91
  ## Testing
92
92
 
93
- Run integration tests with real API Key.
93
+ Run individual integration tests with real API Key.
94
94
 
95
95
  ```ruby
96
96
  ruby -I test test/mailinator_client_api_test.rb
97
97
  ```
98
98
 
99
+ OR run them all:
100
+
101
+ ```ruby
102
+ bundle exec rake test
103
+ ```
104
+
99
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.
100
106
 
101
107
  * `MAILINATOR_TEST_API_TOKEN` - API tokens for authentication; basic requirement across many tests;see also https://manybrain.github.io/m8rdocs/#api-authentication
data/ROADMAP.md CHANGED
@@ -1,24 +1,58 @@
1
1
  # Roadmap
2
2
 
3
- This document tracks planned improvements for the Mailinator Ruby client.
3
+ This document tracks completed work, current gaps, and planned improvements for the Mailinator Ruby client.
4
4
 
5
- ## Phase 1
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`
6
7
 
7
- - [x] Add structural docs (`ROADMAP.md`, `CHANGELOG.md`, `AI_INSTRUCTIONS.md`, `EXAMPLEs.md`) - completed
8
- - [x] Update outdated dependencies (`rake` and `webmock` updated; `httparty` pinned to latest Ruby 2.6-compatible range)
9
- - [x] Update version number - completed (`1.0.7`)
10
- - [ ] Publish those changes (minor release)
8
+ ## Hardening (Phase 3)
11
9
 
12
- ## Next
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
13
19
 
14
- - [ ] Mark deprecated endpoints as deprecated in code
15
- - Rules endpoints marked deprecated in code/docs
16
- - `client.domains.create_domain` and `client.domains.delete_domain` marked deprecated in code/docs
17
- - [ ] Fix URL path inconsistencies between SDK and OpenAPI specification
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)
18
37
  - [x] Add optional query parameter support:
19
- - `messages.fetch_inbox_message` now supports optional `delete`
20
- - `messages.fetch_sms_message` now supports inbox listing query params (`skip`, `limit`, `sort`, `decode_subject`, `cursor`, `full`, `wait`, `delete`)
21
- - [ ] Implement Streaming Messages endpoint (`/api/v2/domains/private/stream/` and inbox variant) with supported query params (`full`, `limit`, `throttleInterval`, `delete`)
22
- - [ ] Fix integration test bug: custom-service webhook tests use `@webhookTokenPrivateDomain` instead of `@webhookTokenCustomService`
23
- - [ ] Decide policy for flaky/500-prone integration flows (`messages.fetch_inbox` with `full`/`wait`, and `webhooks.private_webhook`) and gate or quarantine accordingly
24
- - [ ] Publish those changes
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.
@@ -6,7 +6,7 @@ module MailinatorClient
6
6
  #
7
7
  # User API for accessing Mailinator data
8
8
  class Client
9
- #attr_reader :auth_token, :url
9
+ attr_reader :auth_token, :url
10
10
 
11
11
  def initialize(options = {})
12
12
  @auth_token = options.fetch(:auth_token, nil)
@@ -47,6 +47,13 @@ module MailinatorClient
47
47
  headers["Authorization"] = @auth_token if @auth_token
48
48
  path = @url + options.fetch(:path, "")
49
49
 
50
+ debug_request = ENV["MAILINATOR_DEBUG_REQUESTS"].to_s.strip.downcase
51
+ if debug_request == "1" || debug_request == "true"
52
+ warn "[mailinator] #{method.to_s.upcase} #{path}"
53
+ warn "[mailinator] headers=#{headers}"
54
+ warn "[mailinator] query=#{Utils.fix_query_arrays(options[:query])}"
55
+ end
56
+
50
57
  response = HTTParty.send(method, path,
51
58
  query: Utils.fix_query_arrays(options[:query]),
52
59
  body: options[:body] && options[:body].to_json(),
@@ -54,6 +61,11 @@ module MailinatorClient
54
61
  timeout: 125
55
62
  )
56
63
 
64
+ if debug_request == "1" || debug_request == "true"
65
+ warn "[mailinator] response_code=#{response.code}"
66
+ warn "[mailinator] response_body=#{response.body}"
67
+ end
68
+
57
69
  result = response.parsed_response
58
70
  if response.code >= 400
59
71
  raise ResponseError.new(response.code, result, response.body)
@@ -39,7 +39,7 @@ module MailinatorClient
39
39
  # access token to call this action.
40
40
  #
41
41
  # Parameters:
42
- # * {string} domainId - The Domain name or the Domain id
42
+ # * {string} domainId - The Domain name or simply 'private'
43
43
  #
44
44
  # Responses:
45
45
  # * Domain (https://manybrain.github.io/m8rdocs/#get-domain)
@@ -100,7 +100,7 @@ module MailinatorClient
100
100
  # access token to call this action.
101
101
  #
102
102
  # Parameters:
103
- # * {string} domainId - The Domain name or the Domain id
103
+ # * {string} domainId - The Domain name or simply 'private'
104
104
  #
105
105
  # Responses:
106
106
  # * Status (https://manybrain.github.io/m8rdocs/#delete-domain)