unione 1.1.3

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 (146) hide show
  1. checksums.yaml +7 -0
  2. data/AGENTS.md +99 -0
  3. data/LICENSE +21 -0
  4. data/README.md +270 -0
  5. data/docs/ConfirmedEmail.md +109 -0
  6. data/docs/Domain.md +257 -0
  7. data/docs/Email.md +126 -0
  8. data/docs/EmailValidation.md +54 -0
  9. data/docs/EventDump.md +157 -0
  10. data/docs/Obsolete.md +119 -0
  11. data/docs/Project.md +174 -0
  12. data/docs/Suppression.md +163 -0
  13. data/docs/System.md +73 -0
  14. data/docs/Tag.md +73 -0
  15. data/docs/Template.md +164 -0
  16. data/docs/Webhook.md +182 -0
  17. data/lib/unione/api/confirmed_email/confirmed_email_api.rb +47 -0
  18. data/lib/unione/api/confirmed_email/model/confirmed_email.rb +49 -0
  19. data/lib/unione/api/confirmed_email/model/confirmed_email_create_response.rb +50 -0
  20. data/lib/unione/api/confirmed_email/model/confirmed_email_delete_response.rb +50 -0
  21. data/lib/unione/api/confirmed_email/model/confirmed_email_list_response.rb +50 -0
  22. data/lib/unione/api/confirmed_email/model/confirmed_email_request.rb +42 -0
  23. data/lib/unione/api/domain/domain_api.rb +129 -0
  24. data/lib/unione/api/domain/model/dkim_status.rb +18 -0
  25. data/lib/unione/api/domain/model/domain_delete_request.rb +42 -0
  26. data/lib/unione/api/domain/model/domain_delete_response.rb +51 -0
  27. data/lib/unione/api/domain/model/domain_get_dns_records_request.rb +42 -0
  28. data/lib/unione/api/domain/model/domain_get_dns_records_response.rb +76 -0
  29. data/lib/unione/api/domain/model/domain_get_sandbox_domain_response.rb +51 -0
  30. data/lib/unione/api/domain/model/domain_list_request.rb +60 -0
  31. data/lib/unione/api/domain/model/domain_list_response.rb +51 -0
  32. data/lib/unione/api/domain/model/domain_list_response_domains_item.rb +58 -0
  33. data/lib/unione/api/domain/model/domain_list_response_domains_item_dkim.rb +52 -0
  34. data/lib/unione/api/domain/model/domain_list_response_domains_item_verification_record.rb +50 -0
  35. data/lib/unione/api/domain/model/domain_validate_dkim_request.rb +42 -0
  36. data/lib/unione/api/domain/model/domain_validate_dkim_response.rb +51 -0
  37. data/lib/unione/api/domain/model/domain_validate_verification_record_request.rb +42 -0
  38. data/lib/unione/api/domain/model/domain_validate_verification_record_response.rb +51 -0
  39. data/lib/unione/api/email/email_api.rb +56 -0
  40. data/lib/unione/api/email/model/email_send_request.rb +42 -0
  41. data/lib/unione/api/email/model/email_send_response.rb +83 -0
  42. data/lib/unione/api/email/model/email_subscribe_request.rb +58 -0
  43. data/lib/unione/api/email/model/message_object.rb +291 -0
  44. data/lib/unione/api/email/model/message_object_options.rb +70 -0
  45. data/lib/unione/api/email/model/message_object_recipients_item.rb +77 -0
  46. data/lib/unione/api/email_validation/email_validation_api.rb +34 -0
  47. data/lib/unione/api/email_validation/model/email_validation_single_request.rb +42 -0
  48. data/lib/unione/api/email_validation/model/email_validation_single_response.rb +140 -0
  49. data/lib/unione/api/event_dump/event_dump_api.rb +67 -0
  50. data/lib/unione/api/event_dump/model/event_dump_create_request.rb +119 -0
  51. data/lib/unione/api/event_dump/model/event_dump_create_response.rb +52 -0
  52. data/lib/unione/api/event_dump/model/event_dump_delete_request.rb +43 -0
  53. data/lib/unione/api/event_dump/model/event_dump_files_object.rb +51 -0
  54. data/lib/unione/api/event_dump/model/event_dump_get_request.rb +43 -0
  55. data/lib/unione/api/event_dump/model/event_dump_get_response.rb +51 -0
  56. data/lib/unione/api/event_dump/model/event_dump_list_response.rb +52 -0
  57. data/lib/unione/api/event_dump/model/event_dump_object.rb +66 -0
  58. data/lib/unione/api/event_dump/model/filter_object.rb +139 -0
  59. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_check_request.rb +42 -0
  60. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_check_response.rb +59 -0
  61. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_list_request.rb +43 -0
  62. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_list_response.rb +51 -0
  63. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_list_response_unsubscribed_item.rb +50 -0
  64. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_set_message.rb +25 -0
  65. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_set_request.rb +42 -0
  66. data/lib/unione/api/obsolete/model/obsolete_unsubscribed_set_response.rb +64 -0
  67. data/lib/unione/api/obsolete/obsolete_api.rb +57 -0
  68. data/lib/unione/api/project/model/project_create_request.rb +42 -0
  69. data/lib/unione/api/project/model/project_create_response.rb +60 -0
  70. data/lib/unione/api/project/model/project_delete_request.rb +52 -0
  71. data/lib/unione/api/project/model/project_list_object.rb +146 -0
  72. data/lib/unione/api/project/model/project_list_request.rb +50 -0
  73. data/lib/unione/api/project/model/project_list_response.rb +51 -0
  74. data/lib/unione/api/project/model/project_object.rb +94 -0
  75. data/lib/unione/api/project/model/project_update_object.rb +130 -0
  76. data/lib/unione/api/project/model/project_update_request.rb +60 -0
  77. data/lib/unione/api/project/model/project_update_response.rb +52 -0
  78. data/lib/unione/api/project/project_api.rb +71 -0
  79. data/lib/unione/api/suppression/model/suppression_delete_request.rb +42 -0
  80. data/lib/unione/api/suppression/model/suppression_get_object.rb +91 -0
  81. data/lib/unione/api/suppression/model/suppression_get_request.rb +52 -0
  82. data/lib/unione/api/suppression/model/suppression_get_response.rb +59 -0
  83. data/lib/unione/api/suppression/model/suppression_list_object.rb +91 -0
  84. data/lib/unione/api/suppression/model/suppression_list_request.rb +94 -0
  85. data/lib/unione/api/suppression/model/suppression_list_response.rb +61 -0
  86. data/lib/unione/api/suppression/model/suppression_set_request.rb +69 -0
  87. data/lib/unione/api/suppression/suppression_api.rb +63 -0
  88. data/lib/unione/api/system/model/project_accounting_object.rb +62 -0
  89. data/lib/unione/api/system/model/system_info_response.rb +95 -0
  90. data/lib/unione/api/system/model/system_info_response_accounting.rb +68 -0
  91. data/lib/unione/api/system/model/system_ping_response.rb +51 -0
  92. data/lib/unione/api/system/system_api.rb +35 -0
  93. data/lib/unione/api/tag/model/tag_delete_request.rb +42 -0
  94. data/lib/unione/api/tag/model/tag_list_response.rb +51 -0
  95. data/lib/unione/api/tag/model/tags_response_object.rb +50 -0
  96. data/lib/unione/api/tag/tag_api.rb +40 -0
  97. data/lib/unione/api/template/model/editor_type.rb +19 -0
  98. data/lib/unione/api/template/model/template_delete_request.rb +42 -0
  99. data/lib/unione/api/template/model/template_get_request.rb +42 -0
  100. data/lib/unione/api/template/model/template_get_response.rb +51 -0
  101. data/lib/unione/api/template/model/template_list_object.rb +232 -0
  102. data/lib/unione/api/template/model/template_list_request.rb +52 -0
  103. data/lib/unione/api/template/model/template_list_response.rb +51 -0
  104. data/lib/unione/api/template/model/template_object.rb +201 -0
  105. data/lib/unione/api/template/model/template_set_request.rb +42 -0
  106. data/lib/unione/api/template/model/template_set_response.rb +51 -0
  107. data/lib/unione/api/template/template_api.rb +66 -0
  108. data/lib/unione/api/webhook/model/block_type.rb +20 -0
  109. data/lib/unione/api/webhook/model/device_type.rb +22 -0
  110. data/lib/unione/api/webhook/model/domain_status.rb +19 -0
  111. data/lib/unione/api/webhook/model/event_name.rb +19 -0
  112. data/lib/unione/api/webhook/model/traffic_type.rb +24 -0
  113. data/lib/unione/api/webhook/model/webhook_callback.rb +52 -0
  114. data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item.rb +66 -0
  115. data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item_events_item.rb +52 -0
  116. data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item_events_item_event_data.rb +167 -0
  117. data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item_events_item_event_data_delivery_info.rb +192 -0
  118. data/lib/unione/api/webhook/model/webhook_delete_request.rb +42 -0
  119. data/lib/unione/api/webhook/model/webhook_event_format.rb +18 -0
  120. data/lib/unione/api/webhook/model/webhook_events_object.rb +52 -0
  121. data/lib/unione/api/webhook/model/webhook_get_request.rb +42 -0
  122. data/lib/unione/api/webhook/model/webhook_get_response.rb +51 -0
  123. data/lib/unione/api/webhook/model/webhook_list_request.rb +51 -0
  124. data/lib/unione/api/webhook/model/webhook_list_response.rb +51 -0
  125. data/lib/unione/api/webhook/model/webhook_object.rb +123 -0
  126. data/lib/unione/api/webhook/model/webhook_set_request.rb +109 -0
  127. data/lib/unione/api/webhook/model/webhook_set_response.rb +51 -0
  128. data/lib/unione/api/webhook/model/webhook_status.rb +21 -0
  129. data/lib/unione/api/webhook/webhook_api.rb +89 -0
  130. data/lib/unione/client/api_client.rb +93 -0
  131. data/lib/unione/client/api_error.rb +22 -0
  132. data/lib/unione/client/configuration.rb +49 -0
  133. data/lib/unione/client/decode.rb +33 -0
  134. data/lib/unione/common/model/attachments_array_item.rb +59 -0
  135. data/lib/unione/common/model/body_object.rb +57 -0
  136. data/lib/unione/common/model/email_counter_mode.rb +21 -0
  137. data/lib/unione/common/model/email_status.rb +23 -0
  138. data/lib/unione/common/model/headers_object.rb +72 -0
  139. data/lib/unione/common/model/inline_attachments_array_item.rb +59 -0
  140. data/lib/unione/common/model/success_response.rb +41 -0
  141. data/lib/unione/common/model/template_engine.rb +19 -0
  142. data/lib/unione/common/model/verification_record_status.rb +16 -0
  143. data/lib/unione/uni_one_client.rb +127 -0
  144. data/lib/unione/version.rb +5 -0
  145. data/lib/unione.rb +130 -0
  146. metadata +187 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 966428a227c0701201a9efb14fb683d891df950a2cc1e446fda99113eca0b2b6
4
+ data.tar.gz: 9664b54ea7723c2172e47fdd062468610505fcc24f040d5fae1e5f8e1e364697
5
+ SHA512:
6
+ metadata.gz: 8f1a2f280c5d7066e0b033c8ab86de1e647540e3a73c9232b189c83e2d8798cb3ad55134b2c276ed3898dfa5e956592cb8ac233c660631dab7452881bc9afed3
7
+ data.tar.gz: f36d07366d6b07d739d0f91268e2ef0a9e5dffe7f60bc99006aade3a926983b52f378d3a44e3fc23f43911d47e1b673094d0f378ca77ab260cb19fdb154b33fa
data/AGENTS.md ADDED
@@ -0,0 +1,99 @@
1
+ # AGENTS.md
2
+
3
+ UniOne Ruby SDK — client for the UniOne transactional email Web API (Web API 1.90).
4
+
5
+ ## Working on this repository
6
+
7
+ - **Generated code.** The whole package is generated by the UniOne team from the UniOne Web API OpenAPI spec (Web API 1.90): sources, docs, README.md and this file. Do not hand-edit it: the next release replaces the content of this repository. Report problems and requests in the issues of this repository (https://github.com/unione-repo/unione-ruby-sdk).
8
+ - **Build and check:**
9
+
10
+ ```bash
11
+ gem build *.gemspec
12
+ ```
13
+
14
+ - **Source label.** Every request carries the query parameter `platform=ruby-sdk.1.1.3`, added in one place, the shared request client (`ApiClient`); a package built on this SDK puts its own label in front: `<package>.<version>,ruby-sdk.1.1.3`.
15
+ - **Tests.** Before a release the generator builds and lints the package and runs every example of docs/ and of this file against a mock of the API: no real API key, no real sends.
16
+ - **Release.** The version (1.1.3 in the gemspec) and the tag `v1.1.3` come from the generator; README.md states the Web API version the release was generated from.
17
+ - **Secrets.** Never commit API keys; the examples read `UNIONE_API_KEY` from the environment.
18
+
19
+ ## Integrating UniOne with this SDK
20
+
21
+ Full quickstart: [README.md](README.md). Install:
22
+
23
+ ```bash
24
+ gem install unione
25
+ ```
26
+
27
+ Requirements: Ruby 2.7+.
28
+
29
+ If the project is built on one of these frameworks, install its package instead: it brings this SDK and plugs it into the framework (configuration, client in the container, mailer, webhooks).
30
+
31
+ | Framework | Package | Guide |
32
+ |---|---|---|
33
+ | Ruby on Rails | `unione-rails` | [AGENTS.md](https://github.com/unione-repo/unione-rails/blob/HEAD/AGENTS.md) |
34
+
35
+ Rules that generated code must follow:
36
+
37
+ - Server-side only. Read the API key from `UNIONE_API_KEY`; never put it in browser or mobile code, never commit it.
38
+ - Base URL `https://api.unione.io/en/transactional/api/v1` (an account registered on another host uses that one: `eu1.unione.io`, `us1.unione.io`); every method is POST with a JSON body; auth header `X-API-KEY`. The SDK does all of it.
39
+ - First email without DNS: `domain/get-sandbox-domain` → `confirmed-email/create` (the user clicks the link within 48 hours) → `email/send` from `noreply@<sandbox-domain>` to the confirmed address. Account API key only; up to 10 confirmed addresses, 100 emails a day; the domain expires after 31 days.
40
+ - Never ship a sandbox domain as the production sender (it is not in `domain/list`); read `from_email` from config. Production needs a verified domain: `domain/get-dns-records` → DNS records → `domain/validate-verification-record`, `domain/validate-dkim` → `domain/list`.
41
+ - Set `message.idempotence_key` on retryable sends; retry network errors, `429` and `5xx` with backoff, not other errors unchanged. Up to 500 recipients and 10 MB per request, each attachment up to 7 MB; always `body.html` or `body.plaintext`.
42
+ - Delivery events via webhook (`webhook/set`) with a fast, idempotent HTTPS handler, not polling; check the `auth` field of every notification: the MD5 of the request body with the `auth` value replaced by the API key.
43
+ - Keep the default unsubscribe and tracking behaviour; changes go through UniOne support.
44
+ - Do not invent methods or fields. Check [docs/](docs/) of this package, the [API reference](https://docs.unione.io/en/web-api-ref) or [llms.txt](https://docs.unione.io/llms.txt).
45
+
46
+ ### Send an email
47
+
48
+ The client reads the API key from `UNIONE_API_KEY`:
49
+
50
+ ```ruby
51
+ require 'unione'
52
+
53
+ Common = UniOne::Common::Model
54
+ Email = UniOne::Api::Email::Model
55
+
56
+ client = UniOne.client(ENV.fetch('UNIONE_API_KEY'))
57
+
58
+ response = client.email.send_email(Email::EmailSendRequest.new(
59
+ message: Email::MessageObject.new(
60
+ recipients: [
61
+ Email::MessageObjectRecipientsItem.new(
62
+ email: 'user@example.com',
63
+ substitutions: {
64
+ 'CustomerId' => '12452',
65
+ 'to_name' => 'John Smith',
66
+ }
67
+ )
68
+ ],
69
+ body: Common::BodyObject.new(
70
+ html: '<b>Hello, {{to_name}}</b>',
71
+ plaintext: 'Hello, {{to_name}}'
72
+ ),
73
+ subject: 'UniOne test email ',
74
+ from_email: 'email@example.com',
75
+ from_name: 'John Smith'
76
+ )
77
+ ))
78
+ p response.job_id
79
+ ```
80
+
81
+ ### Errors
82
+
83
+ Every method throws `ApiError` when the request fails: the HTTP status (0 for a network error or a timeout), the [API error code](https://docs.unione.io/en/web-api-ref#api-errors) and the message.
84
+
85
+ ```ruby
86
+ # client created as above
87
+ begin
88
+ client.system.ping
89
+ rescue UniOne::Client::ApiError => e
90
+ # http_status is 0 for a network error or a timeout
91
+ warn "#{e.http_status} #{e.error_code} #{e.message}"
92
+ end
93
+ ```
94
+
95
+ ### Reference
96
+
97
+ - Methods and models of every section: [Email](docs/Email.md), [EmailValidation](docs/EmailValidation.md), [ConfirmedEmail](docs/ConfirmedEmail.md), [Template](docs/Template.md), [Webhook](docs/Webhook.md), [Suppression](docs/Suppression.md), [Domain](docs/Domain.md), [EventDump](docs/EventDump.md), [Tag](docs/Tag.md), [Project](docs/Project.md), [System](docs/System.md), [Obsolete](docs/Obsolete.md)
98
+ - [API reference](https://docs.unione.io/en/web-api-ref)
99
+ - [Full API reference for LLMs](https://docs.unione.io/llms-full.txt)
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 UniOne
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.
data/README.md ADDED
@@ -0,0 +1,270 @@
1
+ # UniOne Ruby SDK 1.1.3
2
+
3
+ Web API 1.90
4
+
5
+ Official Ruby library for the [UniOne](https://unione.io) transactional email API.
6
+
7
+ Quickstart guide: [Send emails with Ruby](https://docs.unione.io/en/send-with-ruby) · Docs for LLMs: [llms.txt](https://docs.unione.io/llms.txt) · [API reference](https://docs.unione.io/en/web-api-ref)
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ gem install unione
13
+ ```
14
+
15
+ Requirements: Ruby 2.7+. No third-party dependencies.
16
+
17
+ ## Get an API key
18
+
19
+ 1. Sign up at [cp.unione.io](https://cp.unione.io/en/user/registration/).
20
+ 2. Copy your API key from [Settings → Security → API](https://cp.unione.io/en/settings/security/api).
21
+ 3. Put it in an environment variable:
22
+
23
+ ```bash
24
+ export UNIONE_API_KEY="your-api-key"
25
+ ```
26
+
27
+ > **Server-side only.** Use this SDK in backend code: API routes, server functions, workers.
28
+ > Never ship the API key to a browser or a mobile app, and never commit it.
29
+
30
+ ## Send your first email — no DNS setup
31
+
32
+ Every account can send test email right away from a **sandbox domain**: pre-verified, DKIM and SPF already set.
33
+ It delivers only to addresses you confirm.
34
+
35
+ <!-- checked examples -->
36
+
37
+ **1. Get your sandbox domain** (`domain/get-sandbox-domain`). The call creates the domain on first use and returns the same one afterwards.
38
+
39
+ ```ruby
40
+ require 'unione'
41
+
42
+ client = UniOne.client(ENV.fetch('UNIONE_API_KEY'))
43
+
44
+ response = client.domain.get_sandbox_domain
45
+ p response.domain
46
+ ```
47
+
48
+ **2. Confirm your inbox** (`confirmed-email/create`). UniOne sends a confirmation email; click the link in it within 48 hours.
49
+
50
+ ```ruby
51
+ require 'unione'
52
+
53
+ ConfirmedEmail = UniOne::Api::ConfirmedEmail::Model
54
+
55
+ client = UniOne.client(ENV.fetch('UNIONE_API_KEY'))
56
+
57
+ response = client.confirmed_email.create(ConfirmedEmail::ConfirmedEmailRequest.new(
58
+ email: 'you@example.com'
59
+ ))
60
+ p response.confirmed_email
61
+ ```
62
+
63
+ Check the status with `confirmed-email/list` — your address should show `"status": "confirmed"`.
64
+
65
+ **3. Send the email** (`email/send`) from any address on the sandbox domain to the confirmed address.
66
+
67
+ ```ruby
68
+ require 'unione'
69
+
70
+ Common = UniOne::Common::Model
71
+ Email = UniOne::Api::Email::Model
72
+
73
+ client = UniOne.client(ENV.fetch('UNIONE_API_KEY'))
74
+
75
+ response = client.email.send_email(Email::EmailSendRequest.new(
76
+ message: Email::MessageObject.new(
77
+ recipients: [
78
+ Email::MessageObjectRecipientsItem.new(
79
+ email: 'you@example.com'
80
+ )
81
+ ],
82
+ body: Common::BodyObject.new(
83
+ html: '<p>It works!</p>'
84
+ ),
85
+ subject: 'Hello from UniOne',
86
+ from_email: 'noreply@<sandbox-domain>'
87
+ )
88
+ ))
89
+ p response.job_id
90
+ ```
91
+
92
+ <!-- /checked examples -->
93
+
94
+ ### What you get back
95
+
96
+ ```json
97
+ {
98
+ "status": "success",
99
+ "job_id": "1ZymBc-00041N-9X",
100
+ "emails": [
101
+ "you@example.com"
102
+ ]
103
+ }
104
+ ```
105
+
106
+ On error the API returns `status: "error"`, a `message` and a numeric `code`:
107
+
108
+ ```json
109
+ {
110
+ "status": "error",
111
+ "code": 102,
112
+ "message": "Error ID:83274F98-C7D5-11F1-B221-6214FF8707B1. Can not decode key wrongkey"
113
+ }
114
+ ```
115
+
116
+ ### Same flow with curl
117
+
118
+ ```bash
119
+ BASE=https://api.unione.io/en/transactional/api/v1
120
+
121
+ curl -s -X POST $BASE/domain/get-sandbox-domain.json \
122
+ -H "Content-Type: application/json" -H "X-API-KEY: $UNIONE_API_KEY" -d '{}'
123
+
124
+ curl -s -X POST $BASE/confirmed-email/create.json \
125
+ -H "Content-Type: application/json" -H "X-API-KEY: $UNIONE_API_KEY" \
126
+ -d '{"email": "you@example.com"}'
127
+
128
+ curl -s -X POST $BASE/email/send.json \
129
+ -H "Content-Type: application/json" -H "X-API-KEY: $UNIONE_API_KEY" \
130
+ -d '{
131
+ "message": {
132
+ "recipients": [
133
+ {
134
+ "email": "you@example.com"
135
+ }
136
+ ],
137
+ "from_email": "noreply@<sandbox-domain>",
138
+ "subject": "Hello from UniOne",
139
+ "body": {
140
+ "html": "<p>It works!</p>"
141
+ }
142
+ }
143
+ }'
144
+ ```
145
+
146
+ ## Sandbox limits
147
+
148
+ - Sends only to confirmed addresses: up to 10 per account.
149
+ - Up to 100 emails a day.
150
+ - The sandbox domain expires after 31 days; call `domain/get-sandbox-domain` again to get a new one.
151
+ - Works only with the account API key, not a project key.
152
+ - Not listed in `domain/list`; the other `domain/*` methods do not apply to it.
153
+
154
+ The sandbox is for development and testing. Do not use a sandbox domain as the sender in production.
155
+
156
+ ## Before production: verify your domain
157
+
158
+ 1. `domain/get-dns-records` — returns the values for your DNS records.
159
+ 2. Add these records at your DNS provider (the domain page of the control panel shows them too):
160
+
161
+ | Type | Host | Value |
162
+ |---|---|---|
163
+ | TXT | `@` | the `verification-record` value (`unione-validate-hash=…`) |
164
+ | TXT | `<selector>._domainkey` (the selector is on the domain page of the control panel, e.g. `us`) | `v=DKIM1; k=rsa; p=<dkim>` |
165
+ | TXT | `@` | `v=spf1 include:spf.unione.io ~all` |
166
+ | CNAME | `_dmarc` | the `dmarc` value |
167
+
168
+ 3. `domain/validate-verification-record`, then `domain/validate-dkim`.
169
+ 4. `domain/list` — wait until the verification record is confirmed and DKIM is active.
170
+ 5. Read `from_email` from your config, so switching from the sandbox needs no code change.
171
+
172
+ ## Sending reliably
173
+
174
+ - **Retries:** set `message.idempotence_key` on sends that may be retried, so a repeated request does not send twice.
175
+ - **Limits:** up to 500 recipients and 10 MB per request; each attachment up to 7 MB.
176
+ - **Body:** always include `body.html` or `body.plaintext`.
177
+ - **Delivery status:** register a webhook (`webhook/set`) with a fast, idempotent HTTPS handler instead of polling.
178
+ - **Defaults:** keep the default unsubscribe footer and tracking; changing them requires UniOne support.
179
+ - **Errors:** retry `429` and `5xx` with backoff; do not retry other errors unchanged.
180
+
181
+ ## Links
182
+
183
+ - [Send emails with Ruby](https://docs.unione.io/en/send-with-ruby) and other [integration guides](https://docs.unione.io/en/integrations/)
184
+ - [Web API reference](https://docs.unione.io/en/web-api-ref)
185
+ - [llms.txt](https://docs.unione.io/llms.txt) for AI coding agents
186
+ - [UniOne MCP server and agent setup](https://unione.io/en/agents)
187
+ - [Support](https://cp.unione.io/en/support)
188
+
189
+ ## For SDK contributors
190
+
191
+ See [AGENTS.md](AGENTS.md): how this SDK is generated from the OpenAPI spec, built, tested and released.
192
+
193
+ ---
194
+
195
+ # SDK reference
196
+
197
+ ## API host
198
+
199
+ The second argument selects the API host (datacenter) or a full base URL.
200
+
201
+ ```ruby
202
+ require 'unione'
203
+
204
+ client = UniOne.client('YOUR_API_KEY', 'us1.unione.io')
205
+ client = UniOne.client('YOUR_API_KEY', UniOne::Client::Configuration::HOST_US1)
206
+ ```
207
+
208
+ ## Custom HTTP client / headers
209
+
210
+ `headers:` adds HTTP headers to every request. `transport:` replaces the HTTP layer: any object responding to `call(method, uri, headers, body, timeout)` that returns `[status, body]` (a lambda works too). Wrap the default `Client::NetHttpTransport` for retries or logging, or call Faraday / HTTParty in your own one; an exception of the transport becomes `ApiError`.
211
+
212
+ ```ruby
213
+ require 'unione'
214
+
215
+ # Logs every request and retries network failures and HTTP 5xx.
216
+ class RetryTransport
217
+ def initialize(inner = UniOne::Client::NetHttpTransport.new, attempts: 3)
218
+ @inner = inner
219
+ @attempts = attempts
220
+ end
221
+
222
+ def call(method, uri, headers, body, timeout)
223
+ (1..@attempts).each do |attempt|
224
+ puts "#{method} #{uri}"
225
+ begin
226
+ status, raw = @inner.call(method, uri, headers, body, timeout)
227
+ return [status, raw] if status < 500 || attempt == @attempts
228
+ rescue StandardError
229
+ raise if attempt == @attempts
230
+ end
231
+ sleep attempt
232
+ end
233
+ end
234
+ end
235
+
236
+ client = UniOne.client('YOUR_API_KEY', transport: RetryTransport.new, headers: { 'X-Request-Id' => '42' })
237
+ ```
238
+
239
+ Models with free-form keys (`HeadersObject`) have an `extra` hash: its keys go next to the named fields.
240
+
241
+ ```ruby
242
+ require 'unione'
243
+
244
+ headers = UniOne::Common::Model::HeadersObject.new(extra: {
245
+ 'X-MyHeader' => 'some data',
246
+ 'CC' => 'copy@example.com',
247
+ 'List-Unsubscribe' => '<mailto:unsubscribe@example.com>'
248
+ })
249
+ ```
250
+
251
+ ## Error handling
252
+
253
+ Every method raises `ApiError` when the API returns an error; it carries the [API error code](https://docs.unione.io/en/web-api-ref#api-errors) and the HTTP status.
254
+
255
+ ## Sections
256
+
257
+ | Section | Methods | Description |
258
+ |---|---|---|
259
+ | [Email](docs/Email.md) | `send_email`, `subscribe` | This group of methods is related with email sending. |
260
+ | [EmailValidation](docs/EmailValidation.md) | `single` | Email validation methods. As a result of the check, you’ll get detailed information on email validity. It will help eliminate nonexistent emails, decrease the number of complaints, clean up the subscribers list and eventually enhance your sender reputation score. For example, you may add validation to a subscription form on your site to let users know they’ve just entered an invalid address. |
261
+ | [ConfirmedEmail](docs/ConfirmedEmail.md) | `create`, `list`, `delete` | Manage email addresses confirmed for sandbox-domain sending. These methods are available only with a main account API key. |
262
+ | [Template](docs/Template.md) | `set`, `get`, `list`, `delete` | You have the option of storing a template on the UniOne side and then using it by id, which is highly recommended for sending repetitive messages or high volume traffic. UniOne supports two different [template engines](https://docs.unione.io/en/template-engines). |
263
+ | [Webhook](docs/Webhook.md) | `set`, `get`, `list`, `delete` | UniOne lets you recieve notifications about email status changes or spam blocks. You provide an URL and every time a watched event occurs we will notify you by submitting a request with JSON data to this URL. |
264
+ | [Suppression](docs/Suppression.md) | `set`, `get`, `list`, `delete` | Methods for managing suppression lists. An email can be added to suppression list because of unsubscription, bounce or complain. |
265
+ | [Domain](docs/Domain.md) | `get_dns_records`, `validate_verification_record`, `validate_dkim`, `list`, `get_sandbox_domain`, `delete` | You can use these methods to setup sender domains and check their statuses. They might be useful in case you want to automate adding domains for your own clients. |
266
+ | [EventDump](docs/EventDump.md) | `create`, `get`, `list`, `delete` | These methods are used to obtain a list of events for a given period of time. The data is stored for up to 45 days, depending on your tariff, i. e. you may fetch all event data starting from 00:00:00 31 days ago and up to current time. For custom tarifs with big sending volumes event dumps are available only for the last 7 days. |
267
+ | [Tag](docs/Tag.md) | `list`, `delete` | This family of methods is used to manage user-defined tags. Tags are used to categorize letters based on your own criteria, e. g. to create a distinction between marketing and transactional letters or group together all notifications for a particular order type. UniOne allows you to assign tags to all outgoing emails, and the tags you’ve set may then be used to filter and analyze delivery statistics. |
268
+ | [Project](docs/Project.md) | `create`, `update`, `list`, `delete` | Projects allow you to group several independent domains, webhooks, templates, and unsubscription lists together. It's very useful if you have your own clients and manage their data from a single UniOne account. Each project receives its own API key, and all API calls with that API key only deal with the data of that project. This way, you can assign a separate project for each client and be sure that they won't conflict; e.g. unsubscribing from one project won't affect another. |
269
+ | [System](docs/System.md) | `ping`, `info` | System operations. |
270
+ | [Obsolete](docs/Obsolete.md) | `unsubscribed_set`, `unsubscribed_check`, `unsubscribed_list` | Obsolete methods dealing with unsubscribes. We recommend using the more flexible [suppression](https://docs.unione.io/en/web-api-ref#suppression) methods instead. Note that you can't resubscribe an unsubscribed recipient using WebAPI, but you can send him an email with subscription link using email/subscribe method. |
@@ -0,0 +1,109 @@
1
+ # ConfirmedEmail
2
+
3
+ [Back to the list of sections](../README.md)
4
+
5
+ Manage email addresses confirmed for sandbox-domain sending. These methods are available only with a main account API key.
6
+
7
+ `UniOne::Api::ConfirmedEmail::ConfirmedEmailApi`, `client.confirmed_email`
8
+
9
+ | Method | Endpoint | Description |
10
+ |---|---|---|
11
+ | [`create`](#create) | `POST /confirmed-email/create.json` | Adds an email address and sends a confirmation link. |
12
+ | [`list`](#list) | `POST /confirmed-email/list.json` | Lists confirmed and unconfirmed email addresses for the account. |
13
+ | [`delete`](#delete) | `POST /confirmed-email/delete.json` | Deletes an email address from the account's confirmed email list. |
14
+
15
+ ## create
16
+
17
+ `POST /confirmed-email/create.json` · [Documentation](https://docs.unione.io/en/web-api-ref#confirmed-email-create)
18
+
19
+ Adds an email address and sends a confirmation link.
20
+
21
+ ### Request: `ConfirmedEmailRequest`
22
+
23
+ | Field | Type | Required | Description |
24
+ |---|---|---|---|
25
+ | `email` | `String` | yes | Email address to add or delete. |
26
+
27
+ ### Response: `ConfirmedEmailCreateResponse`
28
+
29
+ | Field | Type | Description |
30
+ |---|---|---|
31
+ | `status` | `String` | "success" string (`success`) |
32
+ | `confirmed_email` | `ConfirmedEmail` | |
33
+
34
+ ### Example
35
+
36
+ ```ruby
37
+ require 'unione'
38
+
39
+ ConfirmedEmail = UniOne::Api::ConfirmedEmail::Model
40
+
41
+ client = UniOne.client('YOUR_API_KEY')
42
+
43
+ response = client.confirmed_email.create(ConfirmedEmail::ConfirmedEmailRequest.new(
44
+ email: 'dev@example.com'
45
+ ))
46
+ p response.confirmed_email
47
+ ```
48
+
49
+ ## list
50
+
51
+ `POST /confirmed-email/list.json` · [Documentation](https://docs.unione.io/en/web-api-ref#confirmed-email-list)
52
+
53
+ Lists confirmed and unconfirmed email addresses for the account.
54
+
55
+ ### Request
56
+
57
+ The method has no parameters.
58
+
59
+ ### Response: `ConfirmedEmailListResponse`
60
+
61
+ | Field | Type | Description |
62
+ |---|---|---|
63
+ | `status` | `String` | "success" string (`success`) |
64
+ | `confirmed_emails` | `Array<ConfirmedEmail>` | |
65
+
66
+ ### Example
67
+
68
+ ```ruby
69
+ require 'unione'
70
+
71
+ client = UniOne.client('YOUR_API_KEY')
72
+
73
+ response = client.confirmed_email.list
74
+ p response.confirmed_emails
75
+ ```
76
+
77
+ ## delete
78
+
79
+ `POST /confirmed-email/delete.json` · [Documentation](https://docs.unione.io/en/web-api-ref#confirmed-email-delete)
80
+
81
+ Deletes an email address from the account's confirmed email list.
82
+
83
+ ### Request: `ConfirmedEmailRequest`
84
+
85
+ | Field | Type | Required | Description |
86
+ |---|---|---|---|
87
+ | `email` | `String` | yes | Email address to add or delete. |
88
+
89
+ ### Response: `ConfirmedEmailDeleteResponse`
90
+
91
+ | Field | Type | Description |
92
+ |---|---|---|
93
+ | `status` | `String` | "success" string (`success`) |
94
+ | `message` | `String` | |
95
+
96
+ ### Example
97
+
98
+ ```ruby
99
+ require 'unione'
100
+
101
+ ConfirmedEmail = UniOne::Api::ConfirmedEmail::Model
102
+
103
+ client = UniOne.client('YOUR_API_KEY')
104
+
105
+ response = client.confirmed_email.delete(ConfirmedEmail::ConfirmedEmailRequest.new(
106
+ email: 'dev@example.com'
107
+ ))
108
+ p response.message
109
+ ```