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
data/docs/Template.md ADDED
@@ -0,0 +1,164 @@
1
+ # Template
2
+
3
+ [Back to the list of sections](../README.md)
4
+
5
+ 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).
6
+
7
+ `UniOne::Api::Template::TemplateApi`, `client.template`
8
+
9
+ | Method | Endpoint | Description |
10
+ |---|---|---|
11
+ | [`set`](#set) | `POST /template/set.json` | Creates or updates an email template. |
12
+ | [`get`](#get) | `POST /template/get.json` | Gets template properties by it's id. |
13
+ | [`list`](#list) | `POST /template/list.json` | Returns the list of all or some templates of the account. |
14
+ | [`delete`](#delete) | `POST /template/delete.json` | Deletes a template by id. |
15
+
16
+ ## set
17
+
18
+ `POST /template/set.json` · [Documentation](https://docs.unione.io/en/web-api-ref#template-set)
19
+
20
+ Creates or updates an email template.
21
+
22
+ Restrictions:
23
+ * The maximum request size is 10 MB.
24
+ * The number of templates is limited to 10000.
25
+
26
+ ### Request: `TemplateSetRequest`
27
+
28
+ | Field | Type | Required | Description |
29
+ |---|---|---|---|
30
+ | `template` | `TemplateObject` | yes | Object with all the template properties. |
31
+
32
+ ### Response: `TemplateSetResponse`
33
+
34
+ | Field | Type | Description |
35
+ |---|---|---|
36
+ | `status` | `String` | "success" string (`success`) |
37
+ | `template` | `TemplateObject` | Object with all the template properties. |
38
+
39
+ ### Example
40
+
41
+ ```ruby
42
+ require 'unione'
43
+
44
+ Common = UniOne::Common::Model
45
+ Template = UniOne::Api::Template::Model
46
+
47
+ client = UniOne.client('YOUR_API_KEY')
48
+
49
+ response = client.template.set(Template::TemplateSetRequest.new(
50
+ template: Template::TemplateObject.new(
51
+ name: 'name',
52
+ editor_type: Template::EditorType::HTML,
53
+ template_engine: Common::TemplateEngine::VELOCITY,
54
+ subject: 'UniOne test email ',
55
+ from_email: 'user@example.com',
56
+ from_name: 'John Smith',
57
+ reply_to: 'email@example.com',
58
+ reply_to_name: 'John Smith'
59
+ )
60
+ ))
61
+ p response.template
62
+ ```
63
+
64
+ ## get
65
+
66
+ `POST /template/get.json` · [Documentation](https://docs.unione.io/en/web-api-ref#template-get)
67
+
68
+ Gets template properties by it's id.
69
+
70
+ ### Request: `TemplateGetRequest`
71
+
72
+ | Field | Type | Required | Description |
73
+ |---|---|---|---|
74
+ | `id` | `String` | yes | Template id. |
75
+
76
+ ### Response: `TemplateGetResponse`
77
+
78
+ | Field | Type | Description |
79
+ |---|---|---|
80
+ | `status` | `String` | "success" string (`success`) |
81
+ | `template` | `TemplateObject` | Object with all the template properties. |
82
+
83
+ ### Example
84
+
85
+ ```ruby
86
+ require 'unione'
87
+
88
+ Template = UniOne::Api::Template::Model
89
+
90
+ client = UniOne.client('YOUR_API_KEY')
91
+
92
+ response = client.template.get(Template::TemplateGetRequest.new(
93
+ id: '00000000-0000-0000-0000-000000000000'
94
+ ))
95
+ p response.template
96
+ ```
97
+
98
+ ## list
99
+
100
+ `POST /template/list.json` · [Documentation](https://docs.unione.io/en/web-api-ref#template-list)
101
+
102
+ Returns the list of all or some templates of the account.
103
+
104
+ You can iterate thru large list using "offset" and "limit" parameters. When less than "limit" templates are returned then the end of list is reached.
105
+
106
+ ### Request: `TemplateListRequest`
107
+
108
+ | Field | Type | Required | Description |
109
+ |---|---|---|---|
110
+ | `limit` | `Integer` | | Limits the number of templates returned, default is 50. |
111
+ | `offset` | `Integer` | | Index of the first template in the list, starting with 0. |
112
+
113
+ ### Response: `TemplateListResponse`
114
+
115
+ | Field | Type | Description |
116
+ |---|---|---|
117
+ | `status` | `String` | "success" string (`success`) |
118
+ | `templates` | `Array<TemplateListObject>` | Array of template objects. |
119
+
120
+ ### Example
121
+
122
+ ```ruby
123
+ require 'unione'
124
+
125
+ Template = UniOne::Api::Template::Model
126
+
127
+ client = UniOne.client('YOUR_API_KEY')
128
+
129
+ response = client.template.list(Template::TemplateListRequest.new)
130
+ p response.templates
131
+ ```
132
+
133
+ ## delete
134
+
135
+ `POST /template/delete.json` · [Documentation](https://docs.unione.io/en/web-api-ref#template-delete)
136
+
137
+ Deletes a template by id.
138
+
139
+ ### Request: `TemplateDeleteRequest`
140
+
141
+ | Field | Type | Required | Description |
142
+ |---|---|---|---|
143
+ | `id` | `String` | yes | Template id. |
144
+
145
+ ### Response: `SuccessResponse`
146
+
147
+ | Field | Type | Description |
148
+ |---|---|---|
149
+ | `status` | `String` | "success" string (`success`) |
150
+
151
+ ### Example
152
+
153
+ ```ruby
154
+ require 'unione'
155
+
156
+ Template = UniOne::Api::Template::Model
157
+
158
+ client = UniOne.client('YOUR_API_KEY')
159
+
160
+ response = client.template.delete(Template::TemplateDeleteRequest.new(
161
+ id: '00000000-0000-0000-0000-000000000000'
162
+ ))
163
+ p response
164
+ ```
data/docs/Webhook.md ADDED
@@ -0,0 +1,182 @@
1
+ # Webhook
2
+
3
+ [Back to the list of sections](../README.md)
4
+
5
+ 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.
6
+
7
+ You can configure the format of webhook calls (JSON or gzipped JSON), which events you want to be notified of, whether or not you let us groups several events in one request, do you want to receive extra details like SMTP answer or recipient's user agent, etc.
8
+
9
+ Please note that your webhook handler should be able to process at least 5 parallel requests, up to 100 events each (but you can configure the maximum number of parallel connections up to 100, which is recommended).
10
+
11
+ If the URL of your webhook handler is not available (the response is not HTTP 200 OK within 3 seconds timeout), the system will repeat requests each 10 minutes during 24 hours, passing extra parameter retry_count. If there were at least 10 events during last 24 hours and all the webhook requests about these events have failed then we consider webhook handler broken and change it's status to inactive automatically. A notification about that is sent to an email [configured in control panel](https://cp.unione.io/en/user/alerting/technical/).
12
+
13
+ The format of webhook request and details of each event are described [here](https://docs.unione.io/en/web-api-ref#callback-format).
14
+
15
+ `UniOne::Api::Webhook::WebhookApi`, `client.webhook`
16
+
17
+ | Method | Endpoint | Description |
18
+ |---|---|---|
19
+ | [`set`](#set) | `POST /webhook/set.json` | Sets or edits a [webhook](https://docs.unione.io/en/web-api-ref#webhook), i.e. an event notification handler. |
20
+ | [`get`](#get) | `POST /webhook/get.json` | Gets properties of a [webhook](https://docs.unione.io/en/web-api-ref#webhook). |
21
+ | [`list`](#list) | `POST /webhook/list.json` | List all or some [webhooks](https://docs.unione.io/en/web-api-ref#webhook) (event notification handlers) of a user or a project. |
22
+ | [`delete`](#delete) | `POST /webhook/delete.json` | Deletes an event notification handler |
23
+
24
+ ## set
25
+
26
+ `POST /webhook/set.json` · [Documentation](https://docs.unione.io/en/web-api-ref#webhook-set)
27
+
28
+ Sets or edits a [webhook](https://docs.unione.io/en/web-api-ref#webhook), i.e. an event notification handler.
29
+
30
+ ### Request: `WebhookSetRequest`
31
+
32
+ | Field | Type | Required | Description |
33
+ |---|---|---|---|
34
+ | `url` | `String` | yes | URL that will receive the notification when an event occurs. The URL should be unique for a user or a project. Only ASCII characters are supported for now in URL, please convert to [Punycode](https://en.wikipedia.org/wiki/Punycode) if you need to use non-ASCII characters. |
35
+ | `status` | `WebhookStatus` | | Webhook status, "active" by default. "disabled" means that webhook has been disabled by the user, "stopped" means that webhook has been stopped by the system after 24h of failed calls (with minimum of 10 distinct events). (`active`, `disabled`, `stopped`) |
36
+ | `event_format` | `WebhookEventFormat` | | Notification format. "json_post"(default) or "json_post_gzip". (`json_post`, `json_post_gzip`) |
37
+ | `delivery_info` | `Integer` | | Shall detailed delivery info be returned(1) or not(0). When it's 1, the information about SMTP response and internal delivery status is returned for "hard_bounced" and "soft_bounced" email statuses; the user agent, recipient IP address, detected geo fields, device info detected from the user agent (device type and brand, OS name, browser or email client name) and traffic_type (human, machine, protected or unknown) are returned for "opened" and "clicked" statuses; URL is returned for "clicked" status. For "delivered", "soft_bounced" and "hard_bounced" statuses UniOne may also return sender_ip, the IP address of the SMTP server that sent the message, if available. (`0`, `1`) |
38
+ | `single_event` | `Integer` | | 0=several event notifications can be reported in single webhook call, 1=only single event can be reported in one call (not recommended). (`0`, `1`) |
39
+ | `max_parallel` | `Integer` | | Maximum quantity of permitted parallel queries to your server. The more your server can handle - the better. |
40
+ | `events` | `WebhookEventsObject` | | Object containing events to notify of. |
41
+
42
+ ### Response: `WebhookSetResponse`
43
+
44
+ | Field | Type | Description |
45
+ |---|---|---|
46
+ | `status` | `String` | "success" string (`success`) |
47
+ | `object` | `WebhookObject` | Object with all the webhook properties. |
48
+
49
+ ### Example
50
+
51
+ ```ruby
52
+ require 'unione'
53
+
54
+ Webhook = UniOne::Api::Webhook::Model
55
+
56
+ client = UniOne.client('YOUR_API_KEY')
57
+
58
+ response = client.webhook.set(Webhook::WebhookSetRequest.new(
59
+ url: 'https://yourhost.example.com/unione-webhook'
60
+ ))
61
+ p response.object
62
+ ```
63
+
64
+ ## get
65
+
66
+ `POST /webhook/get.json` · [Documentation](https://docs.unione.io/en/web-api-ref#webhook-get)
67
+
68
+ Gets properties of a [webhook](https://docs.unione.io/en/web-api-ref#webhook).
69
+
70
+ ### Request: `WebhookGetRequest`
71
+
72
+ | Field | Type | Required | Description |
73
+ |---|---|---|---|
74
+ | `url` | `String` | yes | Webhook URL. |
75
+
76
+ ### Response: `WebhookGetResponse`
77
+
78
+ | Field | Type | Description |
79
+ |---|---|---|
80
+ | `status` | `String` | "success" string (`success`) |
81
+ | `object` | `WebhookObject` | Object with all the webhook properties. |
82
+
83
+ ### Example
84
+
85
+ ```ruby
86
+ require 'unione'
87
+
88
+ Webhook = UniOne::Api::Webhook::Model
89
+
90
+ client = UniOne.client('YOUR_API_KEY')
91
+
92
+ response = client.webhook.get(Webhook::WebhookGetRequest.new(
93
+ url: 'https://example.com/webhook'
94
+ ))
95
+ p response.object
96
+ ```
97
+
98
+ ## list
99
+
100
+ `POST /webhook/list.json` · [Documentation](https://docs.unione.io/en/web-api-ref#webhook-list)
101
+
102
+ List all or some [webhooks](https://docs.unione.io/en/web-api-ref#webhook) (event notification handlers) of a user or a project.
103
+
104
+ ### Request: `WebhookListRequest`
105
+
106
+ | Field | Type | Required | Description |
107
+ |---|---|---|---|
108
+ | `limit` | `Integer` | | Limits the number of webhooks returned. 50 is recommended. |
109
+ | `offset` | `Integer` | | Index of the first webhook in the list, starting with 0. |
110
+
111
+ ### Response: `WebhookListResponse`
112
+
113
+ | Field | Type | Description |
114
+ |---|---|---|
115
+ | `status` | `String` | "success" string (`success`) |
116
+ | `objects` | `Array<WebhookObject>` | Array of webhooks objects. |
117
+
118
+ ### Example
119
+
120
+ ```ruby
121
+ require 'unione'
122
+
123
+ Webhook = UniOne::Api::Webhook::Model
124
+
125
+ client = UniOne.client('YOUR_API_KEY')
126
+
127
+ response = client.webhook.list(Webhook::WebhookListRequest.new)
128
+ p response.objects
129
+ ```
130
+
131
+ ## delete
132
+
133
+ `POST /webhook/delete.json` · [Documentation](https://docs.unione.io/en/web-api-ref#webhook-delete)
134
+
135
+ Deletes an event notification handler
136
+
137
+ You can also temporarily deactivate webhook without deleting it by setting it's status to "disabled" in [webhook/set](https://docs.unione.io/en/web-api-ref#webhook-set) method.
138
+
139
+ ### Request: `WebhookDeleteRequest`
140
+
141
+ | Field | Type | Required | Description |
142
+ |---|---|---|---|
143
+ | `url` | `String` | yes | Webhook URL. |
144
+
145
+ ### Response: `SuccessResponse`
146
+
147
+ | Field | Type | Description |
148
+ |---|---|---|
149
+ | `status` | `String` | "success" string (`success`) |
150
+
151
+ ### Example
152
+
153
+ ```ruby
154
+ require 'unione'
155
+
156
+ Webhook = UniOne::Api::Webhook::Model
157
+
158
+ client = UniOne.client('YOUR_API_KEY')
159
+
160
+ response = client.webhook.delete(Webhook::WebhookDeleteRequest.new(
161
+ url: 'https://example.com/webhook'
162
+ ))
163
+ p response
164
+ ```
165
+
166
+ ## Callbacks: `WebhookCallback`
167
+
168
+ Webhook callback format description.
169
+
170
+ Parse an incoming webhook request body:
171
+
172
+ ```ruby
173
+ require 'unione'
174
+
175
+ callback = UniOne::Api::Webhook::WebhookApi.parse_callback(request.body.read)
176
+ p callback
177
+ ```
178
+
179
+ | Field | Type | Description |
180
+ |---|---|---|
181
+ | `auth` | `String` | MD5-hash of the message body, in which the value "auth" is replaced by api key of the user/project; with this field the recipient of the notification can both authenticate and verify the notification integrity |
182
+ | `events_by_user` | `Array<WebhookCallbackEventsByUserItem>` | Array with only one element, containing events of a user/project. |
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module UniOne
6
+ module Api
7
+ module ConfirmedEmail
8
+ # Manage email addresses confirmed for sandbox-domain sending. These methods are available only with a
9
+ # main account API key.
10
+ class ConfirmedEmailApi
11
+ # @param client [::UniOne::Client::ApiClient]
12
+ def initialize(client)
13
+ @client = client
14
+ end
15
+
16
+ # Adds an email address and sends a confirmation link.
17
+ #
18
+ # Documentation: https://docs.unione.io/en/web-api-ref#confirmed-email-create
19
+ # @param request [::UniOne::Api::ConfirmedEmail::Model::ConfirmedEmailRequest, Hash]
20
+ # @return [::UniOne::Api::ConfirmedEmail::Model::ConfirmedEmailCreateResponse]
21
+ # @raise [::UniOne::Client::ApiError]
22
+ def create(request)
23
+ ::UniOne::Api::ConfirmedEmail::Model::ConfirmedEmailCreateResponse.from_h(@client.call('/confirmed-email/create.json', request.is_a?(Hash) ? request : request.to_h))
24
+ end
25
+
26
+ # Lists confirmed and unconfirmed email addresses for the account.
27
+ #
28
+ # Documentation: https://docs.unione.io/en/web-api-ref#confirmed-email-list
29
+ # @return [::UniOne::Api::ConfirmedEmail::Model::ConfirmedEmailListResponse]
30
+ # @raise [::UniOne::Client::ApiError]
31
+ def list
32
+ ::UniOne::Api::ConfirmedEmail::Model::ConfirmedEmailListResponse.from_h(@client.call('/confirmed-email/list.json'))
33
+ end
34
+
35
+ # Deletes an email address from the account's confirmed email list.
36
+ #
37
+ # Documentation: https://docs.unione.io/en/web-api-ref#confirmed-email-delete
38
+ # @param request [::UniOne::Api::ConfirmedEmail::Model::ConfirmedEmailRequest, Hash]
39
+ # @return [::UniOne::Api::ConfirmedEmail::Model::ConfirmedEmailDeleteResponse]
40
+ # @raise [::UniOne::Client::ApiError]
41
+ def delete(request)
42
+ ::UniOne::Api::ConfirmedEmail::Model::ConfirmedEmailDeleteResponse.from_h(@client.call('/confirmed-email/delete.json', request.is_a?(Hash) ? request : request.to_h))
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module ConfirmedEmail
6
+ module Model
7
+ # ConfirmedEmail
8
+ class ConfirmedEmail
9
+ # @return [String, nil]
10
+ attr_accessor :email
11
+
12
+ # Confirmation status of the email address.
13
+ # @return [VerificationRecordStatus, nil]
14
+ attr_accessor :status
15
+
16
+ def initialize(
17
+ email: nil,
18
+ status: nil
19
+ )
20
+ @email = email
21
+ @status = status
22
+ end
23
+
24
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
25
+ # gives nil (data that is not a Hash gives an empty object).
26
+ def self.from_h(data)
27
+ data = {} unless data.is_a?(Hash)
28
+ new(
29
+ email: data['email'],
30
+ status: data['status']
31
+ )
32
+ end
33
+
34
+ # JSON-ready hash, nil fields are omitted.
35
+ def to_h
36
+ {
37
+ 'email' => @email,
38
+ 'status' => @status,
39
+ }.compact
40
+ end
41
+
42
+ def to_json(*args)
43
+ to_h.to_json(*args)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module ConfirmedEmail
6
+ module Model
7
+ # ConfirmedEmailCreateResponse
8
+ class ConfirmedEmailCreateResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # @return [ConfirmedEmail, nil]
15
+ attr_accessor :confirmed_email
16
+
17
+ def initialize(
18
+ status: nil,
19
+ confirmed_email: nil
20
+ )
21
+ @status = status
22
+ @confirmed_email = confirmed_email
23
+ end
24
+
25
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
26
+ # gives nil (data that is not a Hash gives an empty object).
27
+ def self.from_h(data)
28
+ data = {} unless data.is_a?(Hash)
29
+ new(
30
+ status: data['status'],
31
+ confirmed_email: ::UniOne::Client::Decode.model(::UniOne::Api::ConfirmedEmail::Model::ConfirmedEmail, data['confirmed_email'])
32
+ )
33
+ end
34
+
35
+ # JSON-ready hash, nil fields are omitted.
36
+ def to_h
37
+ {
38
+ 'status' => @status,
39
+ 'confirmed_email' => @confirmed_email.nil? ? nil : @confirmed_email.to_h,
40
+ }.compact
41
+ end
42
+
43
+ def to_json(*args)
44
+ to_h.to_json(*args)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module ConfirmedEmail
6
+ module Model
7
+ # ConfirmedEmailDeleteResponse
8
+ class ConfirmedEmailDeleteResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # @return [String, nil]
15
+ attr_accessor :message
16
+
17
+ def initialize(
18
+ status: nil,
19
+ message: nil
20
+ )
21
+ @status = status
22
+ @message = message
23
+ end
24
+
25
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
26
+ # gives nil (data that is not a Hash gives an empty object).
27
+ def self.from_h(data)
28
+ data = {} unless data.is_a?(Hash)
29
+ new(
30
+ status: data['status'],
31
+ message: data['message']
32
+ )
33
+ end
34
+
35
+ # JSON-ready hash, nil fields are omitted.
36
+ def to_h
37
+ {
38
+ 'status' => @status,
39
+ 'message' => @message,
40
+ }.compact
41
+ end
42
+
43
+ def to_json(*args)
44
+ to_h.to_json(*args)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module ConfirmedEmail
6
+ module Model
7
+ # ConfirmedEmailListResponse
8
+ class ConfirmedEmailListResponse
9
+ # "success" string
10
+ # Allowed values: `success`.
11
+ # @return [String, nil]
12
+ attr_accessor :status
13
+
14
+ # @return [Array<ConfirmedEmail>, nil]
15
+ attr_accessor :confirmed_emails
16
+
17
+ def initialize(
18
+ status: nil,
19
+ confirmed_emails: nil
20
+ )
21
+ @status = status
22
+ @confirmed_emails = confirmed_emails
23
+ end
24
+
25
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
26
+ # gives nil (data that is not a Hash gives an empty object).
27
+ def self.from_h(data)
28
+ data = {} unless data.is_a?(Hash)
29
+ new(
30
+ status: data['status'],
31
+ confirmed_emails: ::UniOne::Client::Decode.list(data['confirmed_emails']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Api::ConfirmedEmail::Model::ConfirmedEmail, item0) }
32
+ )
33
+ end
34
+
35
+ # JSON-ready hash, nil fields are omitted.
36
+ def to_h
37
+ {
38
+ 'status' => @status,
39
+ 'confirmed_emails' => @confirmed_emails.nil? ? nil : @confirmed_emails.map { |item0| item0.to_h },
40
+ }.compact
41
+ end
42
+
43
+ def to_json(*args)
44
+ to_h.to_json(*args)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UniOne
4
+ module Api
5
+ module ConfirmedEmail
6
+ module Model
7
+ # ConfirmedEmailRequest
8
+ class ConfirmedEmailRequest
9
+ # Email address to add or delete.
10
+ # @return [String, nil]
11
+ attr_accessor :email
12
+
13
+ def initialize(
14
+ email:
15
+ )
16
+ @email = email
17
+ end
18
+
19
+ # Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
20
+ # gives nil (data that is not a Hash gives an empty object).
21
+ def self.from_h(data)
22
+ data = {} unless data.is_a?(Hash)
23
+ new(
24
+ email: data['email']
25
+ )
26
+ end
27
+
28
+ # JSON-ready hash, nil fields are omitted.
29
+ def to_h
30
+ {
31
+ 'email' => @email,
32
+ }.compact
33
+ end
34
+
35
+ def to_json(*args)
36
+ to_h.to_json(*args)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end