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,146 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Project
|
|
6
|
+
module Model
|
|
7
|
+
# ProjectListObject
|
|
8
|
+
class ProjectListObject
|
|
9
|
+
# Unqiue project identifier, ASCII string up to 36 characters long.
|
|
10
|
+
# @return [String, nil]
|
|
11
|
+
attr_accessor :id
|
|
12
|
+
|
|
13
|
+
# API key of the project. You can use it instead of the user API key parameter in all methods except
|
|
14
|
+
# project/* methods.
|
|
15
|
+
# @return [String, nil]
|
|
16
|
+
attr_accessor :api_key
|
|
17
|
+
|
|
18
|
+
# Project name, unique for user account.
|
|
19
|
+
# @return [String, nil]
|
|
20
|
+
attr_accessor :name
|
|
21
|
+
|
|
22
|
+
# ISO-3166 alpha-2 country code. If set, UniOne treats project personal data according to country
|
|
23
|
+
# laws, e.g. GDPR for european countries.
|
|
24
|
+
# @return [String, nil]
|
|
25
|
+
attr_accessor :country
|
|
26
|
+
|
|
27
|
+
# Date and time of project creation in UTC timezone in "YYYY-MM-DD hh:mm:ss" format.
|
|
28
|
+
# @return [String, nil]
|
|
29
|
+
attr_accessor :reg_time
|
|
30
|
+
|
|
31
|
+
# Whether email sending is enabled for this project or not.
|
|
32
|
+
# Default: `True`.
|
|
33
|
+
# @return [Boolean, nil]
|
|
34
|
+
attr_accessor :send_enabled
|
|
35
|
+
|
|
36
|
+
# If it's false then UniOne adds default unsubscribe footer to each email sent with API key of the
|
|
37
|
+
# project. If it's true then appending default unsubscribe footer for this project is avoided and
|
|
38
|
+
# sending with custom unsubscribe url or even without unsubscribe url is permitted for the project.
|
|
39
|
+
# Please note that custom_unsubscribe_url_enabled=true is available only if removing unsubscribe link
|
|
40
|
+
# is approved for the user account by support. More on this
|
|
41
|
+
# [here](https://docs.unione.io/en/unsubscribe-link). When custom_unsubscribe_url_enabled is skipped
|
|
42
|
+
# on creating a project, it's value is taken from user
|
|
43
|
+
# @return [Boolean, nil]
|
|
44
|
+
attr_accessor :custom_unsubscribe_url_enabled
|
|
45
|
+
|
|
46
|
+
# A unique domain identifier which will determine the [tracking
|
|
47
|
+
# domain](https://docs.unione.io/en/tracking-domains) or [dedicated IP](/dedicated-ip) pool to be used
|
|
48
|
+
# by default. If the value is not specified, a default backend domain will be assigned for your
|
|
49
|
+
# account or project instead.
|
|
50
|
+
# @return [Integer, nil]
|
|
51
|
+
attr_accessor :backend_domain_id
|
|
52
|
+
|
|
53
|
+
# Project's email counter value. It increases on every email sent.
|
|
54
|
+
# @return [Integer, nil]
|
|
55
|
+
attr_accessor :email_counter
|
|
56
|
+
|
|
57
|
+
# Allows you to limit the number of emails sent by the project. The sending stops when the limit is
|
|
58
|
+
# reached. Any non-negative 64-bit integer is acceptable. 0 means no limit.
|
|
59
|
+
# @return [Integer, nil]
|
|
60
|
+
attr_accessor :email_counter_limit
|
|
61
|
+
|
|
62
|
+
# 'default' - the counter resets to zero automatically at the beginning of each accounting period.
|
|
63
|
+
# 'permanent' - the counter never resets automatically.
|
|
64
|
+
# Default: `default`.
|
|
65
|
+
# @return [EmailCounterMode, nil]
|
|
66
|
+
attr_accessor :email_counter_mode
|
|
67
|
+
|
|
68
|
+
# A unique identifier that defines the default unsubscribe page. If absent, the account/project will
|
|
69
|
+
# be assigned the system default unsubscribe page.
|
|
70
|
+
# @return [Integer, nil]
|
|
71
|
+
attr_accessor :unsubscribe_page_id
|
|
72
|
+
|
|
73
|
+
def initialize(
|
|
74
|
+
id: nil,
|
|
75
|
+
api_key: nil,
|
|
76
|
+
name: nil,
|
|
77
|
+
country: nil,
|
|
78
|
+
reg_time: nil,
|
|
79
|
+
send_enabled: nil,
|
|
80
|
+
custom_unsubscribe_url_enabled: nil,
|
|
81
|
+
backend_domain_id: nil,
|
|
82
|
+
email_counter: nil,
|
|
83
|
+
email_counter_limit: nil,
|
|
84
|
+
email_counter_mode: nil,
|
|
85
|
+
unsubscribe_page_id: nil
|
|
86
|
+
)
|
|
87
|
+
@id = id
|
|
88
|
+
@api_key = api_key
|
|
89
|
+
@name = name
|
|
90
|
+
@country = country
|
|
91
|
+
@reg_time = reg_time
|
|
92
|
+
@send_enabled = send_enabled
|
|
93
|
+
@custom_unsubscribe_url_enabled = custom_unsubscribe_url_enabled
|
|
94
|
+
@backend_domain_id = backend_domain_id
|
|
95
|
+
@email_counter = email_counter
|
|
96
|
+
@email_counter_limit = email_counter_limit
|
|
97
|
+
@email_counter_mode = email_counter_mode
|
|
98
|
+
@unsubscribe_page_id = unsubscribe_page_id
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
102
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
103
|
+
def self.from_h(data)
|
|
104
|
+
data = {} unless data.is_a?(Hash)
|
|
105
|
+
new(
|
|
106
|
+
id: data['id'],
|
|
107
|
+
api_key: data['api_key'],
|
|
108
|
+
name: data['name'],
|
|
109
|
+
country: data['country'],
|
|
110
|
+
reg_time: data['reg_time'],
|
|
111
|
+
send_enabled: data['send_enabled'],
|
|
112
|
+
custom_unsubscribe_url_enabled: data['custom_unsubscribe_url_enabled'],
|
|
113
|
+
backend_domain_id: data['backend_domain_id'],
|
|
114
|
+
email_counter: data['email_counter'],
|
|
115
|
+
email_counter_limit: data['email_counter_limit'],
|
|
116
|
+
email_counter_mode: data['email_counter_mode'],
|
|
117
|
+
unsubscribe_page_id: data['unsubscribe_page_id']
|
|
118
|
+
)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# JSON-ready hash, nil fields are omitted.
|
|
122
|
+
def to_h
|
|
123
|
+
{
|
|
124
|
+
'id' => @id,
|
|
125
|
+
'api_key' => @api_key,
|
|
126
|
+
'name' => @name,
|
|
127
|
+
'country' => @country,
|
|
128
|
+
'reg_time' => @reg_time,
|
|
129
|
+
'send_enabled' => @send_enabled,
|
|
130
|
+
'custom_unsubscribe_url_enabled' => @custom_unsubscribe_url_enabled,
|
|
131
|
+
'backend_domain_id' => @backend_domain_id,
|
|
132
|
+
'email_counter' => @email_counter,
|
|
133
|
+
'email_counter_limit' => @email_counter_limit,
|
|
134
|
+
'email_counter_mode' => @email_counter_mode,
|
|
135
|
+
'unsubscribe_page_id' => @unsubscribe_page_id,
|
|
136
|
+
}.compact
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def to_json(*args)
|
|
140
|
+
to_h.to_json(*args)
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Project
|
|
6
|
+
module Model
|
|
7
|
+
# ProjectListRequest
|
|
8
|
+
class ProjectListRequest
|
|
9
|
+
# Optional possibility to specify project_id to include only this project to list.
|
|
10
|
+
# @return [String, nil]
|
|
11
|
+
attr_accessor :project_id
|
|
12
|
+
|
|
13
|
+
# Optional possibility to specify project_api_key to include only this project to list.
|
|
14
|
+
# @return [String, nil]
|
|
15
|
+
attr_accessor :project_api_key
|
|
16
|
+
|
|
17
|
+
def initialize(
|
|
18
|
+
project_id: nil,
|
|
19
|
+
project_api_key: nil
|
|
20
|
+
)
|
|
21
|
+
@project_id = project_id
|
|
22
|
+
@project_api_key = project_api_key
|
|
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
|
+
project_id: data['project_id'],
|
|
31
|
+
project_api_key: data['project_api_key']
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# JSON-ready hash, nil fields are omitted.
|
|
36
|
+
def to_h
|
|
37
|
+
{
|
|
38
|
+
'project_id' => @project_id,
|
|
39
|
+
'project_api_key' => @project_api_key,
|
|
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,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Project
|
|
6
|
+
module Model
|
|
7
|
+
# ProjectListResponse
|
|
8
|
+
class ProjectListResponse
|
|
9
|
+
# "success" string
|
|
10
|
+
# Allowed values: `success`.
|
|
11
|
+
# @return [String, nil]
|
|
12
|
+
attr_accessor :status
|
|
13
|
+
|
|
14
|
+
# Array of objects where each object represents one project.
|
|
15
|
+
# @return [Array<ProjectListObject>, nil]
|
|
16
|
+
attr_accessor :projects
|
|
17
|
+
|
|
18
|
+
def initialize(
|
|
19
|
+
status: nil,
|
|
20
|
+
projects: nil
|
|
21
|
+
)
|
|
22
|
+
@status = status
|
|
23
|
+
@projects = projects
|
|
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
|
+
projects: ::UniOne::Client::Decode.list(data['projects']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Api::Project::Model::ProjectListObject, item0) }
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# JSON-ready hash, nil fields are omitted.
|
|
37
|
+
def to_h
|
|
38
|
+
{
|
|
39
|
+
'status' => @status,
|
|
40
|
+
'projects' => @projects.nil? ? nil : @projects.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,94 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Project
|
|
6
|
+
module Model
|
|
7
|
+
# Object with project properties.
|
|
8
|
+
class ProjectObject
|
|
9
|
+
# Project name, unique for user account.
|
|
10
|
+
# @return [String, nil]
|
|
11
|
+
attr_accessor :name
|
|
12
|
+
|
|
13
|
+
# ISO-3166 alpha-2 country code. If set, UniOne treats project personal data according to country
|
|
14
|
+
# laws, e.g. GDPR for european countries.
|
|
15
|
+
# @return [String, nil]
|
|
16
|
+
attr_accessor :country
|
|
17
|
+
|
|
18
|
+
# Whether email sending is enabled for this project or not.
|
|
19
|
+
# Default: `True`.
|
|
20
|
+
# @return [Boolean, nil]
|
|
21
|
+
attr_accessor :send_enabled
|
|
22
|
+
|
|
23
|
+
# If it's false then UniOne adds default unsubscribe footer to each email sent with API key of the
|
|
24
|
+
# project. If it's true then appending default unsubscribe footer for this project is avoided and
|
|
25
|
+
# sending with custom unsubscribe url or even without unsubscribe url is permitted for the project.
|
|
26
|
+
# Please note that custom_unsubscribe_url_enabled=true is available only if removing unsubscribe link
|
|
27
|
+
# is approved for the user account by support. More on this
|
|
28
|
+
# [here](https://docs.unione.io/en/unsubscribe-link). When custom_unsubscribe_url_enabled is skipped
|
|
29
|
+
# on creating a project, it's value is taken from user
|
|
30
|
+
# @return [Boolean, nil]
|
|
31
|
+
attr_accessor :custom_unsubscribe_url_enabled
|
|
32
|
+
|
|
33
|
+
# A unique domain identifier which will determine the [tracking
|
|
34
|
+
# domain](https://docs.unione.io/en/tracking-domains) or [dedicated IP](/dedicated-ip) pool to be used
|
|
35
|
+
# by default. If the value is not specified, a default backend domain will be assigned for your
|
|
36
|
+
# account or project instead.
|
|
37
|
+
# @return [Integer, nil]
|
|
38
|
+
attr_accessor :backend_domain_id
|
|
39
|
+
|
|
40
|
+
# A unique identifier that defines the default unsubscribe page. If absent, the account/project will
|
|
41
|
+
# be assigned the system default unsubscribe page.
|
|
42
|
+
# @return [Integer, nil]
|
|
43
|
+
attr_accessor :unsubscribe_page_id
|
|
44
|
+
|
|
45
|
+
def initialize(
|
|
46
|
+
name:,
|
|
47
|
+
country: nil,
|
|
48
|
+
send_enabled: nil,
|
|
49
|
+
custom_unsubscribe_url_enabled: nil,
|
|
50
|
+
backend_domain_id: nil,
|
|
51
|
+
unsubscribe_page_id: nil
|
|
52
|
+
)
|
|
53
|
+
@name = name
|
|
54
|
+
@country = country
|
|
55
|
+
@send_enabled = send_enabled
|
|
56
|
+
@custom_unsubscribe_url_enabled = custom_unsubscribe_url_enabled
|
|
57
|
+
@backend_domain_id = backend_domain_id
|
|
58
|
+
@unsubscribe_page_id = unsubscribe_page_id
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
62
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
63
|
+
def self.from_h(data)
|
|
64
|
+
data = {} unless data.is_a?(Hash)
|
|
65
|
+
new(
|
|
66
|
+
name: data['name'],
|
|
67
|
+
country: data['country'],
|
|
68
|
+
send_enabled: data['send_enabled'],
|
|
69
|
+
custom_unsubscribe_url_enabled: data['custom_unsubscribe_url_enabled'],
|
|
70
|
+
backend_domain_id: data['backend_domain_id'],
|
|
71
|
+
unsubscribe_page_id: data['unsubscribe_page_id']
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# JSON-ready hash, nil fields are omitted.
|
|
76
|
+
def to_h
|
|
77
|
+
{
|
|
78
|
+
'name' => @name,
|
|
79
|
+
'country' => @country,
|
|
80
|
+
'send_enabled' => @send_enabled,
|
|
81
|
+
'custom_unsubscribe_url_enabled' => @custom_unsubscribe_url_enabled,
|
|
82
|
+
'backend_domain_id' => @backend_domain_id,
|
|
83
|
+
'unsubscribe_page_id' => @unsubscribe_page_id,
|
|
84
|
+
}.compact
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def to_json(*args)
|
|
88
|
+
to_h.to_json(*args)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Project
|
|
6
|
+
module Model
|
|
7
|
+
# Object with project properties.
|
|
8
|
+
class ProjectUpdateObject
|
|
9
|
+
# Project name, unique for user account.
|
|
10
|
+
# @return [String, nil]
|
|
11
|
+
attr_accessor :name
|
|
12
|
+
|
|
13
|
+
# ISO-3166 alpha-2 country code. If set, UniOne treats project personal data according to country
|
|
14
|
+
# laws, e.g. GDPR for european countries.
|
|
15
|
+
# @return [String, nil]
|
|
16
|
+
attr_accessor :country
|
|
17
|
+
|
|
18
|
+
# Whether email sending is enabled for this project or not.
|
|
19
|
+
# Default: `True`.
|
|
20
|
+
# @return [Boolean, nil]
|
|
21
|
+
attr_accessor :send_enabled
|
|
22
|
+
|
|
23
|
+
# If it's false then UniOne adds default unsubscribe footer to each email sent with API key of the
|
|
24
|
+
# project. If it's true then appending default unsubscribe footer for this project is avoided and
|
|
25
|
+
# sending with custom unsubscribe url or even without unsubscribe url is permitted for the project.
|
|
26
|
+
# Please note that custom_unsubscribe_url_enabled=true is available only if removing unsubscribe link
|
|
27
|
+
# is approved for the user account by support. More on this
|
|
28
|
+
# [here](https://docs.unione.io/en/unsubscribe-link). When custom_unsubscribe_url_enabled is skipped
|
|
29
|
+
# on creating a project, it's value is taken from user
|
|
30
|
+
# @return [Boolean, nil]
|
|
31
|
+
attr_accessor :custom_unsubscribe_url_enabled
|
|
32
|
+
|
|
33
|
+
# A unique domain identifier which will determine the [tracking
|
|
34
|
+
# domain](https://docs.unione.io/en/tracking-domains) or [dedicated IP](/dedicated-ip) pool to be used
|
|
35
|
+
# by default. If the value is not specified, a default backend domain will be assigned for your
|
|
36
|
+
# account or project instead.
|
|
37
|
+
# @return [Integer, nil]
|
|
38
|
+
attr_accessor :backend_domain_id
|
|
39
|
+
|
|
40
|
+
# A unique identifier that defines the default unsubscribe page. If absent, the account/project will
|
|
41
|
+
# be assigned the system default unsubscribe page.
|
|
42
|
+
# @return [Integer, nil]
|
|
43
|
+
attr_accessor :unsubscribe_page_id
|
|
44
|
+
|
|
45
|
+
# Project's email counter value. 0 value only is accepted (which means resetting the counter to zero),
|
|
46
|
+
# or refreshes automatically depending on the counter mode set with the 'email_counter_mode'
|
|
47
|
+
# parameter. If the request doesn't contain the field or contains null, the limit value doesn't
|
|
48
|
+
# change.
|
|
49
|
+
# @return [Integer, nil]
|
|
50
|
+
attr_accessor :email_counter
|
|
51
|
+
|
|
52
|
+
# Allows you to limit the number of emails sent by the project. The sending stops when the limit is
|
|
53
|
+
# reached. Any non-negative 64-bit integer is acceptable. Setting to 0 means no limit. If the request
|
|
54
|
+
# doesn't contain the field or contains null, the limit value doesn't change.
|
|
55
|
+
# Default: `0`.
|
|
56
|
+
# @return [Integer, nil]
|
|
57
|
+
attr_accessor :email_counter_limit
|
|
58
|
+
|
|
59
|
+
# Sets the email counter mode. It allows you to choose whether the counter should reset automatically,
|
|
60
|
+
# or remain permanent. The following values are acceptable: 'default' - the counter resets to zero
|
|
61
|
+
# automatically at the beginning of each accounting period, 'permanent' - the counter never resets
|
|
62
|
+
# automatically. The reset can be done only manually by the user in the request with the passes 0
|
|
63
|
+
# value in the email_counter field. If the request doesn't contain the field or contains a null value,
|
|
64
|
+
# the limit value doesn't change.
|
|
65
|
+
# Default: `default`.
|
|
66
|
+
# @return [EmailCounterMode, nil]
|
|
67
|
+
attr_accessor :email_counter_mode
|
|
68
|
+
|
|
69
|
+
def initialize(
|
|
70
|
+
name:,
|
|
71
|
+
country: nil,
|
|
72
|
+
send_enabled: nil,
|
|
73
|
+
custom_unsubscribe_url_enabled: nil,
|
|
74
|
+
backend_domain_id: nil,
|
|
75
|
+
unsubscribe_page_id: nil,
|
|
76
|
+
email_counter: nil,
|
|
77
|
+
email_counter_limit: nil,
|
|
78
|
+
email_counter_mode: nil
|
|
79
|
+
)
|
|
80
|
+
@name = name
|
|
81
|
+
@country = country
|
|
82
|
+
@send_enabled = send_enabled
|
|
83
|
+
@custom_unsubscribe_url_enabled = custom_unsubscribe_url_enabled
|
|
84
|
+
@backend_domain_id = backend_domain_id
|
|
85
|
+
@unsubscribe_page_id = unsubscribe_page_id
|
|
86
|
+
@email_counter = email_counter
|
|
87
|
+
@email_counter_limit = email_counter_limit
|
|
88
|
+
@email_counter_mode = email_counter_mode
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
92
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
93
|
+
def self.from_h(data)
|
|
94
|
+
data = {} unless data.is_a?(Hash)
|
|
95
|
+
new(
|
|
96
|
+
name: data['name'],
|
|
97
|
+
country: data['country'],
|
|
98
|
+
send_enabled: data['send_enabled'],
|
|
99
|
+
custom_unsubscribe_url_enabled: data['custom_unsubscribe_url_enabled'],
|
|
100
|
+
backend_domain_id: data['backend_domain_id'],
|
|
101
|
+
unsubscribe_page_id: data['unsubscribe_page_id'],
|
|
102
|
+
email_counter: data['email_counter'],
|
|
103
|
+
email_counter_limit: data['email_counter_limit'],
|
|
104
|
+
email_counter_mode: data['email_counter_mode']
|
|
105
|
+
)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# JSON-ready hash, nil fields are omitted.
|
|
109
|
+
def to_h
|
|
110
|
+
{
|
|
111
|
+
'name' => @name,
|
|
112
|
+
'country' => @country,
|
|
113
|
+
'send_enabled' => @send_enabled,
|
|
114
|
+
'custom_unsubscribe_url_enabled' => @custom_unsubscribe_url_enabled,
|
|
115
|
+
'backend_domain_id' => @backend_domain_id,
|
|
116
|
+
'unsubscribe_page_id' => @unsubscribe_page_id,
|
|
117
|
+
'email_counter' => @email_counter,
|
|
118
|
+
'email_counter_limit' => @email_counter_limit,
|
|
119
|
+
'email_counter_mode' => @email_counter_mode,
|
|
120
|
+
}.compact
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def to_json(*args)
|
|
124
|
+
to_h.to_json(*args)
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Project
|
|
6
|
+
module Model
|
|
7
|
+
# ProjectUpdateRequest
|
|
8
|
+
class ProjectUpdateRequest
|
|
9
|
+
# Unique project identifier. You should identify project to update either with project_id or with
|
|
10
|
+
# project_api_key field. But we recommend usage of project_id as a more secure option.
|
|
11
|
+
# @return [String, nil]
|
|
12
|
+
attr_accessor :project_id
|
|
13
|
+
|
|
14
|
+
# Optional project API key. You should identify project to update either with project_id or with
|
|
15
|
+
# project_api_key field. But we recommend usage of project_id as a more secure option.
|
|
16
|
+
# @return [String, nil]
|
|
17
|
+
attr_accessor :project_api_key
|
|
18
|
+
|
|
19
|
+
# Object with project properties.
|
|
20
|
+
# @return [ProjectUpdateObject, nil]
|
|
21
|
+
attr_accessor :project
|
|
22
|
+
|
|
23
|
+
def initialize(
|
|
24
|
+
project:,
|
|
25
|
+
project_id: nil,
|
|
26
|
+
project_api_key: nil
|
|
27
|
+
)
|
|
28
|
+
@project_id = project_id
|
|
29
|
+
@project_api_key = project_api_key
|
|
30
|
+
@project = project
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
34
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
35
|
+
def self.from_h(data)
|
|
36
|
+
data = {} unless data.is_a?(Hash)
|
|
37
|
+
new(
|
|
38
|
+
project: ::UniOne::Client::Decode.model(::UniOne::Api::Project::Model::ProjectUpdateObject, data['project']),
|
|
39
|
+
project_id: data['project_id'],
|
|
40
|
+
project_api_key: data['project_api_key']
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# JSON-ready hash, nil fields are omitted.
|
|
45
|
+
def to_h
|
|
46
|
+
{
|
|
47
|
+
'project_id' => @project_id,
|
|
48
|
+
'project_api_key' => @project_api_key,
|
|
49
|
+
'project' => @project.nil? ? nil : @project.to_h,
|
|
50
|
+
}.compact
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def to_json(*args)
|
|
54
|
+
to_h.to_json(*args)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Project
|
|
6
|
+
module Model
|
|
7
|
+
# ProjectUpdateResponse
|
|
8
|
+
class ProjectUpdateResponse
|
|
9
|
+
# "success" string
|
|
10
|
+
# Allowed values: `success`.
|
|
11
|
+
# @return [String, nil]
|
|
12
|
+
attr_accessor :status
|
|
13
|
+
|
|
14
|
+
# API key of the project. Returned only if the project to update was identified by project_api_key.
|
|
15
|
+
# Not returned in case of updating by project_id.
|
|
16
|
+
# @return [String, nil]
|
|
17
|
+
attr_accessor :project_api_key
|
|
18
|
+
|
|
19
|
+
def initialize(
|
|
20
|
+
status: nil,
|
|
21
|
+
project_api_key: nil
|
|
22
|
+
)
|
|
23
|
+
@status = status
|
|
24
|
+
@project_api_key = project_api_key
|
|
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
|
+
status: data['status'],
|
|
33
|
+
project_api_key: data['project_api_key']
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# JSON-ready hash, nil fields are omitted.
|
|
38
|
+
def to_h
|
|
39
|
+
{
|
|
40
|
+
'status' => @status,
|
|
41
|
+
'project_api_key' => @project_api_key,
|
|
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,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
module UniOne
|
|
6
|
+
module Api
|
|
7
|
+
module Project
|
|
8
|
+
# Projects allow you to group several independent domains, webhooks, templates, and unsubscription
|
|
9
|
+
# lists together. It's very useful if you have your own clients and manage their data from a single
|
|
10
|
+
# UniOne account. Each project receives its own API key, and all API calls with that API key only deal
|
|
11
|
+
# with the data of that project. This way, you can assign a separate project for each client and be
|
|
12
|
+
# sure that they won't conflict; e.g. unsubscribing from one project won't affect another.
|
|
13
|
+
#
|
|
14
|
+
# Projects methods are disabled by default due to antispam measures. To enable them, [contact
|
|
15
|
+
# support](https://cp.unione.io/en/support).
|
|
16
|
+
#
|
|
17
|
+
# Please note that sending domains are confirmed and used on per-project basis by default. But it's
|
|
18
|
+
# possible to allow projects to send emails from domains confirmed for main account - just [ask
|
|
19
|
+
# support](https://cp.unione.io/en/support) to enable it.
|
|
20
|
+
class ProjectApi
|
|
21
|
+
# @param client [::UniOne::Client::ApiClient]
|
|
22
|
+
def initialize(client)
|
|
23
|
+
@client = client
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Creates a new project.
|
|
27
|
+
#
|
|
28
|
+
# Documentation: https://docs.unione.io/en/web-api-ref#project-create
|
|
29
|
+
# @param request [::UniOne::Api::Project::Model::ProjectCreateRequest, Hash]
|
|
30
|
+
# @return [::UniOne::Api::Project::Model::ProjectCreateResponse]
|
|
31
|
+
# @raise [::UniOne::Client::ApiError]
|
|
32
|
+
def create(request)
|
|
33
|
+
::UniOne::Api::Project::Model::ProjectCreateResponse.from_h(@client.call('/project/create.json', request.is_a?(Hash) ? request : request.to_h))
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Updates a project.
|
|
37
|
+
#
|
|
38
|
+
# Documentation: https://docs.unione.io/en/web-api-ref#project-update
|
|
39
|
+
# @param request [::UniOne::Api::Project::Model::ProjectUpdateRequest, Hash]
|
|
40
|
+
# @return [::UniOne::Api::Project::Model::ProjectUpdateResponse]
|
|
41
|
+
# @raise [::UniOne::Client::ApiError]
|
|
42
|
+
def update(request)
|
|
43
|
+
::UniOne::Api::Project::Model::ProjectUpdateResponse.from_h(@client.call('/project/update.json', request.is_a?(Hash) ? request : request.to_h))
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Lists projects.
|
|
47
|
+
#
|
|
48
|
+
# Documentation: https://docs.unione.io/en/web-api-ref#project-list
|
|
49
|
+
# @param request [::UniOne::Api::Project::Model::ProjectListRequest, Hash]
|
|
50
|
+
# @return [::UniOne::Api::Project::Model::ProjectListResponse]
|
|
51
|
+
# @raise [::UniOne::Client::ApiError]
|
|
52
|
+
def list(request)
|
|
53
|
+
::UniOne::Api::Project::Model::ProjectListResponse.from_h(@client.call('/project/list.json', request.is_a?(Hash) ? request : request.to_h))
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Deletes a project.
|
|
57
|
+
#
|
|
58
|
+
# The project will be moved to the "trash bin" before being permanently deleted. You can restore the
|
|
59
|
+
# project by contacting support.
|
|
60
|
+
#
|
|
61
|
+
# Documentation: https://docs.unione.io/en/web-api-ref#project-delete
|
|
62
|
+
# @param request [::UniOne::Api::Project::Model::ProjectDeleteRequest, Hash]
|
|
63
|
+
# @return [::UniOne::Common::Model::SuccessResponse]
|
|
64
|
+
# @raise [::UniOne::Client::ApiError]
|
|
65
|
+
def delete(request)
|
|
66
|
+
::UniOne::Common::Model::SuccessResponse.from_h(@client.call('/project/delete.json', request.is_a?(Hash) ? request : request.to_h))
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|