sendpost_ruby_sdk 2.0.2 → 3.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 (360) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +612 -531
  3. data/docs/AccountCycleUsage.md +18 -0
  4. data/docs/AccountStats.md +3 -3
  5. data/docs/AccountWebhookWithStats.md +58 -0
  6. data/docs/AggregateStat.md +14 -14
  7. data/docs/AggregateStats.md +22 -22
  8. data/docs/Attachment.md +4 -4
  9. data/docs/BlacklistLinks.md +20 -0
  10. data/docs/BlacklistResource.md +38 -0
  11. data/docs/BlacklistedOn.md +20 -0
  12. data/docs/CopyTo.md +6 -6
  13. data/docs/CreateDomainRequest.md +2 -2
  14. data/docs/CreateSuppressionRequest.md +4 -4
  15. data/docs/CreateSuppressionRequestHardBounceInner.md +1 -1
  16. data/docs/CreateSuppressionRequestManualInner.md +1 -1
  17. data/docs/CreateSuppressionRequestSpamComplaintInner.md +1 -1
  18. data/docs/CreateSuppressionRequestUnsubscribeInner.md +1 -1
  19. data/docs/DailyStatistics.md +38 -0
  20. data/docs/DateStat.md +40 -0
  21. data/docs/DeleteResponse.md +4 -4
  22. data/docs/DeleteSubAccountResponse.md +4 -4
  23. data/docs/{DeleteSuppression200ResponseInner.md → DeleteSuppression200Response.md} +2 -4
  24. data/docs/DeleteSuppressionRequest.md +1 -1
  25. data/docs/{EmailMessageReplyTo.md → DeleteSuppressionRequestSuppressionsInner.md} +3 -5
  26. data/docs/DeleteWebhookResponse.md +3 -3
  27. data/docs/Device.md +2 -2
  28. data/docs/DnsRecord.md +22 -0
  29. data/docs/Domain.md +24 -28
  30. data/docs/DomainApi.md +66 -66
  31. data/docs/DomainStat.md +46 -0
  32. data/docs/EIP.md +1 -1
  33. data/docs/EmailAddress.md +4 -4
  34. data/docs/EmailApi.md +4 -4
  35. data/docs/EmailMessage.md +30 -30
  36. data/docs/EmailMessageObject.md +33 -26
  37. data/docs/EmailMessageWithTemplate.md +32 -27
  38. data/docs/EmailResponse.md +10 -10
  39. data/docs/EmailTypeStat.md +40 -0
  40. data/docs/ErrorResponse.md +18 -0
  41. data/docs/ErrorResponseError.md +26 -0
  42. data/docs/ErrorResponseErrorDetailsInner.md +20 -0
  43. data/docs/Event.md +18 -36
  44. data/docs/EventMetadata.md +14 -14
  45. data/docs/GeoLocation.md +8 -8
  46. data/docs/GroupStat.md +40 -0
  47. data/docs/IP.md +13 -43
  48. data/docs/IPAllocationRequest.md +4 -4
  49. data/docs/IPApi.md +19 -19
  50. data/docs/IPDeletionResponse.md +2 -2
  51. data/docs/IPPool.md +13 -21
  52. data/docs/IPPoolCreateRequest.md +10 -8
  53. data/docs/IPPoolDeleteResponse.md +2 -2
  54. data/docs/IPPoolStat.md +44 -0
  55. data/docs/IPPoolUpdateRequest.md +13 -7
  56. data/docs/IPPoolsApi.md +26 -19
  57. data/docs/IPStat.md +46 -0
  58. data/docs/IPUpdateRequest.md +2 -2
  59. data/docs/Label.md +10 -6
  60. data/docs/Member.md +15 -21
  61. data/docs/Message.md +37 -53
  62. data/docs/MessageApi.md +83 -3
  63. data/docs/NewSubAccount.md +18 -0
  64. data/docs/NewWebhook.md +46 -0
  65. data/docs/Os.md +26 -0
  66. data/docs/PostmasterDomainStat.md +30 -0
  67. data/docs/ProviderStat.md +40 -0
  68. data/docs/RAIPPoolStat.md +20 -0
  69. data/docs/RDStat.md +20 -0
  70. data/docs/RIPStat.md +20 -0
  71. data/docs/RStat.md +20 -0
  72. data/docs/Recipient.md +8 -8
  73. data/docs/SDStat.md +42 -0
  74. data/docs/SMTPAuth.md +5 -9
  75. data/docs/SeedContactStats.md +28 -0
  76. data/docs/Stat.md +22 -4
  77. data/docs/StatsAApi.md +24 -24
  78. data/docs/StatsApi.md +19 -19
  79. data/docs/SubAccount.md +13 -27
  80. data/docs/SubAccountApi.md +23 -23
  81. data/docs/SubAccountStat.md +44 -0
  82. data/docs/SubAccountStatForPool.md +42 -0
  83. data/docs/Suppression.md +14 -10
  84. data/docs/SuppressionApi.md +19 -19
  85. data/docs/TPSPStat.md +42 -0
  86. data/docs/UpdateSubAccount.md +2 -2
  87. data/docs/UpdateWebhook.md +23 -23
  88. data/docs/UserAgent.md +7 -7
  89. data/docs/ValidationStat.md +32 -0
  90. data/docs/Webhook.md +31 -29
  91. data/docs/WebhookApi.md +28 -28
  92. data/docs/WebhookObject.md +20 -0
  93. data/docs/WebhookReferenceApi.md +71 -0
  94. data/lib/sendpost_ruby_sdk/api/domain_api.rb +84 -84
  95. data/lib/sendpost_ruby_sdk/api/email_api.rb +6 -6
  96. data/lib/sendpost_ruby_sdk/api/ip_api.rb +24 -24
  97. data/lib/sendpost_ruby_sdk/api/ip_pools_api.rb +25 -25
  98. data/lib/sendpost_ruby_sdk/api/message_api.rb +83 -6
  99. data/lib/sendpost_ruby_sdk/api/stats_a_api.rb +30 -30
  100. data/lib/sendpost_ruby_sdk/api/stats_api.rb +24 -24
  101. data/lib/sendpost_ruby_sdk/api/sub_account_api.rb +33 -33
  102. data/lib/sendpost_ruby_sdk/api/suppression_api.rb +23 -23
  103. data/lib/sendpost_ruby_sdk/api/webhook_api.rb +36 -36
  104. data/lib/sendpost_ruby_sdk/api/webhook_reference_api.rb +82 -0
  105. data/lib/sendpost_ruby_sdk/api_client.rb +2 -2
  106. data/lib/sendpost_ruby_sdk/api_error.rb +2 -2
  107. data/lib/sendpost_ruby_sdk/configuration.rb +2 -2
  108. data/lib/sendpost_ruby_sdk/models/account_cycle_usage.rb +222 -0
  109. data/lib/sendpost_ruby_sdk/models/account_stats.rb +5 -3
  110. data/lib/sendpost_ruby_sdk/models/account_webhook_with_stats.rb +463 -0
  111. data/lib/sendpost_ruby_sdk/models/aggregate_stat.rb +37 -29
  112. data/lib/sendpost_ruby_sdk/models/aggregate_stats.rb +43 -24
  113. data/lib/sendpost_ruby_sdk/models/attachment.rb +48 -4
  114. data/lib/sendpost_ruby_sdk/models/blacklist_links.rb +232 -0
  115. data/lib/sendpost_ruby_sdk/models/blacklist_resource.rb +323 -0
  116. data/lib/sendpost_ruby_sdk/models/blacklisted_on.rb +232 -0
  117. data/lib/sendpost_ruby_sdk/models/copy_to.rb +42 -3
  118. data/lib/sendpost_ruby_sdk/models/create_domain_request.rb +32 -3
  119. data/lib/sendpost_ruby_sdk/models/create_suppression_request.rb +6 -6
  120. data/lib/sendpost_ruby_sdk/models/create_suppression_request_hard_bounce_inner.rb +2 -2
  121. data/lib/sendpost_ruby_sdk/models/create_suppression_request_manual_inner.rb +2 -2
  122. data/lib/sendpost_ruby_sdk/models/create_suppression_request_spam_complaint_inner.rb +2 -2
  123. data/lib/sendpost_ruby_sdk/models/create_suppression_request_unsubscribe_inner.rb +2 -2
  124. data/lib/sendpost_ruby_sdk/models/daily_statistics.rb +322 -0
  125. data/lib/sendpost_ruby_sdk/models/date_stat.rb +339 -0
  126. data/lib/sendpost_ruby_sdk/models/delete_response.rb +5 -4
  127. data/lib/sendpost_ruby_sdk/models/delete_sub_account_response.rb +5 -4
  128. data/lib/sendpost_ruby_sdk/models/delete_suppression200_response.rb +221 -0
  129. data/lib/sendpost_ruby_sdk/models/delete_suppression_request.rb +4 -3
  130. data/lib/sendpost_ruby_sdk/models/delete_suppression_request_suppressions_inner.rb +220 -0
  131. data/lib/sendpost_ruby_sdk/models/delete_webhook_response.rb +5 -4
  132. data/lib/sendpost_ruby_sdk/models/device.rb +5 -3
  133. data/lib/sendpost_ruby_sdk/models/dns_record.rb +276 -0
  134. data/lib/sendpost_ruby_sdk/models/domain.rb +42 -85
  135. data/lib/sendpost_ruby_sdk/models/domain_stat.rb +369 -0
  136. data/lib/sendpost_ruby_sdk/models/eip.rb +4 -3
  137. data/lib/sendpost_ruby_sdk/models/email_address.rb +41 -2
  138. data/lib/sendpost_ruby_sdk/models/email_message.rb +26 -9
  139. data/lib/sendpost_ruby_sdk/models/email_message_object.rb +123 -3
  140. data/lib/sendpost_ruby_sdk/models/email_message_with_template.rb +121 -12
  141. data/lib/sendpost_ruby_sdk/models/email_response.rb +8 -4
  142. data/lib/sendpost_ruby_sdk/models/email_type_stat.rb +339 -0
  143. data/lib/sendpost_ruby_sdk/models/error_response.rb +221 -0
  144. data/lib/sendpost_ruby_sdk/models/error_response_error.rb +297 -0
  145. data/lib/sendpost_ruby_sdk/models/error_response_error_details_inner.rb +231 -0
  146. data/lib/sendpost_ruby_sdk/models/event.rb +94 -118
  147. data/lib/sendpost_ruby_sdk/models/event_metadata.rb +15 -5
  148. data/lib/sendpost_ruby_sdk/models/geo_location.rb +20 -14
  149. data/lib/sendpost_ruby_sdk/models/group_stat.rb +339 -0
  150. data/lib/sendpost_ruby_sdk/models/ip.rb +72 -375
  151. data/lib/sendpost_ruby_sdk/models/ip_allocation_request.rb +29 -33
  152. data/lib/sendpost_ruby_sdk/models/ip_deletion_response.rb +5 -4
  153. data/lib/sendpost_ruby_sdk/models/ip_pool.rb +94 -82
  154. data/lib/sendpost_ruby_sdk/models/ip_pool_create_request.rb +91 -29
  155. data/lib/sendpost_ruby_sdk/models/ip_pool_delete_response.rb +5 -2
  156. data/lib/sendpost_ruby_sdk/models/ip_pool_stat.rb +359 -0
  157. data/lib/sendpost_ruby_sdk/models/ip_pool_update_request.rb +97 -7
  158. data/lib/sendpost_ruby_sdk/models/ip_stat.rb +369 -0
  159. data/lib/sendpost_ruby_sdk/models/ip_update_request.rb +4 -20
  160. data/lib/sendpost_ruby_sdk/models/label.rb +101 -6
  161. data/lib/sendpost_ruby_sdk/models/member.rb +49 -57
  162. data/lib/sendpost_ruby_sdk/models/message.rb +39 -120
  163. data/lib/sendpost_ruby_sdk/models/new_sub_account.rb +257 -0
  164. data/lib/sendpost_ruby_sdk/models/new_webhook.rb +407 -0
  165. data/lib/sendpost_ruby_sdk/models/os.rb +262 -0
  166. data/lib/sendpost_ruby_sdk/models/postmaster_domain_stat.rb +282 -0
  167. data/lib/sendpost_ruby_sdk/models/provider_stat.rb +339 -0
  168. data/lib/sendpost_ruby_sdk/models/r_stat.rb +231 -0
  169. data/lib/sendpost_ruby_sdk/models/raip_pool_stat.rb +231 -0
  170. data/lib/sendpost_ruby_sdk/models/rd_stat.rb +231 -0
  171. data/lib/sendpost_ruby_sdk/models/recipient.rb +82 -3
  172. data/lib/sendpost_ruby_sdk/models/rip_stat.rb +231 -0
  173. data/lib/sendpost_ruby_sdk/models/sd_stat.rb +349 -0
  174. data/lib/sendpost_ruby_sdk/models/seed_contact_stats.rb +281 -0
  175. data/lib/sendpost_ruby_sdk/models/smtp_auth.rb +10 -29
  176. data/lib/sendpost_ruby_sdk/models/stat.rb +108 -16
  177. data/lib/sendpost_ruby_sdk/models/sub_account.rb +57 -115
  178. data/lib/sendpost_ruby_sdk/models/sub_account_stat.rb +359 -0
  179. data/lib/sendpost_ruby_sdk/models/sub_account_stat_for_pool.rb +349 -0
  180. data/lib/sendpost_ruby_sdk/models/suppression.rb +82 -15
  181. data/lib/sendpost_ruby_sdk/models/tpsp_stat.rb +349 -0
  182. data/lib/sendpost_ruby_sdk/models/update_sub_account.rb +32 -3
  183. data/lib/sendpost_ruby_sdk/models/update_webhook.rb +83 -37
  184. data/lib/sendpost_ruby_sdk/models/user_agent.rb +11 -6
  185. data/lib/sendpost_ruby_sdk/models/validation_stat.rb +292 -0
  186. data/lib/sendpost_ruby_sdk/models/webhook.rb +108 -67
  187. data/lib/sendpost_ruby_sdk/models/webhook_object.rb +232 -0
  188. data/lib/sendpost_ruby_sdk/version.rb +3 -3
  189. data/lib/sendpost_ruby_sdk.rb +36 -27
  190. data/sendpost_ruby_sdk.gemspec +39 -0
  191. data/spec/api/webhook_reference_api_spec.rb +46 -0
  192. data/spec/models/account_cycle_usage_spec.rb +36 -0
  193. data/spec/models/account_webhook_with_stats_spec.rb +160 -0
  194. data/spec/models/blacklist_links_spec.rb +42 -0
  195. data/spec/models/blacklist_resource_spec.rb +96 -0
  196. data/spec/models/blacklisted_on_spec.rb +42 -0
  197. data/spec/models/daily_statistics_spec.rb +96 -0
  198. data/spec/models/date_stat_spec.rb +102 -0
  199. data/spec/models/delete_suppression200_response_spec.rb +36 -0
  200. data/spec/models/delete_suppression_request_suppressions_inner_spec.rb +36 -0
  201. data/spec/models/dns_record_spec.rb +52 -0
  202. data/spec/models/domain_stat_spec.rb +120 -0
  203. data/spec/models/email_type_stat_spec.rb +102 -0
  204. data/spec/models/error_response_error_details_inner_spec.rb +42 -0
  205. data/spec/models/error_response_error_spec.rb +64 -0
  206. data/spec/models/error_response_spec.rb +36 -0
  207. data/spec/models/group_stat_spec.rb +102 -0
  208. data/spec/models/ip_pool_stat_spec.rb +114 -0
  209. data/spec/models/ip_stat_spec.rb +120 -0
  210. data/spec/models/new_sub_account_spec.rb +36 -0
  211. data/spec/models/new_webhook_spec.rb +120 -0
  212. data/spec/models/os_spec.rb +60 -0
  213. data/spec/models/postmaster_domain_stat_spec.rb +72 -0
  214. data/spec/models/provider_stat_spec.rb +102 -0
  215. data/spec/models/r_stat_spec.rb +42 -0
  216. data/spec/models/raip_pool_stat_spec.rb +42 -0
  217. data/spec/models/rd_stat_spec.rb +42 -0
  218. data/spec/models/rip_stat_spec.rb +42 -0
  219. data/spec/models/sd_stat_spec.rb +108 -0
  220. data/spec/models/seed_contact_stats_spec.rb +66 -0
  221. data/spec/models/sub_account_stat_for_pool_spec.rb +108 -0
  222. data/spec/models/sub_account_stat_spec.rb +114 -0
  223. data/spec/models/tpsp_stat_spec.rb +108 -0
  224. data/spec/models/validation_stat_spec.rb +78 -0
  225. data/spec/models/webhook_object_spec.rb +42 -0
  226. data/spec/spec_helper.rb +2 -2
  227. metadata +143 -219
  228. data/LICENSE +0 -21
  229. data/docs/AccountStatsStat.md +0 -38
  230. data/docs/AggregatedEmailStats.md +0 -38
  231. data/docs/AutoWarmupPlan.md +0 -80
  232. data/docs/CreateSubAccountRequest.md +0 -18
  233. data/docs/CreateWebhookRequest.md +0 -46
  234. data/docs/DomainDkim.md +0 -22
  235. data/docs/DomainDmarc.md +0 -22
  236. data/docs/DomainGpt.md +0 -22
  237. data/docs/DomainReturnPath.md +0 -22
  238. data/docs/DomainSpf.md +0 -22
  239. data/docs/DomainTrack.md +0 -22
  240. data/docs/EmailMessageFrom.md +0 -20
  241. data/docs/EmailMessageToInner.md +0 -26
  242. data/docs/EmailMessageToInnerBccInner.md +0 -22
  243. data/docs/EmailMessageToInnerCcInner.md +0 -22
  244. data/docs/EmailStats.md +0 -20
  245. data/docs/EmailStatsStats.md +0 -38
  246. data/docs/MessageHeaderTo.md +0 -26
  247. data/docs/MessageTo.md +0 -26
  248. data/docs/OperatingSystem.md +0 -26
  249. data/docs/Person.md +0 -20
  250. data/docs/StatStat.md +0 -38
  251. data/docs/StatStats.md +0 -38
  252. data/docs/ThirdPartySendingProvider.md +0 -38
  253. data/lib/sendpost_ruby_sdk/models/account_stats_stat.rb +0 -311
  254. data/lib/sendpost_ruby_sdk/models/aggregated_email_stats.rb +0 -321
  255. data/lib/sendpost_ruby_sdk/models/auto_warmup_plan.rb +0 -531
  256. data/lib/sendpost_ruby_sdk/models/create_sub_account_request.rb +0 -221
  257. data/lib/sendpost_ruby_sdk/models/create_webhook_request.rb +0 -361
  258. data/lib/sendpost_ruby_sdk/models/delete_suppression200_response_inner.rb +0 -231
  259. data/lib/sendpost_ruby_sdk/models/domain_dkim.rb +0 -239
  260. data/lib/sendpost_ruby_sdk/models/domain_dmarc.rb +0 -239
  261. data/lib/sendpost_ruby_sdk/models/domain_gpt.rb +0 -239
  262. data/lib/sendpost_ruby_sdk/models/domain_return_path.rb +0 -239
  263. data/lib/sendpost_ruby_sdk/models/domain_spf.rb +0 -239
  264. data/lib/sendpost_ruby_sdk/models/domain_track.rb +0 -239
  265. data/lib/sendpost_ruby_sdk/models/email_message_from.rb +0 -229
  266. data/lib/sendpost_ruby_sdk/models/email_message_reply_to.rb +0 -229
  267. data/lib/sendpost_ruby_sdk/models/email_message_to_inner.rb +0 -262
  268. data/lib/sendpost_ruby_sdk/models/email_message_to_inner_bcc_inner.rb +0 -240
  269. data/lib/sendpost_ruby_sdk/models/email_message_to_inner_cc_inner.rb +0 -240
  270. data/lib/sendpost_ruby_sdk/models/email_stats.rb +0 -230
  271. data/lib/sendpost_ruby_sdk/models/email_stats_stats.rb +0 -321
  272. data/lib/sendpost_ruby_sdk/models/message_header_to.rb +0 -268
  273. data/lib/sendpost_ruby_sdk/models/message_to.rb +0 -268
  274. data/lib/sendpost_ruby_sdk/models/operating_system.rb +0 -256
  275. data/lib/sendpost_ruby_sdk/models/person.rb +0 -231
  276. data/lib/sendpost_ruby_sdk/models/stat_stat.rb +0 -322
  277. data/lib/sendpost_ruby_sdk/models/stat_stats.rb +0 -321
  278. data/lib/sendpost_ruby_sdk/models/third_party_sending_provider.rb +0 -310
  279. data/spec/api/domain_api_spec.rb +0 -85
  280. data/spec/api/email_api_spec.rb +0 -59
  281. data/spec/api/ip_api_spec.rb +0 -98
  282. data/spec/api/ip_pools_api_spec.rb +0 -98
  283. data/spec/api/message_api_spec.rb +0 -47
  284. data/spec/api/stats_a_api_spec.rb +0 -89
  285. data/spec/api/stats_api_spec.rb +0 -78
  286. data/spec/api/sub_account_api_spec.rb +0 -98
  287. data/spec/api/suppression_api_spec.rb +0 -76
  288. data/spec/api/webhook_api_spec.rb +0 -98
  289. data/spec/models/account_stats_spec.rb +0 -42
  290. data/spec/models/account_stats_stat_spec.rb +0 -96
  291. data/spec/models/aggregate_stat_spec.rb +0 -96
  292. data/spec/models/aggregate_stats_spec.rb +0 -96
  293. data/spec/models/aggregated_email_stats_spec.rb +0 -96
  294. data/spec/models/attachment_spec.rb +0 -42
  295. data/spec/models/auto_warmup_plan_spec.rb +0 -222
  296. data/spec/models/copy_to_spec.rb +0 -48
  297. data/spec/models/create_domain_request_spec.rb +0 -36
  298. data/spec/models/create_sub_account_request_spec.rb +0 -36
  299. data/spec/models/create_suppression_request_hard_bounce_inner_spec.rb +0 -36
  300. data/spec/models/create_suppression_request_manual_inner_spec.rb +0 -36
  301. data/spec/models/create_suppression_request_spam_complaint_inner_spec.rb +0 -36
  302. data/spec/models/create_suppression_request_spec.rb +0 -54
  303. data/spec/models/create_suppression_request_unsubscribe_inner_spec.rb +0 -36
  304. data/spec/models/create_webhook_request_spec.rb +0 -120
  305. data/spec/models/delete_response_spec.rb +0 -42
  306. data/spec/models/delete_sub_account_response_spec.rb +0 -42
  307. data/spec/models/delete_suppression200_response_inner_spec.rb +0 -42
  308. data/spec/models/delete_suppression_request_spec.rb +0 -36
  309. data/spec/models/delete_webhook_response_spec.rb +0 -42
  310. data/spec/models/device_spec.rb +0 -36
  311. data/spec/models/domain_dkim_spec.rb +0 -48
  312. data/spec/models/domain_dmarc_spec.rb +0 -48
  313. data/spec/models/domain_gpt_spec.rb +0 -48
  314. data/spec/models/domain_return_path_spec.rb +0 -48
  315. data/spec/models/domain_spec.rb +0 -150
  316. data/spec/models/domain_spf_spec.rb +0 -48
  317. data/spec/models/domain_track_spec.rb +0 -48
  318. data/spec/models/eip_spec.rb +0 -36
  319. data/spec/models/email_address_spec.rb +0 -42
  320. data/spec/models/email_message_from_spec.rb +0 -42
  321. data/spec/models/email_message_object_spec.rb +0 -120
  322. data/spec/models/email_message_reply_to_spec.rb +0 -42
  323. data/spec/models/email_message_spec.rb +0 -138
  324. data/spec/models/email_message_to_inner_bcc_inner_spec.rb +0 -48
  325. data/spec/models/email_message_to_inner_cc_inner_spec.rb +0 -48
  326. data/spec/models/email_message_to_inner_spec.rb +0 -60
  327. data/spec/models/email_message_with_template_spec.rb +0 -138
  328. data/spec/models/email_response_spec.rb +0 -60
  329. data/spec/models/email_stats_spec.rb +0 -42
  330. data/spec/models/email_stats_stats_spec.rb +0 -96
  331. data/spec/models/event_metadata_spec.rb +0 -84
  332. data/spec/models/event_spec.rb +0 -150
  333. data/spec/models/geo_location_spec.rb +0 -60
  334. data/spec/models/ip_allocation_request_spec.rb +0 -42
  335. data/spec/models/ip_deletion_response_spec.rb +0 -42
  336. data/spec/models/ip_pool_create_request_spec.rb +0 -66
  337. data/spec/models/ip_pool_delete_response_spec.rb +0 -42
  338. data/spec/models/ip_pool_spec.rb +0 -108
  339. data/spec/models/ip_pool_update_request_spec.rb +0 -54
  340. data/spec/models/ip_spec.rb +0 -168
  341. data/spec/models/ip_update_request_spec.rb +0 -36
  342. data/spec/models/label_spec.rb +0 -48
  343. data/spec/models/member_spec.rb +0 -102
  344. data/spec/models/message_header_to_spec.rb +0 -60
  345. data/spec/models/message_spec.rb +0 -210
  346. data/spec/models/message_to_spec.rb +0 -60
  347. data/spec/models/operating_system_spec.rb +0 -60
  348. data/spec/models/person_spec.rb +0 -42
  349. data/spec/models/recipient_spec.rb +0 -60
  350. data/spec/models/smtp_auth_spec.rb +0 -60
  351. data/spec/models/stat_spec.rb +0 -42
  352. data/spec/models/stat_stat_spec.rb +0 -96
  353. data/spec/models/stat_stats_spec.rb +0 -96
  354. data/spec/models/sub_account_spec.rb +0 -130
  355. data/spec/models/suppression_spec.rb +0 -60
  356. data/spec/models/third_party_sending_provider_spec.rb +0 -96
  357. data/spec/models/update_sub_account_spec.rb +0 -36
  358. data/spec/models/update_webhook_spec.rb +0 -120
  359. data/spec/models/user_agent_spec.rb +0 -54
  360. data/spec/models/webhook_spec.rb +0 -144
@@ -0,0 +1,407 @@
1
+ =begin
2
+ #SendPost API
3
+
4
+ ## Introduction > ### 📌 API versioning & the v1 response contract > > This reference documents the **v1 response contract** — the stable, camelCase > response shape that SendPost commits to. This is the shape you should build against. > > **During the current deprecation window**, requests authenticated with an account > or sub-account API key receive the **legacy** response shape by default, so existing > integrations keep working unchanged. To receive the documented v1 shape today, send: > > ``` > X-SendPost-Public-Contract: v1 > ``` > > **How to tell which shape you got.** Every public response echoes the applied > contract in the `X-SendPost-Public-Contract` response header. While the legacy > shape is being served, responses also carry standard deprecation signals: > `Deprecation: true`, a `Sunset` header with the exact cut-over date, and a > `Link: <...>; rel=\"deprecation\"` header pointing at the migration guide. **Read the > `Sunset` header for the authoritative end date** rather than hardcoding one. > > **After the sunset date**, v1 becomes the default and the legacy shape is no longer > served. New integrations should send `X-SendPost-Public-Contract: v1` now and rely on > the shapes in this reference. 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. # API Contract Versioning (Public REST) The public REST API uses a versioned response contract so field changes stay non-breaking: * Send `X-SendPost-Public-Contract: v1` to opt into the current v1 response shape, or `legacy` for the pre-v1 shape. If the header is omitted, the applied contract is policy-driven — `legacy` before the published sunset date, `v1` after it. * Every response echoes `X-SendPost-Public-Contract: <applied>`. When the `legacy` contract is served, responses also include `Deprecation: true`, `Sunset: <RFC1123 date>`, and `Link: <doc-url>; rel=\"deprecation\"`. * Migrate to `v1` before the sunset date. Notable legacy → v1 field changes: Suppression `smtp_error` → `smtpError`, Stat `email_type` → `emailType`. > `X-SendPost-Private-Api: true` is an internal header used only by the SendPost dashboard to receive richer internal objects. It is not part of the public SDK contract and should not be set by API integrations.
5
+
6
+ The version of the OpenAPI document: 1.3.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.13.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Sendpost
17
+ # Request body for creating a new webhook endpoint. **Event Selection Tips:** - For basic tracking: Enable `delivered`, `opened`, `clicked` - For suppression sync: Enable `hardBounced`, `unsubscribed`, `spam` - For debugging: Enable `dropped`, `softBounced` - Use `uniqueOpen`/`uniqueClick` instead of `opened`/`clicked` to reduce volume
18
+ class NewWebhook
19
+ # Whether the webhook is active immediately after creation. Set to false to configure and test before activating.
20
+ attr_accessor :enabled
21
+
22
+ # HTTPS URL endpoint to receive webhook POST requests. Must: - Use HTTPS (HTTP not allowed for security) - Be publicly accessible - Return 2xx status within 10 seconds - Handle duplicate deliveries (use eventId for idempotency)
23
+ attr_accessor :url
24
+
25
+ # Fire when email is accepted by SendPost API
26
+ attr_accessor :processed
27
+
28
+ # Fire when email is sent to recipient's mail server
29
+ attr_accessor :sent
30
+
31
+ # Fire when email is accepted by recipient's mail server
32
+ attr_accessor :delivered
33
+
34
+ # Fire when email is not sent (suppression, invalid, etc.)
35
+ attr_accessor :dropped
36
+
37
+ # Fire when email is rejected at SMTP level
38
+ attr_accessor :smtp_dropped
39
+
40
+ # Fire on temporary delivery failure (will retry)
41
+ attr_accessor :soft_bounced
42
+
43
+ # Fire on permanent delivery failure
44
+ attr_accessor :hard_bounced
45
+
46
+ # Fire when email is opened. Fires on EVERY open. Consider using `uniqueOpen` instead to reduce volume.
47
+ attr_accessor :opened
48
+
49
+ # Fire when a link is clicked. Fires on EVERY click. Consider using `uniqueClick` instead to reduce volume.
50
+ attr_accessor :clicked
51
+
52
+ # Fire when recipient clicks unsubscribe link
53
+ attr_accessor :unsubscribed
54
+
55
+ # Fire when recipient marks email as spam
56
+ attr_accessor :spam
57
+
58
+ # Fire only on FIRST open of each email (unique opens). More efficient than `opened` if you only need engagement metrics.
59
+ attr_accessor :unique_open
60
+
61
+ # Fire only on FIRST click of each email (unique clicks). More efficient than `clicked` if you only need engagement metrics.
62
+ attr_accessor :unique_click
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ :'enabled' => :'enabled',
68
+ :'url' => :'url',
69
+ :'processed' => :'processed',
70
+ :'sent' => :'sent',
71
+ :'delivered' => :'delivered',
72
+ :'dropped' => :'dropped',
73
+ :'smtp_dropped' => :'smtpDropped',
74
+ :'soft_bounced' => :'softBounced',
75
+ :'hard_bounced' => :'hardBounced',
76
+ :'opened' => :'opened',
77
+ :'clicked' => :'clicked',
78
+ :'unsubscribed' => :'unsubscribed',
79
+ :'spam' => :'spam',
80
+ :'unique_open' => :'uniqueOpen',
81
+ :'unique_click' => :'uniqueClick'
82
+ }
83
+ end
84
+
85
+ # Returns attribute mapping this model knows about
86
+ def self.acceptable_attribute_map
87
+ attribute_map
88
+ end
89
+
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ acceptable_attribute_map.values
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'enabled' => :'Boolean',
99
+ :'url' => :'String',
100
+ :'processed' => :'Boolean',
101
+ :'sent' => :'Boolean',
102
+ :'delivered' => :'Boolean',
103
+ :'dropped' => :'Boolean',
104
+ :'smtp_dropped' => :'Boolean',
105
+ :'soft_bounced' => :'Boolean',
106
+ :'hard_bounced' => :'Boolean',
107
+ :'opened' => :'Boolean',
108
+ :'clicked' => :'Boolean',
109
+ :'unsubscribed' => :'Boolean',
110
+ :'spam' => :'Boolean',
111
+ :'unique_open' => :'Boolean',
112
+ :'unique_click' => :'Boolean'
113
+ }
114
+ end
115
+
116
+ # List of attributes with nullable: true
117
+ def self.openapi_nullable
118
+ Set.new([
119
+ ])
120
+ end
121
+
122
+ # Initializes the object
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ def initialize(attributes = {})
125
+ if (!attributes.is_a?(Hash))
126
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendpost::NewWebhook` initialize method"
127
+ end
128
+
129
+ # check to see if the attribute exists and convert string to symbol for hash key
130
+ acceptable_attribute_map = self.class.acceptable_attribute_map
131
+ attributes = attributes.each_with_object({}) { |(k, v), h|
132
+ if (!acceptable_attribute_map.key?(k.to_sym))
133
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendpost::NewWebhook`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
134
+ end
135
+ h[k.to_sym] = v
136
+ }
137
+
138
+ if attributes.key?(:'enabled')
139
+ self.enabled = attributes[:'enabled']
140
+ else
141
+ self.enabled = true
142
+ end
143
+
144
+ if attributes.key?(:'url')
145
+ self.url = attributes[:'url']
146
+ else
147
+ self.url = nil
148
+ end
149
+
150
+ if attributes.key?(:'processed')
151
+ self.processed = attributes[:'processed']
152
+ else
153
+ self.processed = false
154
+ end
155
+
156
+ if attributes.key?(:'sent')
157
+ self.sent = attributes[:'sent']
158
+ else
159
+ self.sent = false
160
+ end
161
+
162
+ if attributes.key?(:'delivered')
163
+ self.delivered = attributes[:'delivered']
164
+ else
165
+ self.delivered = true
166
+ end
167
+
168
+ if attributes.key?(:'dropped')
169
+ self.dropped = attributes[:'dropped']
170
+ else
171
+ self.dropped = true
172
+ end
173
+
174
+ if attributes.key?(:'smtp_dropped')
175
+ self.smtp_dropped = attributes[:'smtp_dropped']
176
+ else
177
+ self.smtp_dropped = false
178
+ end
179
+
180
+ if attributes.key?(:'soft_bounced')
181
+ self.soft_bounced = attributes[:'soft_bounced']
182
+ else
183
+ self.soft_bounced = true
184
+ end
185
+
186
+ if attributes.key?(:'hard_bounced')
187
+ self.hard_bounced = attributes[:'hard_bounced']
188
+ else
189
+ self.hard_bounced = true
190
+ end
191
+
192
+ if attributes.key?(:'opened')
193
+ self.opened = attributes[:'opened']
194
+ else
195
+ self.opened = true
196
+ end
197
+
198
+ if attributes.key?(:'clicked')
199
+ self.clicked = attributes[:'clicked']
200
+ else
201
+ self.clicked = true
202
+ end
203
+
204
+ if attributes.key?(:'unsubscribed')
205
+ self.unsubscribed = attributes[:'unsubscribed']
206
+ else
207
+ self.unsubscribed = true
208
+ end
209
+
210
+ if attributes.key?(:'spam')
211
+ self.spam = attributes[:'spam']
212
+ else
213
+ self.spam = true
214
+ end
215
+
216
+ if attributes.key?(:'unique_open')
217
+ self.unique_open = attributes[:'unique_open']
218
+ else
219
+ self.unique_open = false
220
+ end
221
+
222
+ if attributes.key?(:'unique_click')
223
+ self.unique_click = attributes[:'unique_click']
224
+ else
225
+ self.unique_click = false
226
+ end
227
+ end
228
+
229
+ # Show invalid properties with the reasons. Usually used together with valid?
230
+ # @return Array for valid properties with the reasons
231
+ def list_invalid_properties
232
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
233
+ invalid_properties = Array.new
234
+ if @url.nil?
235
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
236
+ end
237
+
238
+ invalid_properties
239
+ end
240
+
241
+ # Check to see if the all the properties in the model are valid
242
+ # @return true if the model is valid
243
+ def valid?
244
+ warn '[DEPRECATED] the `valid?` method is obsolete'
245
+ return false if @url.nil?
246
+ true
247
+ end
248
+
249
+ # Custom attribute writer method with validation
250
+ # @param [Object] url Value to be assigned
251
+ def url=(url)
252
+ if url.nil?
253
+ fail ArgumentError, 'url cannot be nil'
254
+ end
255
+
256
+ @url = url
257
+ end
258
+
259
+ # Checks equality by comparing each attribute.
260
+ # @param [Object] Object to be compared
261
+ def ==(o)
262
+ return true if self.equal?(o)
263
+ self.class == o.class &&
264
+ enabled == o.enabled &&
265
+ url == o.url &&
266
+ processed == o.processed &&
267
+ sent == o.sent &&
268
+ delivered == o.delivered &&
269
+ dropped == o.dropped &&
270
+ smtp_dropped == o.smtp_dropped &&
271
+ soft_bounced == o.soft_bounced &&
272
+ hard_bounced == o.hard_bounced &&
273
+ opened == o.opened &&
274
+ clicked == o.clicked &&
275
+ unsubscribed == o.unsubscribed &&
276
+ spam == o.spam &&
277
+ unique_open == o.unique_open &&
278
+ unique_click == o.unique_click
279
+ end
280
+
281
+ # @see the `==` method
282
+ # @param [Object] Object to be compared
283
+ def eql?(o)
284
+ self == o
285
+ end
286
+
287
+ # Calculates hash code according to all attributes.
288
+ # @return [Integer] Hash code
289
+ def hash
290
+ [enabled, url, processed, sent, delivered, dropped, smtp_dropped, soft_bounced, hard_bounced, opened, clicked, unsubscribed, spam, unique_open, unique_click].hash
291
+ end
292
+
293
+ # Builds the object from hash
294
+ # @param [Hash] attributes Model attributes in the form of hash
295
+ # @return [Object] Returns the model itself
296
+ def self.build_from_hash(attributes)
297
+ return nil unless attributes.is_a?(Hash)
298
+ attributes = attributes.transform_keys(&:to_sym)
299
+ transformed_hash = {}
300
+ openapi_types.each_pair do |key, type|
301
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
302
+ transformed_hash["#{key}"] = nil
303
+ elsif type =~ /\AArray<(.*)>/i
304
+ # check to ensure the input is an array given that the attribute
305
+ # is documented as an array but the input is not
306
+ if attributes[attribute_map[key]].is_a?(Array)
307
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
308
+ end
309
+ elsif !attributes[attribute_map[key]].nil?
310
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
311
+ end
312
+ end
313
+ new(transformed_hash)
314
+ end
315
+
316
+ # Deserializes the data based on type
317
+ # @param string type Data type
318
+ # @param string value Value to be deserialized
319
+ # @return [Object] Deserialized data
320
+ def self._deserialize(type, value)
321
+ case type.to_sym
322
+ when :Time
323
+ Time.parse(value)
324
+ when :Date
325
+ Date.parse(value)
326
+ when :String
327
+ value.to_s
328
+ when :Integer
329
+ value.to_i
330
+ when :Float
331
+ value.to_f
332
+ when :Boolean
333
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
334
+ true
335
+ else
336
+ false
337
+ end
338
+ when :Object
339
+ # generic object (usually a Hash), return directly
340
+ value
341
+ when /\AArray<(?<inner_type>.+)>\z/
342
+ inner_type = Regexp.last_match[:inner_type]
343
+ value.map { |v| _deserialize(inner_type, v) }
344
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
345
+ k_type = Regexp.last_match[:k_type]
346
+ v_type = Regexp.last_match[:v_type]
347
+ {}.tap do |hash|
348
+ value.each do |k, v|
349
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
350
+ end
351
+ end
352
+ else # model
353
+ # models (e.g. Pet) or oneOf
354
+ klass = Sendpost.const_get(type)
355
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
356
+ end
357
+ end
358
+
359
+ # Returns the string representation of the object
360
+ # @return [String] String presentation of the object
361
+ def to_s
362
+ to_hash.to_s
363
+ end
364
+
365
+ # to_body is an alias to to_hash (backward compatibility)
366
+ # @return [Hash] Returns the object in the form of hash
367
+ def to_body
368
+ to_hash
369
+ end
370
+
371
+ # Returns the object in the form of hash
372
+ # @return [Hash] Returns the object in the form of hash
373
+ def to_hash
374
+ hash = {}
375
+ self.class.attribute_map.each_pair do |attr, param|
376
+ value = self.send(attr)
377
+ if value.nil?
378
+ is_nullable = self.class.openapi_nullable.include?(attr)
379
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
380
+ end
381
+
382
+ hash[param] = _to_hash(value)
383
+ end
384
+ hash
385
+ end
386
+
387
+ # Outputs non-array value in the form of hash
388
+ # For object, use to_hash. Otherwise, just return the value
389
+ # @param [Object] value Any valid value
390
+ # @return [Hash] Returns the value in the form of hash
391
+ def _to_hash(value)
392
+ if value.is_a?(Array)
393
+ value.compact.map { |v| _to_hash(v) }
394
+ elsif value.is_a?(Hash)
395
+ {}.tap do |hash|
396
+ value.each { |k, v| hash[k] = _to_hash(v) }
397
+ end
398
+ elsif value.respond_to? :to_hash
399
+ value.to_hash
400
+ else
401
+ value
402
+ end
403
+ end
404
+
405
+ end
406
+
407
+ end