mailinator_client 1.0.7 → 1.1.1

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: 5b5772a96aa7fe7712e84ceadf80128142dd49f12feee1f3d41a2fe5d261f2eb
4
+ data.tar.gz: db22de067afd78c1b7f552f07ea379c52a40aa3a17693ad9181d4c5194c04aa9
5
5
  SHA512:
6
- metadata.gz: 4e14a072c15f1704646c9896f7bb02d1f0ba80be1d808b878b0b2725ab41b3348c4fb570dcb95d1db846dde4b2701d52a2740114a233da7d927f27cf3234e18d
7
- data.tar.gz: 45bd500f1c146e4f087a5c3008dc08e41fa79d870d67cda8735cb793d81d7901ed4e67fcc63b9e2350559be5545cc280619e8f21bb2f78e227092800a05001de
6
+ metadata.gz: 330f04a4ce7ffe53d8bfde1427fb914bf37403406454c3ac416284b8ecb6d7be102b5ef48bd521ccc4a38e6e684d24f39bbd44230ac22faa61034b8c3c2f1220
7
+ data.tar.gz: edf9ee55e65670d3c25613306e3741258c482576af9431572ad855e7e73abe1182df761514559cea68b530e1475409246e19cafc9ac03905f5677fc8652a3d9b
@@ -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 follow the test expectations in `AGENTS.md` (specifically: no mocked endpoint integration tests, 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,17 @@
1
+ All AI agents (Codex, Copilot, Antigravity) must follow this file and the rules in `.agent/rules/`.
2
+
3
+ # Project Standards and Agent Behavior
4
+
5
+ - **Language and tests:** This is a Ruby SDK tested with Minitest.
6
+ - **Primary workflow:** Use the `.agent/tdd-flow` skill for feature implementation and bug fixes, subject to `.agent/rules/tdd.md`.
7
+ - **Test style:** Write behavior-driven assertions. Endpoint integration tests must use real HTTP requests; do not mock them.
8
+ - **Skipped tests:** Never infer or change implementation for a skipped test. Leave the underlying code untouched.
9
+ - **OpenAPI source of truth:** Use the [Mailinator OpenAPI specification](https://raw.githubusercontent.com/manybrain/mailinatordocs/main/openapi/mailinator-api.yaml).
10
+ - **Spec strictness:** Only assert behavior and properties explicitly defined by the OpenAPI specification. Do not invent validations. Flag ambiguities or gaps for human review.
11
+ - **Request paths:** Resource wrappers use paths relative to `https://api.mailinator.com/api/v2`; do not include `/api/v2` or `/v2` in resource method paths.
12
+ - **Gap-analysis changes:** Follow `docs/openapi-maintenance.md`. Present the implementation plan and wait for approval before changing SDK coverage.
13
+
14
+ # Project References
15
+
16
+ - `docs/openapi-maintenance.md` documents the SDK architecture, conventions, and OpenAPI gap-analysis workflow.
17
+ - `ROADMAP.md` tracks known gaps and planned improvements.
data/CHANGELOG.md CHANGED
@@ -5,10 +5,42 @@ 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.1]
9
+
10
+ ### Security
11
+
12
+ - Updated `httparty` to `>= 0.24, < 0.25` to address the SSRF and API-key leakage vulnerability in CVE-2025-68696.
13
+ - Required `addressable >= 2.9, < 3.0` for development to address the URI-template ReDoS vulnerability in CVE-2026-35611.
14
+
15
+ ### Changed
16
+
17
+ - Raised the minimum supported Ruby version from 2.1 to 2.7, matching the requirement of the fixed `httparty` release line.
18
+ - Updated development dependency floors for `minitest`, `rake`, and `webmock`.
19
+
20
+ ## [1.1.0]
21
+
22
+ ### Changed
23
+
24
+ - Added `messages.fetch_message_summary` for `GET /api/v2/domains/{domain}/messages/{messageId}/summary`.
25
+ - Added `messages.fetch_message_text` for `GET /api/v2/domains/{domain}/messages/{messageId}/text`.
26
+ - Added `messages.fetch_message_textplain` for `GET /api/v2/domains/{domain}/messages/{messageId}/textplain`.
27
+ - Added `messages.fetch_message_texthtml` for `GET /api/v2/domains/{domain}/messages/{messageId}/texthtml`.
28
+ - Added `messages.fetch_message_headers` for `GET /api/v2/domains/{domain}/messages/{messageId}/headers`.
29
+ - Added `messages.stream_domain_messages` for `GET /api/v2/domains/{domain}/stream`.
30
+ - Added `messages.stream_inbox_messages` for `GET /api/v2/domains/{domain}/stream/{inbox}`.
31
+ - Removed `wait` query parameter from `messages.fetch_sms_message` because the endpoint does not support it.
32
+ - Removed `wait` query parameter from `messages.fetch_inbox`.
33
+ - Fixed `webhooks.private_webhook` to include the webhook payload in the request body.
34
+ - Debugging and test updates.
35
+ - Made attachment download tests derive attachment IDs from the attachments list, removing the need for `MAILINATOR_TEST_ATTACHMENT_ID`.
36
+ - Documented that `GET /domains/{domain}/inboxes` is covered by `messages.fetch_inbox` with `inbox: "*"`.
37
+
38
+ ## [1.0.7]
9
39
 
10
40
  ### Added
11
41
 
42
+ - Optional `delete` query parameter support to `messages.fetch_inbox_message`.
43
+ - Inbox-list query parameters to `messages.fetch_sms_message` (`skip`, `limit`, `sort`, `decode_subject`, `cursor`, `full`, `delete`).
12
44
  - `.env.example` with Mailinator integration test variables.
13
45
  - Resource-scoped integration test files:
14
46
  - `test/authenticators_api_test.rb`
@@ -40,11 +72,6 @@ and this project aims to follow [Semantic Versioning](https://semver.org/).
40
72
  - Development: `minitest >= 5.25, < 7.0`, `rake >= 13.0, < 14.0`, `webmock >= 3.26, < 4.0`
41
73
  - Updated integration testing structure by splitting the previous monolithic `test/mailinator_client_api_test.rb`.
42
74
  - 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
75
  - Hardened API error handling for non-JSON/empty error responses:
49
76
  - `MailinatorClient::ResponseError` now handles `nil` parsed responses safely.
50
77
  - `Client#request` now passes raw response body into `ResponseError`.
data/README.md CHANGED
@@ -90,13 +90,19 @@ 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 an individual integration test with a real API key:
94
94
 
95
95
  ```ruby
96
- ruby -I test test/mailinator_client_api_test.rb
96
+ bundle exec ruby -Itest test/messages_api_test.rb
97
97
  ```
98
98
 
99
- 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.
99
+ Or run the full test suite:
100
+
101
+ ```ruby
102
+ bundle exec rake test
103
+ ```
104
+
105
+ Most integration tests require environment variables with valid values. Review the files under `test/` and `.env.example`; the tests whose required variables are unavailable will be skipped.
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
102
108
  * `MAILINATOR_TEST_INBOX` - some already existing inbox within the private domain
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`, `docs/openapi-maintenance.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.
@@ -0,0 +1,150 @@
1
+ # OpenAPI Maintenance
2
+
3
+ This document describes the Ruby client's architecture and the workflow for auditing it against the Mailinator OpenAPI specification.
4
+
5
+ **OpenAPI specification:** [raw YAML](https://raw.githubusercontent.com/manybrain/mailinatordocs/main/openapi/mailinator-api.yaml) ([GitHub view](https://github.com/manybrain/mailinatordocs/blob/main/openapi/mailinator-api.yaml))
6
+
7
+ ## Codebase Structure
8
+
9
+ The structure under `lib/mailinator_client/` reflects Mailinator API resource groups.
10
+
11
+ - `lib/mailinator_client.rb` loads all components and delegates module-level calls to a singleton `Client`.
12
+ - `lib/mailinator_client/client.rb` implements shared HTTP request behavior.
13
+ - `authenticators.rb`, `domains.rb`, `messages.rb`, `rules.rb`, `stats.rb`, and `webhooks.rb` contain resource wrappers.
14
+ - `utils.rb` normalizes input and query structures.
15
+ - `error.rb` defines `ResponseError`.
16
+ - `version.rb` defines gem version metadata used in user-agent headers.
17
+
18
+ ## Request and Response Conventions
19
+
20
+ The client uses resource wrappers rather than per-operation request classes. Each resource method generally:
21
+
22
+ 1. Accepts a params hash and normalizes its keys with `Utils.symbolize_hash_keys`.
23
+ 2. Validates required keys with `ArgumentError`.
24
+ 3. Constructs a resource-relative `path`, `query`, and optional `body`.
25
+ 4. Calls `@client.request(...)`.
26
+
27
+ `Client#request` joins resource-relative paths such as `/domains/example.com/inboxes/test` to the base URL `https://api.mailinator.com/api/v2`. Resource methods must not include `/api/v2` or `/v2` in their paths.
28
+
29
+ Requests use HTTParty with JSON headers and optional authorization. Responses with status codes of 400 or higher raise `MailinatorClient::ResponseError`, which exposes the HTTP `code`, API error `type`, and response message.
30
+
31
+ The SDK generally returns parsed Hash and Array values rather than typed model objects.
32
+
33
+ ## Gap Analysis Workflow
34
+
35
+ Use this workflow to identify differences between the OpenAPI specification and SDK coverage.
36
+
37
+ ### 1. Read the OpenAPI Specification
38
+
39
+ Retrieve and parse the raw YAML linked above. For every `paths` entry, record:
40
+
41
+ - HTTP method
42
+ - Full specification path
43
+ - `operationId`
44
+ - Tag
45
+ - Path and query parameters
46
+ - Request and response schemas relevant to implementation and tests
47
+
48
+ ### 2. Catalog the SDK
49
+
50
+ For each resource wrapper under `lib/mailinator_client/`:
51
+
52
+ 1. Enumerate every public method that calls `@client.request(...)`.
53
+ 2. Record its HTTP method and resource-relative path template.
54
+ 3. Record the query parameters it sends.
55
+ 4. Note methods marked as deprecated.
56
+ 5. Map the resource file to the corresponding OpenAPI tag.
57
+
58
+ ### 3. Report Gaps
59
+
60
+ Report these categories:
61
+
62
+ #### Operations missing from the SDK
63
+
64
+ List specification operations with no corresponding Ruby method.
65
+
66
+ #### SDK operations missing from the specification
67
+
68
+ List SDK methods whose resolved path and HTTP method have no specification entry. Note deprecated methods separately; flag other methods for clarification.
69
+
70
+ #### URL construction mismatches
71
+
72
+ The specification paths begin with `/api/v2/`, while SDK resource methods use paths relative to the client's `/api/v2` base URL. Flag:
73
+
74
+ - A client base URL that does not end in `/api/v2`.
75
+ - Resource paths containing `/api/v2` or `/v2`, which would duplicate or bypass the client base path.
76
+ - Resolved SDK URLs that do not match the specification path.
77
+
78
+ #### Parameter gaps
79
+
80
+ For each matched operation, compare the SDK's path and query parameters with those declared by the specification.
81
+
82
+ #### Domain-listing exception
83
+
84
+ Treat `GET /api/v2/domains/{domain}/inboxes` as covered by `messages.fetch_inbox` with `inbox: "*"`. Do not report it as a missing SDK method.
85
+
86
+ ### 4. Propose a Plan
87
+
88
+ Before changing code, present a plan containing:
89
+
90
+ 1. New methods, grouped by resource file.
91
+ 2. URL-construction fixes.
92
+ 3. Parameter additions.
93
+ 4. Deprecated or undocumented methods, without removing them unless explicitly approved.
94
+ 5. Response-shape expectations grounded in the specification.
95
+
96
+ Wait for approval before implementing SDK coverage changes.
97
+
98
+ ### 5. Implement
99
+
100
+ Follow the patterns already present in the matching resource wrapper:
101
+
102
+ ```ruby
103
+ def get_example(params = {})
104
+ params = Utils.symbolize_hash_keys(params)
105
+ query_params = {}
106
+ headers = {}
107
+ body = nil
108
+
109
+ raise ArgumentError, "domain is required" unless params.has_key?(:domain)
110
+ raise ArgumentError, "id is required" unless params.has_key?(:id)
111
+
112
+ path = "/domains/#{params[:domain]}/examples/#{params[:id]}"
113
+
114
+ @client.request(
115
+ method: :get,
116
+ path: path,
117
+ query: query_params,
118
+ headers: headers,
119
+ body: body
120
+ )
121
+ end
122
+ ```
123
+
124
+ Keep methods in the appropriate resource file, use snake_case method names, preserve the parameter naming conventions of that file, and document optional parameters.
125
+
126
+ ## Verification
127
+
128
+ Run the complete suite:
129
+
130
+ ```sh
131
+ bundle exec rake test
132
+ ```
133
+
134
+ Run a focused test when appropriate:
135
+
136
+ ```sh
137
+ bundle exec ruby -Itest test/messages_query_params_test.rb
138
+ ```
139
+
140
+ Integration tests load local values from `.env` and skip when their required variables are missing. For each changed operation, verify that the resolved URL and query parameters exactly match the specification. Assertions must test response semantics and only fields guaranteed by the specification.
141
+
142
+ ## Additional Conventions
143
+
144
+ | Convention | Detail |
145
+ |---|---|
146
+ | Version source | `MailinatorClient::VERSION` in `lib/mailinator_client/version.rb`, referenced by the gemspec and user-agent string |
147
+ | Authorization | `Client#request` adds the `Authorization` header when an auth token is provided |
148
+ | No-token requests | Supported for flows such as some webhook operations |
149
+ | Deprecation | Use Ruby/YARD comments and reflect the status in user-facing documentation |
150
+ | Entrypoint | `lib/mailinator_client.rb` requires resource and support files and delegates to the singleton client |
@@ -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)