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,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
module UniOne
|
|
6
|
+
module Api
|
|
7
|
+
module Template
|
|
8
|
+
# You have the option of storing a template on the UniOne side and then using it by id, which is
|
|
9
|
+
# highly recommended for sending repetitive messages or high volume traffic. UniOne supports two
|
|
10
|
+
# different [template engines](https://docs.unione.io/en/template-engines).
|
|
11
|
+
class TemplateApi
|
|
12
|
+
# @param client [::UniOne::Client::ApiClient]
|
|
13
|
+
def initialize(client)
|
|
14
|
+
@client = client
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Creates or updates an email template.
|
|
18
|
+
#
|
|
19
|
+
# Restrictions:
|
|
20
|
+
# * The maximum request size is 10 MB.
|
|
21
|
+
# * The number of templates is limited to 10000.
|
|
22
|
+
#
|
|
23
|
+
# Documentation: https://docs.unione.io/en/web-api-ref#template-set
|
|
24
|
+
# @param request [::UniOne::Api::Template::Model::TemplateSetRequest, Hash]
|
|
25
|
+
# @return [::UniOne::Api::Template::Model::TemplateSetResponse]
|
|
26
|
+
# @raise [::UniOne::Client::ApiError]
|
|
27
|
+
def set(request)
|
|
28
|
+
::UniOne::Api::Template::Model::TemplateSetResponse.from_h(@client.call('/template/set.json', request.is_a?(Hash) ? request : request.to_h))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Gets template properties by it's id.
|
|
32
|
+
#
|
|
33
|
+
# Documentation: https://docs.unione.io/en/web-api-ref#template-get
|
|
34
|
+
# @param request [::UniOne::Api::Template::Model::TemplateGetRequest, Hash]
|
|
35
|
+
# @return [::UniOne::Api::Template::Model::TemplateGetResponse]
|
|
36
|
+
# @raise [::UniOne::Client::ApiError]
|
|
37
|
+
def get(request)
|
|
38
|
+
::UniOne::Api::Template::Model::TemplateGetResponse.from_h(@client.call('/template/get.json', request.is_a?(Hash) ? request : request.to_h))
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Returns the list of all or some templates of the account.
|
|
42
|
+
#
|
|
43
|
+
# You can iterate thru large list using "offset" and "limit" parameters. When less than "limit"
|
|
44
|
+
# templates are returned then the end of list is reached.
|
|
45
|
+
#
|
|
46
|
+
# Documentation: https://docs.unione.io/en/web-api-ref#template-list
|
|
47
|
+
# @param request [::UniOne::Api::Template::Model::TemplateListRequest, Hash]
|
|
48
|
+
# @return [::UniOne::Api::Template::Model::TemplateListResponse]
|
|
49
|
+
# @raise [::UniOne::Client::ApiError]
|
|
50
|
+
def list(request)
|
|
51
|
+
::UniOne::Api::Template::Model::TemplateListResponse.from_h(@client.call('/template/list.json', request.is_a?(Hash) ? request : request.to_h))
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Deletes a template by id.
|
|
55
|
+
#
|
|
56
|
+
# Documentation: https://docs.unione.io/en/web-api-ref#template-delete
|
|
57
|
+
# @param request [::UniOne::Api::Template::Model::TemplateDeleteRequest, Hash]
|
|
58
|
+
# @return [::UniOne::Common::Model::SuccessResponse]
|
|
59
|
+
# @raise [::UniOne::Client::ApiError]
|
|
60
|
+
def delete(request)
|
|
61
|
+
::UniOne::Common::Model::SuccessResponse.from_h(@client.call('/template/delete.json', request.is_a?(Hash) ? request : request.to_h))
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# Spam block type, either single or multiple sending SMTP. For single sending SMTP block in common
|
|
8
|
+
# pool UniOne retries several other SMTPs. This property exists only if
|
|
9
|
+
# event_name="transactional_spam_block".
|
|
10
|
+
module BlockType
|
|
11
|
+
ONE_SMTP = 'one_smtp'
|
|
12
|
+
ALL_SMTP = 'all_smtp'
|
|
13
|
+
|
|
14
|
+
# All values
|
|
15
|
+
ALL = [ONE_SMTP, ALL_SMTP].freeze
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# Recipient's device type, detected from the user agent. Present for "clicked" and "opened" statuses;
|
|
8
|
+
# equals "unknown" if the device type couldn't be detected.
|
|
9
|
+
module DeviceType
|
|
10
|
+
DESKTOP = 'desktop'
|
|
11
|
+
MOBILE = 'mobile'
|
|
12
|
+
TABLET = 'tablet'
|
|
13
|
+
OTHER = 'other'
|
|
14
|
+
UNKNOWN = 'unknown'
|
|
15
|
+
|
|
16
|
+
# All values
|
|
17
|
+
ALL = [DESKTOP, MOBILE, TABLET, OTHER, UNKNOWN].freeze
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# Whether it's a block or unblock event. This property exists only if
|
|
8
|
+
# event_name="transactional_spam_block".
|
|
9
|
+
module DomainStatus
|
|
10
|
+
BLOCKED = 'blocked'
|
|
11
|
+
UNBLOCKED = 'unblocked'
|
|
12
|
+
|
|
13
|
+
# All values
|
|
14
|
+
ALL = [BLOCKED, UNBLOCKED].freeze
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# Type of event data contained in event_data field, either "transactional_email_status" or
|
|
8
|
+
# "transactional_spam_block".
|
|
9
|
+
module EventName
|
|
10
|
+
TRANSACTIONAL_EMAIL_STATUS = 'transactional_email_status'
|
|
11
|
+
TRANSACTIONAL_SPAM_BLOCK = 'transactional_spam_block'
|
|
12
|
+
|
|
13
|
+
# All values
|
|
14
|
+
ALL = [TRANSACTIONAL_EMAIL_STATUS, TRANSACTIONAL_SPAM_BLOCK].freeze
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# Traffic quality for "opened" and "clicked" statuses. "human" means a recognized browser or email
|
|
8
|
+
# client without machine signs; "machine" means a bot, link scanner or security proxy; "protected"
|
|
9
|
+
# means a mailbox/OS privacy proxy where a human action cannot be confirmed (Apple Mail Privacy
|
|
10
|
+
# Protection / iCloud Private Relay, Gmail Image Proxy — Apple MPP is protected, not machine);
|
|
11
|
+
# "unknown" means the user agent is missing, broken or not recognized.
|
|
12
|
+
module TrafficType
|
|
13
|
+
HUMAN = 'human'
|
|
14
|
+
MACHINE = 'machine'
|
|
15
|
+
PROTECTED = 'protected'
|
|
16
|
+
UNKNOWN = 'unknown'
|
|
17
|
+
|
|
18
|
+
# All values
|
|
19
|
+
ALL = [HUMAN, MACHINE, PROTECTED, UNKNOWN].freeze
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# Webhook callback format description.
|
|
8
|
+
class WebhookCallback
|
|
9
|
+
# MD5-hash of the message body, in which the value "auth" is replaced by api key of the user/project;
|
|
10
|
+
# with this field the recipient of the notification can both authenticate and verify the notification
|
|
11
|
+
# integrity
|
|
12
|
+
# @return [String, nil]
|
|
13
|
+
attr_accessor :auth
|
|
14
|
+
|
|
15
|
+
# Array with only one element, containing events of a user/project.
|
|
16
|
+
# @return [Array<WebhookCallbackEventsByUserItem>, nil]
|
|
17
|
+
attr_accessor :events_by_user
|
|
18
|
+
|
|
19
|
+
def initialize(
|
|
20
|
+
auth: nil,
|
|
21
|
+
events_by_user: nil
|
|
22
|
+
)
|
|
23
|
+
@auth = auth
|
|
24
|
+
@events_by_user = events_by_user
|
|
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
|
+
auth: data['auth'],
|
|
33
|
+
events_by_user: ::UniOne::Client::Decode.list(data['events_by_user']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Api::Webhook::Model::WebhookCallbackEventsByUserItem, item0) }
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# JSON-ready hash, nil fields are omitted.
|
|
38
|
+
def to_h
|
|
39
|
+
{
|
|
40
|
+
'auth' => @auth,
|
|
41
|
+
'events_by_user' => @events_by_user.nil? ? nil : @events_by_user.map { |item0| item0.to_h },
|
|
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,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# WebhookCallbackEventsByUserItem
|
|
8
|
+
class WebhookCallbackEventsByUserItem
|
|
9
|
+
# Unique user identifier.
|
|
10
|
+
# @return [Integer, nil]
|
|
11
|
+
attr_accessor :user_id
|
|
12
|
+
|
|
13
|
+
# Project identifier, present only if webhook was registered for the project using project API key.
|
|
14
|
+
# @return [String, nil]
|
|
15
|
+
attr_accessor :project_id
|
|
16
|
+
|
|
17
|
+
# Project name, present only if webhook was registered for the project using project API key.
|
|
18
|
+
# @return [String, nil]
|
|
19
|
+
attr_accessor :project_name
|
|
20
|
+
|
|
21
|
+
# Array of events reported by webhook.
|
|
22
|
+
# @return [Array<WebhookCallbackEventsByUserItemEventsItem>, nil]
|
|
23
|
+
attr_accessor :events
|
|
24
|
+
|
|
25
|
+
def initialize(
|
|
26
|
+
user_id: nil,
|
|
27
|
+
project_id: nil,
|
|
28
|
+
project_name: nil,
|
|
29
|
+
events: nil
|
|
30
|
+
)
|
|
31
|
+
@user_id = user_id
|
|
32
|
+
@project_id = project_id
|
|
33
|
+
@project_name = project_name
|
|
34
|
+
@events = events
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
38
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
39
|
+
def self.from_h(data)
|
|
40
|
+
data = {} unless data.is_a?(Hash)
|
|
41
|
+
new(
|
|
42
|
+
user_id: data['user_id'],
|
|
43
|
+
project_id: data['project_id'],
|
|
44
|
+
project_name: data['project_name'],
|
|
45
|
+
events: ::UniOne::Client::Decode.list(data['events']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Api::Webhook::Model::WebhookCallbackEventsByUserItemEventsItem, item0) }
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# JSON-ready hash, nil fields are omitted.
|
|
50
|
+
def to_h
|
|
51
|
+
{
|
|
52
|
+
'user_id' => @user_id,
|
|
53
|
+
'project_id' => @project_id,
|
|
54
|
+
'project_name' => @project_name,
|
|
55
|
+
'events' => @events.nil? ? nil : @events.map { |item0| item0.to_h },
|
|
56
|
+
}.compact
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def to_json(*args)
|
|
60
|
+
to_h.to_json(*args)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# WebhookCallbackEventsByUserItemEventsItem
|
|
8
|
+
class WebhookCallbackEventsByUserItemEventsItem
|
|
9
|
+
# Type of event data contained in event_data field, either "transactional_email_status" or
|
|
10
|
+
# "transactional_spam_block".
|
|
11
|
+
# @return [EventName, nil]
|
|
12
|
+
attr_accessor :event_name
|
|
13
|
+
|
|
14
|
+
# Object with different event properties depending on "event_name". Below you can see all the
|
|
15
|
+
# properties, "transactional_email_status"-related first and then "transactional_spam_block"-related.
|
|
16
|
+
# @return [WebhookCallbackEventsByUserItemEventsItemEventData, nil]
|
|
17
|
+
attr_accessor :event_data
|
|
18
|
+
|
|
19
|
+
def initialize(
|
|
20
|
+
event_name: nil,
|
|
21
|
+
event_data: nil
|
|
22
|
+
)
|
|
23
|
+
@event_name = event_name
|
|
24
|
+
@event_data = event_data
|
|
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
|
+
event_name: data['event_name'],
|
|
33
|
+
event_data: ::UniOne::Client::Decode.model(::UniOne::Api::Webhook::Model::WebhookCallbackEventsByUserItemEventsItemEventData, data['event_data'])
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# JSON-ready hash, nil fields are omitted.
|
|
38
|
+
def to_h
|
|
39
|
+
{
|
|
40
|
+
'event_name' => @event_name,
|
|
41
|
+
'event_data' => @event_data.nil? ? nil : @event_data.to_h,
|
|
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
|
data/lib/unione/api/webhook/model/webhook_callback_events_by_user_item_events_item_event_data.rb
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Webhook
|
|
6
|
+
module Model
|
|
7
|
+
# Object with different event properties depending on "event_name". Below you can see all the
|
|
8
|
+
# properties, "transactional_email_status"-related first and then "transactional_spam_block"-related.
|
|
9
|
+
class WebhookCallbackEventsByUserItemEventsItemEventData
|
|
10
|
+
# Job identifier returned earlier by [email/send](https://docs.unione.io/en/web-api-ref#email-send)
|
|
11
|
+
# method. Property exists only if event_name="transactional_email_status".
|
|
12
|
+
# @return [String, nil]
|
|
13
|
+
attr_accessor :job_id
|
|
14
|
+
|
|
15
|
+
# Metadata passed in [email/send](https://docs.unione.io/en/web-api-ref#email-send) method in
|
|
16
|
+
# recipients.metadata or global_metadata properties. This property exists only if
|
|
17
|
+
# event_name="transactional_email_status".
|
|
18
|
+
# @return [Hash{String => String}, nil]
|
|
19
|
+
attr_accessor :metadata
|
|
20
|
+
|
|
21
|
+
# Recipient's email. This property exists only if event_name="transactional_email_status".
|
|
22
|
+
# @return [String, nil]
|
|
23
|
+
attr_accessor :email
|
|
24
|
+
|
|
25
|
+
# Email delivery status. This property exists only if event_name="transactional_email_status".
|
|
26
|
+
# Possible values are:
|
|
27
|
+
#
|
|
28
|
+
# __accepted__ — the message has been accepted, but not sent yet.
|
|
29
|
+
# __sent__ — the message has been sent, but not delivered yet.
|
|
30
|
+
# __delivered__ — the message has been delivered. It can be changed to “opened”, “clicked”,
|
|
31
|
+
# “unsubscribed”, “subscribed” or “spam”.
|
|
32
|
+
# __opened__ — the message has been delivered and read. It can be changed to “clicked”,
|
|
33
|
+
# “unsubscribed”, “subscribed” or “spam”.
|
|
34
|
+
# __clicked__ — the message has been delivered, read, and at least one of the links in email has been
|
|
35
|
+
# clicked. It can be changed to “unsubscribed”, “subscribed” or “spam”.
|
|
36
|
+
# __unsubscribed__ — the message has been delivered to the recipient and read, but then the recipient
|
|
37
|
+
# unsubscribed. It can be changed to “subscribed”.
|
|
38
|
+
# __subscribed__ — the message has been delivered to the recipient and read, but then the recipient
|
|
39
|
+
# unsubscribed and subscribed again. It can be changed to “unsubscribed”.
|
|
40
|
+
# __soft_bounced__ — temporary delivery failure. UniOne will try to deliver the message during 48
|
|
41
|
+
# hours. In case of success the status changes to “delivered”, in case of failure to deliver during 48
|
|
42
|
+
# hours message status changes to “hard_bounced”.
|
|
43
|
+
# __hard_bounced__ — failed to deliver the message, there will be no delivery attempts. It's a final
|
|
44
|
+
# status. There are a lot of possible reasons, you can use SMTP response from
|
|
45
|
+
# delivery_info.destination_response field or UniOne internal reason classification from
|
|
46
|
+
# delivery_info.delivery_status field to analyze the reason.
|
|
47
|
+
# __spam__ — the message has been delivered, but it was reported as spam by the recipient. UniOne can
|
|
48
|
+
# receive and process the spam complaint from several domains, including msn.com, outlook.com,
|
|
49
|
+
# hotmail.com, live.com, ukr.net, yahoo.com, aol.com using
|
|
50
|
+
# [FBL](https://en.wikipedia.org/wiki/Feedback_loop_(email)).
|
|
51
|
+
# @return [EmailStatus, nil]
|
|
52
|
+
attr_accessor :status
|
|
53
|
+
|
|
54
|
+
# Event date & time in UTC time zone in "YYYY-MM-DD hh:mm:ss" format. This property exists only if
|
|
55
|
+
# event_name="transactional_email_status".
|
|
56
|
+
# @return [String, nil]
|
|
57
|
+
attr_accessor :event_time
|
|
58
|
+
|
|
59
|
+
# URL for "opened" and "clicked" statuses. This property exists only if
|
|
60
|
+
# event_name="transactional_email_status".
|
|
61
|
+
# @return [String, nil]
|
|
62
|
+
attr_accessor :url
|
|
63
|
+
|
|
64
|
+
# Object with detailed delivery info.Event date & time in UTC time zone in "YYYY-MM-DD hh:mm:ss"
|
|
65
|
+
# format. This property exists only if webhook has delivery_info proeprty set to 1 and
|
|
66
|
+
# event_name="transactional_email_status".
|
|
67
|
+
# @return [WebhookCallbackEventsByUserItemEventsItemEventDataDeliveryInfo, nil]
|
|
68
|
+
attr_accessor :delivery_info
|
|
69
|
+
|
|
70
|
+
# Spam block date & time in UTC time zone in "YYYY-MM-DD hh:mm:ss" format. This property exists only
|
|
71
|
+
# if event_name="transactional_spam_block".
|
|
72
|
+
# @return [String, nil]
|
|
73
|
+
attr_accessor :block_time
|
|
74
|
+
|
|
75
|
+
# Spam block type, either single or multiple sending SMTP. For single sending SMTP block in common
|
|
76
|
+
# pool UniOne retries several other SMTPs. This property exists only if
|
|
77
|
+
# event_name="transactional_spam_block".
|
|
78
|
+
# @return [BlockType, nil]
|
|
79
|
+
attr_accessor :block_type
|
|
80
|
+
|
|
81
|
+
# Domain that blocked sending. This property exists only if event_name="transactional_spam_block".
|
|
82
|
+
# @return [String, nil]
|
|
83
|
+
attr_accessor :domain
|
|
84
|
+
|
|
85
|
+
# Number of sending SMTPs blocked. This property exists only if event_name="transactional_spam_block".
|
|
86
|
+
# @return [Integer, nil]
|
|
87
|
+
attr_accessor :smtp_blocks_count
|
|
88
|
+
|
|
89
|
+
# Whether it's a block or unblock event. This property exists only if
|
|
90
|
+
# event_name="transactional_spam_block".
|
|
91
|
+
# @return [DomainStatus, nil]
|
|
92
|
+
attr_accessor :domain_status
|
|
93
|
+
|
|
94
|
+
def initialize(
|
|
95
|
+
job_id: nil,
|
|
96
|
+
metadata: nil,
|
|
97
|
+
email: nil,
|
|
98
|
+
status: nil,
|
|
99
|
+
event_time: nil,
|
|
100
|
+
url: nil,
|
|
101
|
+
delivery_info: nil,
|
|
102
|
+
block_time: nil,
|
|
103
|
+
block_type: nil,
|
|
104
|
+
domain: nil,
|
|
105
|
+
smtp_blocks_count: nil,
|
|
106
|
+
domain_status: nil
|
|
107
|
+
)
|
|
108
|
+
@job_id = job_id
|
|
109
|
+
@metadata = metadata
|
|
110
|
+
@email = email
|
|
111
|
+
@status = status
|
|
112
|
+
@event_time = event_time
|
|
113
|
+
@url = url
|
|
114
|
+
@delivery_info = delivery_info
|
|
115
|
+
@block_time = block_time
|
|
116
|
+
@block_type = block_type
|
|
117
|
+
@domain = domain
|
|
118
|
+
@smtp_blocks_count = smtp_blocks_count
|
|
119
|
+
@domain_status = domain_status
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
123
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
124
|
+
def self.from_h(data)
|
|
125
|
+
data = {} unless data.is_a?(Hash)
|
|
126
|
+
new(
|
|
127
|
+
job_id: data['job_id'],
|
|
128
|
+
metadata: ::UniOne::Client::Decode.map(data['metadata']),
|
|
129
|
+
email: data['email'],
|
|
130
|
+
status: data['status'],
|
|
131
|
+
event_time: data['event_time'],
|
|
132
|
+
url: data['url'],
|
|
133
|
+
delivery_info: ::UniOne::Client::Decode.model(::UniOne::Api::Webhook::Model::WebhookCallbackEventsByUserItemEventsItemEventDataDeliveryInfo, data['delivery_info']),
|
|
134
|
+
block_time: data['block_time'],
|
|
135
|
+
block_type: data['block_type'],
|
|
136
|
+
domain: data['domain'],
|
|
137
|
+
smtp_blocks_count: data['SMTP_blocks_count'],
|
|
138
|
+
domain_status: data['domain_status']
|
|
139
|
+
)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# JSON-ready hash, nil fields are omitted.
|
|
143
|
+
def to_h
|
|
144
|
+
{
|
|
145
|
+
'job_id' => @job_id,
|
|
146
|
+
'metadata' => @metadata,
|
|
147
|
+
'email' => @email,
|
|
148
|
+
'status' => @status,
|
|
149
|
+
'event_time' => @event_time,
|
|
150
|
+
'url' => @url,
|
|
151
|
+
'delivery_info' => @delivery_info.nil? ? nil : @delivery_info.to_h,
|
|
152
|
+
'block_time' => @block_time,
|
|
153
|
+
'block_type' => @block_type,
|
|
154
|
+
'domain' => @domain,
|
|
155
|
+
'SMTP_blocks_count' => @smtp_blocks_count,
|
|
156
|
+
'domain_status' => @domain_status,
|
|
157
|
+
}.compact
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def to_json(*args)
|
|
161
|
+
to_h.to_json(*args)
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|