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 +4 -4
- data/.agent/rules/tdd.md +7 -0
- data/.agent/tdd-flow/skill.md +15 -0
- data/.env.example +14 -1
- data/.github/copilot-instructions.md +7 -0
- data/AGENTS.md +17 -0
- data/CHANGELOG.md +33 -6
- data/README.md +9 -3
- data/ROADMAP.md +51 -17
- data/docs/openapi-maintenance.md +150 -0
- data/lib/mailinator_client/client.rb +13 -1
- data/lib/mailinator_client/domains.rb +2 -2
- data/lib/mailinator_client/messages.rb +442 -25
- data/lib/mailinator_client/rules.rb +6 -6
- data/lib/mailinator_client/version.rb +1 -1
- data/lib/mailinator_client/webhooks.rb +1 -0
- data/mailinator_client.gemspec +6 -5
- data/test/messages_api_test.rb +205 -67
- data/test/messages_headers_api_test.rb +30 -0
- data/test/messages_query_params_test.rb +58 -36
- data/test/messages_stream_domain_api_test.rb +39 -0
- data/test/messages_stream_inbox_api_test.rb +40 -0
- data/test/messages_summary_api_test.rb +28 -0
- data/test/messages_text_api_test.rb +28 -0
- data/test/messages_texthtml_api_test.rb +28 -0
- data/test/messages_textplain_api_test.rb +28 -0
- data/test/webhooks_api_test.rb +3 -3
- metadata +54 -16
- data/AI_INSTRUCTIONS.md +0 -194
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
|
|
2
|
+
|
|
3
|
+
class MessagesTextHtmlApiTest < Minitest::Test
|
|
4
|
+
def test_fetch_message_texthtml_endpoint
|
|
5
|
+
require_env!(
|
|
6
|
+
"MAILINATOR_TEST_API_TOKEN",
|
|
7
|
+
"MAILINATOR_TEST_MESSAGE_WITH_ATTACHMENT_ID"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
client = integration_client
|
|
11
|
+
domain_name = ENV["MAILINATOR_TEST_DOMAIN"].to_s.strip
|
|
12
|
+
domain_name = first_domain_name(client) if domain_name.empty?
|
|
13
|
+
|
|
14
|
+
response = client.messages.fetch_message_texthtml(
|
|
15
|
+
domain: domain_name,
|
|
16
|
+
messageId: ENV["MAILINATOR_TEST_MESSAGE_WITH_ATTACHMENT_ID"]
|
|
17
|
+
) rescue begin
|
|
18
|
+
e = $!
|
|
19
|
+
if e.is_a?(MailinatorClient::ResponseError)
|
|
20
|
+
flunk "Expected HTTP 200 from message text/html endpoint, got HTTP #{e.code}"
|
|
21
|
+
end
|
|
22
|
+
raise
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
assert_kind_of(Hash, response, "Expected message text/html response to be a JSON object")
|
|
26
|
+
assert_equal(["text/html"], response.keys.sort, "Expected only the text/html property")
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
|
|
2
|
+
|
|
3
|
+
class MessagesTextPlainApiTest < Minitest::Test
|
|
4
|
+
def test_fetch_message_textplain_endpoint
|
|
5
|
+
require_env!(
|
|
6
|
+
"MAILINATOR_TEST_API_TOKEN",
|
|
7
|
+
"MAILINATOR_TEST_MESSAGE_WITH_ATTACHMENT_ID"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
client = integration_client
|
|
11
|
+
domain_name = ENV["MAILINATOR_TEST_DOMAIN"].to_s.strip
|
|
12
|
+
domain_name = first_domain_name(client) if domain_name.empty?
|
|
13
|
+
|
|
14
|
+
response = client.messages.fetch_message_textplain(
|
|
15
|
+
domain: domain_name,
|
|
16
|
+
messageId: ENV["MAILINATOR_TEST_MESSAGE_WITH_ATTACHMENT_ID"]
|
|
17
|
+
) rescue begin
|
|
18
|
+
e = $!
|
|
19
|
+
if e.is_a?(MailinatorClient::ResponseError)
|
|
20
|
+
flunk "Expected HTTP 200 from message text/plain endpoint, got HTTP #{e.code}"
|
|
21
|
+
end
|
|
22
|
+
raise
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
assert_kind_of(Hash, response, "Expected text/plain response to be a JSON object")
|
|
26
|
+
assert_equal(["text/plain"], response.keys.sort, "Expected only the text/plain property")
|
|
27
|
+
end
|
|
28
|
+
end
|
data/test/webhooks_api_test.rb
CHANGED
|
@@ -4,6 +4,7 @@ class WebhooksApiTest < Minitest::Test
|
|
|
4
4
|
def test_webhooks_endpoints
|
|
5
5
|
require_env!(
|
|
6
6
|
"MAILINATOR_TEST_WEBHOOKTOKEN_PRIVATEDOMAIN",
|
|
7
|
+
"MAILINATOR_TEST_WEBHOOKTOKEN_CUSTOMSERVICE",
|
|
7
8
|
"MAILINATOR_TEST_WEBHOOK_INBOX",
|
|
8
9
|
"MAILINATOR_TEST_WEBHOOK_CUSTOMSERVICE"
|
|
9
10
|
)
|
|
@@ -32,15 +33,14 @@ class WebhooksApiTest < Minitest::Test
|
|
|
32
33
|
assert response != nil, "Expected private inbox webhook response to not be nil"
|
|
33
34
|
assert response["status"] == "ok", "Expected private inbox webhook response to be ok"
|
|
34
35
|
|
|
35
|
-
# Known bug: currently uses private-domain token, not custom-service token.
|
|
36
36
|
client_without_auth.webhooks.private_custom_service_webhook(
|
|
37
|
-
whToken: ENV["
|
|
37
|
+
whToken: ENV["MAILINATOR_TEST_WEBHOOKTOKEN_CUSTOMSERVICE"],
|
|
38
38
|
customService: ENV["MAILINATOR_TEST_WEBHOOK_CUSTOMSERVICE"],
|
|
39
39
|
webhook: webhook
|
|
40
40
|
)
|
|
41
41
|
|
|
42
42
|
client_without_auth.webhooks.private_custom_service_inbox_webhook(
|
|
43
|
-
whToken: ENV["
|
|
43
|
+
whToken: ENV["MAILINATOR_TEST_WEBHOOKTOKEN_CUSTOMSERVICE"],
|
|
44
44
|
customService: ENV["MAILINATOR_TEST_WEBHOOK_CUSTOMSERVICE"],
|
|
45
45
|
inbox: ENV["MAILINATOR_TEST_WEBHOOK_INBOX"],
|
|
46
46
|
webhook: webhook
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mailinator_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Manybrain, LLC
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-08-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|
|
@@ -16,47 +16,67 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0.
|
|
19
|
+
version: '0.24'
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '0.
|
|
22
|
+
version: '0.25'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
27
|
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '0.
|
|
29
|
+
version: '0.24'
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '0.
|
|
32
|
+
version: '0.25'
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
name: addressable
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2.9'
|
|
40
|
+
- - "<"
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: '3.0'
|
|
43
|
+
type: :development
|
|
44
|
+
prerelease: false
|
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - ">="
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '2.9'
|
|
50
|
+
- - "<"
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '3.0'
|
|
33
53
|
- !ruby/object:Gem::Dependency
|
|
34
54
|
name: minitest
|
|
35
55
|
requirement: !ruby/object:Gem::Requirement
|
|
36
56
|
requirements:
|
|
37
57
|
- - ">="
|
|
38
58
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '5.
|
|
59
|
+
version: '5.26'
|
|
40
60
|
- - "<"
|
|
41
61
|
- !ruby/object:Gem::Version
|
|
42
|
-
version: '
|
|
62
|
+
version: '6.0'
|
|
43
63
|
type: :development
|
|
44
64
|
prerelease: false
|
|
45
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
46
66
|
requirements:
|
|
47
67
|
- - ">="
|
|
48
68
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: '5.
|
|
69
|
+
version: '5.26'
|
|
50
70
|
- - "<"
|
|
51
71
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: '
|
|
72
|
+
version: '6.0'
|
|
53
73
|
- !ruby/object:Gem::Dependency
|
|
54
74
|
name: rake
|
|
55
75
|
requirement: !ruby/object:Gem::Requirement
|
|
56
76
|
requirements:
|
|
57
77
|
- - ">="
|
|
58
78
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: '13.
|
|
79
|
+
version: '13.4'
|
|
60
80
|
- - "<"
|
|
61
81
|
- !ruby/object:Gem::Version
|
|
62
82
|
version: '14.0'
|
|
@@ -66,7 +86,7 @@ dependencies:
|
|
|
66
86
|
requirements:
|
|
67
87
|
- - ">="
|
|
68
88
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '13.
|
|
89
|
+
version: '13.4'
|
|
70
90
|
- - "<"
|
|
71
91
|
- !ruby/object:Gem::Version
|
|
72
92
|
version: '14.0'
|
|
@@ -76,7 +96,7 @@ dependencies:
|
|
|
76
96
|
requirements:
|
|
77
97
|
- - ">="
|
|
78
98
|
- !ruby/object:Gem::Version
|
|
79
|
-
version:
|
|
99
|
+
version: 3.26.2
|
|
80
100
|
- - "<"
|
|
81
101
|
- !ruby/object:Gem::Version
|
|
82
102
|
version: '4.0'
|
|
@@ -86,7 +106,7 @@ dependencies:
|
|
|
86
106
|
requirements:
|
|
87
107
|
- - ">="
|
|
88
108
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
109
|
+
version: 3.26.2
|
|
90
110
|
- - "<"
|
|
91
111
|
- !ruby/object:Gem::Version
|
|
92
112
|
version: '4.0'
|
|
@@ -97,12 +117,15 @@ executables: []
|
|
|
97
117
|
extensions: []
|
|
98
118
|
extra_rdoc_files: []
|
|
99
119
|
files:
|
|
120
|
+
- ".agent/rules/tdd.md"
|
|
121
|
+
- ".agent/tdd-flow/skill.md"
|
|
100
122
|
- ".env.example"
|
|
123
|
+
- ".github/copilot-instructions.md"
|
|
101
124
|
- ".gitignore"
|
|
102
125
|
- ".markdownlint.json"
|
|
103
126
|
- ".ruby-version"
|
|
104
127
|
- ".travis.yml"
|
|
105
|
-
-
|
|
128
|
+
- AGENTS.md
|
|
106
129
|
- CHANGELOG.md
|
|
107
130
|
- EXAMPLES.md
|
|
108
131
|
- Gemfile
|
|
@@ -113,6 +136,7 @@ files:
|
|
|
113
136
|
- docs/authenticators.md
|
|
114
137
|
- docs/domains.md
|
|
115
138
|
- docs/messages.md
|
|
139
|
+
- docs/openapi-maintenance.md
|
|
116
140
|
- docs/rules.md
|
|
117
141
|
- docs/stats.md
|
|
118
142
|
- docs/webhooks.md
|
|
@@ -131,7 +155,14 @@ files:
|
|
|
131
155
|
- test/authenticators_api_test.rb
|
|
132
156
|
- test/domains_api_test.rb
|
|
133
157
|
- test/messages_api_test.rb
|
|
158
|
+
- test/messages_headers_api_test.rb
|
|
134
159
|
- test/messages_query_params_test.rb
|
|
160
|
+
- test/messages_stream_domain_api_test.rb
|
|
161
|
+
- test/messages_stream_inbox_api_test.rb
|
|
162
|
+
- test/messages_summary_api_test.rb
|
|
163
|
+
- test/messages_text_api_test.rb
|
|
164
|
+
- test/messages_texthtml_api_test.rb
|
|
165
|
+
- test/messages_textplain_api_test.rb
|
|
135
166
|
- test/rules_api_test.rb
|
|
136
167
|
- test/stats_api_test.rb
|
|
137
168
|
- test/test_helper.rb
|
|
@@ -148,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
148
179
|
requirements:
|
|
149
180
|
- - ">="
|
|
150
181
|
- !ruby/object:Gem::Version
|
|
151
|
-
version: '2.
|
|
182
|
+
version: '2.7'
|
|
152
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
184
|
requirements:
|
|
154
185
|
- - ">="
|
|
@@ -163,7 +194,14 @@ test_files:
|
|
|
163
194
|
- test/authenticators_api_test.rb
|
|
164
195
|
- test/domains_api_test.rb
|
|
165
196
|
- test/messages_api_test.rb
|
|
197
|
+
- test/messages_headers_api_test.rb
|
|
166
198
|
- test/messages_query_params_test.rb
|
|
199
|
+
- test/messages_stream_domain_api_test.rb
|
|
200
|
+
- test/messages_stream_inbox_api_test.rb
|
|
201
|
+
- test/messages_summary_api_test.rb
|
|
202
|
+
- test/messages_text_api_test.rb
|
|
203
|
+
- test/messages_texthtml_api_test.rb
|
|
204
|
+
- test/messages_textplain_api_test.rb
|
|
167
205
|
- test/rules_api_test.rb
|
|
168
206
|
- test/stats_api_test.rb
|
|
169
207
|
- test/test_helper.rb
|
data/AI_INSTRUCTIONS.md
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
# AI Instructions
|
|
2
|
-
|
|
3
|
-
This document explains the relationship between this Ruby client and the Mailinator OpenAPI specification.
|
|
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)
|
|
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 — Catalogue 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
|
-
### Step 4 — Build a Plan
|
|
120
|
-
|
|
121
|
-
Before making any changes, write out a plan that includes:
|
|
122
|
-
|
|
123
|
-
1. **New methods to add** — one method per missing `operationId`, grouped by resource file.
|
|
124
|
-
2. **URL fixes** — list every file where the prefix needs to change from `/v2/` to `/api/v2/`.
|
|
125
|
-
3. **Query parameter additions** — list every file and which parameters to add.
|
|
126
|
-
4. **Deprecated methods** — decide whether to keep and mark as deprecated or remove. Do not remove without confirmation.
|
|
127
|
-
5. **Response/entity notes** — list response shape expectations or wrappers needed for consistency.
|
|
128
|
-
|
|
129
|
-
Present the plan to the user and wait for approval before proceeding.
|
|
130
|
-
|
|
131
|
-
### Step 5 — Implement
|
|
132
|
-
|
|
133
|
-
Follow the existing patterns in the codebase:
|
|
134
|
-
|
|
135
|
-
#### Adding a new method
|
|
136
|
-
|
|
137
|
-
Use an existing method in the matching resource file as a template.
|
|
138
|
-
|
|
139
|
-
```ruby
|
|
140
|
-
def get_example(params = {})
|
|
141
|
-
params = Utils.symbolize_hash_keys(params)
|
|
142
|
-
query_params = {}
|
|
143
|
-
headers = {}
|
|
144
|
-
body = nil
|
|
145
|
-
|
|
146
|
-
raise ArgumentError.new("domain is required") unless params.has_key?(:domain)
|
|
147
|
-
raise ArgumentError.new("id is required") unless params.has_key?(:id)
|
|
148
|
-
|
|
149
|
-
path = "/domains/#{params[:domain]}/examples/#{params[:id]}"
|
|
150
|
-
|
|
151
|
-
@client.request(
|
|
152
|
-
method: :get,
|
|
153
|
-
path: path,
|
|
154
|
-
query: query_params,
|
|
155
|
-
headers: headers,
|
|
156
|
-
body: body
|
|
157
|
-
)
|
|
158
|
-
end
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
Key rules:
|
|
162
|
-
- **Always** use `/api/v2/` as the path prefix — never `/v2/`.
|
|
163
|
-
- Keep methods in the appropriate resource file (`messages.rb`, `rules.rb`, etc.).
|
|
164
|
-
- Validate required params with `ArgumentError`.
|
|
165
|
-
- Use snake_case method names and preserve existing naming conventions in the file.
|
|
166
|
-
|
|
167
|
-
#### Fixing a URL prefix
|
|
168
|
-
|
|
169
|
-
If any hardcoded URL includes `/v2/`, change it to `/api/v2/`. Prefer resource-relative `path` values (`/domains/...`) and let `Client#request` prepend base URL.
|
|
170
|
-
|
|
171
|
-
#### Adding a missing query parameter
|
|
172
|
-
|
|
173
|
-
Add an assignment in the method's query assembly:
|
|
174
|
-
```ruby
|
|
175
|
-
query_params[:my_param] = params[:myParam] if params.has_key?(:myParam)
|
|
176
|
-
```
|
|
177
|
-
Then document the optional parameter in the method comment block.
|
|
178
|
-
|
|
179
|
-
### Step 6 — Verify
|
|
180
|
-
|
|
181
|
-
After implementing:
|
|
182
|
-
1. Run tests: `ruby -I test test/mailinator_client_api_test.rb` (with required env vars).
|
|
183
|
-
2. Run lint/static checks if configured for this repo.
|
|
184
|
-
3. Manually verify at least one changed method generates the exact spec path and sends expected query params.
|
|
185
|
-
|
|
186
|
-
### Notes on SDK Conventions
|
|
187
|
-
|
|
188
|
-
| Convention | Detail |
|
|
189
|
-
|---|---|
|
|
190
|
-
| Version source | `lib/mailinator_client/version.rb` (`MailinatorClient::VERSION`), referenced by gemspec and user-agent string. |
|
|
191
|
-
| Auth header | Set in `Client#request` as `Authorization` when `auth_token` is provided. |
|
|
192
|
-
| No-token requests | Supported by instantiating `Client` without `auth_token` (used by some webhook flows). |
|
|
193
|
-
| Deprecation marker | Use Ruby/YARD style deprecation comments near method definitions and reflect in README/docs. |
|
|
194
|
-
| Entrypoint loading | `lib/mailinator_client.rb` requires resource/support files and delegates module methods to singleton client. |
|