sendpost_ruby_sdk 1.0.1 → 2.0.0

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 (287) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -0
  3. data/README.md +626 -82
  4. data/docs/AccountStats.md +20 -0
  5. data/docs/AccountStatsStat.md +38 -0
  6. data/docs/AggregateStat.md +38 -0
  7. data/docs/AggregateStats.md +38 -0
  8. data/docs/AggregatedEmailStats.md +38 -0
  9. data/docs/Attachment.md +4 -4
  10. data/docs/AutoWarmupPlan.md +80 -0
  11. data/docs/CopyTo.md +5 -5
  12. data/docs/CreateDomainRequest.md +18 -0
  13. data/docs/CreateSubAccountRequest.md +18 -0
  14. data/docs/CreateSuppressionRequest.md +24 -0
  15. data/docs/CreateSuppressionRequestHardBounceInner.md +18 -0
  16. data/docs/{SuppressionEmail.md → CreateSuppressionRequestManualInner.md} +3 -3
  17. data/docs/CreateSuppressionRequestSpamComplaintInner.md +18 -0
  18. data/docs/CreateSuppressionRequestUnsubscribeInner.md +18 -0
  19. data/docs/CreateWebhookRequest.md +46 -0
  20. data/docs/DeleteResponse.md +2 -2
  21. data/docs/DeleteSubAccountResponse.md +20 -0
  22. data/docs/DeleteSuppression200ResponseInner.md +20 -0
  23. data/docs/DeleteSuppressionRequest.md +18 -0
  24. data/docs/DeleteWebhookResponse.md +20 -0
  25. data/docs/Device.md +1 -1
  26. data/docs/Domain.md +56 -0
  27. data/docs/DomainApi.md +301 -0
  28. data/docs/DomainDkim.md +22 -0
  29. data/docs/DomainDmarc.md +22 -0
  30. data/docs/DomainGpt.md +22 -0
  31. data/docs/DomainReturnPath.md +22 -0
  32. data/docs/DomainTrack.md +22 -0
  33. data/docs/EIP.md +18 -0
  34. data/docs/{From.md → EmailAddress.md} +4 -4
  35. data/docs/EmailApi.md +38 -32
  36. data/docs/EmailMessage.md +30 -24
  37. data/docs/EmailMessageFrom.md +20 -0
  38. data/docs/EmailMessageObject.md +46 -0
  39. data/docs/{ReplyTo.md → EmailMessageReplyTo.md} +5 -5
  40. data/docs/EmailMessageToInner.md +26 -0
  41. data/docs/EmailMessageToInnerBccInner.md +22 -0
  42. data/docs/EmailMessageToInnerCcInner.md +22 -0
  43. data/docs/EmailMessageWithTemplate.md +52 -0
  44. data/docs/EmailResponse.md +8 -8
  45. data/docs/EmailStats.md +20 -0
  46. data/docs/EmailStatsStats.md +38 -0
  47. data/docs/Event.md +56 -0
  48. data/docs/EventMetadata.md +13 -9
  49. data/docs/{City.md → GeoLocation.md} +8 -8
  50. data/docs/IP.md +62 -0
  51. data/docs/IPAllocationRequest.md +20 -0
  52. data/docs/IPApi.md +375 -0
  53. data/docs/IPDeletionResponse.md +20 -0
  54. data/docs/IPPool.md +42 -0
  55. data/docs/IPPoolCreateRequest.md +28 -0
  56. data/docs/IPPoolDeleteResponse.md +20 -0
  57. data/docs/IPPoolUpdateRequest.md +24 -0
  58. data/docs/IPPoolsApi.md +361 -0
  59. data/docs/IPUpdateRequest.md +18 -0
  60. data/docs/Label.md +22 -0
  61. data/docs/Member.md +40 -0
  62. data/docs/Message.md +76 -0
  63. data/docs/MessageApi.md +79 -0
  64. data/docs/MessageHeaderTo.md +26 -0
  65. data/docs/MessageTo.md +26 -0
  66. data/docs/{Os.md → OperatingSystem.md} +7 -7
  67. data/docs/Person.md +20 -0
  68. data/docs/{To.md → Recipient.md} +7 -7
  69. data/docs/SMTPAuth.md +26 -0
  70. data/docs/Stat.md +20 -0
  71. data/docs/StatStats.md +38 -0
  72. data/docs/StatsAApi.md +307 -0
  73. data/docs/StatsApi.md +237 -0
  74. data/docs/SubAccount.md +48 -0
  75. data/docs/SubAccountApi.md +375 -0
  76. data/docs/Suppression.md +8 -8
  77. data/docs/SuppressionApi.md +76 -134
  78. data/docs/ThirdPartySendingProvider.md +38 -0
  79. data/docs/UpdateSubAccount.md +18 -0
  80. data/docs/UpdateWebhook.md +46 -0
  81. data/docs/UserAgent.md +4 -4
  82. data/docs/Webhook.md +54 -0
  83. data/docs/WebhookApi.md +375 -0
  84. data/git_push.sh +2 -2
  85. data/lib/sendpost_ruby_sdk/api/domain_api.rb +290 -0
  86. data/lib/sendpost_ruby_sdk/api/email_api.rb +33 -35
  87. data/lib/sendpost_ruby_sdk/api/ip_api.rb +356 -0
  88. data/lib/sendpost_ruby_sdk/api/ip_pools_api.rb +356 -0
  89. data/lib/sendpost_ruby_sdk/api/message_api.rb +85 -0
  90. data/lib/sendpost_ruby_sdk/api/stats_a_api.rb +320 -0
  91. data/lib/sendpost_ruby_sdk/api/stats_api.rb +260 -0
  92. data/lib/sendpost_ruby_sdk/api/sub_account_api.rb +356 -0
  93. data/lib/sendpost_ruby_sdk/api/suppression_api.rb +81 -141
  94. data/lib/sendpost_ruby_sdk/api/webhook_api.rb +356 -0
  95. data/lib/sendpost_ruby_sdk/api_client.rb +26 -24
  96. data/lib/sendpost_ruby_sdk/api_error.rb +3 -3
  97. data/lib/sendpost_ruby_sdk/configuration.rb +39 -12
  98. data/lib/sendpost_ruby_sdk/models/account_stats.rb +229 -0
  99. data/lib/sendpost_ruby_sdk/models/account_stats_stat.rb +310 -0
  100. data/lib/sendpost_ruby_sdk/models/aggregate_stat.rb +321 -0
  101. data/lib/sendpost_ruby_sdk/models/aggregate_stats.rb +310 -0
  102. data/lib/sendpost_ruby_sdk/models/aggregated_email_stats.rb +321 -0
  103. data/lib/sendpost_ruby_sdk/models/attachment.rb +27 -24
  104. data/lib/sendpost_ruby_sdk/models/auto_warmup_plan.rb +531 -0
  105. data/lib/sendpost_ruby_sdk/models/copy_to.rb +40 -36
  106. data/lib/sendpost_ruby_sdk/models/create_domain_request.rb +221 -0
  107. data/lib/sendpost_ruby_sdk/models/create_sub_account_request.rb +221 -0
  108. data/lib/sendpost_ruby_sdk/models/create_suppression_request.rb +259 -0
  109. data/lib/sendpost_ruby_sdk/models/create_suppression_request_hard_bounce_inner.rb +220 -0
  110. data/lib/sendpost_ruby_sdk/models/create_suppression_request_manual_inner.rb +220 -0
  111. data/lib/sendpost_ruby_sdk/models/create_suppression_request_spam_complaint_inner.rb +220 -0
  112. data/lib/sendpost_ruby_sdk/models/create_suppression_request_unsubscribe_inner.rb +220 -0
  113. data/lib/sendpost_ruby_sdk/models/create_webhook_request.rb +361 -0
  114. data/lib/sendpost_ruby_sdk/models/delete_response.rb +27 -24
  115. data/lib/sendpost_ruby_sdk/models/delete_sub_account_response.rb +231 -0
  116. data/lib/sendpost_ruby_sdk/models/delete_suppression200_response_inner.rb +231 -0
  117. data/lib/sendpost_ruby_sdk/models/delete_suppression_request.rb +222 -0
  118. data/lib/sendpost_ruby_sdk/models/delete_webhook_response.rb +231 -0
  119. data/lib/sendpost_ruby_sdk/models/device.rb +25 -24
  120. data/lib/sendpost_ruby_sdk/models/domain.rb +406 -0
  121. data/lib/sendpost_ruby_sdk/models/domain_dkim.rb +239 -0
  122. data/lib/sendpost_ruby_sdk/models/domain_dmarc.rb +239 -0
  123. data/lib/sendpost_ruby_sdk/models/domain_gpt.rb +239 -0
  124. data/lib/sendpost_ruby_sdk/models/domain_return_path.rb +239 -0
  125. data/lib/sendpost_ruby_sdk/models/domain_track.rb +239 -0
  126. data/lib/sendpost_ruby_sdk/models/eip.rb +238 -0
  127. data/lib/sendpost_ruby_sdk/models/email_address.rb +229 -0
  128. data/lib/sendpost_ruby_sdk/models/email_message.rb +133 -103
  129. data/lib/sendpost_ruby_sdk/models/email_message_from.rb +229 -0
  130. data/lib/sendpost_ruby_sdk/models/email_message_object.rb +354 -0
  131. data/lib/sendpost_ruby_sdk/models/email_message_reply_to.rb +229 -0
  132. data/lib/sendpost_ruby_sdk/models/email_message_to_inner.rb +262 -0
  133. data/lib/sendpost_ruby_sdk/models/email_message_to_inner_bcc_inner.rb +240 -0
  134. data/lib/sendpost_ruby_sdk/models/email_message_to_inner_cc_inner.rb +240 -0
  135. data/lib/sendpost_ruby_sdk/models/email_message_with_template.rb +392 -0
  136. data/lib/sendpost_ruby_sdk/models/email_response.rb +52 -49
  137. data/lib/sendpost_ruby_sdk/models/email_stats.rb +230 -0
  138. data/lib/sendpost_ruby_sdk/models/email_stats_stats.rb +321 -0
  139. data/lib/sendpost_ruby_sdk/models/event.rb +393 -0
  140. data/lib/sendpost_ruby_sdk/models/event_metadata.rb +77 -58
  141. data/lib/sendpost_ruby_sdk/models/geo_location.rb +256 -0
  142. data/lib/sendpost_ruby_sdk/models/ip.rb +491 -0
  143. data/lib/sendpost_ruby_sdk/models/ip_allocation_request.rb +266 -0
  144. data/lib/sendpost_ruby_sdk/models/ip_deletion_response.rb +265 -0
  145. data/lib/sendpost_ruby_sdk/models/ip_pool.rb +335 -0
  146. data/lib/sendpost_ruby_sdk/models/ip_pool_create_request.rb +269 -0
  147. data/lib/sendpost_ruby_sdk/models/ip_pool_delete_response.rb +229 -0
  148. data/lib/sendpost_ruby_sdk/models/ip_pool_update_request.rb +249 -0
  149. data/lib/sendpost_ruby_sdk/models/ip_update_request.rb +238 -0
  150. data/lib/sendpost_ruby_sdk/models/label.rb +241 -0
  151. data/lib/sendpost_ruby_sdk/models/member.rb +331 -0
  152. data/lib/sendpost_ruby_sdk/models/message.rb +523 -0
  153. data/lib/sendpost_ruby_sdk/models/message_header_to.rb +268 -0
  154. data/lib/sendpost_ruby_sdk/models/message_to.rb +268 -0
  155. data/lib/sendpost_ruby_sdk/models/operating_system.rb +256 -0
  156. data/lib/sendpost_ruby_sdk/models/person.rb +231 -0
  157. data/lib/sendpost_ruby_sdk/models/recipient.rb +263 -0
  158. data/lib/sendpost_ruby_sdk/models/smtp_auth.rb +261 -0
  159. data/lib/sendpost_ruby_sdk/models/stat.rb +230 -0
  160. data/lib/sendpost_ruby_sdk/models/stat_stats.rb +321 -0
  161. data/lib/sendpost_ruby_sdk/models/sub_account.rb +415 -0
  162. data/lib/sendpost_ruby_sdk/models/suppression.rb +52 -46
  163. data/lib/sendpost_ruby_sdk/models/third_party_sending_provider.rb +310 -0
  164. data/lib/sendpost_ruby_sdk/models/update_sub_account.rb +221 -0
  165. data/lib/sendpost_ruby_sdk/models/update_webhook.rb +368 -0
  166. data/lib/sendpost_ruby_sdk/models/user_agent.rb +25 -24
  167. data/lib/sendpost_ruby_sdk/models/webhook.rb +405 -0
  168. data/lib/sendpost_ruby_sdk/version.rb +4 -4
  169. data/lib/sendpost_ruby_sdk.rb +72 -15
  170. data/spec/api/domain_api_spec.rb +85 -0
  171. data/spec/api/email_api_spec.rb +9 -9
  172. data/spec/api/ip_api_spec.rb +98 -0
  173. data/spec/api/ip_pools_api_spec.rb +98 -0
  174. data/spec/api/message_api_spec.rb +47 -0
  175. data/spec/api/stats_a_api_spec.rb +89 -0
  176. data/spec/api/stats_api_spec.rb +78 -0
  177. data/spec/api/sub_account_api_spec.rb +98 -0
  178. data/spec/api/suppression_api_spec.rb +22 -34
  179. data/spec/api/webhook_api_spec.rb +98 -0
  180. data/spec/models/account_stats_spec.rb +42 -0
  181. data/spec/models/account_stats_stat_spec.rb +96 -0
  182. data/spec/models/aggregate_stat_spec.rb +96 -0
  183. data/spec/models/aggregate_stats_spec.rb +96 -0
  184. data/spec/models/aggregated_email_stats_spec.rb +96 -0
  185. data/spec/models/attachment_spec.rb +6 -4
  186. data/spec/models/auto_warmup_plan_spec.rb +222 -0
  187. data/spec/models/copy_to_spec.rb +8 -6
  188. data/spec/models/create_domain_request_spec.rb +36 -0
  189. data/spec/models/create_sub_account_request_spec.rb +36 -0
  190. data/spec/models/create_suppression_request_hard_bounce_inner_spec.rb +36 -0
  191. data/spec/models/create_suppression_request_manual_inner_spec.rb +36 -0
  192. data/spec/models/create_suppression_request_spam_complaint_inner_spec.rb +36 -0
  193. data/spec/models/create_suppression_request_spec.rb +54 -0
  194. data/spec/models/create_suppression_request_unsubscribe_inner_spec.rb +36 -0
  195. data/spec/models/create_webhook_request_spec.rb +120 -0
  196. data/spec/models/delete_response_spec.rb +6 -4
  197. data/spec/models/delete_sub_account_response_spec.rb +42 -0
  198. data/spec/models/delete_suppression200_response_inner_spec.rb +42 -0
  199. data/spec/models/delete_suppression_request_spec.rb +36 -0
  200. data/spec/models/delete_webhook_response_spec.rb +42 -0
  201. data/spec/models/device_spec.rb +6 -4
  202. data/spec/models/domain_dkim_spec.rb +48 -0
  203. data/spec/models/domain_dmarc_spec.rb +48 -0
  204. data/spec/models/domain_gpt_spec.rb +48 -0
  205. data/spec/models/domain_return_path_spec.rb +48 -0
  206. data/spec/models/domain_spec.rb +150 -0
  207. data/spec/models/domain_track_spec.rb +48 -0
  208. data/spec/models/eip_spec.rb +36 -0
  209. data/spec/models/email_address_spec.rb +42 -0
  210. data/spec/models/email_message_from_spec.rb +42 -0
  211. data/spec/models/email_message_object_spec.rb +120 -0
  212. data/spec/models/email_message_reply_to_spec.rb +42 -0
  213. data/spec/models/email_message_spec.rb +37 -17
  214. data/spec/models/email_message_to_inner_bcc_inner_spec.rb +48 -0
  215. data/spec/models/email_message_to_inner_cc_inner_spec.rb +48 -0
  216. data/spec/models/email_message_to_inner_spec.rb +60 -0
  217. data/spec/models/email_message_with_template_spec.rb +138 -0
  218. data/spec/models/email_response_spec.rb +10 -8
  219. data/spec/models/email_stats_spec.rb +42 -0
  220. data/spec/models/email_stats_stats_spec.rb +96 -0
  221. data/spec/models/event_metadata_spec.rb +24 -10
  222. data/spec/models/event_spec.rb +150 -0
  223. data/spec/models/geo_location_spec.rb +60 -0
  224. data/spec/models/ip_allocation_request_spec.rb +42 -0
  225. data/spec/models/ip_deletion_response_spec.rb +42 -0
  226. data/spec/models/ip_pool_create_request_spec.rb +66 -0
  227. data/spec/models/ip_pool_delete_response_spec.rb +42 -0
  228. data/spec/models/ip_pool_spec.rb +108 -0
  229. data/spec/models/ip_pool_update_request_spec.rb +54 -0
  230. data/spec/models/ip_spec.rb +168 -0
  231. data/spec/models/ip_update_request_spec.rb +36 -0
  232. data/spec/models/label_spec.rb +48 -0
  233. data/spec/models/member_spec.rb +102 -0
  234. data/spec/models/message_header_to_spec.rb +60 -0
  235. data/spec/models/message_spec.rb +210 -0
  236. data/spec/models/message_to_spec.rb +60 -0
  237. data/spec/models/operating_system_spec.rb +60 -0
  238. data/spec/models/person_spec.rb +42 -0
  239. data/spec/models/recipient_spec.rb +60 -0
  240. data/spec/models/smtp_auth_spec.rb +60 -0
  241. data/spec/models/stat_spec.rb +42 -0
  242. data/spec/models/stat_stats_spec.rb +96 -0
  243. data/spec/models/sub_account_spec.rb +130 -0
  244. data/spec/models/suppression_spec.rb +11 -9
  245. data/spec/models/third_party_sending_provider_spec.rb +96 -0
  246. data/spec/models/update_sub_account_spec.rb +36 -0
  247. data/spec/models/update_webhook_spec.rb +120 -0
  248. data/spec/models/user_agent_spec.rb +6 -4
  249. data/spec/models/webhook_spec.rb +144 -0
  250. data/spec/spec_helper.rb +3 -3
  251. metadata +288 -67
  252. data/config-ruby.json +0 -11
  253. data/docs/CountStat.md +0 -18
  254. data/docs/QEmailMessage.md +0 -70
  255. data/docs/QEvent.md +0 -42
  256. data/docs/RDSuppression.md +0 -18
  257. data/docs/RSuppression.md +0 -24
  258. data/docs/WebhookEvent.md +0 -20
  259. data/generate-libs.bash +0 -1
  260. data/lib/sendpost_ruby_sdk/models/city.rb +0 -255
  261. data/lib/sendpost_ruby_sdk/models/count_stat.rb +0 -219
  262. data/lib/sendpost_ruby_sdk/models/from.rb +0 -228
  263. data/lib/sendpost_ruby_sdk/models/os.rb +0 -255
  264. data/lib/sendpost_ruby_sdk/models/q_email_message.rb +0 -461
  265. data/lib/sendpost_ruby_sdk/models/q_event.rb +0 -329
  266. data/lib/sendpost_ruby_sdk/models/r_suppression.rb +0 -254
  267. data/lib/sendpost_ruby_sdk/models/rd_suppression.rb +0 -221
  268. data/lib/sendpost_ruby_sdk/models/reply_to.rb +0 -228
  269. data/lib/sendpost_ruby_sdk/models/suppression_email.rb +0 -219
  270. data/lib/sendpost_ruby_sdk/models/to.rb +0 -259
  271. data/lib/sendpost_ruby_sdk/models/webhook_event.rb +0 -228
  272. data/sendpost.yaml +0 -662
  273. data/sendpost_ruby_sdk.gemspec +0 -38
  274. data/spec/api_client_spec.rb +0 -228
  275. data/spec/configuration_spec.rb +0 -42
  276. data/spec/models/city_spec.rb +0 -58
  277. data/spec/models/count_stat_spec.rb +0 -34
  278. data/spec/models/from_spec.rb +0 -40
  279. data/spec/models/os_spec.rb +0 -58
  280. data/spec/models/q_email_message_spec.rb +0 -190
  281. data/spec/models/q_event_spec.rb +0 -106
  282. data/spec/models/r_suppression_spec.rb +0 -52
  283. data/spec/models/rd_suppression_spec.rb +0 -34
  284. data/spec/models/reply_to_spec.rb +0 -40
  285. data/spec/models/suppression_email_spec.rb +0 -34
  286. data/spec/models/to_spec.rb +0 -58
  287. data/spec/models/webhook_event_spec.rb +0 -40
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #SendPost API
3
3
 
4
- #Email API and SMTP relay to not just send and measure email sending, but also alert and optimise. We provide you with tools, expertise and support needed to reliably deliver emails to your customers inboxes on time, every time.
4
+ ## Introduction SendPost provides email API and SMTP relay which can be used not just to send & measure but also alert & optimised email sending. You can use SendPost to: * Send personalised emails to multiple recipients using email API * Track opens and clicks * Analyse statistics around open, clicks, bounce, unsubscribe and spam At and advanced level you can use it to: * Manage multiple sub-accounts which may map to your promotional or transactional sending, multiple product lines or multiple customers * Classify your emails using groups for better analysis * Analyse and fix email sending at sub-account level, IP Pool level or group level * Have automated alerts to notify disruptions regarding email sending * Manage different dedicated IP Pools so to better control your email sending * Automatically know when IP or domain is blacklisted or sender score is down * Leverage pro deliverability tools to get significantly better email deliverability & inboxing [<img src=\"https://run.pstmn.io/button.svg\" alt=\"Run In Postman\" style=\"width: 128px; height: 32px;\">](https://god.gw.postman.com/run-collection/33476323-e6dbd27f-c4a7-4d49-bcac-94b0611b938b?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D33476323-e6dbd27f-c4a7-4d49-bcac-94b0611b938b%26entityType%3Dcollection%26workspaceId%3D6b1e4f65-96a9-4136-9512-6266c852517e) # Overview ## REST API SendPost API is built on REST API principles. Authenticated users can interact with any of the API endpoints to perform: * **GET**- to get a resource * **POST** - to create a resource * **PUT** - to update an existing resource * **DELETE** - to delete a resource The API endpoint for all API calls is: <code>https://api.sendpost.io/api/v1</code> Some conventions that have been followed in the API design overall are following: * All resources have either <code>/api/v1/subaccount</code> or <code>/api/v1/account</code> in their API call resource path based on who is authorised for the resource. All API calls with path <code>/api/v1/subaccount</code> use <code>X-SubAccount-ApiKey</code> in their request header. Likewise all API calls with path <code>/api/v1/account</code> use <code>X-Account-ApiKey</code> in their request header. * All resource endpoints end with singular name and not plural. So we have <code>domain</code> instead of domains for domain resource endpoint. Likewise we have <code>sender</code> instead of senders for sender resource endpoint. * Body submitted for POST / PUT API calls as well as JSON response from SendPost API follow camelcase convention * All timestamps returned in response (created or submittedAt response fields) are UNIX nano epoch timestamp. <aside class=\"success\"> All resources have either <code>/api/v1/subaccount</code> or <code>/api/v1/account</code> in their API call resource path based on who is authorised for the resource. All API calls with path <code>/api/v1/subaccount</code> use <code>X-SubAccount-ApiKey</code> in their request header. Likewise all API calls with path <code>/api/v1/account</code> use <code>X-Account-ApiKey</code> in their request header. </aside> SendPost uses conventional HTTP response codes to indicate the success or failure of an API request. * Codes in the <code>2xx</code> range indicate success. * Codes in the <code>4xx</code> range indicate an error owing due to unauthorize access, incorrect request parameters or body etc. * Code in the <code>5xx</code> range indicate an eror with SendPost's servers ( internal service issue or maintenance ) <aside class=\"info\"> SendPost all responses return <code>created</code> in UNIX nano epoch timestamp. </aside> ## Authentication SendPost uses API keys for authentication. You can register a new SendPost API key at our [developer portal](https://app.sendpost.io/register). SendPost expects the API key to be included in all API requests to the server in a header that looks like the following: `X-SubAccount-ApiKey: AHEZEP8192SEGH` This API key is used for all Sub-Account level operations such as: * Sending emails * Retrieving stats regarding open, click, bounce, unsubscribe and spam * Uploading suppressions list * Verifying sending domains and more In addition to <code>X-SubAccount-ApiKey</code> you also have another API Key <code>X-Account-APIKey</code> which is used for Account level operations such as : * Creating and managing sub-accounts * Allocating IPs for your account * Getting overall billing and usage information * Email List validation * Creating and managing alerts and more <aside class=\"notice\"> You must look at individual API reference page to look at whether <code>X-SubAccount-ApiKey</code> is required or <code>X-Account-ApiKey</code> </aside> In case an incorrect API Key header is specified or if it is missed you will get HTTP Response 401 ( Unauthorized ) response from SendPost. ## HTTP Response Headers Code | Reason | Details ---------------| -----------------------| ----------- 200 | Success | Everything went well 401 | Unauthorized | Incorrect or missing API header either <code>X-SubAccount-ApiKey</code> or <code>X-Account-ApiKey</code> 403 | Forbidden | Typically sent when resource with same name or details already exist 406 | Missing resource id | Resource id specified is either missing or doesn't exist 422 | Unprocessable entity | Request body is not in proper format 500 | Internal server error | Some error happened at SendPost while processing API request 503 | Service Unavailable | SendPost is offline for maintenance. Please try again later # API SDKs We have native SendPost SDKs in the following programming languages. You can integrate with them or create your own SDK with our API specification. In case you need any assistance with respect to API then do reachout to our team from website chat or email us at **hello@sendpost.io** * [PHP](https://github.com/sendpost/sendpost_php_sdk) * [Javascript](https://github.com/sendpost/sendpost_javascript_sdk) * [Ruby](https://github.com/sendpost/sendpost_ruby_sdk) * [Python](https://github.com/sendpost/sendpost_python_sdk) * [Golang](https://github.com/sendpost/sendpost_go_sdk) # API Reference SendX REST API can be broken down into two major sub-sections: * Sub-Account * Account Sub-Account API operations enable common email sending API use-cases like sending bulk email, adding new domains or senders for email sending programmatically, retrieving stats, adding suppressions etc. All Sub-Account API operations need to pass <code>X-SubAccount-ApiKey</code> header with every API call. The Account API operations allow users to manage multiple sub-accounts and manage IPs. A single parent SendPost account can have 100's of sub-accounts. You may want to create sub-accounts for different products your company is running or to segregate types of emails or for managing email sending across multiple customers of yours. # SMTP Reference Simple Mail Transfer Protocol (SMTP) is a quick and easy way to send email from one server to another. SendPost provides an SMTP service that allows you to deliver your email via our servers instead of your own client or server. This means you can count on SendPost's delivery at scale for your SMTP needs. ## Integrating SMTP 1. Get the SMTP `username` and `password` from your SendPost account. 2. Set the server host in your email client or application to `smtp.sendpost.io`. This setting is sometimes referred to as the external SMTP server or the SMTP relay. 3. Set the `username` and `password`. 4. Set the port to `587` (or as specified below). ## SMTP Ports - For an unencrypted or a TLS connection, use port `25`, `2525` or `587`. - For a SSL connection, use port `465` - Check your firewall and network to ensure they're not blocking any of our SMTP Endpoints. SendPost supports STARTTLS for establishing a TLS-encrypted connection. STARTTLS is a means of upgrading an unencrypted connection to an encrypted connection. There are versions of STARTTLS for a variety of protocols; the SMTP version is defined in [RFC 3207](https://www.ietf.org/rfc/rfc3207.txt). To set up a STARTTLS connection, the SMTP client connects to the SendPost SMTP endpoint `smtp.sendpost.io` on port 25, 587, or 2525, issues an EHLO command, and waits for the server to announce that it supports the STARTTLS SMTP extension. The client then issues the STARTTLS command, initiating TLS negotiation. When negotiation is complete, the client issues an EHLO command over the new encrypted connection, and the SMTP session proceeds normally. <aside class=\"success\"> If you are unsure which port to use, a TLS connection on port 587 is typically recommended. </aside> ## Sending email from your application ```javascript \"use strict\"; const nodemailer = require(\"nodemailer\"); async function main() { // create reusable transporter object using the default SMTP transport let transporter = nodemailer.createTransport({ host: \"smtp.sendpost.io\", port: 587, secure: false, // true for 465, false for other ports auth: { user: \"<username>\" , // generated ethereal user pass: \"<password>\", // generated ethereal password }, requireTLS: true, debug: true, logger: true, }); // send mail with defined transport object try { let info = await transporter.sendMail({ from: 'erlich@piedpiper.com', to: 'gilfoyle@piedpiper.com', subject: 'Test Email Subject', html: '<h1>Hello Geeks!!!</h1>', }); console.log(\"Message sent: %s\", info.messageId); } catch (e) { console.log(e) } } main().catch(console.error); ``` For PHP ```php <?php // Import PHPMailer classes into the global namespace use PHPMailer\\PHPMailer\\PHPMailer; use PHPMailer\\PHPMailer\\SMTP; use PHPMailer\\PHPMailer\\Exception; // Load Composer's autoloader require 'vendor/autoload.php'; $mail = new PHPMailer(true); // Settings try { $mail->SMTPDebug = SMTP::DEBUG_CONNECTION; // Enable verbose debug output $mail->isSMTP(); // Send using SMTP $mail->Host = 'smtp.sendpost.io'; // Set the SMTP server to send through $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '<username>'; // SMTP username $mail->Password = '<password>'; // SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable implicit TLS encryption $mail->Port = 587; // TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` //Recipients $mail->setFrom('erlich@piedpiper.com', 'Erlich'); $mail->addAddress('gilfoyle@piedpiper.com', 'Gilfoyle'); //Content $mail->isHTML(true); //Set email format to HTML $mail->Subject = 'Here is the subject'; $mail->Body = 'This is the HTML message body <b>in bold!</b>'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo \"Message could not be sent. Mailer Error: {$mail->ErrorInfo}\"; } ``` For Python ```python #!/usr/bin/python3 import sys import os import re from smtplib import SMTP import ssl from email.mime.text import MIMEText SMTPserver = 'smtp.sendpost.io' PORT = 587 sender = 'erlich@piedpiper.com' destination = ['gilfoyle@piedpiper.com'] USERNAME = \"<username>\" PASSWORD = \"<password>\" # typical values for text_subtype are plain, html, xml text_subtype = 'plain' content=\"\"\"\\ Test message \"\"\" subject=\"Sent from Python\" try: msg = MIMEText(content, text_subtype) msg['Subject']= subject msg['From'] = sender conn = SMTP(SMTPserver, PORT) conn.ehlo() context = ssl.create_default_context() conn.starttls(context=context) # upgrade to tls conn.ehlo() conn.set_debuglevel(True) conn.login(USERNAME, PASSWORD) try: resp = conn.sendmail(sender, destination, msg.as_string()) print(\"Send Mail Response: \", resp) except Exception as e: print(\"Send Email Error: \", e) finally: conn.quit() except Exception as e: print(\"Error:\", e) ``` For Golang ```go package main import ( \"fmt\" \"net/smtp\" \"os\" ) // Sending Email Using Smtp in Golang func main() { username := \"<username>\" password := \"<password>\" from := \"erlich@piedpiper.com\" toList := []string{\"gilfoyle@piedpiper.com\"} host := \"smtp.sendpost.io\" port := \"587\" // recommended // This is the message to send in the mail msg := \"Hello geeks!!!\" // We can't send strings directly in mail, // strings need to be converted into slice bytes body := []byte(msg) // PlainAuth uses the given username and password to // authenticate to host and act as identity. // Usually identity should be the empty string, // to act as username. auth := smtp.PlainAuth(\"\", username, password, host) // SendMail uses TLS connection to send the mail // The email is sent to all address in the toList, // the body should be of type bytes, not strings // This returns error if any occured. err := smtp.SendMail(host+\":\"+port, auth, from, toList, body) // handling the errors if err != nil { fmt.Println(err) os.Exit(1) } fmt.Println(\"Successfully sent mail to all user in toList\") } ``` For Java ```java // implementation 'com.sun.mail:javax.mail:1.6.2' import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class SMTPConnect { // This address must be verified. static final String FROM = \"erlich@piedpiper.com\"; static final String FROMNAME = \"Erlich Bachman\"; // Replace recipient@example.com with a \"To\" address. If your account // is still in the sandbox, this address must be verified. static final String TO = \"gilfoyle@piedpiper.com\"; // Replace smtp_username with your SendPost SMTP user name. static final String SMTP_USERNAME = \"<username>\"; // Replace smtp_password with your SendPost SMTP password. static final String SMTP_PASSWORD = \"<password>\"; // SMTP Host Name static final String HOST = \"smtp.sendpost.io\"; // The port you will connect to on SendPost SMTP Endpoint. static final int PORT = 587; static final String SUBJECT = \"SendPost SMTP Test (SMTP interface accessed using Java)\"; static final String BODY = String.join( System.getProperty(\"line.separator\"), \"<h1>SendPost SMTP Test</h1>\", \"<p>This email was sent with SendPost using the \", \"<a href='https://github.com/eclipse-ee4j/mail'>Javamail Package</a>\", \" for <a href='https://www.java.com'>Java</a>.\" ); public static void main(String[] args) throws Exception { // Create a Properties object to contain connection configuration information. Properties props = System.getProperties(); props.put(\"mail.transport.protocol\", \"smtp\"); props.put(\"mail.smtp.port\", PORT); props.put(\"mail.smtp.starttls.enable\", \"true\"); props.put(\"mail.smtp.debug\", \"true\"); props.put(\"mail.smtp.auth\", \"true\"); // Create a Session object to represent a mail session with the specified properties. Session session = Session.getDefaultInstance(props); // Create a message with the specified information. MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress(FROM,FROMNAME)); msg.setRecipient(Message.RecipientType.TO, new InternetAddress(TO)); msg.setSubject(SUBJECT); msg.setContent(BODY,\"text/html\"); // Create a transport. Transport transport = session.getTransport(); // Send the message. try { System.out.println(\"Sending...\"); // Connect to SendPost SMTP using the SMTP username and password you specified above. transport.connect(HOST, SMTP_USERNAME, SMTP_PASSWORD); // Send the email. transport.sendMessage(msg, msg.getAllRecipients()); System.out.println(\"Email sent!\"); } catch (Exception ex) { System.out.println(\"The email was not sent.\"); System.out.println(\"Error message: \" + ex.getMessage()); System.out.println(ex); } // Close and terminate the connection. } } ``` Many programming languages support sending email using SMTP. This capability might be built into the programming language itself, or it might be available as an add-on, plug-in, or library. You can take advantage of this capability by sending email through SendPost from within application programs that you write. We have provided examples in Python3, Golang, Java, PHP, JS.
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
- Contact: hello@sendpost.io
7
+
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ Generator version: 7.13.0
10
10
 
11
11
  =end
12
12
 
@@ -15,80 +15,97 @@ require 'time'
15
15
 
16
16
  module Sendpost
17
17
  class EmailMessage
18
- attr_accessor :attachments
18
+ attr_accessor :message_id
19
19
 
20
- attr_accessor :from
20
+ attr_accessor :account_id
21
21
 
22
- attr_accessor :groups
22
+ attr_accessor :sub_account_id
23
23
 
24
- attr_accessor :html_body
24
+ attr_accessor :ip_id
25
25
 
26
- attr_accessor :ippool
26
+ attr_accessor :public_ip
27
27
 
28
- attr_accessor :pre_text
28
+ attr_accessor :local_ip
29
29
 
30
- attr_accessor :reply_to
30
+ attr_accessor :email_type
31
31
 
32
- attr_accessor :subject
32
+ attr_accessor :submitted_at
33
33
 
34
- attr_accessor :template
34
+ attr_accessor :from
35
35
 
36
- attr_accessor :text_body
36
+ attr_accessor :reply_to
37
37
 
38
38
  attr_accessor :to
39
39
 
40
- attr_accessor :track_clicks
40
+ attr_accessor :groups
41
41
 
42
- attr_accessor :track_opens
42
+ attr_accessor :ip_pool
43
43
 
44
44
  attr_accessor :headers
45
45
 
46
- attr_accessor :amp_body
46
+ attr_accessor :custom_fields
47
+
48
+ attr_accessor :track_opens
49
+
50
+ attr_accessor :track_clicks
51
+
52
+ attr_accessor :webhook_endpoint
47
53
 
48
54
  # Attribute mapping from ruby-style variable name to JSON key.
49
55
  def self.attribute_map
50
56
  {
51
- :'attachments' => :'attachments',
57
+ :'message_id' => :'messageID',
58
+ :'account_id' => :'accountID',
59
+ :'sub_account_id' => :'subAccountID',
60
+ :'ip_id' => :'ipID',
61
+ :'public_ip' => :'publicIP',
62
+ :'local_ip' => :'localIP',
63
+ :'email_type' => :'emailType',
64
+ :'submitted_at' => :'submittedAt',
52
65
  :'from' => :'from',
53
- :'groups' => :'groups',
54
- :'html_body' => :'htmlBody',
55
- :'ippool' => :'ippool',
56
- :'pre_text' => :'preText',
57
66
  :'reply_to' => :'replyTo',
58
- :'subject' => :'subject',
59
- :'template' => :'template',
60
- :'text_body' => :'textBody',
61
67
  :'to' => :'to',
62
- :'track_clicks' => :'trackClicks',
63
- :'track_opens' => :'trackOpens',
68
+ :'groups' => :'groups',
69
+ :'ip_pool' => :'ipPool',
64
70
  :'headers' => :'headers',
65
- :'amp_body' => :'ampBody'
71
+ :'custom_fields' => :'customFields',
72
+ :'track_opens' => :'trackOpens',
73
+ :'track_clicks' => :'trackClicks',
74
+ :'webhook_endpoint' => :'webhookEndpoint'
66
75
  }
67
76
  end
68
77
 
78
+ # Returns attribute mapping this model knows about
79
+ def self.acceptable_attribute_map
80
+ attribute_map
81
+ end
82
+
69
83
  # Returns all the JSON keys this model knows about
70
84
  def self.acceptable_attributes
71
- attribute_map.values
85
+ acceptable_attribute_map.values
72
86
  end
73
87
 
74
88
  # Attribute type mapping.
75
89
  def self.openapi_types
76
90
  {
77
- :'attachments' => :'Array<Attachment>',
78
- :'from' => :'From',
91
+ :'message_id' => :'String',
92
+ :'account_id' => :'Integer',
93
+ :'sub_account_id' => :'Integer',
94
+ :'ip_id' => :'Integer',
95
+ :'public_ip' => :'String',
96
+ :'local_ip' => :'String',
97
+ :'email_type' => :'String',
98
+ :'submitted_at' => :'Integer',
99
+ :'from' => :'EmailMessageFrom',
100
+ :'reply_to' => :'EmailMessageReplyTo',
101
+ :'to' => :'Array<EmailMessageToInner>',
79
102
  :'groups' => :'Array<String>',
80
- :'html_body' => :'String',
81
- :'ippool' => :'String',
82
- :'pre_text' => :'String',
83
- :'reply_to' => :'ReplyTo',
84
- :'subject' => :'String',
85
- :'template' => :'String',
86
- :'text_body' => :'String',
87
- :'to' => :'Array<To>',
88
- :'track_clicks' => :'Boolean',
103
+ :'ip_pool' => :'String',
104
+ :'headers' => :'Hash<String, String>',
105
+ :'custom_fields' => :'Hash<String, String>',
89
106
  :'track_opens' => :'Boolean',
90
- :'headers' => :'Object',
91
- :'amp_body' => :'String'
107
+ :'track_clicks' => :'Boolean',
108
+ :'webhook_endpoint' => :'String'
92
109
  }
93
110
  end
94
111
 
@@ -106,55 +123,52 @@ module Sendpost
106
123
  end
107
124
 
108
125
  # check to see if the attribute exists and convert string to symbol for hash key
126
+ acceptable_attribute_map = self.class.acceptable_attribute_map
109
127
  attributes = attributes.each_with_object({}) { |(k, v), h|
110
- if (!self.class.attribute_map.key?(k.to_sym))
111
- fail ArgumentError, "`#{k}` is not a valid attribute in `Sendpost::EmailMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
128
+ if (!acceptable_attribute_map.key?(k.to_sym))
129
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendpost::EmailMessage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
112
130
  end
113
131
  h[k.to_sym] = v
114
132
  }
115
133
 
116
- if attributes.key?(:'attachments')
117
- if (value = attributes[:'attachments']).is_a?(Array)
118
- self.attachments = value
119
- end
134
+ if attributes.key?(:'message_id')
135
+ self.message_id = attributes[:'message_id']
120
136
  end
121
137
 
122
- if attributes.key?(:'from')
123
- self.from = attributes[:'from']
138
+ if attributes.key?(:'account_id')
139
+ self.account_id = attributes[:'account_id']
124
140
  end
125
141
 
126
- if attributes.key?(:'groups')
127
- if (value = attributes[:'groups']).is_a?(Array)
128
- self.groups = value
129
- end
142
+ if attributes.key?(:'sub_account_id')
143
+ self.sub_account_id = attributes[:'sub_account_id']
130
144
  end
131
145
 
132
- if attributes.key?(:'html_body')
133
- self.html_body = attributes[:'html_body']
146
+ if attributes.key?(:'ip_id')
147
+ self.ip_id = attributes[:'ip_id']
134
148
  end
135
149
 
136
- if attributes.key?(:'ippool')
137
- self.ippool = attributes[:'ippool']
150
+ if attributes.key?(:'public_ip')
151
+ self.public_ip = attributes[:'public_ip']
138
152
  end
139
153
 
140
- if attributes.key?(:'pre_text')
141
- self.pre_text = attributes[:'pre_text']
154
+ if attributes.key?(:'local_ip')
155
+ self.local_ip = attributes[:'local_ip']
142
156
  end
143
157
 
144
- if attributes.key?(:'reply_to')
145
- self.reply_to = attributes[:'reply_to']
158
+ if attributes.key?(:'email_type')
159
+ self.email_type = attributes[:'email_type']
146
160
  end
147
161
 
148
- if attributes.key?(:'subject')
149
- self.subject = attributes[:'subject']
162
+ if attributes.key?(:'submitted_at')
163
+ self.submitted_at = attributes[:'submitted_at']
150
164
  end
151
165
 
152
- if attributes.key?(:'template')
153
- self.template = attributes[:'template']
166
+ if attributes.key?(:'from')
167
+ self.from = attributes[:'from']
154
168
  end
155
169
 
156
- if attributes.key?(:'text_body')
157
- self.text_body = attributes[:'text_body']
170
+ if attributes.key?(:'reply_to')
171
+ self.reply_to = attributes[:'reply_to']
158
172
  end
159
173
 
160
174
  if attributes.key?(:'to')
@@ -163,26 +177,45 @@ module Sendpost
163
177
  end
164
178
  end
165
179
 
166
- if attributes.key?(:'track_clicks')
167
- self.track_clicks = attributes[:'track_clicks']
180
+ if attributes.key?(:'groups')
181
+ if (value = attributes[:'groups']).is_a?(Array)
182
+ self.groups = value
183
+ end
184
+ end
185
+
186
+ if attributes.key?(:'ip_pool')
187
+ self.ip_pool = attributes[:'ip_pool']
188
+ end
189
+
190
+ if attributes.key?(:'headers')
191
+ if (value = attributes[:'headers']).is_a?(Hash)
192
+ self.headers = value
193
+ end
194
+ end
195
+
196
+ if attributes.key?(:'custom_fields')
197
+ if (value = attributes[:'custom_fields']).is_a?(Hash)
198
+ self.custom_fields = value
199
+ end
168
200
  end
169
201
 
170
202
  if attributes.key?(:'track_opens')
171
203
  self.track_opens = attributes[:'track_opens']
172
204
  end
173
205
 
174
- if attributes.key?(:'headers')
175
- self.headers = attributes[:'headers']
206
+ if attributes.key?(:'track_clicks')
207
+ self.track_clicks = attributes[:'track_clicks']
176
208
  end
177
209
 
178
- if attributes.key?(:'amp_body')
179
- self.amp_body = attributes[:'amp_body']
210
+ if attributes.key?(:'webhook_endpoint')
211
+ self.webhook_endpoint = attributes[:'webhook_endpoint']
180
212
  end
181
213
  end
182
214
 
183
215
  # Show invalid properties with the reasons. Usually used together with valid?
184
216
  # @return Array for valid properties with the reasons
185
217
  def list_invalid_properties
218
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
186
219
  invalid_properties = Array.new
187
220
  invalid_properties
188
221
  end
@@ -190,6 +223,7 @@ module Sendpost
190
223
  # Check to see if the all the properties in the model are valid
191
224
  # @return true if the model is valid
192
225
  def valid?
226
+ warn '[DEPRECATED] the `valid?` method is obsolete'
193
227
  true
194
228
  end
195
229
 
@@ -198,21 +232,24 @@ module Sendpost
198
232
  def ==(o)
199
233
  return true if self.equal?(o)
200
234
  self.class == o.class &&
201
- attachments == o.attachments &&
235
+ message_id == o.message_id &&
236
+ account_id == o.account_id &&
237
+ sub_account_id == o.sub_account_id &&
238
+ ip_id == o.ip_id &&
239
+ public_ip == o.public_ip &&
240
+ local_ip == o.local_ip &&
241
+ email_type == o.email_type &&
242
+ submitted_at == o.submitted_at &&
202
243
  from == o.from &&
203
- groups == o.groups &&
204
- html_body == o.html_body &&
205
- ippool == o.ippool &&
206
- pre_text == o.pre_text &&
207
244
  reply_to == o.reply_to &&
208
- subject == o.subject &&
209
- template == o.template &&
210
- text_body == o.text_body &&
211
245
  to == o.to &&
212
- track_clicks == o.track_clicks &&
213
- track_opens == o.track_opens &&
246
+ groups == o.groups &&
247
+ ip_pool == o.ip_pool &&
214
248
  headers == o.headers &&
215
- amp_body == o.amp_body
249
+ custom_fields == o.custom_fields &&
250
+ track_opens == o.track_opens &&
251
+ track_clicks == o.track_clicks &&
252
+ webhook_endpoint == o.webhook_endpoint
216
253
  end
217
254
 
218
255
  # @see the `==` method
@@ -224,44 +261,37 @@ module Sendpost
224
261
  # Calculates hash code according to all attributes.
225
262
  # @return [Integer] Hash code
226
263
  def hash
227
- [attachments, from, groups, html_body, ippool, pre_text, reply_to, subject, template, text_body, to, track_clicks, track_opens, headers, amp_body].hash
264
+ [message_id, account_id, sub_account_id, ip_id, public_ip, local_ip, email_type, submitted_at, from, reply_to, to, groups, ip_pool, headers, custom_fields, track_opens, track_clicks, webhook_endpoint].hash
228
265
  end
229
266
 
230
267
  # Builds the object from hash
231
268
  # @param [Hash] attributes Model attributes in the form of hash
232
269
  # @return [Object] Returns the model itself
233
270
  def self.build_from_hash(attributes)
234
- new.build_from_hash(attributes)
235
- end
236
-
237
- # Builds the object from hash
238
- # @param [Hash] attributes Model attributes in the form of hash
239
- # @return [Object] Returns the model itself
240
- def build_from_hash(attributes)
241
271
  return nil unless attributes.is_a?(Hash)
242
272
  attributes = attributes.transform_keys(&:to_sym)
243
- self.class.openapi_types.each_pair do |key, type|
244
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
245
- self.send("#{key}=", nil)
273
+ transformed_hash = {}
274
+ openapi_types.each_pair do |key, type|
275
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
276
+ transformed_hash["#{key}"] = nil
246
277
  elsif type =~ /\AArray<(.*)>/i
247
278
  # check to ensure the input is an array given that the attribute
248
279
  # is documented as an array but the input is not
249
- if attributes[self.class.attribute_map[key]].is_a?(Array)
250
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
280
+ if attributes[attribute_map[key]].is_a?(Array)
281
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
251
282
  end
252
- elsif !attributes[self.class.attribute_map[key]].nil?
253
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
283
+ elsif !attributes[attribute_map[key]].nil?
284
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
254
285
  end
255
286
  end
256
-
257
- self
287
+ new(transformed_hash)
258
288
  end
259
289
 
260
290
  # Deserializes the data based on type
261
291
  # @param string type Data type
262
292
  # @param string value Value to be deserialized
263
293
  # @return [Object] Deserialized data
264
- def _deserialize(type, value)
294
+ def self._deserialize(type, value)
265
295
  case type.to_sym
266
296
  when :Time
267
297
  Time.parse(value)
@@ -296,7 +326,7 @@ module Sendpost
296
326
  else # model
297
327
  # models (e.g. Pet) or oneOf
298
328
  klass = Sendpost.const_get(type)
299
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
329
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
300
330
  end
301
331
  end
302
332