ElasticEmail 4.0.27 → 4.0.29

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.
Files changed (253) hide show
  1. checksums.yaml +4 -4
  2. data/ElasticEmail.gemspec +1 -1
  3. data/README.md +21 -9
  4. data/VERSION +1 -1
  5. data/docs/CampaignOptions.md +3 -1
  6. data/docs/CampaignTemplate.md +2 -2
  7. data/docs/CampaignsApi.md +73 -0
  8. data/docs/DKIMRecord.md +26 -0
  9. data/docs/DomainData.md +7 -1
  10. data/docs/DomainDetail.md +7 -1
  11. data/docs/EmailContent.md +2 -2
  12. data/docs/MessageAttachment.md +2 -2
  13. data/docs/SecurityApi.md +4 -4
  14. data/docs/SubAccountsApi.md +73 -1
  15. data/docs/Webhook.md +42 -0
  16. data/docs/WebhookApi.md +372 -0
  17. data/docs/WebhookCreatePayload.md +34 -0
  18. data/docs/WebhookUpdatePayload.md +36 -0
  19. data/lib/ElasticEmail/api/campaigns_api.rb +69 -1
  20. data/lib/ElasticEmail/api/contacts_api.rb +1 -1
  21. data/lib/ElasticEmail/api/domains_api.rb +1 -1
  22. data/lib/ElasticEmail/api/emails_api.rb +1 -1
  23. data/lib/ElasticEmail/api/events_api.rb +1 -1
  24. data/lib/ElasticEmail/api/files_api.rb +1 -1
  25. data/lib/ElasticEmail/api/inbound_route_api.rb +1 -1
  26. data/lib/ElasticEmail/api/lists_api.rb +1 -1
  27. data/lib/ElasticEmail/api/security_api.rb +5 -5
  28. data/lib/ElasticEmail/api/segments_api.rb +1 -1
  29. data/lib/ElasticEmail/api/statistics_api.rb +1 -1
  30. data/lib/ElasticEmail/api/sub_accounts_api.rb +66 -3
  31. data/lib/ElasticEmail/api/suppressions_api.rb +1 -1
  32. data/lib/ElasticEmail/api/templates_api.rb +1 -1
  33. data/lib/ElasticEmail/api/verifications_api.rb +1 -1
  34. data/lib/ElasticEmail/api/webhook_api.rb +351 -0
  35. data/lib/ElasticEmail/api_client.rb +8 -9
  36. data/lib/ElasticEmail/api_error.rb +1 -1
  37. data/lib/ElasticEmail/configuration.rb +1 -1
  38. data/lib/ElasticEmail/models/access_level.rb +1 -1
  39. data/lib/ElasticEmail/models/account_status_enum.rb +1 -1
  40. data/lib/ElasticEmail/models/api_key.rb +10 -4
  41. data/lib/ElasticEmail/models/api_key_payload.rb +30 -4
  42. data/lib/ElasticEmail/models/body_content_type.rb +1 -1
  43. data/lib/ElasticEmail/models/body_part.rb +20 -4
  44. data/lib/ElasticEmail/models/campaign.rb +30 -4
  45. data/lib/ElasticEmail/models/campaign_options.rb +25 -8
  46. data/lib/ElasticEmail/models/campaign_recipient.rb +10 -4
  47. data/lib/ElasticEmail/models/campaign_status.rb +1 -1
  48. data/lib/ElasticEmail/models/campaign_template.rb +21 -5
  49. data/lib/ElasticEmail/models/certificate_validation_status.rb +3 -2
  50. data/lib/ElasticEmail/models/channel_log_status_summary.rb +10 -4
  51. data/lib/ElasticEmail/models/compression_format.rb +1 -1
  52. data/lib/ElasticEmail/models/consent_data.rb +10 -4
  53. data/lib/ElasticEmail/models/consent_tracking.rb +1 -1
  54. data/lib/ElasticEmail/models/contact.rb +10 -4
  55. data/lib/ElasticEmail/models/contact_activity.rb +10 -4
  56. data/lib/ElasticEmail/models/contact_payload.rb +20 -4
  57. data/lib/ElasticEmail/models/contact_source.rb +1 -1
  58. data/lib/ElasticEmail/models/contact_status.rb +1 -1
  59. data/lib/ElasticEmail/models/contact_update_payload.rb +10 -4
  60. data/lib/ElasticEmail/models/contacts_list.rb +10 -4
  61. data/lib/ElasticEmail/models/delivery_optimization_type.rb +1 -1
  62. data/lib/ElasticEmail/models/dkim_record.rb +258 -0
  63. data/lib/ElasticEmail/models/domain_data.rb +42 -8
  64. data/lib/ElasticEmail/models/domain_detail.rb +42 -8
  65. data/lib/ElasticEmail/models/domain_owner.rb +1 -1
  66. data/lib/ElasticEmail/models/domain_payload.rb +10 -4
  67. data/lib/ElasticEmail/models/domain_update_payload.rb +10 -4
  68. data/lib/ElasticEmail/models/email_content.rb +21 -5
  69. data/lib/ElasticEmail/models/email_data.rb +10 -4
  70. data/lib/ElasticEmail/models/email_job_failed_status.rb +10 -4
  71. data/lib/ElasticEmail/models/email_job_status.rb +10 -4
  72. data/lib/ElasticEmail/models/email_message_data.rb +30 -4
  73. data/lib/ElasticEmail/models/email_predicted_validation_status.rb +1 -1
  74. data/lib/ElasticEmail/models/email_recipient.rb +20 -4
  75. data/lib/ElasticEmail/models/email_send.rb +10 -4
  76. data/lib/ElasticEmail/models/email_status.rb +10 -4
  77. data/lib/ElasticEmail/models/email_transactional_message_data.rb +30 -4
  78. data/lib/ElasticEmail/models/email_validation_result.rb +10 -4
  79. data/lib/ElasticEmail/models/email_validation_status.rb +1 -1
  80. data/lib/ElasticEmail/models/email_view.rb +10 -4
  81. data/lib/ElasticEmail/models/emails_payload.rb +10 -4
  82. data/lib/ElasticEmail/models/encoding_type.rb +1 -1
  83. data/lib/ElasticEmail/models/event_type.rb +6 -3
  84. data/lib/ElasticEmail/models/events_order_by.rb +1 -1
  85. data/lib/ElasticEmail/models/export_file_formats.rb +1 -1
  86. data/lib/ElasticEmail/models/export_link.rb +10 -4
  87. data/lib/ElasticEmail/models/export_status.rb +1 -1
  88. data/lib/ElasticEmail/models/file_info.rb +10 -4
  89. data/lib/ElasticEmail/models/file_payload.rb +20 -4
  90. data/lib/ElasticEmail/models/file_upload_result.rb +10 -4
  91. data/lib/ElasticEmail/models/inbound_payload.rb +50 -4
  92. data/lib/ElasticEmail/models/inbound_route.rb +10 -4
  93. data/lib/ElasticEmail/models/inbound_route_action_type.rb +1 -1
  94. data/lib/ElasticEmail/models/inbound_route_filter_type.rb +1 -1
  95. data/lib/ElasticEmail/models/list_payload.rb +20 -4
  96. data/lib/ElasticEmail/models/list_update_payload.rb +10 -4
  97. data/lib/ElasticEmail/models/log_job_status.rb +1 -1
  98. data/lib/ElasticEmail/models/log_status_summary.rb +10 -4
  99. data/lib/ElasticEmail/models/merge_email_payload.rb +30 -4
  100. data/lib/ElasticEmail/models/message_attachment.rb +31 -5
  101. data/lib/ElasticEmail/models/message_category.rb +1 -1
  102. data/lib/ElasticEmail/models/message_category_enum.rb +1 -1
  103. data/lib/ElasticEmail/models/new_api_key.rb +10 -4
  104. data/lib/ElasticEmail/models/new_smtp_credentials.rb +10 -4
  105. data/lib/ElasticEmail/models/options.rb +10 -4
  106. data/lib/ElasticEmail/models/recipient_event.rb +10 -4
  107. data/lib/ElasticEmail/models/segment.rb +10 -4
  108. data/lib/ElasticEmail/models/segment_payload.rb +30 -4
  109. data/lib/ElasticEmail/models/smtp_credentials.rb +10 -4
  110. data/lib/ElasticEmail/models/smtp_credentials_payload.rb +20 -4
  111. data/lib/ElasticEmail/models/sort_order_item.rb +30 -4
  112. data/lib/ElasticEmail/models/split_optimization_type.rb +1 -1
  113. data/lib/ElasticEmail/models/split_options.rb +10 -4
  114. data/lib/ElasticEmail/models/sub_account_info.rb +10 -4
  115. data/lib/ElasticEmail/models/subaccount_email_credits_payload.rb +20 -4
  116. data/lib/ElasticEmail/models/subaccount_email_settings.rb +10 -4
  117. data/lib/ElasticEmail/models/subaccount_email_settings_payload.rb +10 -4
  118. data/lib/ElasticEmail/models/subaccount_payload.rb +30 -4
  119. data/lib/ElasticEmail/models/subaccount_settings_info.rb +10 -4
  120. data/lib/ElasticEmail/models/subaccount_settings_info_payload.rb +10 -4
  121. data/lib/ElasticEmail/models/suppression.rb +10 -4
  122. data/lib/ElasticEmail/models/template.rb +10 -4
  123. data/lib/ElasticEmail/models/template_payload.rb +20 -4
  124. data/lib/ElasticEmail/models/template_scope.rb +1 -1
  125. data/lib/ElasticEmail/models/template_type.rb +1 -1
  126. data/lib/ElasticEmail/models/tracking_type.rb +1 -1
  127. data/lib/ElasticEmail/models/tracking_validation_status.rb +1 -1
  128. data/lib/ElasticEmail/models/transactional_recipient.rb +20 -4
  129. data/lib/ElasticEmail/models/utm.rb +10 -4
  130. data/lib/ElasticEmail/models/verification_file_result.rb +10 -4
  131. data/lib/ElasticEmail/models/verification_file_result_details.rb +10 -4
  132. data/lib/ElasticEmail/models/verification_status.rb +1 -1
  133. data/lib/ElasticEmail/models/webhook.rb +336 -0
  134. data/lib/ElasticEmail/models/webhook_create_payload.rb +329 -0
  135. data/lib/ElasticEmail/models/webhook_update_payload.rb +312 -0
  136. data/lib/ElasticEmail/version.rb +2 -2
  137. data/lib/ElasticEmail.rb +6 -1
  138. data/spec/api/campaigns_api_spec.rb +14 -1
  139. data/spec/api/contacts_api_spec.rb +1 -1
  140. data/spec/api/domains_api_spec.rb +1 -1
  141. data/spec/api/emails_api_spec.rb +1 -1
  142. data/spec/api/events_api_spec.rb +1 -1
  143. data/spec/api/files_api_spec.rb +1 -1
  144. data/spec/api/inbound_route_api_spec.rb +1 -1
  145. data/spec/api/lists_api_spec.rb +1 -1
  146. data/spec/api/security_api_spec.rb +3 -3
  147. data/spec/api/segments_api_spec.rb +1 -1
  148. data/spec/api/statistics_api_spec.rb +1 -1
  149. data/spec/api/sub_accounts_api_spec.rb +14 -2
  150. data/spec/api/suppressions_api_spec.rb +1 -1
  151. data/spec/api/templates_api_spec.rb +1 -1
  152. data/spec/api/verifications_api_spec.rb +1 -1
  153. data/spec/api/webhook_api_spec.rb +97 -0
  154. data/spec/models/access_level_spec.rb +1 -1
  155. data/spec/models/account_status_enum_spec.rb +1 -1
  156. data/spec/models/api_key_payload_spec.rb +1 -1
  157. data/spec/models/api_key_spec.rb +1 -1
  158. data/spec/models/body_content_type_spec.rb +1 -1
  159. data/spec/models/body_part_spec.rb +1 -1
  160. data/spec/models/campaign_options_spec.rb +7 -1
  161. data/spec/models/campaign_recipient_spec.rb +1 -1
  162. data/spec/models/campaign_spec.rb +1 -1
  163. data/spec/models/campaign_status_spec.rb +1 -1
  164. data/spec/models/campaign_template_spec.rb +1 -1
  165. data/spec/models/certificate_validation_status_spec.rb +1 -1
  166. data/spec/models/channel_log_status_summary_spec.rb +1 -1
  167. data/spec/models/compression_format_spec.rb +1 -1
  168. data/spec/models/consent_data_spec.rb +1 -1
  169. data/spec/models/consent_tracking_spec.rb +1 -1
  170. data/spec/models/contact_activity_spec.rb +1 -1
  171. data/spec/models/contact_payload_spec.rb +1 -1
  172. data/spec/models/contact_source_spec.rb +1 -1
  173. data/spec/models/contact_spec.rb +1 -1
  174. data/spec/models/contact_status_spec.rb +1 -1
  175. data/spec/models/contact_update_payload_spec.rb +1 -1
  176. data/spec/models/contacts_list_spec.rb +1 -1
  177. data/spec/models/delivery_optimization_type_spec.rb +1 -1
  178. data/spec/models/dkim_record_spec.rb +60 -0
  179. data/spec/models/domain_data_spec.rb +19 -1
  180. data/spec/models/domain_detail_spec.rb +19 -1
  181. data/spec/models/domain_owner_spec.rb +1 -1
  182. data/spec/models/domain_payload_spec.rb +1 -1
  183. data/spec/models/domain_update_payload_spec.rb +1 -1
  184. data/spec/models/email_content_spec.rb +1 -1
  185. data/spec/models/email_data_spec.rb +1 -1
  186. data/spec/models/email_job_failed_status_spec.rb +1 -1
  187. data/spec/models/email_job_status_spec.rb +1 -1
  188. data/spec/models/email_message_data_spec.rb +1 -1
  189. data/spec/models/email_predicted_validation_status_spec.rb +1 -1
  190. data/spec/models/email_recipient_spec.rb +1 -1
  191. data/spec/models/email_send_spec.rb +1 -1
  192. data/spec/models/email_status_spec.rb +1 -1
  193. data/spec/models/email_transactional_message_data_spec.rb +1 -1
  194. data/spec/models/email_validation_result_spec.rb +1 -1
  195. data/spec/models/email_validation_status_spec.rb +1 -1
  196. data/spec/models/email_view_spec.rb +1 -1
  197. data/spec/models/emails_payload_spec.rb +1 -1
  198. data/spec/models/encoding_type_spec.rb +1 -1
  199. data/spec/models/event_type_spec.rb +1 -1
  200. data/spec/models/events_order_by_spec.rb +1 -1
  201. data/spec/models/export_file_formats_spec.rb +1 -1
  202. data/spec/models/export_link_spec.rb +1 -1
  203. data/spec/models/export_status_spec.rb +1 -1
  204. data/spec/models/file_info_spec.rb +1 -1
  205. data/spec/models/file_payload_spec.rb +1 -1
  206. data/spec/models/file_upload_result_spec.rb +1 -1
  207. data/spec/models/inbound_payload_spec.rb +1 -1
  208. data/spec/models/inbound_route_action_type_spec.rb +1 -1
  209. data/spec/models/inbound_route_filter_type_spec.rb +1 -1
  210. data/spec/models/inbound_route_spec.rb +1 -1
  211. data/spec/models/list_payload_spec.rb +1 -1
  212. data/spec/models/list_update_payload_spec.rb +1 -1
  213. data/spec/models/log_job_status_spec.rb +1 -1
  214. data/spec/models/log_status_summary_spec.rb +1 -1
  215. data/spec/models/merge_email_payload_spec.rb +1 -1
  216. data/spec/models/message_attachment_spec.rb +1 -1
  217. data/spec/models/message_category_enum_spec.rb +1 -1
  218. data/spec/models/message_category_spec.rb +1 -1
  219. data/spec/models/new_api_key_spec.rb +1 -1
  220. data/spec/models/new_smtp_credentials_spec.rb +1 -1
  221. data/spec/models/options_spec.rb +1 -1
  222. data/spec/models/recipient_event_spec.rb +1 -1
  223. data/spec/models/segment_payload_spec.rb +1 -1
  224. data/spec/models/segment_spec.rb +1 -1
  225. data/spec/models/smtp_credentials_payload_spec.rb +1 -1
  226. data/spec/models/smtp_credentials_spec.rb +1 -1
  227. data/spec/models/sort_order_item_spec.rb +1 -1
  228. data/spec/models/split_optimization_type_spec.rb +1 -1
  229. data/spec/models/split_options_spec.rb +1 -1
  230. data/spec/models/sub_account_info_spec.rb +1 -1
  231. data/spec/models/subaccount_email_credits_payload_spec.rb +1 -1
  232. data/spec/models/subaccount_email_settings_payload_spec.rb +1 -1
  233. data/spec/models/subaccount_email_settings_spec.rb +1 -1
  234. data/spec/models/subaccount_payload_spec.rb +1 -1
  235. data/spec/models/subaccount_settings_info_payload_spec.rb +1 -1
  236. data/spec/models/subaccount_settings_info_spec.rb +1 -1
  237. data/spec/models/suppression_spec.rb +1 -1
  238. data/spec/models/template_payload_spec.rb +1 -1
  239. data/spec/models/template_scope_spec.rb +1 -1
  240. data/spec/models/template_spec.rb +1 -1
  241. data/spec/models/template_type_spec.rb +1 -1
  242. data/spec/models/tracking_type_spec.rb +1 -1
  243. data/spec/models/tracking_validation_status_spec.rb +1 -1
  244. data/spec/models/transactional_recipient_spec.rb +1 -1
  245. data/spec/models/utm_spec.rb +1 -1
  246. data/spec/models/verification_file_result_details_spec.rb +1 -1
  247. data/spec/models/verification_file_result_spec.rb +1 -1
  248. data/spec/models/verification_status_spec.rb +1 -1
  249. data/spec/models/webhook_create_payload_spec.rb +84 -0
  250. data/spec/models/webhook_spec.rb +108 -0
  251. data/spec/models/webhook_update_payload_spec.rb +90 -0
  252. data/spec/spec_helper.rb +1 -1
  253. metadata +109 -89
@@ -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
- Generator version: 7.11.0
9
+ Generator version: 7.14.0
10
10
 
11
11
  =end
12
12
 
@@ -19,6 +19,69 @@ module ElasticEmail
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Get SubAccount ApiKey
23
+ # Returns API key token for the specified SubAccount. The default API key created for the subaccount has a 48-hour expiration period. Required Access Level: ModifySubAccounts
24
+ # @param email [String] Email address of Sub-Account
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [String]
27
+ def subaccounts_by_email_apikey_get(email, opts = {})
28
+ data, _status_code, _headers = subaccounts_by_email_apikey_get_with_http_info(email, opts)
29
+ data
30
+ end
31
+
32
+ # Get SubAccount ApiKey
33
+ # Returns API key token for the specified SubAccount. The default API key created for the subaccount has a 48-hour expiration period. Required Access Level: ModifySubAccounts
34
+ # @param email [String] Email address of Sub-Account
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
37
+ def subaccounts_by_email_apikey_get_with_http_info(email, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: SubAccountsApi.subaccounts_by_email_apikey_get ...'
40
+ end
41
+ # verify the required parameter 'email' is set
42
+ if @api_client.config.client_side_validation && email.nil?
43
+ fail ArgumentError, "Missing the required parameter 'email' when calling SubAccountsApi.subaccounts_by_email_apikey_get"
44
+ end
45
+ # resource path
46
+ local_var_path = '/subaccounts/{email}/apikey'.sub('{' + 'email' + '}', CGI.escape(email.to_s))
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+
56
+ # form parameters
57
+ form_params = opts[:form_params] || {}
58
+
59
+ # http body (model)
60
+ post_body = opts[:debug_body]
61
+
62
+ # return_type
63
+ return_type = opts[:debug_return_type] || 'String'
64
+
65
+ # auth_names
66
+ auth_names = opts[:debug_auth_names] || ['apikey']
67
+
68
+ new_options = opts.merge(
69
+ :operation => :"SubAccountsApi.subaccounts_by_email_apikey_get",
70
+ :header_params => header_params,
71
+ :query_params => query_params,
72
+ :form_params => form_params,
73
+ :body => post_body,
74
+ :auth_names => auth_names,
75
+ :return_type => return_type
76
+ )
77
+
78
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
79
+ if @api_client.config.debugging
80
+ @api_client.config.logger.debug "API called: SubAccountsApi#subaccounts_by_email_apikey_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
81
+ end
82
+ return data, status_code, headers
83
+ end
84
+
22
85
  # Add, Subtract Email Credits
23
86
  # Update email credits of a subaccount by the given amount. Required Access Level: ModifySubAccounts
24
87
  # @param email [String] Email address of Sub-Account
@@ -353,7 +416,7 @@ module ElasticEmail
353
416
  end
354
417
 
355
418
  # Add SubAccount
356
- # Add a new SubAccount to your Account. To receive an access token for this SubAccount, make a POST security/apikeys request using the 'subaccount' parameter. Required Access Level: ModifySubAccounts
419
+ # Add a new SubAccount to your Account. To receive an access token for this SubAccount, make a POST security/apikeys request using the 'subaccount' parameter. The default API key created for the subaccount has a 48-hour expiration period. Required Access Level: ModifySubAccounts
357
420
  # @param subaccount_payload [SubaccountPayload]
358
421
  # @param [Hash] opts the optional parameters
359
422
  # @return [SubAccountInfo]
@@ -363,7 +426,7 @@ module ElasticEmail
363
426
  end
364
427
 
365
428
  # Add SubAccount
366
- # Add a new SubAccount to your Account. To receive an access token for this SubAccount, make a POST security/apikeys request using the &#39;subaccount&#39; parameter. Required Access Level: ModifySubAccounts
429
+ # Add a new SubAccount to your Account. To receive an access token for this SubAccount, make a POST security/apikeys request using the &#39;subaccount&#39; parameter. The default API key created for the subaccount has a 48-hour expiration period. Required Access Level: ModifySubAccounts
367
430
  # @param subaccount_payload [SubaccountPayload]
368
431
  # @param [Hash] opts the optional parameters
369
432
  # @return [Array<(SubAccountInfo, Integer, Hash)>] SubAccountInfo data, response status code and response headers
@@ -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
- Generator version: 7.11.0
9
+ Generator version: 7.14.0
10
10
 
11
11
  =end
12
12
 
@@ -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
- Generator version: 7.11.0
9
+ Generator version: 7.14.0
10
10
 
11
11
  =end
12
12
 
@@ -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
- Generator version: 7.11.0
9
+ Generator version: 7.14.0
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,351 @@
1
+ =begin
2
+ #Elastic Email REST API
3
+
4
+ #This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach. Every API call is established on which specific request type (GET, POST, PUT, DELETE) will be used. The API has a limit of 20 concurrent connections and a hard timeout of 600 seconds per request. To start using this API, you will need your Access Token (available <a target='_blank' href='https://app.elasticemail.com/marketing/settings/new/manage-api'>here</a>). Remember to keep it safe. Required access levels are listed in the given request’s description. Downloadable library clients can be found in our Github repository <a target='_blank' href='https://github.com/ElasticEmail?tab=repositories&q=%22rest+api%22+in%3Areadme'>here</a>
5
+
6
+ The version of the OpenAPI document: 4.0.0
7
+ Contact: support@elasticemail.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module ElasticEmail
16
+ class WebhookApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Delete Webhook
23
+ # Delete the specified notifications webhook. Required Access Level: ModifyWebNotifications
24
+ # @param publicid [String]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [nil]
27
+ def webhook_by_publicid_delete(publicid, opts = {})
28
+ webhook_by_publicid_delete_with_http_info(publicid, opts)
29
+ nil
30
+ end
31
+
32
+ # Delete Webhook
33
+ # Delete the specified notifications webhook. Required Access Level: ModifyWebNotifications
34
+ # @param publicid [String]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
37
+ def webhook_by_publicid_delete_with_http_info(publicid, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: WebhookApi.webhook_by_publicid_delete ...'
40
+ end
41
+ # verify the required parameter 'publicid' is set
42
+ if @api_client.config.client_side_validation && publicid.nil?
43
+ fail ArgumentError, "Missing the required parameter 'publicid' when calling WebhookApi.webhook_by_publicid_delete"
44
+ end
45
+ # resource path
46
+ local_var_path = '/webhook/{publicid}'.sub('{' + 'publicid' + '}', CGI.escape(publicid.to_s))
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+
54
+ # form parameters
55
+ form_params = opts[:form_params] || {}
56
+
57
+ # http body (model)
58
+ post_body = opts[:debug_body]
59
+
60
+ # return_type
61
+ return_type = opts[:debug_return_type]
62
+
63
+ # auth_names
64
+ auth_names = opts[:debug_auth_names] || ['apikey']
65
+
66
+ new_options = opts.merge(
67
+ :operation => :"WebhookApi.webhook_by_publicid_delete",
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => return_type
74
+ )
75
+
76
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: WebhookApi#webhook_by_publicid_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ return data, status_code, headers
81
+ end
82
+
83
+ # Load Webhook
84
+ # Load notifications webhook details. Required Access Level: ViewWebNotifications
85
+ # @param publicid [String]
86
+ # @param [Hash] opts the optional parameters
87
+ # @return [Webhook]
88
+ def webhook_by_publicid_get(publicid, opts = {})
89
+ data, _status_code, _headers = webhook_by_publicid_get_with_http_info(publicid, opts)
90
+ data
91
+ end
92
+
93
+ # Load Webhook
94
+ # Load notifications webhook details. Required Access Level: ViewWebNotifications
95
+ # @param publicid [String]
96
+ # @param [Hash] opts the optional parameters
97
+ # @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
98
+ def webhook_by_publicid_get_with_http_info(publicid, opts = {})
99
+ if @api_client.config.debugging
100
+ @api_client.config.logger.debug 'Calling API: WebhookApi.webhook_by_publicid_get ...'
101
+ end
102
+ # verify the required parameter 'publicid' is set
103
+ if @api_client.config.client_side_validation && publicid.nil?
104
+ fail ArgumentError, "Missing the required parameter 'publicid' when calling WebhookApi.webhook_by_publicid_get"
105
+ end
106
+ # resource path
107
+ local_var_path = '/webhook/{publicid}'.sub('{' + 'publicid' + '}', CGI.escape(publicid.to_s))
108
+
109
+ # query parameters
110
+ query_params = opts[:query_params] || {}
111
+
112
+ # header parameters
113
+ header_params = opts[:header_params] || {}
114
+ # HTTP header 'Accept' (if needed)
115
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
116
+
117
+ # form parameters
118
+ form_params = opts[:form_params] || {}
119
+
120
+ # http body (model)
121
+ post_body = opts[:debug_body]
122
+
123
+ # return_type
124
+ return_type = opts[:debug_return_type] || 'Webhook'
125
+
126
+ # auth_names
127
+ auth_names = opts[:debug_auth_names] || ['apikey']
128
+
129
+ new_options = opts.merge(
130
+ :operation => :"WebhookApi.webhook_by_publicid_get",
131
+ :header_params => header_params,
132
+ :query_params => query_params,
133
+ :form_params => form_params,
134
+ :body => post_body,
135
+ :auth_names => auth_names,
136
+ :return_type => return_type
137
+ )
138
+
139
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
140
+ if @api_client.config.debugging
141
+ @api_client.config.logger.debug "API called: WebhookApi#webhook_by_publicid_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
142
+ end
143
+ return data, status_code, headers
144
+ end
145
+
146
+ # Update Webhook
147
+ # Update notification webhook. Required Access Level: ModifyWebNotifications
148
+ # @param publicid [String]
149
+ # @param webhook_update_payload [WebhookUpdatePayload]
150
+ # @param [Hash] opts the optional parameters
151
+ # @return [Webhook]
152
+ def webhook_by_publicid_put(publicid, webhook_update_payload, opts = {})
153
+ data, _status_code, _headers = webhook_by_publicid_put_with_http_info(publicid, webhook_update_payload, opts)
154
+ data
155
+ end
156
+
157
+ # Update Webhook
158
+ # Update notification webhook. Required Access Level: ModifyWebNotifications
159
+ # @param publicid [String]
160
+ # @param webhook_update_payload [WebhookUpdatePayload]
161
+ # @param [Hash] opts the optional parameters
162
+ # @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
163
+ def webhook_by_publicid_put_with_http_info(publicid, webhook_update_payload, opts = {})
164
+ if @api_client.config.debugging
165
+ @api_client.config.logger.debug 'Calling API: WebhookApi.webhook_by_publicid_put ...'
166
+ end
167
+ # verify the required parameter 'publicid' is set
168
+ if @api_client.config.client_side_validation && publicid.nil?
169
+ fail ArgumentError, "Missing the required parameter 'publicid' when calling WebhookApi.webhook_by_publicid_put"
170
+ end
171
+ # verify the required parameter 'webhook_update_payload' is set
172
+ if @api_client.config.client_side_validation && webhook_update_payload.nil?
173
+ fail ArgumentError, "Missing the required parameter 'webhook_update_payload' when calling WebhookApi.webhook_by_publicid_put"
174
+ end
175
+ # resource path
176
+ local_var_path = '/webhook/{publicid}'.sub('{' + 'publicid' + '}', CGI.escape(publicid.to_s))
177
+
178
+ # query parameters
179
+ query_params = opts[:query_params] || {}
180
+
181
+ # header parameters
182
+ header_params = opts[:header_params] || {}
183
+ # HTTP header 'Accept' (if needed)
184
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
185
+ # HTTP header 'Content-Type'
186
+ content_type = @api_client.select_header_content_type(['application/json'])
187
+ if !content_type.nil?
188
+ header_params['Content-Type'] = content_type
189
+ end
190
+
191
+ # form parameters
192
+ form_params = opts[:form_params] || {}
193
+
194
+ # http body (model)
195
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_update_payload)
196
+
197
+ # return_type
198
+ return_type = opts[:debug_return_type] || 'Webhook'
199
+
200
+ # auth_names
201
+ auth_names = opts[:debug_auth_names] || ['apikey']
202
+
203
+ new_options = opts.merge(
204
+ :operation => :"WebhookApi.webhook_by_publicid_put",
205
+ :header_params => header_params,
206
+ :query_params => query_params,
207
+ :form_params => form_params,
208
+ :body => post_body,
209
+ :auth_names => auth_names,
210
+ :return_type => return_type
211
+ )
212
+
213
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
214
+ if @api_client.config.debugging
215
+ @api_client.config.logger.debug "API called: WebhookApi#webhook_by_publicid_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
216
+ end
217
+ return data, status_code, headers
218
+ end
219
+
220
+ # Load Webhooks
221
+ # Returns a list of notification webhooks. Required Access Level: ViewWebNotifications
222
+ # @param [Hash] opts the optional parameters
223
+ # @option opts [Integer] :limit Maximum number of returned items.
224
+ # @option opts [Integer] :offset How many items should be returned ahead.
225
+ # @return [Array<Webhook>]
226
+ def webhook_get(opts = {})
227
+ data, _status_code, _headers = webhook_get_with_http_info(opts)
228
+ data
229
+ end
230
+
231
+ # Load Webhooks
232
+ # Returns a list of notification webhooks. Required Access Level: ViewWebNotifications
233
+ # @param [Hash] opts the optional parameters
234
+ # @option opts [Integer] :limit Maximum number of returned items.
235
+ # @option opts [Integer] :offset How many items should be returned ahead.
236
+ # @return [Array<(Array<Webhook>, Integer, Hash)>] Array<Webhook> data, response status code and response headers
237
+ def webhook_get_with_http_info(opts = {})
238
+ if @api_client.config.debugging
239
+ @api_client.config.logger.debug 'Calling API: WebhookApi.webhook_get ...'
240
+ end
241
+ # resource path
242
+ local_var_path = '/webhook'
243
+
244
+ # query parameters
245
+ query_params = opts[:query_params] || {}
246
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
247
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
248
+
249
+ # header parameters
250
+ header_params = opts[:header_params] || {}
251
+ # HTTP header 'Accept' (if needed)
252
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
253
+
254
+ # form parameters
255
+ form_params = opts[:form_params] || {}
256
+
257
+ # http body (model)
258
+ post_body = opts[:debug_body]
259
+
260
+ # return_type
261
+ return_type = opts[:debug_return_type] || 'Array<Webhook>'
262
+
263
+ # auth_names
264
+ auth_names = opts[:debug_auth_names] || ['apikey']
265
+
266
+ new_options = opts.merge(
267
+ :operation => :"WebhookApi.webhook_get",
268
+ :header_params => header_params,
269
+ :query_params => query_params,
270
+ :form_params => form_params,
271
+ :body => post_body,
272
+ :auth_names => auth_names,
273
+ :return_type => return_type
274
+ )
275
+
276
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
277
+ if @api_client.config.debugging
278
+ @api_client.config.logger.debug "API called: WebhookApi#webhook_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
279
+ end
280
+ return data, status_code, headers
281
+ end
282
+
283
+ # Add Webhook
284
+ # Add a notification webhook. Required Access Level: ModifyWebNotifications
285
+ # @param webhook_create_payload [WebhookCreatePayload]
286
+ # @param [Hash] opts the optional parameters
287
+ # @return [Webhook]
288
+ def webhook_post(webhook_create_payload, opts = {})
289
+ data, _status_code, _headers = webhook_post_with_http_info(webhook_create_payload, opts)
290
+ data
291
+ end
292
+
293
+ # Add Webhook
294
+ # Add a notification webhook. Required Access Level: ModifyWebNotifications
295
+ # @param webhook_create_payload [WebhookCreatePayload]
296
+ # @param [Hash] opts the optional parameters
297
+ # @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
298
+ def webhook_post_with_http_info(webhook_create_payload, opts = {})
299
+ if @api_client.config.debugging
300
+ @api_client.config.logger.debug 'Calling API: WebhookApi.webhook_post ...'
301
+ end
302
+ # verify the required parameter 'webhook_create_payload' is set
303
+ if @api_client.config.client_side_validation && webhook_create_payload.nil?
304
+ fail ArgumentError, "Missing the required parameter 'webhook_create_payload' when calling WebhookApi.webhook_post"
305
+ end
306
+ # resource path
307
+ local_var_path = '/webhook'
308
+
309
+ # query parameters
310
+ query_params = opts[:query_params] || {}
311
+
312
+ # header parameters
313
+ header_params = opts[:header_params] || {}
314
+ # HTTP header 'Accept' (if needed)
315
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
316
+ # HTTP header 'Content-Type'
317
+ content_type = @api_client.select_header_content_type(['application/json'])
318
+ if !content_type.nil?
319
+ header_params['Content-Type'] = content_type
320
+ end
321
+
322
+ # form parameters
323
+ form_params = opts[:form_params] || {}
324
+
325
+ # http body (model)
326
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_create_payload)
327
+
328
+ # return_type
329
+ return_type = opts[:debug_return_type] || 'Webhook'
330
+
331
+ # auth_names
332
+ auth_names = opts[:debug_auth_names] || ['apikey']
333
+
334
+ new_options = opts.merge(
335
+ :operation => :"WebhookApi.webhook_post",
336
+ :header_params => header_params,
337
+ :query_params => query_params,
338
+ :form_params => form_params,
339
+ :body => post_body,
340
+ :auth_names => auth_names,
341
+ :return_type => return_type
342
+ )
343
+
344
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
345
+ if @api_client.config.debugging
346
+ @api_client.config.logger.debug "API called: WebhookApi#webhook_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
347
+ end
348
+ return data, status_code, headers
349
+ end
350
+ end
351
+ 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
- Generator version: 7.11.0
9
+ Generator version: 7.14.0
10
10
 
11
11
  =end
12
12
 
@@ -49,7 +49,8 @@ module ElasticEmail
49
49
  # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
50
50
  def call_api(http_method, path, opts = {})
51
51
  request = build_request(http_method, path, opts)
52
- tempfile = download_file(request) if opts[:return_type] == 'File'
52
+ tempfile = nil
53
+ (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File'
53
54
  response = request.run
54
55
 
55
56
  if @config.debugging
@@ -188,19 +189,17 @@ module ElasticEmail
188
189
  chunk.force_encoding(encoding)
189
190
  tempfile.write(chunk)
190
191
  end
191
- # run the request to ensure the tempfile is created successfully before returning it
192
- request.run
193
- if tempfile
192
+ request.on_complete do
193
+ if !tempfile
194
+ fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
195
+ end
194
196
  tempfile.close
195
197
  @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
196
198
  "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
197
199
  "will be deleted automatically with GC. It's also recommended to delete the temp file "\
198
200
  "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}")
201
+ yield tempfile if block_given?
201
202
  end
202
-
203
- tempfile
204
203
  end
205
204
 
206
205
  # Check if the given MIME is a JSON MIME.
@@ -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
- Generator version: 7.11.0
9
+ Generator version: 7.14.0
10
10
 
11
11
  =end
12
12
 
@@ -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
- Generator version: 7.11.0
9
+ Generator version: 7.14.0
10
10
 
11
11
  =end
12
12
 
@@ -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
- Generator version: 7.11.0
9
+ Generator version: 7.14.0
10
10
 
11
11
  =end
12
12
 
@@ -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
- Generator version: 7.11.0
9
+ Generator version: 7.14.0
10
10
 
11
11
  =end
12
12
 
@@ -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
- Generator version: 7.11.0
9
+ Generator version: 7.14.0
10
10
 
11
11
  =end
12
12
 
@@ -46,9 +46,14 @@ module ElasticEmail
46
46
  }
47
47
  end
48
48
 
49
+ # Returns attribute mapping this model knows about
50
+ def self.acceptable_attribute_map
51
+ attribute_map
52
+ end
53
+
49
54
  # Returns all the JSON keys this model knows about
50
55
  def self.acceptable_attributes
51
- attribute_map.values
56
+ acceptable_attribute_map.values
52
57
  end
53
58
 
54
59
  # Attribute type mapping.
@@ -79,9 +84,10 @@ module ElasticEmail
79
84
  end
80
85
 
81
86
  # check to see if the attribute exists and convert string to symbol for hash key
87
+ acceptable_attribute_map = self.class.acceptable_attribute_map
82
88
  attributes = attributes.each_with_object({}) { |(k, v), h|
83
- if (!self.class.attribute_map.key?(k.to_sym))
84
- fail ArgumentError, "`#{k}` is not a valid attribute in `ElasticEmail::ApiKey`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
+ if (!acceptable_attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ElasticEmail::ApiKey`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
85
91
  end
86
92
  h[k.to_sym] = v
87
93
  }
@@ -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
- Generator version: 7.11.0
9
+ Generator version: 7.14.0
10
10
 
11
11
  =end
12
12
 
@@ -42,9 +42,14 @@ module ElasticEmail
42
42
  }
43
43
  end
44
44
 
45
+ # Returns attribute mapping this model knows about
46
+ def self.acceptable_attribute_map
47
+ attribute_map
48
+ end
49
+
45
50
  # Returns all the JSON keys this model knows about
46
51
  def self.acceptable_attributes
47
- attribute_map.values
52
+ acceptable_attribute_map.values
48
53
  end
49
54
 
50
55
  # Attribute type mapping.
@@ -73,9 +78,10 @@ module ElasticEmail
73
78
  end
74
79
 
75
80
  # check to see if the attribute exists and convert string to symbol for hash key
81
+ acceptable_attribute_map = self.class.acceptable_attribute_map
76
82
  attributes = attributes.each_with_object({}) { |(k, v), h|
77
- if (!self.class.attribute_map.key?(k.to_sym))
78
- fail ArgumentError, "`#{k}` is not a valid attribute in `ElasticEmail::ApiKeyPayload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
83
+ if (!acceptable_attribute_map.key?(k.to_sym))
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ElasticEmail::ApiKeyPayload`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
79
85
  end
80
86
  h[k.to_sym] = v
81
87
  }
@@ -134,6 +140,26 @@ module ElasticEmail
134
140
  true
135
141
  end
136
142
 
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] name Value to be assigned
145
+ def name=(name)
146
+ if name.nil?
147
+ fail ArgumentError, 'name cannot be nil'
148
+ end
149
+
150
+ @name = name
151
+ end
152
+
153
+ # Custom attribute writer method with validation
154
+ # @param [Object] access_level Value to be assigned
155
+ def access_level=(access_level)
156
+ if access_level.nil?
157
+ fail ArgumentError, 'access_level cannot be nil'
158
+ end
159
+
160
+ @access_level = access_level
161
+ end
162
+
137
163
  # Checks equality by comparing each attribute.
138
164
  # @param [Object] Object to be compared
139
165
  def ==(o)
@@ -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
- Generator version: 7.11.0
9
+ Generator version: 7.14.0
10
10
 
11
11
  =end
12
12