ElasticEmail 4.0.23 → 4.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ElasticEmail.gemspec +2 -1
- data/README.md +10 -4
- data/VERSION +1 -1
- data/docs/CampaignOptions.md +4 -0
- data/docs/CampaignTemplate.md +2 -2
- data/docs/EmailContent.md +2 -2
- data/docs/EmailJobFailedStatus.md +24 -0
- data/docs/EmailJobStatus.md +56 -0
- data/docs/EmailMessageData.md +1 -1
- data/docs/EmailTransactionalMessageData.md +1 -1
- data/docs/EmailValidationResult.md +2 -2
- data/docs/EmailsApi.md +97 -3
- data/docs/EmailsPayload.md +1 -1
- data/docs/ListPayload.md +1 -1
- data/docs/ListsApi.md +78 -0
- data/docs/MergeEmailPayload.md +1 -1
- data/lib/ElasticEmail/api/campaigns_api.rb +1 -1
- data/lib/ElasticEmail/api/contacts_api.rb +1 -1
- data/lib/ElasticEmail/api/emails_api.rb +94 -1
- data/lib/ElasticEmail/api/events_api.rb +1 -1
- data/lib/ElasticEmail/api/files_api.rb +1 -1
- data/lib/ElasticEmail/api/inbound_route_api.rb +1 -1
- data/lib/ElasticEmail/api/lists_api.rb +70 -1
- data/lib/ElasticEmail/api/security_api.rb +1 -1
- data/lib/ElasticEmail/api/segments_api.rb +1 -1
- data/lib/ElasticEmail/api/statistics_api.rb +1 -1
- data/lib/ElasticEmail/api/sub_accounts_api.rb +1 -1
- data/lib/ElasticEmail/api/suppressions_api.rb +1 -1
- data/lib/ElasticEmail/api/templates_api.rb +1 -1
- data/lib/ElasticEmail/api/verifications_api.rb +1 -1
- data/lib/ElasticEmail/api_client.rb +25 -23
- data/lib/ElasticEmail/api_error.rb +1 -1
- data/lib/ElasticEmail/configuration.rb +28 -10
- data/lib/ElasticEmail/models/access_level.rb +3 -3
- data/lib/ElasticEmail/models/account_status_enum.rb +1 -1
- data/lib/ElasticEmail/models/api_key.rb +14 -19
- data/lib/ElasticEmail/models/api_key_payload.rb +18 -19
- data/lib/ElasticEmail/models/body_content_type.rb +1 -1
- data/lib/ElasticEmail/models/body_part.rb +14 -19
- data/lib/ElasticEmail/models/campaign.rb +18 -19
- data/lib/ElasticEmail/models/campaign_options.rb +35 -20
- data/lib/ElasticEmail/models/campaign_recipient.rb +14 -19
- data/lib/ElasticEmail/models/campaign_status.rb +1 -1
- data/lib/ElasticEmail/models/campaign_template.rb +21 -19
- data/lib/ElasticEmail/models/channel_log_status_summary.rb +14 -19
- data/lib/ElasticEmail/models/compression_format.rb +1 -1
- data/lib/ElasticEmail/models/consent_data.rb +14 -19
- data/lib/ElasticEmail/models/consent_tracking.rb +1 -1
- data/lib/ElasticEmail/models/contact.rb +14 -19
- data/lib/ElasticEmail/models/contact_activity.rb +14 -19
- data/lib/ElasticEmail/models/contact_payload.rb +16 -19
- data/lib/ElasticEmail/models/contact_source.rb +1 -1
- data/lib/ElasticEmail/models/contact_status.rb +1 -1
- data/lib/ElasticEmail/models/contact_update_payload.rb +14 -19
- data/lib/ElasticEmail/models/contacts_list.rb +14 -19
- data/lib/ElasticEmail/models/delivery_optimization_type.rb +1 -1
- data/lib/ElasticEmail/models/email_content.rb +21 -19
- data/lib/ElasticEmail/models/email_data.rb +14 -19
- data/lib/ElasticEmail/models/{contact_history.rb → email_job_failed_status.rb} +44 -83
- data/lib/ElasticEmail/models/email_job_status.rb +415 -0
- data/lib/ElasticEmail/models/email_message_data.rb +23 -19
- data/lib/ElasticEmail/models/email_predicted_validation_status.rb +1 -1
- data/lib/ElasticEmail/models/email_recipient.rb +16 -19
- data/lib/ElasticEmail/models/email_send.rb +14 -19
- data/lib/ElasticEmail/models/email_status.rb +14 -19
- data/lib/ElasticEmail/models/email_transactional_message_data.rb +23 -19
- data/lib/ElasticEmail/models/email_validation_result.rb +16 -20
- data/lib/ElasticEmail/models/email_validation_status.rb +1 -1
- data/lib/ElasticEmail/models/email_view.rb +14 -19
- data/lib/ElasticEmail/models/emails_payload.rb +14 -19
- data/lib/ElasticEmail/models/encoding_type.rb +1 -1
- data/lib/ElasticEmail/models/event_type.rb +1 -1
- data/lib/ElasticEmail/models/events_order_by.rb +1 -1
- data/lib/ElasticEmail/models/export_file_formats.rb +1 -1
- data/lib/ElasticEmail/models/export_link.rb +14 -19
- data/lib/ElasticEmail/models/export_status.rb +1 -1
- data/lib/ElasticEmail/models/file_info.rb +14 -19
- data/lib/ElasticEmail/models/file_payload.rb +16 -19
- data/lib/ElasticEmail/models/file_upload_result.rb +14 -19
- data/lib/ElasticEmail/models/inbound_payload.rb +18 -19
- data/lib/ElasticEmail/models/inbound_route.rb +14 -19
- data/lib/ElasticEmail/models/inbound_route_action_type.rb +1 -1
- data/lib/ElasticEmail/models/inbound_route_filter_type.rb +1 -1
- data/lib/ElasticEmail/models/list_payload.rb +16 -19
- data/lib/ElasticEmail/models/list_update_payload.rb +14 -19
- data/lib/ElasticEmail/models/log_job_status.rb +1 -1
- data/lib/ElasticEmail/models/log_status_summary.rb +14 -19
- data/lib/ElasticEmail/models/merge_email_payload.rb +23 -19
- data/lib/ElasticEmail/models/message_attachment.rb +18 -19
- data/lib/ElasticEmail/models/message_category.rb +1 -1
- data/lib/ElasticEmail/models/new_api_key.rb +14 -19
- data/lib/ElasticEmail/models/new_smtp_credentials.rb +14 -19
- data/lib/ElasticEmail/models/options.rb +16 -19
- data/lib/ElasticEmail/models/recipient_event.rb +14 -19
- data/lib/ElasticEmail/models/segment.rb +14 -19
- data/lib/ElasticEmail/models/segment_payload.rb +18 -19
- data/lib/ElasticEmail/models/smtp_credentials.rb +14 -19
- data/lib/ElasticEmail/models/smtp_credentials_payload.rb +16 -19
- data/lib/ElasticEmail/models/sort_order_item.rb +18 -19
- data/lib/ElasticEmail/models/split_optimization_type.rb +1 -1
- data/lib/ElasticEmail/models/split_options.rb +14 -19
- data/lib/ElasticEmail/models/sub_account_info.rb +14 -19
- data/lib/ElasticEmail/models/subaccount_email_credits_payload.rb +16 -19
- data/lib/ElasticEmail/models/subaccount_email_settings.rb +14 -19
- data/lib/ElasticEmail/models/subaccount_email_settings_payload.rb +14 -19
- data/lib/ElasticEmail/models/subaccount_payload.rb +18 -19
- data/lib/ElasticEmail/models/subaccount_settings_info.rb +14 -19
- data/lib/ElasticEmail/models/subaccount_settings_info_payload.rb +14 -19
- data/lib/ElasticEmail/models/suppression.rb +14 -19
- data/lib/ElasticEmail/models/template.rb +14 -19
- data/lib/ElasticEmail/models/template_payload.rb +16 -19
- data/lib/ElasticEmail/models/template_scope.rb +1 -1
- data/lib/ElasticEmail/models/template_type.rb +3 -2
- data/lib/ElasticEmail/models/transactional_recipient.rb +16 -19
- data/lib/ElasticEmail/models/utm.rb +14 -19
- data/lib/ElasticEmail/models/verification_file_result.rb +14 -19
- data/lib/ElasticEmail/models/verification_file_result_details.rb +14 -19
- data/lib/ElasticEmail/models/verification_status.rb +1 -1
- data/lib/ElasticEmail/version.rb +2 -2
- data/lib/ElasticEmail.rb +3 -1
- data/spec/api/campaigns_api_spec.rb +7 -7
- data/spec/api/contacts_api_spec.rb +12 -25
- data/spec/api/emails_api_spec.rb +28 -6
- data/spec/api/events_api_spec.rb +9 -9
- data/spec/api/files_api_spec.rb +7 -7
- data/spec/api/inbound_route_api_spec.rb +8 -8
- data/spec/api/lists_api_spec.rb +23 -9
- data/spec/api/security_api_spec.rb +12 -12
- data/spec/api/segments_api_spec.rb +7 -7
- data/spec/api/statistics_api_spec.rb +7 -7
- data/spec/api/sub_accounts_api_spec.rb +8 -8
- data/spec/api/suppressions_api_spec.rb +26 -26
- data/spec/api/templates_api_spec.rb +7 -7
- data/spec/api/verifications_api_spec.rb +30 -18
- data/spec/models/access_level_spec.rb +5 -3
- data/spec/models/account_status_enum_spec.rb +5 -3
- data/spec/models/api_key_payload_spec.rb +10 -8
- data/spec/models/api_key_spec.rb +11 -9
- data/spec/models/body_content_type_spec.rb +5 -3
- data/spec/models/body_part_spec.rb +8 -6
- data/spec/models/campaign_options_spec.rb +22 -8
- data/spec/models/campaign_recipient_spec.rb +7 -5
- data/spec/models/campaign_spec.rb +10 -8
- data/spec/models/campaign_status_spec.rb +5 -3
- data/spec/models/campaign_template_spec.rb +12 -10
- data/spec/models/channel_log_status_summary_spec.rb +19 -17
- data/spec/models/compression_format_spec.rb +5 -3
- data/spec/models/consent_data_spec.rb +8 -6
- data/spec/models/consent_tracking_spec.rb +5 -3
- data/spec/models/contact_activity_spec.rb +16 -14
- data/spec/models/contact_payload_spec.rb +11 -9
- data/spec/models/contact_source_spec.rb +5 -3
- data/spec/models/contact_spec.rb +16 -14
- data/spec/models/contact_status_spec.rb +5 -3
- data/spec/models/contact_update_payload_spec.rb +8 -6
- data/spec/models/contacts_list_spec.rb +9 -7
- data/spec/models/delivery_optimization_type_spec.rb +5 -3
- data/spec/models/email_content_spec.rb +22 -14
- data/spec/models/email_data_spec.rb +8 -6
- data/spec/models/email_job_failed_status_spec.rb +54 -0
- data/spec/models/email_job_status_spec.rb +150 -0
- data/spec/models/email_message_data_spec.rb +8 -6
- data/spec/models/email_predicted_validation_status_spec.rb +4 -2
- data/spec/models/email_recipient_spec.rb +7 -5
- data/spec/models/email_send_spec.rb +7 -5
- data/spec/models/email_status_spec.rb +17 -15
- data/spec/models/email_transactional_message_data_spec.rb +8 -6
- data/spec/models/email_validation_result_spec.rb +26 -12
- data/spec/models/email_validation_status_spec.rb +5 -3
- data/spec/models/email_view_spec.rb +8 -6
- data/spec/models/emails_payload_spec.rb +7 -5
- data/spec/models/encoding_type_spec.rb +5 -3
- data/spec/models/event_type_spec.rb +5 -3
- data/spec/models/events_order_by_spec.rb +5 -3
- data/spec/models/export_file_formats_spec.rb +5 -3
- data/spec/models/export_link_spec.rb +7 -5
- data/spec/models/export_status_spec.rb +5 -3
- data/spec/models/file_info_spec.rb +10 -8
- data/spec/models/file_payload_spec.rb +8 -6
- data/spec/models/file_upload_result_spec.rb +7 -5
- data/spec/models/inbound_payload_spec.rb +11 -9
- data/spec/models/inbound_route_action_type_spec.rb +5 -3
- data/spec/models/inbound_route_filter_type_spec.rb +5 -3
- data/spec/models/inbound_route_spec.rb +12 -10
- data/spec/models/list_payload_spec.rb +8 -6
- data/spec/models/list_update_payload_spec.rb +7 -5
- data/spec/models/log_job_status_spec.rb +5 -3
- data/spec/models/log_status_summary_spec.rb +18 -16
- data/spec/models/merge_email_payload_spec.rb +8 -6
- data/spec/models/message_attachment_spec.rb +14 -6
- data/spec/models/message_category_spec.rb +5 -3
- data/spec/models/new_api_key_spec.rb +12 -10
- data/spec/models/new_smtp_credentials_spec.rb +12 -10
- data/spec/models/options_spec.rb +11 -9
- data/spec/models/recipient_event_spec.rb +18 -16
- data/spec/models/segment_payload_spec.rb +7 -5
- data/spec/models/segment_spec.rb +7 -5
- data/spec/models/smtp_credentials_payload_spec.rb +9 -7
- data/spec/models/smtp_credentials_spec.rb +11 -9
- data/spec/models/sort_order_item_spec.rb +7 -5
- data/spec/models/split_optimization_type_spec.rb +5 -3
- data/spec/models/split_options_spec.rb +7 -5
- data/spec/models/sub_account_info_spec.rb +14 -12
- data/spec/models/subaccount_email_credits_payload_spec.rb +7 -5
- data/spec/models/subaccount_email_settings_payload_spec.rb +17 -9
- data/spec/models/subaccount_email_settings_spec.rb +18 -10
- data/spec/models/subaccount_payload_spec.rb +9 -7
- data/spec/models/subaccount_settings_info_payload_spec.rb +6 -4
- data/spec/models/subaccount_settings_info_spec.rb +6 -4
- data/spec/models/suppression_spec.rb +9 -7
- data/spec/models/template_payload_spec.rb +9 -7
- data/spec/models/template_scope_spec.rb +5 -3
- data/spec/models/template_spec.rb +11 -9
- data/spec/models/template_type_spec.rb +5 -3
- data/spec/models/transactional_recipient_spec.rb +8 -6
- data/spec/models/utm_spec.rb +9 -7
- data/spec/models/verification_file_result_details_spec.rb +12 -10
- data/spec/models/verification_file_result_spec.rb +11 -9
- data/spec/models/verification_status_spec.rb +5 -3
- data/spec/spec_helper.rb +1 -1
- metadata +10 -18
- data/docs/ContactHistEventType.md +0 -15
- data/docs/ContactHistory.md +0 -30
- data/docs/TemplateScopeType.md +0 -15
- data/lib/ElasticEmail/models/contact_hist_event_type.rb +0 -49
- data/lib/ElasticEmail/models/template_scope_type.rb +0 -38
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/contact_hist_event_type_spec.rb +0 -28
- data/spec/models/contact_history_spec.rb +0 -70
- data/spec/models/template_scope_type_spec.rb +0 -28
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 4.0.0
|
7
7
|
Contact: support@elasticemail.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.7.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -19,6 +19,75 @@ module ElasticEmail
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
+
# Load Contacts in List
|
23
|
+
# Returns a list of contacts. Required Access Level: ViewContacts
|
24
|
+
# @param listname [String] Name of your list.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @option opts [Integer] :limit Maximum number of returned items.
|
27
|
+
# @option opts [Integer] :offset How many items should be returned ahead.
|
28
|
+
# @return [Array<Contact>]
|
29
|
+
def lists_by_listname_contacts_get(listname, opts = {})
|
30
|
+
data, _status_code, _headers = lists_by_listname_contacts_get_with_http_info(listname, opts)
|
31
|
+
data
|
32
|
+
end
|
33
|
+
|
34
|
+
# Load Contacts in List
|
35
|
+
# Returns a list of contacts. Required Access Level: ViewContacts
|
36
|
+
# @param listname [String] Name of your list.
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @option opts [Integer] :limit Maximum number of returned items.
|
39
|
+
# @option opts [Integer] :offset How many items should be returned ahead.
|
40
|
+
# @return [Array<(Array<Contact>, Integer, Hash)>] Array<Contact> data, response status code and response headers
|
41
|
+
def lists_by_listname_contacts_get_with_http_info(listname, opts = {})
|
42
|
+
if @api_client.config.debugging
|
43
|
+
@api_client.config.logger.debug 'Calling API: ListsApi.lists_by_listname_contacts_get ...'
|
44
|
+
end
|
45
|
+
# verify the required parameter 'listname' is set
|
46
|
+
if @api_client.config.client_side_validation && listname.nil?
|
47
|
+
fail ArgumentError, "Missing the required parameter 'listname' when calling ListsApi.lists_by_listname_contacts_get"
|
48
|
+
end
|
49
|
+
# resource path
|
50
|
+
local_var_path = '/lists/{listname}/contacts'.sub('{' + 'listname' + '}', CGI.escape(listname.to_s))
|
51
|
+
|
52
|
+
# query parameters
|
53
|
+
query_params = opts[:query_params] || {}
|
54
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
55
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
56
|
+
|
57
|
+
# header parameters
|
58
|
+
header_params = opts[:header_params] || {}
|
59
|
+
# HTTP header 'Accept' (if needed)
|
60
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
61
|
+
|
62
|
+
# form parameters
|
63
|
+
form_params = opts[:form_params] || {}
|
64
|
+
|
65
|
+
# http body (model)
|
66
|
+
post_body = opts[:debug_body]
|
67
|
+
|
68
|
+
# return_type
|
69
|
+
return_type = opts[:debug_return_type] || 'Array<Contact>'
|
70
|
+
|
71
|
+
# auth_names
|
72
|
+
auth_names = opts[:debug_auth_names] || ['apikey']
|
73
|
+
|
74
|
+
new_options = opts.merge(
|
75
|
+
:operation => :"ListsApi.lists_by_listname_contacts_get",
|
76
|
+
:header_params => header_params,
|
77
|
+
:query_params => query_params,
|
78
|
+
:form_params => form_params,
|
79
|
+
:body => post_body,
|
80
|
+
:auth_names => auth_names,
|
81
|
+
:return_type => return_type
|
82
|
+
)
|
83
|
+
|
84
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
85
|
+
if @api_client.config.debugging
|
86
|
+
@api_client.config.logger.debug "API called: ListsApi#lists_by_listname_contacts_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
87
|
+
end
|
88
|
+
return data, status_code, headers
|
89
|
+
end
|
90
|
+
|
22
91
|
# Add Contacts to List
|
23
92
|
# Add existing Contacts to specified list. Required Access Level: ModifyContacts
|
24
93
|
# @param name [String] Name of your list.
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 4.0.0
|
7
7
|
Contact: support@elasticemail.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.7.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -17,6 +17,7 @@ require 'tempfile'
|
|
17
17
|
require 'time'
|
18
18
|
require 'typhoeus'
|
19
19
|
|
20
|
+
|
20
21
|
module ElasticEmail
|
21
22
|
class ApiClient
|
22
23
|
# The Configuration object holding settings to be used in the API client.
|
@@ -45,9 +46,10 @@ module ElasticEmail
|
|
45
46
|
# Call an API with given options.
|
46
47
|
#
|
47
48
|
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
48
|
-
# the data deserialized from response body (
|
49
|
+
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
49
50
|
def call_api(http_method, path, opts = {})
|
50
51
|
request = build_request(http_method, path, opts)
|
52
|
+
tempfile = download_file(request) if opts[:return_type] == 'File'
|
51
53
|
response = request.run
|
52
54
|
|
53
55
|
if @config.debugging
|
@@ -69,7 +71,9 @@ module ElasticEmail
|
|
69
71
|
end
|
70
72
|
end
|
71
73
|
|
72
|
-
if opts[:return_type]
|
74
|
+
if opts[:return_type] == 'File'
|
75
|
+
data = tempfile
|
76
|
+
elsif opts[:return_type]
|
73
77
|
data = deserialize(response, opts[:return_type])
|
74
78
|
else
|
75
79
|
data = nil
|
@@ -125,9 +129,7 @@ module ElasticEmail
|
|
125
129
|
end
|
126
130
|
end
|
127
131
|
|
128
|
-
|
129
|
-
download_file(request) if opts[:return_type] == 'File'
|
130
|
-
request
|
132
|
+
Typhoeus::Request.new(url, req_opts)
|
131
133
|
end
|
132
134
|
|
133
135
|
# Builds the HTTP request body
|
@@ -165,6 +167,8 @@ module ElasticEmail
|
|
165
167
|
# process can use.
|
166
168
|
#
|
167
169
|
# @see Configuration#temp_folder_path
|
170
|
+
#
|
171
|
+
# @return [Tempfile] the tempfile generated
|
168
172
|
def download_file(request)
|
169
173
|
tempfile = nil
|
170
174
|
encoding = nil
|
@@ -179,21 +183,24 @@ module ElasticEmail
|
|
179
183
|
prefix = prefix + '-' unless prefix.end_with?('-')
|
180
184
|
encoding = response.body.encoding
|
181
185
|
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
182
|
-
@tempfile = tempfile
|
183
186
|
end
|
184
187
|
request.on_body do |chunk|
|
185
188
|
chunk.force_encoding(encoding)
|
186
189
|
tempfile.write(chunk)
|
187
190
|
end
|
188
|
-
request
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
191
|
+
# run the request to ensure the tempfile is created successfully before returning it
|
192
|
+
request.run
|
193
|
+
if tempfile
|
194
|
+
tempfile.close
|
195
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
196
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
197
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
198
|
+
"explicitly with `tempfile.delete`"
|
199
|
+
else
|
200
|
+
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
196
201
|
end
|
202
|
+
|
203
|
+
tempfile
|
197
204
|
end
|
198
205
|
|
199
206
|
# Check if the given MIME is a JSON MIME.
|
@@ -205,7 +212,7 @@ module ElasticEmail
|
|
205
212
|
# @param [String] mime MIME
|
206
213
|
# @return [Boolean] True if the MIME is application/json
|
207
214
|
def json_mime?(mime)
|
208
|
-
(mime == '*/*') || !(mime =~
|
215
|
+
(mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
|
209
216
|
end
|
210
217
|
|
211
218
|
# Deserialize the response to the given return type.
|
@@ -214,15 +221,10 @@ module ElasticEmail
|
|
214
221
|
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
215
222
|
def deserialize(response, return_type)
|
216
223
|
body = response.body
|
217
|
-
|
218
|
-
# handle file downloading - return the File instance processed in request callbacks
|
219
|
-
# note that response body is empty when the file is written in chunks in request on_body callback
|
220
|
-
return @tempfile if return_type == 'File'
|
221
|
-
|
222
224
|
return nil if body.nil? || body.empty?
|
223
225
|
|
224
226
|
# return response body directly for String return type
|
225
|
-
return body if return_type == 'String'
|
227
|
+
return body.to_s if return_type == 'String'
|
226
228
|
|
227
229
|
# ensuring a default content type
|
228
230
|
content_type = response.headers['Content-Type'] || 'application/json'
|
@@ -289,7 +291,7 @@ module ElasticEmail
|
|
289
291
|
# @param [String] filename the filename to be sanitized
|
290
292
|
# @return [String] the sanitized filename
|
291
293
|
def sanitize_filename(filename)
|
292
|
-
filename.
|
294
|
+
filename.split(/[\/\\]/).last
|
293
295
|
end
|
294
296
|
|
295
297
|
def build_request_url(path, opts = {})
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 4.0.0
|
7
7
|
Contact: support@elasticemail.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.7.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -67,6 +67,11 @@ module ElasticEmail
|
|
67
67
|
# @return [Proc]
|
68
68
|
attr_accessor :access_token_getter
|
69
69
|
|
70
|
+
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
|
71
|
+
# HTTP responses with return type `File` will be returned as a stream of binary data.
|
72
|
+
# Default to false.
|
73
|
+
attr_accessor :return_binary_data
|
74
|
+
|
70
75
|
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
71
76
|
# details will be logged with `logger.debug` (see the `logger` attribute).
|
72
77
|
# Default to false.
|
@@ -74,6 +79,14 @@ module ElasticEmail
|
|
74
79
|
# @return [true, false]
|
75
80
|
attr_accessor :debugging
|
76
81
|
|
82
|
+
# Set this to ignore operation servers for the API client. This is useful when you need to
|
83
|
+
# send requests to a different server than the one specified in the OpenAPI document.
|
84
|
+
# Will default to the base url defined in the spec but can be overridden by setting
|
85
|
+
# `scheme`, `host`, `base_path` directly.
|
86
|
+
# Default to false.
|
87
|
+
# @return [true, false]
|
88
|
+
attr_accessor :ignore_operation_servers
|
89
|
+
|
77
90
|
# Defines the logger used for debugging.
|
78
91
|
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
79
92
|
#
|
@@ -147,7 +160,7 @@ module ElasticEmail
|
|
147
160
|
@scheme = 'https'
|
148
161
|
@host = 'api.elasticemail.com'
|
149
162
|
@base_path = '/v4'
|
150
|
-
@server_index =
|
163
|
+
@server_index = nil
|
151
164
|
@server_operation_index = {}
|
152
165
|
@server_variables = {}
|
153
166
|
@server_operation_variables = {}
|
@@ -161,6 +174,7 @@ module ElasticEmail
|
|
161
174
|
@timeout = 0
|
162
175
|
@params_encoding = nil
|
163
176
|
@debugging = false
|
177
|
+
@ignore_operation_servers = false
|
164
178
|
@inject_format = false
|
165
179
|
@force_ending_format = false
|
166
180
|
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
@@ -195,10 +209,13 @@ module ElasticEmail
|
|
195
209
|
|
196
210
|
# Returns base URL for specified operation based on server settings
|
197
211
|
def base_url(operation = nil)
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
212
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
|
213
|
+
if operation_server_settings.key?(operation) then
|
214
|
+
index = server_operation_index.fetch(operation, server_index)
|
215
|
+
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
216
|
+
else
|
217
|
+
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
|
218
|
+
end
|
202
219
|
end
|
203
220
|
|
204
221
|
# Gets API key (with prefix if set).
|
@@ -215,8 +232,8 @@ module ElasticEmail
|
|
215
232
|
|
216
233
|
# Gets access_token using access_token_getter or uses the static access_token
|
217
234
|
def access_token_with_refresh
|
218
|
-
|
219
|
-
|
235
|
+
return access_token if access_token_getter.nil?
|
236
|
+
access_token_getter.call
|
220
237
|
end
|
221
238
|
|
222
239
|
# Gets Basic Auth token string
|
@@ -260,8 +277,8 @@ module ElasticEmail
|
|
260
277
|
servers = server_settings if servers == nil
|
261
278
|
|
262
279
|
# check array index out of bound
|
263
|
-
if (index < 0 || index >= servers.size)
|
264
|
-
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
280
|
+
if (index.nil? || index < 0 || index >= servers.size)
|
281
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
|
265
282
|
end
|
266
283
|
|
267
284
|
server = servers[index]
|
@@ -286,5 +303,6 @@ module ElasticEmail
|
|
286
303
|
url
|
287
304
|
end
|
288
305
|
|
306
|
+
|
289
307
|
end
|
290
308
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 4.0.0
|
7
7
|
Contact: support@elasticemail.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.7.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -59,16 +59,16 @@ module ElasticEmail
|
|
59
59
|
EXTENDED_LOGS = "ExtendedLogs".freeze
|
60
60
|
VERIFY_EMAILS = "VerifyEmails".freeze
|
61
61
|
MODIFY2_FA_SMS = "Modify2FASms".freeze
|
62
|
-
DISABLE_CONTACTS_STORE = "DisableContactsStore".freeze
|
63
62
|
MODIFY_LANDING_PAGES = "ModifyLandingPages".freeze
|
64
63
|
VIEW_LANDING_PAGES = "ViewLandingPages".freeze
|
65
64
|
MODIFY_SUPPRESSIONS = "ModifySuppressions".freeze
|
66
65
|
VIEW_SUPPRESSIONS = "ViewSuppressions".freeze
|
67
66
|
VIEW_DRAG_DROP_EDITOR = "ViewDragDropEditor".freeze
|
68
67
|
VIEW_TEMPLATE_EDITOR = "ViewTemplateEditor".freeze
|
68
|
+
VIEW_AI_TOOLS = "ViewAITools".freeze
|
69
69
|
|
70
70
|
def self.all_vars
|
71
|
-
@all_vars ||= [NONE, VIEW_ACCOUNT, VIEW_CONTACTS, VIEW_FORMS, VIEW_TEMPLATES, VIEW_CAMPAIGNS, VIEW_CHANNELS, VIEW_AUTOMATIONS, VIEW_SURVEYS, VIEW_SETTINGS, VIEW_BILLING, VIEW_SUB_ACCOUNTS, VIEW_USERS, VIEW_FILES, VIEW_REPORTS, MODIFY_ACCOUNT, MODIFY_CONTACTS, MODIFY_FORMS, MODIFY_TEMPLATES, MODIFY_CAMPAIGNS, MODIFY_CHANNELS, MODIFY_AUTOMATIONS, MODIFY_SURVEYS, MODIFY_FILES, EXPORT, SEND_SMTP, SEND_SMS, MODIFY_SETTINGS, MODIFY_BILLING, MODIFY_PROFILE, MODIFY_SUB_ACCOUNTS, MODIFY_USERS, SECURITY, MODIFY_LANGUAGE, VIEW_SUPPORT, SEND_HTTP, MODIFY2_FA_EMAIL, MODIFY_SUPPORT, VIEW_CUSTOM_FIELDS, MODIFY_CUSTOM_FIELDS, MODIFY_WEB_NOTIFICATIONS, EXTENDED_LOGS, VERIFY_EMAILS, MODIFY2_FA_SMS,
|
71
|
+
@all_vars ||= [NONE, VIEW_ACCOUNT, VIEW_CONTACTS, VIEW_FORMS, VIEW_TEMPLATES, VIEW_CAMPAIGNS, VIEW_CHANNELS, VIEW_AUTOMATIONS, VIEW_SURVEYS, VIEW_SETTINGS, VIEW_BILLING, VIEW_SUB_ACCOUNTS, VIEW_USERS, VIEW_FILES, VIEW_REPORTS, MODIFY_ACCOUNT, MODIFY_CONTACTS, MODIFY_FORMS, MODIFY_TEMPLATES, MODIFY_CAMPAIGNS, MODIFY_CHANNELS, MODIFY_AUTOMATIONS, MODIFY_SURVEYS, MODIFY_FILES, EXPORT, SEND_SMTP, SEND_SMS, MODIFY_SETTINGS, MODIFY_BILLING, MODIFY_PROFILE, MODIFY_SUB_ACCOUNTS, MODIFY_USERS, SECURITY, MODIFY_LANGUAGE, VIEW_SUPPORT, SEND_HTTP, MODIFY2_FA_EMAIL, MODIFY_SUPPORT, VIEW_CUSTOM_FIELDS, MODIFY_CUSTOM_FIELDS, MODIFY_WEB_NOTIFICATIONS, EXTENDED_LOGS, VERIFY_EMAILS, MODIFY2_FA_SMS, MODIFY_LANDING_PAGES, VIEW_LANDING_PAGES, MODIFY_SUPPRESSIONS, VIEW_SUPPRESSIONS, VIEW_DRAG_DROP_EDITOR, VIEW_TEMPLATE_EDITOR, VIEW_AI_TOOLS].freeze
|
72
72
|
end
|
73
73
|
|
74
74
|
# Builds the enum from string
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 4.0.0
|
7
7
|
Contact: support@elasticemail.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.7.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -118,6 +118,7 @@ module ElasticEmail
|
|
118
118
|
# Show invalid properties with the reasons. Usually used together with valid?
|
119
119
|
# @return Array for valid properties with the reasons
|
120
120
|
def list_invalid_properties
|
121
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
121
122
|
invalid_properties = Array.new
|
122
123
|
invalid_properties
|
123
124
|
end
|
@@ -125,6 +126,7 @@ module ElasticEmail
|
|
125
126
|
# Check to see if the all the properties in the model are valid
|
126
127
|
# @return true if the model is valid
|
127
128
|
def valid?
|
129
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
128
130
|
true
|
129
131
|
end
|
130
132
|
|
@@ -157,37 +159,30 @@ module ElasticEmail
|
|
157
159
|
# @param [Hash] attributes Model attributes in the form of hash
|
158
160
|
# @return [Object] Returns the model itself
|
159
161
|
def self.build_from_hash(attributes)
|
160
|
-
new.build_from_hash(attributes)
|
161
|
-
end
|
162
|
-
|
163
|
-
# Builds the object from hash
|
164
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
165
|
-
# @return [Object] Returns the model itself
|
166
|
-
def build_from_hash(attributes)
|
167
162
|
return nil unless attributes.is_a?(Hash)
|
168
163
|
attributes = attributes.transform_keys(&:to_sym)
|
169
|
-
|
170
|
-
|
171
|
-
|
164
|
+
transformed_hash = {}
|
165
|
+
openapi_types.each_pair do |key, type|
|
166
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
167
|
+
transformed_hash["#{key}"] = nil
|
172
168
|
elsif type =~ /\AArray<(.*)>/i
|
173
169
|
# check to ensure the input is an array given that the attribute
|
174
170
|
# is documented as an array but the input is not
|
175
|
-
if attributes[
|
176
|
-
|
171
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
172
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
177
173
|
end
|
178
|
-
elsif !attributes[
|
179
|
-
|
174
|
+
elsif !attributes[attribute_map[key]].nil?
|
175
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
180
176
|
end
|
181
177
|
end
|
182
|
-
|
183
|
-
self
|
178
|
+
new(transformed_hash)
|
184
179
|
end
|
185
180
|
|
186
181
|
# Deserializes the data based on type
|
187
182
|
# @param string type Data type
|
188
183
|
# @param string value Value to be deserialized
|
189
184
|
# @return [Object] Deserialized data
|
190
|
-
def _deserialize(type, value)
|
185
|
+
def self._deserialize(type, value)
|
191
186
|
case type.to_sym
|
192
187
|
when :Time
|
193
188
|
Time.parse(value)
|
@@ -222,7 +217,7 @@ module ElasticEmail
|
|
222
217
|
else # model
|
223
218
|
# models (e.g. Pet) or oneOf
|
224
219
|
klass = ElasticEmail.const_get(type)
|
225
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
220
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
226
221
|
end
|
227
222
|
end
|
228
223
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 4.0.0
|
7
7
|
Contact: support@elasticemail.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.7.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -82,12 +82,16 @@ module ElasticEmail
|
|
82
82
|
|
83
83
|
if attributes.key?(:'name')
|
84
84
|
self.name = attributes[:'name']
|
85
|
+
else
|
86
|
+
self.name = nil
|
85
87
|
end
|
86
88
|
|
87
89
|
if attributes.key?(:'access_level')
|
88
90
|
if (value = attributes[:'access_level']).is_a?(Array)
|
89
91
|
self.access_level = value
|
90
92
|
end
|
93
|
+
else
|
94
|
+
self.access_level = nil
|
91
95
|
end
|
92
96
|
|
93
97
|
if attributes.key?(:'expires')
|
@@ -108,6 +112,7 @@ module ElasticEmail
|
|
108
112
|
# Show invalid properties with the reasons. Usually used together with valid?
|
109
113
|
# @return Array for valid properties with the reasons
|
110
114
|
def list_invalid_properties
|
115
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
111
116
|
invalid_properties = Array.new
|
112
117
|
if @name.nil?
|
113
118
|
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
@@ -123,6 +128,7 @@ module ElasticEmail
|
|
123
128
|
# Check to see if the all the properties in the model are valid
|
124
129
|
# @return true if the model is valid
|
125
130
|
def valid?
|
131
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
126
132
|
return false if @name.nil?
|
127
133
|
return false if @access_level.nil?
|
128
134
|
true
|
@@ -156,37 +162,30 @@ module ElasticEmail
|
|
156
162
|
# @param [Hash] attributes Model attributes in the form of hash
|
157
163
|
# @return [Object] Returns the model itself
|
158
164
|
def self.build_from_hash(attributes)
|
159
|
-
new.build_from_hash(attributes)
|
160
|
-
end
|
161
|
-
|
162
|
-
# Builds the object from hash
|
163
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
164
|
-
# @return [Object] Returns the model itself
|
165
|
-
def build_from_hash(attributes)
|
166
165
|
return nil unless attributes.is_a?(Hash)
|
167
166
|
attributes = attributes.transform_keys(&:to_sym)
|
168
|
-
|
169
|
-
|
170
|
-
|
167
|
+
transformed_hash = {}
|
168
|
+
openapi_types.each_pair do |key, type|
|
169
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
170
|
+
transformed_hash["#{key}"] = nil
|
171
171
|
elsif type =~ /\AArray<(.*)>/i
|
172
172
|
# check to ensure the input is an array given that the attribute
|
173
173
|
# is documented as an array but the input is not
|
174
|
-
if attributes[
|
175
|
-
|
174
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
175
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
176
176
|
end
|
177
|
-
elsif !attributes[
|
178
|
-
|
177
|
+
elsif !attributes[attribute_map[key]].nil?
|
178
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
179
179
|
end
|
180
180
|
end
|
181
|
-
|
182
|
-
self
|
181
|
+
new(transformed_hash)
|
183
182
|
end
|
184
183
|
|
185
184
|
# Deserializes the data based on type
|
186
185
|
# @param string type Data type
|
187
186
|
# @param string value Value to be deserialized
|
188
187
|
# @return [Object] Deserialized data
|
189
|
-
def _deserialize(type, value)
|
188
|
+
def self._deserialize(type, value)
|
190
189
|
case type.to_sym
|
191
190
|
when :Time
|
192
191
|
Time.parse(value)
|
@@ -221,7 +220,7 @@ module ElasticEmail
|
|
221
220
|
else # model
|
222
221
|
# models (e.g. Pet) or oneOf
|
223
222
|
klass = ElasticEmail.const_get(type)
|
224
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
223
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
225
224
|
end
|
226
225
|
end
|
227
226
|
|