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,232 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Template
|
|
6
|
+
module Model
|
|
7
|
+
# TemplateListObject
|
|
8
|
+
class TemplateListObject
|
|
9
|
+
# Template unique identifier.
|
|
10
|
+
# @return [String, nil]
|
|
11
|
+
attr_accessor :id
|
|
12
|
+
|
|
13
|
+
# Template name.
|
|
14
|
+
# @return [String, nil]
|
|
15
|
+
attr_accessor :name
|
|
16
|
+
|
|
17
|
+
# Editor type, "html" or "visual". Default is "html". You can create a template with "visual" editor
|
|
18
|
+
# type only in web interface.
|
|
19
|
+
# @return [EditorType, nil]
|
|
20
|
+
attr_accessor :editor_type
|
|
21
|
+
|
|
22
|
+
# The [template engine](https://docs.unione.io/en/template-engines) for handling the
|
|
23
|
+
# substitutions(merge tags), "simple", "velocity", "liquid" or "none". Default value is "simple".
|
|
24
|
+
# @return [TemplateEngine, nil]
|
|
25
|
+
attr_accessor :template_engine
|
|
26
|
+
|
|
27
|
+
# Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If
|
|
28
|
+
# the substitution names are duplicated in object "substitutions", the values of the variables will be
|
|
29
|
+
# taken from the object "substitutions". The substitutions can be used in the following parameters:
|
|
30
|
+
#
|
|
31
|
+
# - body.html
|
|
32
|
+
# - body.plaintext
|
|
33
|
+
# - body.amp
|
|
34
|
+
# - subject
|
|
35
|
+
# - from_name
|
|
36
|
+
# - options.unsubscribe_url
|
|
37
|
+
# A substitution name can consist from latin characeters, numbers and "_" symbol, and should start
|
|
38
|
+
# with the letter.
|
|
39
|
+
# @return [Hash{String => String}, nil]
|
|
40
|
+
attr_accessor :global_substitutions
|
|
41
|
+
|
|
42
|
+
# Object for passing the metadata common for all the recipients, such as "key": "value". Max key
|
|
43
|
+
# quantity: 10. Max key length: 64 symbols. Max value length: 1024 symbols. The metadata is returned
|
|
44
|
+
# by [webhook](https://docs.unione.io/en/web-api-ref#webhook). To group single emails into a campaign,
|
|
45
|
+
# you can use the system key 'campaign_id' with a value in the form of a non-negative decimal integer
|
|
46
|
+
# up to 128 bits or a UUID in the format 'c7703772-453e-4c77-a9ae-9a1b94051b5a'. Incorrect values will
|
|
47
|
+
# be treated as '0'.
|
|
48
|
+
# @return [Hash{String => String}, nil]
|
|
49
|
+
attr_accessor :global_metadata
|
|
50
|
+
|
|
51
|
+
# Contains HTML/plaintext/AMP parts of the email. Either html or plaintext part is required.
|
|
52
|
+
# @return [BodyObject, nil]
|
|
53
|
+
attr_accessor :body
|
|
54
|
+
|
|
55
|
+
# Email subject.
|
|
56
|
+
# @return [String, nil]
|
|
57
|
+
attr_accessor :subject
|
|
58
|
+
|
|
59
|
+
# Sender's email.
|
|
60
|
+
# @return [String, nil]
|
|
61
|
+
attr_accessor :from_email
|
|
62
|
+
|
|
63
|
+
# Sender's name.
|
|
64
|
+
# @return [String, nil]
|
|
65
|
+
attr_accessor :from_name
|
|
66
|
+
|
|
67
|
+
# Optional Reply-To email (in case it's different to sender's email)
|
|
68
|
+
# @return [String, nil]
|
|
69
|
+
attr_accessor :reply_to
|
|
70
|
+
|
|
71
|
+
# Optional Reply-To name (if reply_to email is specified and you want to display not only this email
|
|
72
|
+
# but also the name)
|
|
73
|
+
# @return [String, nil]
|
|
74
|
+
attr_accessor :reply_to_name
|
|
75
|
+
|
|
76
|
+
# 1 = click tracking is on (default), 0 = click tracking is off. To use track_links = 0, you need to
|
|
77
|
+
# ask support to enable this feature.
|
|
78
|
+
# Allowed values: `0`, `1`.
|
|
79
|
+
# @return [Integer, nil]
|
|
80
|
+
attr_accessor :track_links
|
|
81
|
+
|
|
82
|
+
# 1 = read tracking is on (default), 0=read tracking is off. To use track_read = 0, you need to ask
|
|
83
|
+
# support to enable this feature.
|
|
84
|
+
# Allowed values: `0`, `1`.
|
|
85
|
+
# @return [Integer, nil]
|
|
86
|
+
attr_accessor :track_read
|
|
87
|
+
|
|
88
|
+
# Contains email headers, maximum 50. Only headers with “X-” name prefix are accepted, all other are
|
|
89
|
+
# ignored, for example X-UNIONE-Global-Language, X-UNIONE-Template-Engine. Standard headers "To,"
|
|
90
|
+
# "CC," and "BCC" are passed without the "X-." Yet, they are processed in a particular way and, as a
|
|
91
|
+
# result, have a number of restrictions. You can find more details about it [here](/cc-and-bcc). If
|
|
92
|
+
# our support have approved omitting standard unsubscription block for you, you can also pass
|
|
93
|
+
# List-Unsubscribe, List-Subscribe, List-Help, List-Owner, List-Archive, In-Reply-To and References
|
|
94
|
+
# headers.
|
|
95
|
+
# @return [HeadersObject, nil]
|
|
96
|
+
attr_accessor :headers
|
|
97
|
+
|
|
98
|
+
# Optional array of attachments
|
|
99
|
+
# @return [Array<AttachmentsArrayItem>, nil]
|
|
100
|
+
attr_accessor :attachments
|
|
101
|
+
|
|
102
|
+
# Optional array of inline attachments, e.g. for including images in email instead of loading them
|
|
103
|
+
# from external URL.
|
|
104
|
+
# @return [Array<InlineAttachmentsArrayItem>, nil]
|
|
105
|
+
attr_accessor :inline_attachments
|
|
106
|
+
|
|
107
|
+
# Template creation date and time in UTC timezone in format "YYYY-MM-DD hh:mm:ss"
|
|
108
|
+
# @return [String, nil]
|
|
109
|
+
attr_accessor :created
|
|
110
|
+
|
|
111
|
+
# Unique user identifier.
|
|
112
|
+
# @return [Integer, nil]
|
|
113
|
+
attr_accessor :user_id
|
|
114
|
+
|
|
115
|
+
# Unqiue project identifier, ASCII string up to 36 characters long.
|
|
116
|
+
# @return [String, nil]
|
|
117
|
+
attr_accessor :project_id
|
|
118
|
+
|
|
119
|
+
# Project name, unique for user account.
|
|
120
|
+
# @return [String, nil]
|
|
121
|
+
attr_accessor :project_name
|
|
122
|
+
|
|
123
|
+
def initialize(
|
|
124
|
+
id: nil,
|
|
125
|
+
name: nil,
|
|
126
|
+
editor_type: nil,
|
|
127
|
+
template_engine: nil,
|
|
128
|
+
global_substitutions: nil,
|
|
129
|
+
global_metadata: nil,
|
|
130
|
+
body: nil,
|
|
131
|
+
subject: nil,
|
|
132
|
+
from_email: nil,
|
|
133
|
+
from_name: nil,
|
|
134
|
+
reply_to: nil,
|
|
135
|
+
reply_to_name: nil,
|
|
136
|
+
track_links: nil,
|
|
137
|
+
track_read: nil,
|
|
138
|
+
headers: nil,
|
|
139
|
+
attachments: nil,
|
|
140
|
+
inline_attachments: nil,
|
|
141
|
+
created: nil,
|
|
142
|
+
user_id: nil,
|
|
143
|
+
project_id: nil,
|
|
144
|
+
project_name: nil
|
|
145
|
+
)
|
|
146
|
+
@id = id
|
|
147
|
+
@name = name
|
|
148
|
+
@editor_type = editor_type
|
|
149
|
+
@template_engine = template_engine
|
|
150
|
+
@global_substitutions = global_substitutions
|
|
151
|
+
@global_metadata = global_metadata
|
|
152
|
+
@body = body
|
|
153
|
+
@subject = subject
|
|
154
|
+
@from_email = from_email
|
|
155
|
+
@from_name = from_name
|
|
156
|
+
@reply_to = reply_to
|
|
157
|
+
@reply_to_name = reply_to_name
|
|
158
|
+
@track_links = track_links
|
|
159
|
+
@track_read = track_read
|
|
160
|
+
@headers = headers
|
|
161
|
+
@attachments = attachments
|
|
162
|
+
@inline_attachments = inline_attachments
|
|
163
|
+
@created = created
|
|
164
|
+
@user_id = user_id
|
|
165
|
+
@project_id = project_id
|
|
166
|
+
@project_name = project_name
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
170
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
171
|
+
def self.from_h(data)
|
|
172
|
+
data = {} unless data.is_a?(Hash)
|
|
173
|
+
new(
|
|
174
|
+
id: data['id'],
|
|
175
|
+
name: data['name'],
|
|
176
|
+
editor_type: data['editor_type'],
|
|
177
|
+
template_engine: data['template_engine'],
|
|
178
|
+
global_substitutions: ::UniOne::Client::Decode.map(data['global_substitutions']),
|
|
179
|
+
global_metadata: ::UniOne::Client::Decode.map(data['global_metadata']),
|
|
180
|
+
body: ::UniOne::Client::Decode.model(::UniOne::Common::Model::BodyObject, data['body']),
|
|
181
|
+
subject: data['subject'],
|
|
182
|
+
from_email: data['from_email'],
|
|
183
|
+
from_name: data['from_name'],
|
|
184
|
+
reply_to: data['reply_to'],
|
|
185
|
+
reply_to_name: data['reply_to_name'],
|
|
186
|
+
track_links: data['track_links'],
|
|
187
|
+
track_read: data['track_read'],
|
|
188
|
+
headers: ::UniOne::Client::Decode.model(::UniOne::Common::Model::HeadersObject, data['headers']),
|
|
189
|
+
attachments: ::UniOne::Client::Decode.list(data['attachments']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Common::Model::AttachmentsArrayItem, item0) },
|
|
190
|
+
inline_attachments: ::UniOne::Client::Decode.list(data['inline_attachments']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Common::Model::InlineAttachmentsArrayItem, item0) },
|
|
191
|
+
created: data['created'],
|
|
192
|
+
user_id: data['user_id'],
|
|
193
|
+
project_id: data['project_id'],
|
|
194
|
+
project_name: data['project_name']
|
|
195
|
+
)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# JSON-ready hash, nil fields are omitted.
|
|
199
|
+
def to_h
|
|
200
|
+
{
|
|
201
|
+
'id' => @id,
|
|
202
|
+
'name' => @name,
|
|
203
|
+
'editor_type' => @editor_type,
|
|
204
|
+
'template_engine' => @template_engine,
|
|
205
|
+
'global_substitutions' => @global_substitutions,
|
|
206
|
+
'global_metadata' => @global_metadata,
|
|
207
|
+
'body' => @body.nil? ? nil : @body.to_h,
|
|
208
|
+
'subject' => @subject,
|
|
209
|
+
'from_email' => @from_email,
|
|
210
|
+
'from_name' => @from_name,
|
|
211
|
+
'reply_to' => @reply_to,
|
|
212
|
+
'reply_to_name' => @reply_to_name,
|
|
213
|
+
'track_links' => @track_links,
|
|
214
|
+
'track_read' => @track_read,
|
|
215
|
+
'headers' => @headers.nil? ? nil : @headers.to_h,
|
|
216
|
+
'attachments' => @attachments.nil? ? nil : @attachments.map { |item0| item0.to_h },
|
|
217
|
+
'inline_attachments' => @inline_attachments.nil? ? nil : @inline_attachments.map { |item0| item0.to_h },
|
|
218
|
+
'created' => @created,
|
|
219
|
+
'user_id' => @user_id,
|
|
220
|
+
'project_id' => @project_id,
|
|
221
|
+
'project_name' => @project_name,
|
|
222
|
+
}.compact
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
def to_json(*args)
|
|
226
|
+
to_h.to_json(*args)
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Template
|
|
6
|
+
module Model
|
|
7
|
+
# TemplateListRequest
|
|
8
|
+
class TemplateListRequest
|
|
9
|
+
# Limits the number of templates returned, default is 50.
|
|
10
|
+
# Default: `50`.
|
|
11
|
+
# @return [Integer, nil]
|
|
12
|
+
attr_accessor :limit
|
|
13
|
+
|
|
14
|
+
# Index of the first template in the list, starting with 0.
|
|
15
|
+
# Default: `0`.
|
|
16
|
+
# @return [Integer, nil]
|
|
17
|
+
attr_accessor :offset
|
|
18
|
+
|
|
19
|
+
def initialize(
|
|
20
|
+
limit: nil,
|
|
21
|
+
offset: nil
|
|
22
|
+
)
|
|
23
|
+
@limit = limit
|
|
24
|
+
@offset = offset
|
|
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
|
+
limit: data['limit'],
|
|
33
|
+
offset: data['offset']
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# JSON-ready hash, nil fields are omitted.
|
|
38
|
+
def to_h
|
|
39
|
+
{
|
|
40
|
+
'limit' => @limit,
|
|
41
|
+
'offset' => @offset,
|
|
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,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Template
|
|
6
|
+
module Model
|
|
7
|
+
# TemplateListResponse
|
|
8
|
+
class TemplateListResponse
|
|
9
|
+
# "success" string
|
|
10
|
+
# Allowed values: `success`.
|
|
11
|
+
# @return [String, nil]
|
|
12
|
+
attr_accessor :status
|
|
13
|
+
|
|
14
|
+
# Array of template objects.
|
|
15
|
+
# @return [Array<TemplateListObject>, nil]
|
|
16
|
+
attr_accessor :templates
|
|
17
|
+
|
|
18
|
+
def initialize(
|
|
19
|
+
status: nil,
|
|
20
|
+
templates: nil
|
|
21
|
+
)
|
|
22
|
+
@status = status
|
|
23
|
+
@templates = templates
|
|
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
|
+
templates: ::UniOne::Client::Decode.list(data['templates']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Api::Template::Model::TemplateListObject, item0) }
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# JSON-ready hash, nil fields are omitted.
|
|
37
|
+
def to_h
|
|
38
|
+
{
|
|
39
|
+
'status' => @status,
|
|
40
|
+
'templates' => @templates.nil? ? nil : @templates.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,201 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Template
|
|
6
|
+
module Model
|
|
7
|
+
# Object with all the template properties.
|
|
8
|
+
class TemplateObject
|
|
9
|
+
# Template unique identifier. If you omit the "id" field then new template will be created. If you
|
|
10
|
+
# specify the "id" field, the system will try to find a template with the specified id and edit it.
|
|
11
|
+
# @return [String, nil]
|
|
12
|
+
attr_accessor :id
|
|
13
|
+
|
|
14
|
+
# Template name.
|
|
15
|
+
# @return [String, nil]
|
|
16
|
+
attr_accessor :name
|
|
17
|
+
|
|
18
|
+
# Editor type, "html" or "visual". Default is "html". You can create a template with "visual" editor
|
|
19
|
+
# type only in web interface.
|
|
20
|
+
# @return [EditorType, nil]
|
|
21
|
+
attr_accessor :editor_type
|
|
22
|
+
|
|
23
|
+
# The [template engine](https://docs.unione.io/en/template-engines) for handling the
|
|
24
|
+
# substitutions(merge tags), "simple", "velocity", "liquid" or "none". Default value is "simple".
|
|
25
|
+
# @return [TemplateEngine, nil]
|
|
26
|
+
attr_accessor :template_engine
|
|
27
|
+
|
|
28
|
+
# Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If
|
|
29
|
+
# the substitution names are duplicated in object "substitutions", the values of the variables will be
|
|
30
|
+
# taken from the object "substitutions". The substitutions can be used in the following parameters:
|
|
31
|
+
#
|
|
32
|
+
# - body.html
|
|
33
|
+
# - body.plaintext
|
|
34
|
+
# - body.amp
|
|
35
|
+
# - subject
|
|
36
|
+
# - from_name
|
|
37
|
+
# - options.unsubscribe_url
|
|
38
|
+
# A substitution name can consist from latin characeters, numbers and "_" symbol, and should start
|
|
39
|
+
# with the letter.
|
|
40
|
+
# @return [Hash{String => String}, nil]
|
|
41
|
+
attr_accessor :global_substitutions
|
|
42
|
+
|
|
43
|
+
# Object for passing the metadata common for all the recipients, such as "key": "value". Max key
|
|
44
|
+
# quantity: 10. Max key length: 64 symbols. Max value length: 1024 symbols. The metadata is returned
|
|
45
|
+
# by [webhook](https://docs.unione.io/en/web-api-ref#webhook). To group single emails into a campaign,
|
|
46
|
+
# you can use the system key 'campaign_id' with a value in the form of a non-negative decimal integer
|
|
47
|
+
# up to 128 bits or a UUID in the format 'c7703772-453e-4c77-a9ae-9a1b94051b5a'. Incorrect values will
|
|
48
|
+
# be treated as '0'.
|
|
49
|
+
# @return [Hash{String => String}, nil]
|
|
50
|
+
attr_accessor :global_metadata
|
|
51
|
+
|
|
52
|
+
# Contains HTML/plaintext/AMP parts of the email. Either html or plaintext part is required.
|
|
53
|
+
# @return [BodyObject, nil]
|
|
54
|
+
attr_accessor :body
|
|
55
|
+
|
|
56
|
+
# Email subject.
|
|
57
|
+
# @return [String, nil]
|
|
58
|
+
attr_accessor :subject
|
|
59
|
+
|
|
60
|
+
# Sender's email.
|
|
61
|
+
# @return [String, nil]
|
|
62
|
+
attr_accessor :from_email
|
|
63
|
+
|
|
64
|
+
# Sender's name.
|
|
65
|
+
# @return [String, nil]
|
|
66
|
+
attr_accessor :from_name
|
|
67
|
+
|
|
68
|
+
# Optional Reply-To email (in case it's different to sender's email)
|
|
69
|
+
# @return [String, nil]
|
|
70
|
+
attr_accessor :reply_to
|
|
71
|
+
|
|
72
|
+
# Optional Reply-To name (if reply_to email is specified and you want to display not only this email
|
|
73
|
+
# but also the name)
|
|
74
|
+
# @return [String, nil]
|
|
75
|
+
attr_accessor :reply_to_name
|
|
76
|
+
|
|
77
|
+
# 1 = click tracking is on (default), 0 = click tracking is off. To use track_links = 0, you need to
|
|
78
|
+
# ask support to enable this feature.
|
|
79
|
+
# Allowed values: `0`, `1`.
|
|
80
|
+
# @return [Integer, nil]
|
|
81
|
+
attr_accessor :track_links
|
|
82
|
+
|
|
83
|
+
# 1 = read tracking is on (default), 0=read tracking is off. To use track_read = 0, you need to ask
|
|
84
|
+
# support to enable this feature.
|
|
85
|
+
# Allowed values: `0`, `1`.
|
|
86
|
+
# @return [Integer, nil]
|
|
87
|
+
attr_accessor :track_read
|
|
88
|
+
|
|
89
|
+
# Contains email headers, maximum 50. Only headers with “X-” name prefix are accepted, all other are
|
|
90
|
+
# ignored, for example X-UNIONE-Global-Language, X-UNIONE-Template-Engine. Standard headers "To,"
|
|
91
|
+
# "CC," and "BCC" are passed without the "X-." Yet, they are processed in a particular way and, as a
|
|
92
|
+
# result, have a number of restrictions. You can find more details about it [here](/cc-and-bcc). If
|
|
93
|
+
# our support have approved omitting standard unsubscription block for you, you can also pass
|
|
94
|
+
# List-Unsubscribe, List-Subscribe, List-Help, List-Owner, List-Archive, In-Reply-To and References
|
|
95
|
+
# headers.
|
|
96
|
+
# @return [HeadersObject, nil]
|
|
97
|
+
attr_accessor :headers
|
|
98
|
+
|
|
99
|
+
# Optional array of attachments
|
|
100
|
+
# @return [Array<AttachmentsArrayItem>, nil]
|
|
101
|
+
attr_accessor :attachments
|
|
102
|
+
|
|
103
|
+
# Optional array of inline attachments, e.g. for including images in email instead of loading them
|
|
104
|
+
# from external URL.
|
|
105
|
+
# @return [Array<InlineAttachmentsArrayItem>, nil]
|
|
106
|
+
attr_accessor :inline_attachments
|
|
107
|
+
|
|
108
|
+
def initialize(
|
|
109
|
+
name:,
|
|
110
|
+
from_email:,
|
|
111
|
+
id: nil,
|
|
112
|
+
editor_type: nil,
|
|
113
|
+
template_engine: nil,
|
|
114
|
+
global_substitutions: nil,
|
|
115
|
+
global_metadata: nil,
|
|
116
|
+
body: nil,
|
|
117
|
+
subject: nil,
|
|
118
|
+
from_name: nil,
|
|
119
|
+
reply_to: nil,
|
|
120
|
+
reply_to_name: nil,
|
|
121
|
+
track_links: nil,
|
|
122
|
+
track_read: nil,
|
|
123
|
+
headers: nil,
|
|
124
|
+
attachments: nil,
|
|
125
|
+
inline_attachments: nil
|
|
126
|
+
)
|
|
127
|
+
@id = id
|
|
128
|
+
@name = name
|
|
129
|
+
@editor_type = editor_type
|
|
130
|
+
@template_engine = template_engine
|
|
131
|
+
@global_substitutions = global_substitutions
|
|
132
|
+
@global_metadata = global_metadata
|
|
133
|
+
@body = body
|
|
134
|
+
@subject = subject
|
|
135
|
+
@from_email = from_email
|
|
136
|
+
@from_name = from_name
|
|
137
|
+
@reply_to = reply_to
|
|
138
|
+
@reply_to_name = reply_to_name
|
|
139
|
+
@track_links = track_links
|
|
140
|
+
@track_read = track_read
|
|
141
|
+
@headers = headers
|
|
142
|
+
@attachments = attachments
|
|
143
|
+
@inline_attachments = inline_attachments
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Builds the object from decoded JSON. Lenient: a missing field, nil or a value of another type
|
|
147
|
+
# gives nil (data that is not a Hash gives an empty object).
|
|
148
|
+
def self.from_h(data)
|
|
149
|
+
data = {} unless data.is_a?(Hash)
|
|
150
|
+
new(
|
|
151
|
+
name: data['name'],
|
|
152
|
+
from_email: data['from_email'],
|
|
153
|
+
id: data['id'],
|
|
154
|
+
editor_type: data['editor_type'],
|
|
155
|
+
template_engine: data['template_engine'],
|
|
156
|
+
global_substitutions: ::UniOne::Client::Decode.map(data['global_substitutions']),
|
|
157
|
+
global_metadata: ::UniOne::Client::Decode.map(data['global_metadata']),
|
|
158
|
+
body: ::UniOne::Client::Decode.model(::UniOne::Common::Model::BodyObject, data['body']),
|
|
159
|
+
subject: data['subject'],
|
|
160
|
+
from_name: data['from_name'],
|
|
161
|
+
reply_to: data['reply_to'],
|
|
162
|
+
reply_to_name: data['reply_to_name'],
|
|
163
|
+
track_links: data['track_links'],
|
|
164
|
+
track_read: data['track_read'],
|
|
165
|
+
headers: ::UniOne::Client::Decode.model(::UniOne::Common::Model::HeadersObject, data['headers']),
|
|
166
|
+
attachments: ::UniOne::Client::Decode.list(data['attachments']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Common::Model::AttachmentsArrayItem, item0) },
|
|
167
|
+
inline_attachments: ::UniOne::Client::Decode.list(data['inline_attachments']) { |item0| ::UniOne::Client::Decode.model(::UniOne::Common::Model::InlineAttachmentsArrayItem, item0) }
|
|
168
|
+
)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# JSON-ready hash, nil fields are omitted.
|
|
172
|
+
def to_h
|
|
173
|
+
{
|
|
174
|
+
'id' => @id,
|
|
175
|
+
'name' => @name,
|
|
176
|
+
'editor_type' => @editor_type,
|
|
177
|
+
'template_engine' => @template_engine,
|
|
178
|
+
'global_substitutions' => @global_substitutions,
|
|
179
|
+
'global_metadata' => @global_metadata,
|
|
180
|
+
'body' => @body.nil? ? nil : @body.to_h,
|
|
181
|
+
'subject' => @subject,
|
|
182
|
+
'from_email' => @from_email,
|
|
183
|
+
'from_name' => @from_name,
|
|
184
|
+
'reply_to' => @reply_to,
|
|
185
|
+
'reply_to_name' => @reply_to_name,
|
|
186
|
+
'track_links' => @track_links,
|
|
187
|
+
'track_read' => @track_read,
|
|
188
|
+
'headers' => @headers.nil? ? nil : @headers.to_h,
|
|
189
|
+
'attachments' => @attachments.nil? ? nil : @attachments.map { |item0| item0.to_h },
|
|
190
|
+
'inline_attachments' => @inline_attachments.nil? ? nil : @inline_attachments.map { |item0| item0.to_h },
|
|
191
|
+
}.compact
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def to_json(*args)
|
|
195
|
+
to_h.to_json(*args)
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module UniOne
|
|
4
|
+
module Api
|
|
5
|
+
module Template
|
|
6
|
+
module Model
|
|
7
|
+
# Object with all the properties of the template.
|
|
8
|
+
class TemplateSetRequest
|
|
9
|
+
# Object with all the template properties.
|
|
10
|
+
# @return [TemplateObject, nil]
|
|
11
|
+
attr_accessor :template
|
|
12
|
+
|
|
13
|
+
def initialize(
|
|
14
|
+
template:
|
|
15
|
+
)
|
|
16
|
+
@template = template
|
|
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
|
+
template: ::UniOne::Client::Decode.model(::UniOne::Api::Template::Model::TemplateObject, data['template'])
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# JSON-ready hash, nil fields are omitted.
|
|
29
|
+
def to_h
|
|
30
|
+
{
|
|
31
|
+
'template' => @template.nil? ? nil : @template.to_h,
|
|
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 Template
|
|
6
|
+
module Model
|
|
7
|
+
# TemplateSetResponse
|
|
8
|
+
class TemplateSetResponse
|
|
9
|
+
# "success" string
|
|
10
|
+
# Allowed values: `success`.
|
|
11
|
+
# @return [String, nil]
|
|
12
|
+
attr_accessor :status
|
|
13
|
+
|
|
14
|
+
# Object with all the template properties.
|
|
15
|
+
# @return [TemplateObject, nil]
|
|
16
|
+
attr_accessor :template
|
|
17
|
+
|
|
18
|
+
def initialize(
|
|
19
|
+
status: nil,
|
|
20
|
+
template: nil
|
|
21
|
+
)
|
|
22
|
+
@status = status
|
|
23
|
+
@template = template
|
|
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
|
+
template: ::UniOne::Client::Decode.model(::UniOne::Api::Template::Model::TemplateObject, data['template'])
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# JSON-ready hash, nil fields are omitted.
|
|
37
|
+
def to_h
|
|
38
|
+
{
|
|
39
|
+
'status' => @status,
|
|
40
|
+
'template' => @template.nil? ? nil : @template.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
|