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.
- checksums.yaml +7 -0
- data/AGENTS.md +99 -0
- data/LICENSE +21 -0
- data/README.md +270 -0
- data/docs/ConfirmedEmail.md +109 -0
- data/docs/Domain.md +257 -0
- data/docs/Email.md +126 -0
- data/docs/EmailValidation.md +54 -0
- data/docs/EventDump.md +157 -0
- data/docs/Obsolete.md +119 -0
- data/docs/Project.md +174 -0
- data/docs/Suppression.md +163 -0
- data/docs/System.md +73 -0
- data/docs/Tag.md +73 -0
- data/docs/Template.md +164 -0
- data/docs/Webhook.md +182 -0
- data/lib/unione/api/confirmed_email/confirmed_email_api.rb +47 -0
- data/lib/unione/api/confirmed_email/model/confirmed_email.rb +49 -0
- data/lib/unione/api/confirmed_email/model/confirmed_email_create_response.rb +50 -0
- data/lib/unione/api/confirmed_email/model/confirmed_email_delete_response.rb +50 -0
- data/lib/unione/api/confirmed_email/model/confirmed_email_list_response.rb +50 -0
- data/lib/unione/api/confirmed_email/model/confirmed_email_request.rb +42 -0
- data/lib/unione/api/domain/domain_api.rb +129 -0
- data/lib/unione/api/domain/model/dkim_status.rb +18 -0
- data/lib/unione/api/domain/model/domain_delete_request.rb +42 -0
- data/lib/unione/api/domain/model/domain_delete_response.rb +51 -0
- data/lib/unione/api/domain/model/domain_get_dns_records_request.rb +42 -0
- data/lib/unione/api/domain/model/domain_get_dns_records_response.rb +76 -0
- data/lib/unione/api/domain/model/domain_get_sandbox_domain_response.rb +51 -0
- data/lib/unione/api/domain/model/domain_list_request.rb +60 -0
- data/lib/unione/api/domain/model/domain_list_response.rb +51 -0
- data/lib/unione/api/domain/model/domain_list_response_domains_item.rb +58 -0
- data/lib/unione/api/domain/model/domain_list_response_domains_item_dkim.rb +52 -0
- data/lib/unione/api/domain/model/domain_list_response_domains_item_verification_record.rb +50 -0
- data/lib/unione/api/domain/model/domain_validate_dkim_request.rb +42 -0
- data/lib/unione/api/domain/model/domain_validate_dkim_response.rb +51 -0
- data/lib/unione/api/domain/model/domain_validate_verification_record_request.rb +42 -0
- data/lib/unione/api/domain/model/domain_validate_verification_record_response.rb +51 -0
- data/lib/unione/api/email/email_api.rb +56 -0
- data/lib/unione/api/email/model/email_send_request.rb +42 -0
- data/lib/unione/api/email/model/email_send_response.rb +83 -0
- data/lib/unione/api/email/model/email_subscribe_request.rb +58 -0
- data/lib/unione/api/email/model/message_object.rb +291 -0
- data/lib/unione/api/email/model/message_object_options.rb +70 -0
- data/lib/unione/api/email/model/message_object_recipients_item.rb +77 -0
- data/lib/unione/api/email_validation/email_validation_api.rb +34 -0
- data/lib/unione/api/email_validation/model/email_validation_single_request.rb +42 -0
- data/lib/unione/api/email_validation/model/email_validation_single_response.rb +140 -0
- data/lib/unione/api/event_dump/event_dump_api.rb +67 -0
- data/lib/unione/api/event_dump/model/event_dump_create_request.rb +119 -0
- data/lib/unione/api/event_dump/model/event_dump_create_response.rb +52 -0
- data/lib/unione/api/event_dump/model/event_dump_delete_request.rb +43 -0
- data/lib/unione/api/event_dump/model/event_dump_files_object.rb +51 -0
- data/lib/unione/api/event_dump/model/event_dump_get_request.rb +43 -0
- data/lib/unione/api/event_dump/model/event_dump_get_response.rb +51 -0
- data/lib/unione/api/event_dump/model/event_dump_list_response.rb +52 -0
- data/lib/unione/api/event_dump/model/event_dump_object.rb +66 -0
- data/lib/unione/api/event_dump/model/filter_object.rb +139 -0
- data/lib/unione/api/obsolete/model/obsolete_unsubscribed_check_request.rb +42 -0
- data/lib/unione/api/obsolete/model/obsolete_unsubscribed_check_response.rb +59 -0
- data/lib/unione/api/obsolete/model/obsolete_unsubscribed_list_request.rb +43 -0
- data/lib/unione/api/obsolete/model/obsolete_unsubscribed_list_response.rb +51 -0
- data/lib/unione/api/obsolete/model/obsolete_unsubscribed_list_response_unsubscribed_item.rb +50 -0
- data/lib/unione/api/obsolete/model/obsolete_unsubscribed_set_message.rb +25 -0
- data/lib/unione/api/obsolete/model/obsolete_unsubscribed_set_request.rb +42 -0
- data/lib/unione/api/obsolete/model/obsolete_unsubscribed_set_response.rb +64 -0
- data/lib/unione/api/obsolete/obsolete_api.rb +57 -0
- data/lib/unione/api/project/model/project_create_request.rb +42 -0
- data/lib/unione/api/project/model/project_create_response.rb +60 -0
- data/lib/unione/api/project/model/project_delete_request.rb +52 -0
- data/lib/unione/api/project/model/project_list_object.rb +146 -0
- data/lib/unione/api/project/model/project_list_request.rb +50 -0
- data/lib/unione/api/project/model/project_list_response.rb +51 -0
- data/lib/unione/api/project/model/project_object.rb +94 -0
- data/lib/unione/api/project/model/project_update_object.rb +130 -0
- data/lib/unione/api/project/model/project_update_request.rb +60 -0
- data/lib/unione/api/project/model/project_update_response.rb +52 -0
- data/lib/unione/api/project/project_api.rb +71 -0
- data/lib/unione/api/suppression/model/suppression_delete_request.rb +42 -0
- data/lib/unione/api/suppression/model/suppression_get_object.rb +91 -0
- data/lib/unione/api/suppression/model/suppression_get_request.rb +52 -0
- data/lib/unione/api/suppression/model/suppression_get_response.rb +59 -0
- data/lib/unione/api/suppression/model/suppression_list_object.rb +91 -0
- data/lib/unione/api/suppression/model/suppression_list_request.rb +94 -0
- data/lib/unione/api/suppression/model/suppression_list_response.rb +61 -0
- data/lib/unione/api/suppression/model/suppression_set_request.rb +69 -0
- data/lib/unione/api/suppression/suppression_api.rb +63 -0
- data/lib/unione/api/system/model/project_accounting_object.rb +62 -0
- data/lib/unione/api/system/model/system_info_response.rb +95 -0
- data/lib/unione/api/system/model/system_info_response_accounting.rb +68 -0
- data/lib/unione/api/system/model/system_ping_response.rb +51 -0
- data/lib/unione/api/system/system_api.rb +35 -0
- data/lib/unione/api/tag/model/tag_delete_request.rb +42 -0
- data/lib/unione/api/tag/model/tag_list_response.rb +51 -0
- data/lib/unione/api/tag/model/tags_response_object.rb +50 -0
- data/lib/unione/api/tag/tag_api.rb +40 -0
- data/lib/unione/api/template/model/editor_type.rb +19 -0
- data/lib/unione/api/template/model/template_delete_request.rb +42 -0
- data/lib/unione/api/template/model/template_get_request.rb +42 -0
- data/lib/unione/api/template/model/template_get_response.rb +51 -0
- data/lib/unione/api/template/model/template_list_object.rb +232 -0
- data/lib/unione/api/template/model/template_list_request.rb +52 -0
- data/lib/unione/api/template/model/template_list_response.rb +51 -0
- data/lib/unione/api/template/model/template_object.rb +201 -0
- data/lib/unione/api/template/model/template_set_request.rb +42 -0
- data/lib/unione/api/template/model/template_set_response.rb +51 -0
- data/lib/unione/api/template/template_api.rb +66 -0
- data/lib/unione/api/webhook/model/block_type.rb +20 -0
- data/lib/unione/api/webhook/model/device_type.rb +22 -0
- data/lib/unione/api/webhook/model/domain_status.rb +19 -0
- data/lib/unione/api/webhook/model/event_name.rb +19 -0
- data/lib/unione/api/webhook/model/traffic_type.rb +24 -0
- data/lib/unione/api/webhook/model/webhook_callback.rb +52 -0
- data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item.rb +66 -0
- data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item_events_item.rb +52 -0
- data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item_events_item_event_data.rb +167 -0
- data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item_events_item_event_data_delivery_info.rb +192 -0
- data/lib/unione/api/webhook/model/webhook_delete_request.rb +42 -0
- data/lib/unione/api/webhook/model/webhook_event_format.rb +18 -0
- data/lib/unione/api/webhook/model/webhook_events_object.rb +52 -0
- data/lib/unione/api/webhook/model/webhook_get_request.rb +42 -0
- data/lib/unione/api/webhook/model/webhook_get_response.rb +51 -0
- data/lib/unione/api/webhook/model/webhook_list_request.rb +51 -0
- data/lib/unione/api/webhook/model/webhook_list_response.rb +51 -0
- data/lib/unione/api/webhook/model/webhook_object.rb +123 -0
- data/lib/unione/api/webhook/model/webhook_set_request.rb +109 -0
- data/lib/unione/api/webhook/model/webhook_set_response.rb +51 -0
- data/lib/unione/api/webhook/model/webhook_status.rb +21 -0
- data/lib/unione/api/webhook/webhook_api.rb +89 -0
- data/lib/unione/client/api_client.rb +93 -0
- data/lib/unione/client/api_error.rb +22 -0
- data/lib/unione/client/configuration.rb +49 -0
- data/lib/unione/client/decode.rb +33 -0
- data/lib/unione/common/model/attachments_array_item.rb +59 -0
- data/lib/unione/common/model/body_object.rb +57 -0
- data/lib/unione/common/model/email_counter_mode.rb +21 -0
- data/lib/unione/common/model/email_status.rb +23 -0
- data/lib/unione/common/model/headers_object.rb +72 -0
- data/lib/unione/common/model/inline_attachments_array_item.rb +59 -0
- data/lib/unione/common/model/success_response.rb +41 -0
- data/lib/unione/common/model/template_engine.rb +19 -0
- data/lib/unione/common/model/verification_record_status.rb +16 -0
- data/lib/unione/uni_one_client.rb +127 -0
- data/lib/unione/version.rb +5 -0
- data/lib/unione.rb +130 -0
- metadata +187 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# Object with detailed delivery info.Event date & time in UTC time zone in "YYYY-MM-DD hh:mm:ss"
|
|
8
|
+
# format. This property exists only if webhook has delivery_info proeprty set to 1 and
|
|
9
|
+
# event_name="transactional_email_status".
|
|
10
|
+
class WebhookCallbackEventsByUserItemEventsItemEventDataDeliveryInfo
|
|
11
|
+
# UniOne internal detailed delivery status. Some possible values are:
|
|
12
|
+
#
|
|
13
|
+
# __err_user_unknown__ -- email address doesn't exist;
|
|
14
|
+
# __err_user_inactive__ -- email address isn't used anymore;
|
|
15
|
+
# __err_will_retry__ -- email was temporary rejected, delivery will be retried later;
|
|
16
|
+
# __err_mailbox_discarded__ -- email address was active earlier, but now it's deleted;
|
|
17
|
+
# __err_mailbox_full__ -- mailbox is full;
|
|
18
|
+
# __err_spam_rejected__ -- email was rejected as a spam;
|
|
19
|
+
# __err_blacklisted__ -- email was rejected because sender IP or sender domain is found in a black
|
|
20
|
+
# list;
|
|
21
|
+
# __err_too_large__ -- email size is over limit, according to recipient's server;
|
|
22
|
+
# __err_unsubscribed__ -- email was unsubscribed;
|
|
23
|
+
# __err_unreachable__ -- numerous delivery failures lead to mark this email address as permanently
|
|
24
|
+
# unavailable;
|
|
25
|
+
# __err_skip_letter__ -- sending has been canceled because the email address is temporarily
|
|
26
|
+
# unavailable;
|
|
27
|
+
# __err_domain_inactive__ -- the domain does not accept mail or does not exist;
|
|
28
|
+
# __err_destination_misconfigured__ -- the domain does not accept mail due to incorrect settings on
|
|
29
|
+
# the recipient’s side, and the server’s response contains information about a cause that can be fixed
|
|
30
|
+
# (for example, an inoperative blacklist is used, etc.);
|
|
31
|
+
# __err_delivery_failed__ -- delivery failed due to other reasons;
|
|
32
|
+
# __err_spam_skipped__ -- sending has been canceled because the campaign has been blocked as a spam;
|
|
33
|
+
# __err_lost__ -- the message was not sent due to inconsistency of its parts or it has been lost
|
|
34
|
+
# because of the failure on our side. The sender needs to re-send the letter on his own, since the
|
|
35
|
+
# original has not been saved;
|
|
36
|
+
#
|
|
37
|
+
# We reserve the right to change or add internal delivery statuses as we need, so the following list
|
|
38
|
+
# is provided as an example only, without any description: ok_sent, ok_delivered, ok_read,
|
|
39
|
+
# ok_link_visited, ok_unsubscribed, ok_resubscribed, ok_spam_folder, ok_fbl, not_sent,
|
|
40
|
+
# skip_dup_unreachable, skip_dup_temp_unreachable, skip_dup_mailbox_full, err_spam_removed,
|
|
41
|
+
# err_resend, err_unknown, err_retry_letter, err_src_invalid, err_dest_invalid, err_not_available,
|
|
42
|
+
# err_internal, err_no_dns, err_no_smtp, err_giveup.
|
|
43
|
+
# @return [String, nil]
|
|
44
|
+
attr_accessor :delivery_status
|
|
45
|
+
|
|
46
|
+
# SMTP response.
|
|
47
|
+
# @return [String, nil]
|
|
48
|
+
attr_accessor :destination_response
|
|
49
|
+
|
|
50
|
+
# User agent of recipient. Present only if detected for "clicked" and "opened" statuses.
|
|
51
|
+
# @return [String, nil]
|
|
52
|
+
attr_accessor :user_agent
|
|
53
|
+
|
|
54
|
+
# Recipient's device type, detected from the user agent. Present for "clicked" and "opened" statuses;
|
|
55
|
+
# equals "unknown" if the device type couldn't be detected.
|
|
56
|
+
# @return [DeviceType, nil]
|
|
57
|
+
attr_accessor :device_type
|
|
58
|
+
|
|
59
|
+
# Recipient's device brand, detected from the user agent. Present for "clicked" and "opened" statuses
|
|
60
|
+
# if detected. For device_type "mobile" and "tablet" it's always present and equals "unknown" when the
|
|
61
|
+
# brand couldn't be detected.
|
|
62
|
+
# @return [String, nil]
|
|
63
|
+
attr_accessor :device_brand
|
|
64
|
+
|
|
65
|
+
# Name of the operating system of the recipient's device, detected from the user agent. Present for
|
|
66
|
+
# "clicked" and "opened" statuses; equals "unknown" if the OS couldn't be detected.
|
|
67
|
+
# @return [String, nil]
|
|
68
|
+
attr_accessor :os_name
|
|
69
|
+
|
|
70
|
+
# Name of the browser the email was opened in, detected from the user agent. Present for "clicked" and
|
|
71
|
+
# "opened" statuses only if a browser was detected, so it never comes together with email_client_name.
|
|
72
|
+
# @return [String, nil]
|
|
73
|
+
attr_accessor :browser_name
|
|
74
|
+
|
|
75
|
+
# Name of the email client application the email was opened in, detected from the user agent. Present
|
|
76
|
+
# for "clicked" and "opened" statuses only if an email client was detected, so it never comes together
|
|
77
|
+
# with browser_name.
|
|
78
|
+
# @return [String, nil]
|
|
79
|
+
attr_accessor :email_client_name
|
|
80
|
+
|
|
81
|
+
# Traffic quality for "opened" and "clicked" statuses. "human" means a recognized browser or email
|
|
82
|
+
# client without machine signs; "machine" means a bot, link scanner or security proxy; "protected"
|
|
83
|
+
# means a mailbox/OS privacy proxy where a human action cannot be confirmed (Apple Mail Privacy
|
|
84
|
+
# Protection / iCloud Private Relay, Gmail Image Proxy — Apple MPP is protected, not machine);
|
|
85
|
+
# "unknown" means the user agent is missing, broken or not recognized.
|
|
86
|
+
# @return [TrafficType, nil]
|
|
87
|
+
attr_accessor :traffic_type
|
|
88
|
+
|
|
89
|
+
# Recipient's IP address. Present only if detected for "clicked" and "opened" statuses.
|
|
90
|
+
# @return [String, nil]
|
|
91
|
+
attr_accessor :ip
|
|
92
|
+
|
|
93
|
+
# ISO 3166-1 alpha-2 country code detected from recipient IP. Present for "clicked" and "opened"
|
|
94
|
+
# statuses.
|
|
95
|
+
# @return [String, nil]
|
|
96
|
+
attr_accessor :country_code
|
|
97
|
+
|
|
98
|
+
# Country detected from recipient IP. Present for "clicked" and "opened" statuses.
|
|
99
|
+
# @return [String, nil]
|
|
100
|
+
attr_accessor :country
|
|
101
|
+
|
|
102
|
+
# City detected from recipient IP. Present for "clicked" and "opened" statuses.
|
|
103
|
+
# @return [String, nil]
|
|
104
|
+
attr_accessor :city
|
|
105
|
+
|
|
106
|
+
# IP address of the SMTP server that sent the message. Present only for "delivered", "soft_bounced"
|
|
107
|
+
# and "hard_bounced" statuses, if available.
|
|
108
|
+
# @return [String, nil]
|
|
109
|
+
attr_accessor :sender_ip
|
|
110
|
+
|
|
111
|
+
def initialize(
|
|
112
|
+
delivery_status: nil,
|
|
113
|
+
destination_response: nil,
|
|
114
|
+
user_agent: nil,
|
|
115
|
+
device_type: nil,
|
|
116
|
+
device_brand: nil,
|
|
117
|
+
os_name: nil,
|
|
118
|
+
browser_name: nil,
|
|
119
|
+
email_client_name: nil,
|
|
120
|
+
traffic_type: nil,
|
|
121
|
+
ip: nil,
|
|
122
|
+
country_code: nil,
|
|
123
|
+
country: nil,
|
|
124
|
+
city: nil,
|
|
125
|
+
sender_ip: nil
|
|
126
|
+
)
|
|
127
|
+
@delivery_status = delivery_status
|
|
128
|
+
@destination_response = destination_response
|
|
129
|
+
@user_agent = user_agent
|
|
130
|
+
@device_type = device_type
|
|
131
|
+
@device_brand = device_brand
|
|
132
|
+
@os_name = os_name
|
|
133
|
+
@browser_name = browser_name
|
|
134
|
+
@email_client_name = email_client_name
|
|
135
|
+
@traffic_type = traffic_type
|
|
136
|
+
@ip = ip
|
|
137
|
+
@country_code = country_code
|
|
138
|
+
@country = country
|
|
139
|
+
@city = city
|
|
140
|
+
@sender_ip = sender_ip
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
144
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
145
|
+
def self.from_h(data)
|
|
146
|
+
data = {} unless data.is_a?(Hash)
|
|
147
|
+
new(
|
|
148
|
+
delivery_status: data['delivery_status'],
|
|
149
|
+
destination_response: data['destination_response'],
|
|
150
|
+
user_agent: data['user_agent'],
|
|
151
|
+
device_type: data['device_type'],
|
|
152
|
+
device_brand: data['device_brand'],
|
|
153
|
+
os_name: data['os_name'],
|
|
154
|
+
browser_name: data['browser_name'],
|
|
155
|
+
email_client_name: data['email_client_name'],
|
|
156
|
+
traffic_type: data['traffic_type'],
|
|
157
|
+
ip: data['ip'],
|
|
158
|
+
country_code: data['country_code'],
|
|
159
|
+
country: data['country'],
|
|
160
|
+
city: data['city'],
|
|
161
|
+
sender_ip: data['sender_ip']
|
|
162
|
+
)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# JSON-ready hash, nil fields are omitted.
|
|
166
|
+
def to_h
|
|
167
|
+
{
|
|
168
|
+
'delivery_status' => @delivery_status,
|
|
169
|
+
'destination_response' => @destination_response,
|
|
170
|
+
'user_agent' => @user_agent,
|
|
171
|
+
'device_type' => @device_type,
|
|
172
|
+
'device_brand' => @device_brand,
|
|
173
|
+
'os_name' => @os_name,
|
|
174
|
+
'browser_name' => @browser_name,
|
|
175
|
+
'email_client_name' => @email_client_name,
|
|
176
|
+
'traffic_type' => @traffic_type,
|
|
177
|
+
'ip' => @ip,
|
|
178
|
+
'country_code' => @country_code,
|
|
179
|
+
'country' => @country,
|
|
180
|
+
'city' => @city,
|
|
181
|
+
'sender_ip' => @sender_ip,
|
|
182
|
+
}.compact
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def to_json(*args)
|
|
186
|
+
to_h.to_json(*args)
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# WebhookDeleteRequest
|
|
8
|
+
class WebhookDeleteRequest
|
|
9
|
+
# Webhook URL.
|
|
10
|
+
# @return [String, nil]
|
|
11
|
+
attr_accessor :url
|
|
12
|
+
|
|
13
|
+
def initialize(
|
|
14
|
+
url:
|
|
15
|
+
)
|
|
16
|
+
@url = url
|
|
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
|
+
url: data['url']
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# JSON-ready hash, nil fields are omitted.
|
|
29
|
+
def to_h
|
|
30
|
+
{
|
|
31
|
+
'url' => @url,
|
|
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
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# Notification format. "json_post"(default) or "json_post_gzip".
|
|
8
|
+
module WebhookEventFormat
|
|
9
|
+
JSON_POST = 'json_post'
|
|
10
|
+
JSON_POST_GZIP = 'json_post_gzip'
|
|
11
|
+
|
|
12
|
+
# All values
|
|
13
|
+
ALL = [JSON_POST, JSON_POST_GZIP].freeze
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# Object containing events to notify of.
|
|
8
|
+
class WebhookEventsObject
|
|
9
|
+
# If present then spam block events will be reported. Should contain single array element with "*"
|
|
10
|
+
# string.
|
|
11
|
+
# @return [Array<String>, nil]
|
|
12
|
+
attr_accessor :spam_block
|
|
13
|
+
|
|
14
|
+
# If present then email status change events will be reported. Contains names of statuses to notify
|
|
15
|
+
# of.
|
|
16
|
+
# @return [Array<EmailStatus>, nil]
|
|
17
|
+
attr_accessor :email_status
|
|
18
|
+
|
|
19
|
+
def initialize(
|
|
20
|
+
spam_block: nil,
|
|
21
|
+
email_status: nil
|
|
22
|
+
)
|
|
23
|
+
@spam_block = spam_block
|
|
24
|
+
@email_status = email_status
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
28
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
29
|
+
def self.from_h(data)
|
|
30
|
+
data = {} unless data.is_a?(Hash)
|
|
31
|
+
new(
|
|
32
|
+
spam_block: ::UniOne::Client::Decode.list(data['spam_block']),
|
|
33
|
+
email_status: ::UniOne::Client::Decode.list(data['email_status'])
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# JSON-ready hash, nil fields are omitted.
|
|
38
|
+
def to_h
|
|
39
|
+
{
|
|
40
|
+
'spam_block' => @spam_block,
|
|
41
|
+
'email_status' => @email_status,
|
|
42
|
+
}.compact
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def to_json(*args)
|
|
46
|
+
to_h.to_json(*args)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# WebhookGetRequest
|
|
8
|
+
class WebhookGetRequest
|
|
9
|
+
# Webhook URL.
|
|
10
|
+
# @return [String, nil]
|
|
11
|
+
attr_accessor :url
|
|
12
|
+
|
|
13
|
+
def initialize(
|
|
14
|
+
url:
|
|
15
|
+
)
|
|
16
|
+
@url = url
|
|
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
|
+
url: data['url']
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# JSON-ready hash, nil fields are omitted.
|
|
29
|
+
def to_h
|
|
30
|
+
{
|
|
31
|
+
'url' => @url,
|
|
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
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# WebhookGetResponse
|
|
8
|
+
class WebhookGetResponse
|
|
9
|
+
# "success" string
|
|
10
|
+
# Allowed values: `success`.
|
|
11
|
+
# @return [String, nil]
|
|
12
|
+
attr_accessor :status
|
|
13
|
+
|
|
14
|
+
# Object with all the webhook properties.
|
|
15
|
+
# @return [WebhookObject, nil]
|
|
16
|
+
attr_accessor :object
|
|
17
|
+
|
|
18
|
+
def initialize(
|
|
19
|
+
status: nil,
|
|
20
|
+
object: nil
|
|
21
|
+
)
|
|
22
|
+
@status = status
|
|
23
|
+
@object = object
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
27
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
28
|
+
def self.from_h(data)
|
|
29
|
+
data = {} unless data.is_a?(Hash)
|
|
30
|
+
new(
|
|
31
|
+
status: data['status'],
|
|
32
|
+
object: ::UniOne::Client::Decode.model(::UniOne::Api::Webhook::Model::WebhookObject, data['object'])
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# JSON-ready hash, nil fields are omitted.
|
|
37
|
+
def to_h
|
|
38
|
+
{
|
|
39
|
+
'status' => @status,
|
|
40
|
+
'object' => @object.nil? ? nil : @object.to_h,
|
|
41
|
+
}.compact
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def to_json(*args)
|
|
45
|
+
to_h.to_json(*args)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# WebhookListRequest
|
|
8
|
+
class WebhookListRequest
|
|
9
|
+
# Limits the number of webhooks returned. 50 is recommended.
|
|
10
|
+
# @return [Integer, nil]
|
|
11
|
+
attr_accessor :limit
|
|
12
|
+
|
|
13
|
+
# Index of the first webhook in the list, starting with 0.
|
|
14
|
+
# Default: `0`.
|
|
15
|
+
# @return [Integer, nil]
|
|
16
|
+
attr_accessor :offset
|
|
17
|
+
|
|
18
|
+
def initialize(
|
|
19
|
+
limit: nil,
|
|
20
|
+
offset: nil
|
|
21
|
+
)
|
|
22
|
+
@limit = limit
|
|
23
|
+
@offset = offset
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
27
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
28
|
+
def self.from_h(data)
|
|
29
|
+
data = {} unless data.is_a?(Hash)
|
|
30
|
+
new(
|
|
31
|
+
limit: data['limit'],
|
|
32
|
+
offset: data['offset']
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# JSON-ready hash, nil fields are omitted.
|
|
37
|
+
def to_h
|
|
38
|
+
{
|
|
39
|
+
'limit' => @limit,
|
|
40
|
+
'offset' => @offset,
|
|
41
|
+
}.compact
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def to_json(*args)
|
|
45
|
+
to_h.to_json(*args)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# WebhookListResponse
|
|
8
|
+
class WebhookListResponse
|
|
9
|
+
# "success" string
|
|
10
|
+
# Allowed values: `success`.
|
|
11
|
+
# @return [String, nil]
|
|
12
|
+
attr_accessor :status
|
|
13
|
+
|
|
14
|
+
# Array of webhooks objects.
|
|
15
|
+
# @return [Array<WebhookObject>, nil]
|
|
16
|
+
attr_accessor :objects
|
|
17
|
+
|
|
18
|
+
def initialize(
|
|
19
|
+
status: nil,
|
|
20
|
+
objects: nil
|
|
21
|
+
)
|
|
22
|
+
@status = status
|
|
23
|
+
@objects = objects
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
27
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
28
|
+
def self.from_h(data)
|
|
29
|
+
data = {} unless data.is_a?(Hash)
|
|
30
|
+
new(
|
|
31
|
+
status: data['status'],
|
|
32
|
+
objects: ::UniOne::Client::Decode.list(data['objects']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Api::Webhook::Model::WebhookObject, item0) }
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# JSON-ready hash, nil fields are omitted.
|
|
37
|
+
def to_h
|
|
38
|
+
{
|
|
39
|
+
'status' => @status,
|
|
40
|
+
'objects' => @objects.nil? ? nil : @objects.map { |item0| item0.to_h },
|
|
41
|
+
}.compact
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def to_json(*args)
|
|
45
|
+
to_h.to_json(*args)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# Object with all the webhook properties.
|
|
8
|
+
class WebhookObject
|
|
9
|
+
# Webhook unique identifier.
|
|
10
|
+
# @return [Integer, nil]
|
|
11
|
+
attr_accessor :id
|
|
12
|
+
|
|
13
|
+
# Webhook URL.
|
|
14
|
+
# @return [String, nil]
|
|
15
|
+
attr_accessor :url
|
|
16
|
+
|
|
17
|
+
# Webhook status, "active" by default. "disabled" means that webhook has been disabled by the user,
|
|
18
|
+
# "stopped" means that webhook has been stopped by the system after 24h of failed calls (with minimum
|
|
19
|
+
# of 10 distinct events).
|
|
20
|
+
# Default: `active`.
|
|
21
|
+
# @return [WebhookStatus, nil]
|
|
22
|
+
attr_accessor :status
|
|
23
|
+
|
|
24
|
+
# Notification format. "json_post"(default) or "json_post_gzip".
|
|
25
|
+
# Default: `json_post`.
|
|
26
|
+
# @return [WebhookEventFormat, nil]
|
|
27
|
+
attr_accessor :event_format
|
|
28
|
+
|
|
29
|
+
# Shall detailed delivery info be returned(1) or not(0). When it's 1, the information about SMTP
|
|
30
|
+
# response and internal delivery status is returned for "hard_bounced" and "soft_bounced" email
|
|
31
|
+
# statuses; the user agent, recipient IP address, detected geo fields, device info detected from the
|
|
32
|
+
# user agent (device type and brand, OS name, browser or email client name) and traffic_type (human,
|
|
33
|
+
# machine, protected or unknown) are returned for "opened" and "clicked" statuses; URL is returned for
|
|
34
|
+
# "clicked" status. For "delivered", "soft_bounced" and "hard_bounced" statuses UniOne may also return
|
|
35
|
+
# sender_ip, the IP address of the SMTP server that sent the message, if available.
|
|
36
|
+
# Allowed values: `0`, `1`.
|
|
37
|
+
# Default: `0`.
|
|
38
|
+
# @return [Integer, nil]
|
|
39
|
+
attr_accessor :delivery_info
|
|
40
|
+
|
|
41
|
+
# 0=several event notifications can be reported in single webhook call, 1=only single event can be
|
|
42
|
+
# reported in one call (not recommended).
|
|
43
|
+
# Allowed values: `0`, `1`.
|
|
44
|
+
# Default: `0`.
|
|
45
|
+
# @return [Integer, nil]
|
|
46
|
+
attr_accessor :single_event
|
|
47
|
+
|
|
48
|
+
# Maximum quantity of permitted parallel queries to your server. The more your server can handle - the
|
|
49
|
+
# better.
|
|
50
|
+
# Default: `10`.
|
|
51
|
+
# @return [Integer, nil]
|
|
52
|
+
attr_accessor :max_parallel
|
|
53
|
+
|
|
54
|
+
# Webhook properties last update date and time in UTC timezone in "YYYY-MM-DD hh:mm:ss" format.
|
|
55
|
+
# @return [String, nil]
|
|
56
|
+
attr_accessor :updated_at
|
|
57
|
+
|
|
58
|
+
# Object containing events to notify of.
|
|
59
|
+
# @return [WebhookEventsObject, nil]
|
|
60
|
+
attr_accessor :events
|
|
61
|
+
|
|
62
|
+
def initialize(
|
|
63
|
+
id: nil,
|
|
64
|
+
url: nil,
|
|
65
|
+
status: nil,
|
|
66
|
+
event_format: nil,
|
|
67
|
+
delivery_info: nil,
|
|
68
|
+
single_event: nil,
|
|
69
|
+
max_parallel: nil,
|
|
70
|
+
updated_at: nil,
|
|
71
|
+
events: nil
|
|
72
|
+
)
|
|
73
|
+
@id = id
|
|
74
|
+
@url = url
|
|
75
|
+
@status = status
|
|
76
|
+
@event_format = event_format
|
|
77
|
+
@delivery_info = delivery_info
|
|
78
|
+
@single_event = single_event
|
|
79
|
+
@max_parallel = max_parallel
|
|
80
|
+
@updated_at = updated_at
|
|
81
|
+
@events = events
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
85
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
86
|
+
def self.from_h(data)
|
|
87
|
+
data = {} unless data.is_a?(Hash)
|
|
88
|
+
new(
|
|
89
|
+
id: data['id'],
|
|
90
|
+
url: data['url'],
|
|
91
|
+
status: data['status'],
|
|
92
|
+
event_format: data['event_format'],
|
|
93
|
+
delivery_info: data['delivery_info'],
|
|
94
|
+
single_event: data['single_event'],
|
|
95
|
+
max_parallel: data['max_parallel'],
|
|
96
|
+
updated_at: data['updated_at'],
|
|
97
|
+
events: ::UniOne::Client::Decode.model(::UniOne::Api::Webhook::Model::WebhookEventsObject, data['events'])
|
|
98
|
+
)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# JSON-ready hash, nil fields are omitted.
|
|
102
|
+
def to_h
|
|
103
|
+
{
|
|
104
|
+
'id' => @id,
|
|
105
|
+
'url' => @url,
|
|
106
|
+
'status' => @status,
|
|
107
|
+
'event_format' => @event_format,
|
|
108
|
+
'delivery_info' => @delivery_info,
|
|
109
|
+
'single_event' => @single_event,
|
|
110
|
+
'max_parallel' => @max_parallel,
|
|
111
|
+
'updated_at' => @updated_at,
|
|
112
|
+
'events' => @events.nil? ? nil : @events.to_h,
|
|
113
|
+
}.compact
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def to_json(*args)
|
|
117
|
+
to_h.to_json(*args)
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|