fastcomments 0.3.0 → 1.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 (374) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -4
  3. data/client/README.md +185 -4
  4. data/client/docs/APIDomainConfiguration.md +46 -0
  5. data/client/docs/APITenant.md +72 -0
  6. data/client/docs/APITenantDailyUsage.md +54 -0
  7. data/client/docs/AddHashTag200Response.md +34 -0
  8. data/client/docs/AddHashTagsBulk200Response.md +34 -0
  9. data/client/docs/BillingInfo.md +32 -0
  10. data/client/docs/BulkCreateHashTagsBody.md +20 -0
  11. data/client/docs/BulkCreateHashTagsBodyTagsInner.md +20 -0
  12. data/client/docs/BulkCreateHashTagsResponse.md +20 -0
  13. data/client/docs/CommentLogData.md +7 -1
  14. data/client/docs/CreateEmailTemplate200Response.md +34 -0
  15. data/client/docs/CreateEmailTemplateBody.md +28 -0
  16. data/client/docs/CreateEmailTemplateResponse.md +20 -0
  17. data/client/docs/CreateHashTagBody.md +22 -0
  18. data/client/docs/CreateHashTagResponse.md +20 -0
  19. data/client/docs/CreateModerator200Response.md +34 -0
  20. data/client/docs/CreateModeratorBody.md +24 -0
  21. data/client/docs/CreateModeratorResponse.md +20 -0
  22. data/client/docs/CreateQuestionConfig200Response.md +34 -0
  23. data/client/docs/CreateQuestionConfigBody.md +44 -0
  24. data/client/docs/CreateQuestionConfigResponse.md +20 -0
  25. data/client/docs/CreateQuestionResult200Response.md +34 -0
  26. data/client/docs/CreateQuestionResultBody.md +30 -0
  27. data/client/docs/CreateQuestionResultResponse.md +20 -0
  28. data/client/docs/CreateTenant200Response.md +34 -0
  29. data/client/docs/CreateTenantBody.md +62 -0
  30. data/client/docs/CreateTenantPackage200Response.md +34 -0
  31. data/client/docs/CreateTenantPackageBody.md +112 -0
  32. data/client/docs/CreateTenantPackageResponse.md +20 -0
  33. data/client/docs/CreateTenantResponse.md +20 -0
  34. data/client/docs/CreateTenantUser200Response.md +34 -0
  35. data/client/docs/CreateTenantUserBody.md +64 -0
  36. data/client/docs/CreateTenantUserResponse.md +20 -0
  37. data/client/docs/CreateVote200Response.md +32 -0
  38. data/client/docs/CreateVoteResponse.md +18 -0
  39. data/client/docs/CustomEmailTemplate.md +38 -0
  40. data/client/docs/DefaultApi.md +5229 -591
  41. data/client/docs/DeleteHashTagRequest.md +18 -0
  42. data/client/docs/DeleteVote200Response.md +32 -0
  43. data/client/docs/DeleteVoteResponse.md +18 -0
  44. data/client/docs/DigestEmailFrequency.md +15 -0
  45. data/client/docs/EmailTemplateDefinition.md +24 -0
  46. data/client/docs/EmailTemplateRenderErrorResponse.md +30 -0
  47. data/client/docs/GetCachedNotificationCount200Response.md +34 -0
  48. data/client/docs/GetCachedNotificationCountResponse.md +20 -0
  49. data/client/docs/GetEmailTemplate200Response.md +34 -0
  50. data/client/docs/GetEmailTemplateDefinitions200Response.md +34 -0
  51. data/client/docs/GetEmailTemplateDefinitionsResponse.md +20 -0
  52. data/client/docs/GetEmailTemplateRenderErrors200Response.md +34 -0
  53. data/client/docs/GetEmailTemplateRenderErrorsResponse.md +20 -0
  54. data/client/docs/GetEmailTemplateResponse.md +20 -0
  55. data/client/docs/GetEmailTemplates200Response.md +34 -0
  56. data/client/docs/GetEmailTemplatesResponse.md +20 -0
  57. data/client/docs/GetHashTags200Response.md +34 -0
  58. data/client/docs/GetHashTagsResponse.md +20 -0
  59. data/client/docs/GetModerator200Response.md +34 -0
  60. data/client/docs/GetModeratorResponse.md +20 -0
  61. data/client/docs/GetModerators200Response.md +34 -0
  62. data/client/docs/GetModeratorsResponse.md +20 -0
  63. data/client/docs/GetNotificationCount200Response.md +34 -0
  64. data/client/docs/GetNotificationCountResponse.md +20 -0
  65. data/client/docs/GetNotifications200Response.md +34 -0
  66. data/client/docs/GetNotificationsResponse.md +20 -0
  67. data/client/docs/GetPendingWebhookEventCount200Response.md +34 -0
  68. data/client/docs/GetPendingWebhookEventCountResponse.md +20 -0
  69. data/client/docs/GetPendingWebhookEvents200Response.md +34 -0
  70. data/client/docs/GetPendingWebhookEventsResponse.md +20 -0
  71. data/client/docs/GetQuestionConfig200Response.md +34 -0
  72. data/client/docs/GetQuestionConfigResponse.md +20 -0
  73. data/client/docs/GetQuestionConfigs200Response.md +34 -0
  74. data/client/docs/GetQuestionConfigsResponse.md +20 -0
  75. data/client/docs/GetQuestionResult200Response.md +34 -0
  76. data/client/docs/GetQuestionResultResponse.md +20 -0
  77. data/client/docs/GetQuestionResults200Response.md +34 -0
  78. data/client/docs/GetQuestionResultsResponse.md +20 -0
  79. data/client/docs/GetTenant200Response.md +34 -0
  80. data/client/docs/GetTenantDailyUsages200Response.md +34 -0
  81. data/client/docs/GetTenantDailyUsagesResponse.md +20 -0
  82. data/client/docs/GetTenantPackage200Response.md +34 -0
  83. data/client/docs/GetTenantPackageResponse.md +20 -0
  84. data/client/docs/GetTenantPackages200Response.md +34 -0
  85. data/client/docs/GetTenantPackagesResponse.md +20 -0
  86. data/client/docs/GetTenantResponse.md +20 -0
  87. data/client/docs/GetTenantUser200Response.md +34 -0
  88. data/client/docs/GetTenantUserResponse.md +20 -0
  89. data/client/docs/GetTenantUsers200Response.md +34 -0
  90. data/client/docs/GetTenantUsersResponse.md +20 -0
  91. data/client/docs/GetTenants200Response.md +34 -0
  92. data/client/docs/GetTenantsResponse.md +20 -0
  93. data/client/docs/GetUser200Response.md +34 -0
  94. data/client/docs/GetUserResponse.md +20 -0
  95. data/client/docs/GetVotes200Response.md +38 -0
  96. data/client/docs/GetVotesForUser200Response.md +38 -0
  97. data/client/docs/GetVotesForUserResponse.md +24 -0
  98. data/client/docs/GetVotesResponse.md +24 -0
  99. data/client/docs/ImportedSiteType.md +15 -0
  100. data/client/docs/Moderator.md +52 -0
  101. data/client/docs/PatchHashTag200Response.md +34 -0
  102. data/client/docs/PendingCommentToSyncOutbound.md +42 -0
  103. data/client/docs/PublicApi.md +6 -6
  104. data/client/docs/PublicVote.md +28 -0
  105. data/client/docs/QuestionConfig.md +58 -0
  106. data/client/docs/QuestionConfigCustomOptionsInner.md +20 -0
  107. data/client/docs/RenderEmailTemplate200Response.md +34 -0
  108. data/client/docs/RenderEmailTemplateBody.md +24 -0
  109. data/client/docs/RenderEmailTemplateResponse.md +20 -0
  110. data/client/docs/ReplaceTenantPackageBody.md +76 -0
  111. data/client/docs/ReplaceTenantUserBody.md +72 -0
  112. data/client/docs/TenantHashTag.md +26 -0
  113. data/client/docs/TenantPackage.md +120 -0
  114. data/client/docs/UpdateEmailTemplateBody.md +28 -0
  115. data/client/docs/UpdateHashTagBody.md +22 -0
  116. data/client/docs/UpdateHashTagResponse.md +20 -0
  117. data/client/docs/UpdateModeratorBody.md +24 -0
  118. data/client/docs/UpdateNotificationBody.md +20 -0
  119. data/client/docs/UpdateQuestionConfigBody.md +44 -0
  120. data/client/docs/UpdateQuestionResultBody.md +30 -0
  121. data/client/docs/UpdateTenantBody.md +64 -0
  122. data/client/docs/UpdateTenantPackageBody.md +78 -0
  123. data/client/docs/UpdateTenantUserBody.md +64 -0
  124. data/client/docs/User.md +118 -0
  125. data/client/docs/UserNotificationCount.md +24 -0
  126. data/client/lib/fastcomments-client/api/default_api.rb +5133 -776
  127. data/client/lib/fastcomments-client/api/public_api.rb +6 -10
  128. data/client/lib/fastcomments-client/models/add_hash_tag200_response.rb +103 -0
  129. data/client/lib/fastcomments-client/models/add_hash_tags_bulk200_response.rb +103 -0
  130. data/client/lib/fastcomments-client/models/api_domain_configuration.rb +355 -0
  131. data/client/lib/fastcomments-client/models/api_tenant.rb +583 -0
  132. data/client/lib/fastcomments-client/models/api_tenant_daily_usage.rb +632 -0
  133. data/client/lib/fastcomments-client/models/billing_info.rb +315 -0
  134. data/client/lib/fastcomments-client/models/bulk_create_hash_tags_body.rb +175 -0
  135. data/client/lib/fastcomments-client/models/bulk_create_hash_tags_body_tags_inner.rb +173 -0
  136. data/client/lib/fastcomments-client/models/bulk_create_hash_tags_response.rb +214 -0
  137. data/client/lib/fastcomments-client/models/comment_log_data.rb +31 -4
  138. data/client/lib/fastcomments-client/models/comment_log_type.rb +2 -1
  139. data/client/lib/fastcomments-client/models/create_email_template200_response.rb +103 -0
  140. data/client/lib/fastcomments-client/models/create_email_template_body.rb +249 -0
  141. data/client/lib/fastcomments-client/models/create_email_template_response.rb +212 -0
  142. data/client/lib/fastcomments-client/models/create_hash_tag_body.rb +182 -0
  143. data/client/lib/fastcomments-client/models/create_hash_tag_response.rb +212 -0
  144. data/client/lib/fastcomments-client/models/create_moderator200_response.rb +103 -0
  145. data/client/lib/fastcomments-client/models/create_moderator_body.rb +210 -0
  146. data/client/lib/fastcomments-client/models/create_moderator_response.rb +212 -0
  147. data/client/lib/fastcomments-client/models/create_question_config200_response.rb +103 -0
  148. data/client/lib/fastcomments-client/models/create_question_config_body.rb +336 -0
  149. data/client/lib/fastcomments-client/models/create_question_config_response.rb +212 -0
  150. data/client/lib/fastcomments-client/models/create_question_result200_response.rb +103 -0
  151. data/client/lib/fastcomments-client/models/create_question_result_body.rb +255 -0
  152. data/client/lib/fastcomments-client/models/create_question_result_response.rb +212 -0
  153. data/client/lib/fastcomments-client/models/create_tenant200_response.rb +103 -0
  154. data/client/lib/fastcomments-client/models/create_tenant_body.rb +384 -0
  155. data/client/lib/fastcomments-client/models/create_tenant_package200_response.rb +103 -0
  156. data/client/lib/fastcomments-client/models/create_tenant_package_body.rb +797 -0
  157. data/client/lib/fastcomments-client/models/create_tenant_package_response.rb +212 -0
  158. data/client/lib/fastcomments-client/models/create_tenant_response.rb +212 -0
  159. data/client/lib/fastcomments-client/models/create_tenant_user200_response.rb +103 -0
  160. data/client/lib/fastcomments-client/models/create_tenant_user_body.rb +390 -0
  161. data/client/lib/fastcomments-client/models/create_tenant_user_response.rb +212 -0
  162. data/client/lib/fastcomments-client/models/create_vote200_response.rb +103 -0
  163. data/client/lib/fastcomments-client/models/create_vote_response.rb +186 -0
  164. data/client/lib/fastcomments-client/models/custom_email_template.rb +369 -0
  165. data/client/lib/fastcomments-client/models/delete_hash_tag_request.rb +147 -0
  166. data/client/lib/fastcomments-client/models/delete_vote200_response.rb +103 -0
  167. data/client/lib/fastcomments-client/models/delete_vote_response.rb +186 -0
  168. data/client/lib/fastcomments-client/models/digest_email_frequency.rb +42 -0
  169. data/client/lib/fastcomments-client/models/email_template_definition.rb +248 -0
  170. data/client/lib/fastcomments-client/models/email_template_render_error_response.rb +320 -0
  171. data/client/lib/fastcomments-client/models/get_cached_notification_count200_response.rb +103 -0
  172. data/client/lib/fastcomments-client/models/get_cached_notification_count_response.rb +212 -0
  173. data/client/lib/fastcomments-client/models/get_email_template200_response.rb +103 -0
  174. data/client/lib/fastcomments-client/models/get_email_template_definitions200_response.rb +103 -0
  175. data/client/lib/fastcomments-client/models/get_email_template_definitions_response.rb +214 -0
  176. data/client/lib/fastcomments-client/models/get_email_template_render_errors200_response.rb +103 -0
  177. data/client/lib/fastcomments-client/models/get_email_template_render_errors_response.rb +214 -0
  178. data/client/lib/fastcomments-client/models/get_email_template_response.rb +212 -0
  179. data/client/lib/fastcomments-client/models/get_email_templates200_response.rb +103 -0
  180. data/client/lib/fastcomments-client/models/get_email_templates_response.rb +214 -0
  181. data/client/lib/fastcomments-client/models/get_hash_tags200_response.rb +103 -0
  182. data/client/lib/fastcomments-client/models/get_hash_tags_response.rb +214 -0
  183. data/client/lib/fastcomments-client/models/get_moderator200_response.rb +103 -0
  184. data/client/lib/fastcomments-client/models/get_moderator_response.rb +212 -0
  185. data/client/lib/fastcomments-client/models/get_moderators200_response.rb +103 -0
  186. data/client/lib/fastcomments-client/models/get_moderators_response.rb +214 -0
  187. data/client/lib/fastcomments-client/models/get_notification_count200_response.rb +103 -0
  188. data/client/lib/fastcomments-client/models/get_notification_count_response.rb +212 -0
  189. data/client/lib/fastcomments-client/models/get_notifications200_response.rb +103 -0
  190. data/client/lib/fastcomments-client/models/get_notifications_response.rb +214 -0
  191. data/client/lib/fastcomments-client/models/get_pending_webhook_event_count200_response.rb +103 -0
  192. data/client/lib/fastcomments-client/models/get_pending_webhook_event_count_response.rb +212 -0
  193. data/client/lib/fastcomments-client/models/get_pending_webhook_events200_response.rb +103 -0
  194. data/client/lib/fastcomments-client/models/get_pending_webhook_events_response.rb +214 -0
  195. data/client/lib/fastcomments-client/models/get_question_config200_response.rb +103 -0
  196. data/client/lib/fastcomments-client/models/get_question_config_response.rb +212 -0
  197. data/client/lib/fastcomments-client/models/get_question_configs200_response.rb +103 -0
  198. data/client/lib/fastcomments-client/models/get_question_configs_response.rb +214 -0
  199. data/client/lib/fastcomments-client/models/get_question_result200_response.rb +103 -0
  200. data/client/lib/fastcomments-client/models/get_question_result_response.rb +212 -0
  201. data/client/lib/fastcomments-client/models/get_question_results200_response.rb +103 -0
  202. data/client/lib/fastcomments-client/models/get_question_results_response.rb +214 -0
  203. data/client/lib/fastcomments-client/models/get_tenant200_response.rb +103 -0
  204. data/client/lib/fastcomments-client/models/get_tenant_daily_usages200_response.rb +103 -0
  205. data/client/lib/fastcomments-client/models/get_tenant_daily_usages_response.rb +214 -0
  206. data/client/lib/fastcomments-client/models/get_tenant_package200_response.rb +103 -0
  207. data/client/lib/fastcomments-client/models/get_tenant_package_response.rb +212 -0
  208. data/client/lib/fastcomments-client/models/get_tenant_packages200_response.rb +103 -0
  209. data/client/lib/fastcomments-client/models/get_tenant_packages_response.rb +214 -0
  210. data/client/lib/fastcomments-client/models/get_tenant_response.rb +212 -0
  211. data/client/lib/fastcomments-client/models/get_tenant_user200_response.rb +103 -0
  212. data/client/lib/fastcomments-client/models/get_tenant_user_response.rb +212 -0
  213. data/client/lib/fastcomments-client/models/get_tenant_users200_response.rb +103 -0
  214. data/client/lib/fastcomments-client/models/get_tenant_users_response.rb +214 -0
  215. data/client/lib/fastcomments-client/models/get_tenants200_response.rb +103 -0
  216. data/client/lib/fastcomments-client/models/get_tenants_response.rb +214 -0
  217. data/client/lib/fastcomments-client/models/get_user200_response.rb +103 -0
  218. data/client/lib/fastcomments-client/models/get_user_response.rb +212 -0
  219. data/client/lib/fastcomments-client/models/get_votes200_response.rb +103 -0
  220. data/client/lib/fastcomments-client/models/get_votes_for_user200_response.rb +103 -0
  221. data/client/lib/fastcomments-client/models/get_votes_for_user_response.rb +270 -0
  222. data/client/lib/fastcomments-client/models/get_votes_response.rb +270 -0
  223. data/client/lib/fastcomments-client/models/imported_site_type.rb +40 -0
  224. data/client/lib/fastcomments-client/models/moderator.rb +538 -0
  225. data/client/lib/fastcomments-client/models/patch_hash_tag200_response.rb +103 -0
  226. data/client/lib/fastcomments-client/models/pending_comment_to_sync_outbound.rb +428 -0
  227. data/client/lib/fastcomments-client/models/public_vote.rb +294 -0
  228. data/client/lib/fastcomments-client/models/question_config.rb +671 -0
  229. data/client/lib/fastcomments-client/models/question_config_custom_options_inner.rb +190 -0
  230. data/client/lib/fastcomments-client/models/render_email_template200_response.rb +103 -0
  231. data/client/lib/fastcomments-client/models/render_email_template_body.rb +214 -0
  232. data/client/lib/fastcomments-client/models/render_email_template_response.rb +212 -0
  233. data/client/lib/fastcomments-client/models/replace_tenant_package_body.rb +665 -0
  234. data/client/lib/fastcomments-client/models/replace_tenant_user_body.rb +426 -0
  235. data/client/lib/fastcomments-client/models/tenant_hash_tag.rb +251 -0
  236. data/client/lib/fastcomments-client/models/tenant_package.rb +994 -0
  237. data/client/lib/fastcomments-client/models/update_email_template_body.rb +198 -0
  238. data/client/lib/fastcomments-client/models/update_hash_tag_body.rb +165 -0
  239. data/client/lib/fastcomments-client/models/update_hash_tag_response.rb +212 -0
  240. data/client/lib/fastcomments-client/models/update_moderator_body.rb +176 -0
  241. data/client/lib/fastcomments-client/models/update_notification_body.rb +156 -0
  242. data/client/lib/fastcomments-client/models/update_question_config_body.rb +268 -0
  243. data/client/lib/fastcomments-client/models/update_question_result_body.rb +204 -0
  244. data/client/lib/fastcomments-client/models/update_tenant_body.rb +359 -0
  245. data/client/lib/fastcomments-client/models/update_tenant_package_body.rb +419 -0
  246. data/client/lib/fastcomments-client/models/update_tenant_user_body.rb +356 -0
  247. data/client/lib/fastcomments-client/models/user.rb +753 -0
  248. data/client/lib/fastcomments-client/models/user_notification_count.rb +242 -0
  249. data/client/lib/fastcomments-client/version.rb +1 -1
  250. data/client/lib/fastcomments-client.rb +119 -0
  251. data/client/spec/api/default_api_spec.rb +740 -0
  252. data/client/spec/api/public_api_spec.rb +1 -1
  253. data/client/spec/models/add_hash_tag200_response_spec.rb +21 -0
  254. data/client/spec/models/add_hash_tags_bulk200_response_spec.rb +21 -0
  255. data/client/spec/models/api_domain_configuration_spec.rb +120 -0
  256. data/client/spec/models/api_tenant_daily_usage_spec.rb +144 -0
  257. data/client/spec/models/api_tenant_spec.rb +198 -0
  258. data/client/spec/models/billing_info_spec.rb +78 -0
  259. data/client/spec/models/bulk_create_hash_tags_body_spec.rb +42 -0
  260. data/client/spec/models/bulk_create_hash_tags_body_tags_inner_spec.rb +42 -0
  261. data/client/spec/models/bulk_create_hash_tags_response_spec.rb +42 -0
  262. data/client/spec/models/comment_log_data_spec.rb +18 -0
  263. data/client/spec/models/create_email_template200_response_spec.rb +21 -0
  264. data/client/spec/models/create_email_template_body_spec.rb +66 -0
  265. data/client/spec/models/create_email_template_response_spec.rb +42 -0
  266. data/client/spec/models/create_hash_tag_body_spec.rb +48 -0
  267. data/client/spec/models/create_hash_tag_response_spec.rb +42 -0
  268. data/client/spec/models/create_moderator200_response_spec.rb +21 -0
  269. data/client/spec/models/create_moderator_body_spec.rb +54 -0
  270. data/client/spec/models/create_moderator_response_spec.rb +42 -0
  271. data/client/spec/models/create_question_config200_response_spec.rb +21 -0
  272. data/client/spec/models/create_question_config_body_spec.rb +114 -0
  273. data/client/spec/models/create_question_config_response_spec.rb +42 -0
  274. data/client/spec/models/create_question_result200_response_spec.rb +21 -0
  275. data/client/spec/models/create_question_result_body_spec.rb +72 -0
  276. data/client/spec/models/create_question_result_response_spec.rb +42 -0
  277. data/client/spec/models/create_tenant200_response_spec.rb +21 -0
  278. data/client/spec/models/create_tenant_body_spec.rb +168 -0
  279. data/client/spec/models/create_tenant_package200_response_spec.rb +21 -0
  280. data/client/spec/models/create_tenant_package_body_spec.rb +318 -0
  281. data/client/spec/models/create_tenant_package_response_spec.rb +42 -0
  282. data/client/spec/models/create_tenant_response_spec.rb +42 -0
  283. data/client/spec/models/create_tenant_user200_response_spec.rb +21 -0
  284. data/client/spec/models/create_tenant_user_body_spec.rb +174 -0
  285. data/client/spec/models/create_tenant_user_response_spec.rb +42 -0
  286. data/client/spec/models/create_vote200_response_spec.rb +21 -0
  287. data/client/spec/models/create_vote_response_spec.rb +36 -0
  288. data/client/spec/models/custom_email_template_spec.rb +96 -0
  289. data/client/spec/models/delete_hash_tag_request_spec.rb +36 -0
  290. data/client/spec/models/delete_vote200_response_spec.rb +21 -0
  291. data/client/spec/models/delete_vote_response_spec.rb +36 -0
  292. data/client/spec/models/digest_email_frequency_spec.rb +30 -0
  293. data/client/spec/models/email_template_definition_spec.rb +54 -0
  294. data/client/spec/models/email_template_render_error_response_spec.rb +72 -0
  295. data/client/spec/models/get_cached_notification_count200_response_spec.rb +21 -0
  296. data/client/spec/models/get_cached_notification_count_response_spec.rb +42 -0
  297. data/client/spec/models/get_email_template200_response_spec.rb +21 -0
  298. data/client/spec/models/get_email_template_definitions200_response_spec.rb +21 -0
  299. data/client/spec/models/get_email_template_definitions_response_spec.rb +42 -0
  300. data/client/spec/models/get_email_template_render_errors200_response_spec.rb +21 -0
  301. data/client/spec/models/get_email_template_render_errors_response_spec.rb +42 -0
  302. data/client/spec/models/get_email_template_response_spec.rb +42 -0
  303. data/client/spec/models/get_email_templates200_response_spec.rb +21 -0
  304. data/client/spec/models/get_email_templates_response_spec.rb +42 -0
  305. data/client/spec/models/get_hash_tags200_response_spec.rb +21 -0
  306. data/client/spec/models/get_hash_tags_response_spec.rb +42 -0
  307. data/client/spec/models/get_moderator200_response_spec.rb +21 -0
  308. data/client/spec/models/get_moderator_response_spec.rb +42 -0
  309. data/client/spec/models/get_moderators200_response_spec.rb +21 -0
  310. data/client/spec/models/get_moderators_response_spec.rb +42 -0
  311. data/client/spec/models/get_notification_count200_response_spec.rb +21 -0
  312. data/client/spec/models/get_notification_count_response_spec.rb +42 -0
  313. data/client/spec/models/get_notifications200_response_spec.rb +21 -0
  314. data/client/spec/models/get_notifications_response_spec.rb +42 -0
  315. data/client/spec/models/get_pending_webhook_event_count200_response_spec.rb +21 -0
  316. data/client/spec/models/get_pending_webhook_event_count_response_spec.rb +42 -0
  317. data/client/spec/models/get_pending_webhook_events200_response_spec.rb +21 -0
  318. data/client/spec/models/get_pending_webhook_events_response_spec.rb +42 -0
  319. data/client/spec/models/get_question_config200_response_spec.rb +21 -0
  320. data/client/spec/models/get_question_config_response_spec.rb +42 -0
  321. data/client/spec/models/get_question_configs200_response_spec.rb +21 -0
  322. data/client/spec/models/get_question_configs_response_spec.rb +42 -0
  323. data/client/spec/models/get_question_result200_response_spec.rb +21 -0
  324. data/client/spec/models/get_question_result_response_spec.rb +42 -0
  325. data/client/spec/models/get_question_results200_response_spec.rb +21 -0
  326. data/client/spec/models/get_question_results_response_spec.rb +42 -0
  327. data/client/spec/models/get_tenant200_response_spec.rb +21 -0
  328. data/client/spec/models/get_tenant_daily_usages200_response_spec.rb +21 -0
  329. data/client/spec/models/get_tenant_daily_usages_response_spec.rb +42 -0
  330. data/client/spec/models/get_tenant_package200_response_spec.rb +21 -0
  331. data/client/spec/models/get_tenant_package_response_spec.rb +42 -0
  332. data/client/spec/models/get_tenant_packages200_response_spec.rb +21 -0
  333. data/client/spec/models/get_tenant_packages_response_spec.rb +42 -0
  334. data/client/spec/models/get_tenant_response_spec.rb +42 -0
  335. data/client/spec/models/get_tenant_user200_response_spec.rb +21 -0
  336. data/client/spec/models/get_tenant_user_response_spec.rb +42 -0
  337. data/client/spec/models/get_tenant_users200_response_spec.rb +21 -0
  338. data/client/spec/models/get_tenant_users_response_spec.rb +42 -0
  339. data/client/spec/models/get_tenants200_response_spec.rb +21 -0
  340. data/client/spec/models/get_tenants_response_spec.rb +42 -0
  341. data/client/spec/models/get_user200_response_spec.rb +21 -0
  342. data/client/spec/models/get_user_response_spec.rb +42 -0
  343. data/client/spec/models/get_votes200_response_spec.rb +21 -0
  344. data/client/spec/models/get_votes_for_user200_response_spec.rb +21 -0
  345. data/client/spec/models/get_votes_for_user_response_spec.rb +54 -0
  346. data/client/spec/models/get_votes_response_spec.rb +54 -0
  347. data/client/spec/models/imported_site_type_spec.rb +30 -0
  348. data/client/spec/models/moderator_spec.rb +138 -0
  349. data/client/spec/models/patch_hash_tag200_response_spec.rb +21 -0
  350. data/client/spec/models/pending_comment_to_sync_outbound_spec.rb +108 -0
  351. data/client/spec/models/public_vote_spec.rb +66 -0
  352. data/client/spec/models/question_config_custom_options_inner_spec.rb +42 -0
  353. data/client/spec/models/question_config_spec.rb +156 -0
  354. data/client/spec/models/render_email_template200_response_spec.rb +21 -0
  355. data/client/spec/models/render_email_template_body_spec.rb +54 -0
  356. data/client/spec/models/render_email_template_response_spec.rb +42 -0
  357. data/client/spec/models/replace_tenant_package_body_spec.rb +210 -0
  358. data/client/spec/models/replace_tenant_user_body_spec.rb +198 -0
  359. data/client/spec/models/tenant_hash_tag_spec.rb +60 -0
  360. data/client/spec/models/tenant_package_spec.rb +342 -0
  361. data/client/spec/models/update_email_template_body_spec.rb +66 -0
  362. data/client/spec/models/update_hash_tag_body_spec.rb +48 -0
  363. data/client/spec/models/update_hash_tag_response_spec.rb +42 -0
  364. data/client/spec/models/update_moderator_body_spec.rb +54 -0
  365. data/client/spec/models/update_notification_body_spec.rb +42 -0
  366. data/client/spec/models/update_question_config_body_spec.rb +114 -0
  367. data/client/spec/models/update_question_result_body_spec.rb +72 -0
  368. data/client/spec/models/update_tenant_body_spec.rb +174 -0
  369. data/client/spec/models/update_tenant_package_body_spec.rb +216 -0
  370. data/client/spec/models/update_tenant_user_body_spec.rb +174 -0
  371. data/client/spec/models/user_notification_count_spec.rb +54 -0
  372. data/client/spec/models/user_spec.rb +336 -0
  373. data/lib/fastcomments.rb +2 -1
  374. metadata +359 -2
@@ -0,0 +1,336 @@
1
+ =begin
2
+ #fastcomments
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 0.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FastCommentsClient
17
+ class CreateQuestionConfigBody < ApiModelBase
18
+ attr_accessor :name
19
+
20
+ attr_accessor :question
21
+
22
+ attr_accessor :help_text
23
+
24
+ attr_accessor :type
25
+
26
+ attr_accessor :num_stars
27
+
28
+ attr_accessor :min
29
+
30
+ attr_accessor :max
31
+
32
+ attr_accessor :default_value
33
+
34
+ attr_accessor :label_negative
35
+
36
+ attr_accessor :label_positive
37
+
38
+ attr_accessor :custom_options
39
+
40
+ attr_accessor :sub_question_ids
41
+
42
+ attr_accessor :always_show_sub_questions
43
+
44
+ attr_accessor :reporting_order
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'name' => :'name',
50
+ :'question' => :'question',
51
+ :'help_text' => :'helpText',
52
+ :'type' => :'type',
53
+ :'num_stars' => :'numStars',
54
+ :'min' => :'min',
55
+ :'max' => :'max',
56
+ :'default_value' => :'defaultValue',
57
+ :'label_negative' => :'labelNegative',
58
+ :'label_positive' => :'labelPositive',
59
+ :'custom_options' => :'customOptions',
60
+ :'sub_question_ids' => :'subQuestionIds',
61
+ :'always_show_sub_questions' => :'alwaysShowSubQuestions',
62
+ :'reporting_order' => :'reportingOrder'
63
+ }
64
+ end
65
+
66
+ # Returns attribute mapping this model knows about
67
+ def self.acceptable_attribute_map
68
+ attribute_map
69
+ end
70
+
71
+ # Returns all the JSON keys this model knows about
72
+ def self.acceptable_attributes
73
+ acceptable_attribute_map.values
74
+ end
75
+
76
+ # Attribute type mapping.
77
+ def self.openapi_types
78
+ {
79
+ :'name' => :'String',
80
+ :'question' => :'String',
81
+ :'help_text' => :'String',
82
+ :'type' => :'String',
83
+ :'num_stars' => :'Float',
84
+ :'min' => :'Float',
85
+ :'max' => :'Float',
86
+ :'default_value' => :'Float',
87
+ :'label_negative' => :'String',
88
+ :'label_positive' => :'String',
89
+ :'custom_options' => :'Array<QuestionConfigCustomOptionsInner>',
90
+ :'sub_question_ids' => :'Array<String>',
91
+ :'always_show_sub_questions' => :'Boolean',
92
+ :'reporting_order' => :'Float'
93
+ }
94
+ end
95
+
96
+ # List of attributes with nullable: true
97
+ def self.openapi_nullable
98
+ Set.new([
99
+ ])
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ if (!attributes.is_a?(Hash))
106
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FastCommentsClient::CreateQuestionConfigBody` initialize method"
107
+ end
108
+
109
+ # check to see if the attribute exists and convert string to symbol for hash key
110
+ acceptable_attribute_map = self.class.acceptable_attribute_map
111
+ attributes = attributes.each_with_object({}) { |(k, v), h|
112
+ if (!acceptable_attribute_map.key?(k.to_sym))
113
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FastCommentsClient::CreateQuestionConfigBody`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
114
+ end
115
+ h[k.to_sym] = v
116
+ }
117
+
118
+ if attributes.key?(:'name')
119
+ self.name = attributes[:'name']
120
+ else
121
+ self.name = nil
122
+ end
123
+
124
+ if attributes.key?(:'question')
125
+ self.question = attributes[:'question']
126
+ else
127
+ self.question = nil
128
+ end
129
+
130
+ if attributes.key?(:'help_text')
131
+ self.help_text = attributes[:'help_text']
132
+ end
133
+
134
+ if attributes.key?(:'type')
135
+ self.type = attributes[:'type']
136
+ else
137
+ self.type = nil
138
+ end
139
+
140
+ if attributes.key?(:'num_stars')
141
+ self.num_stars = attributes[:'num_stars']
142
+ end
143
+
144
+ if attributes.key?(:'min')
145
+ self.min = attributes[:'min']
146
+ end
147
+
148
+ if attributes.key?(:'max')
149
+ self.max = attributes[:'max']
150
+ end
151
+
152
+ if attributes.key?(:'default_value')
153
+ self.default_value = attributes[:'default_value']
154
+ end
155
+
156
+ if attributes.key?(:'label_negative')
157
+ self.label_negative = attributes[:'label_negative']
158
+ end
159
+
160
+ if attributes.key?(:'label_positive')
161
+ self.label_positive = attributes[:'label_positive']
162
+ end
163
+
164
+ if attributes.key?(:'custom_options')
165
+ if (value = attributes[:'custom_options']).is_a?(Array)
166
+ self.custom_options = value
167
+ end
168
+ end
169
+
170
+ if attributes.key?(:'sub_question_ids')
171
+ if (value = attributes[:'sub_question_ids']).is_a?(Array)
172
+ self.sub_question_ids = value
173
+ end
174
+ end
175
+
176
+ if attributes.key?(:'always_show_sub_questions')
177
+ self.always_show_sub_questions = attributes[:'always_show_sub_questions']
178
+ end
179
+
180
+ if attributes.key?(:'reporting_order')
181
+ self.reporting_order = attributes[:'reporting_order']
182
+ else
183
+ self.reporting_order = nil
184
+ end
185
+ end
186
+
187
+ # Show invalid properties with the reasons. Usually used together with valid?
188
+ # @return Array for valid properties with the reasons
189
+ def list_invalid_properties
190
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
191
+ invalid_properties = Array.new
192
+ if @name.nil?
193
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
194
+ end
195
+
196
+ if @question.nil?
197
+ invalid_properties.push('invalid value for "question", question cannot be nil.')
198
+ end
199
+
200
+ if @type.nil?
201
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
202
+ end
203
+
204
+ if @reporting_order.nil?
205
+ invalid_properties.push('invalid value for "reporting_order", reporting_order cannot be nil.')
206
+ end
207
+
208
+ invalid_properties
209
+ end
210
+
211
+ # Check to see if the all the properties in the model are valid
212
+ # @return true if the model is valid
213
+ def valid?
214
+ warn '[DEPRECATED] the `valid?` method is obsolete'
215
+ return false if @name.nil?
216
+ return false if @question.nil?
217
+ return false if @type.nil?
218
+ return false if @reporting_order.nil?
219
+ true
220
+ end
221
+
222
+ # Custom attribute writer method with validation
223
+ # @param [Object] name Value to be assigned
224
+ def name=(name)
225
+ if name.nil?
226
+ fail ArgumentError, 'name cannot be nil'
227
+ end
228
+
229
+ @name = name
230
+ end
231
+
232
+ # Custom attribute writer method with validation
233
+ # @param [Object] question Value to be assigned
234
+ def question=(question)
235
+ if question.nil?
236
+ fail ArgumentError, 'question cannot be nil'
237
+ end
238
+
239
+ @question = question
240
+ end
241
+
242
+ # Custom attribute writer method with validation
243
+ # @param [Object] type Value to be assigned
244
+ def type=(type)
245
+ if type.nil?
246
+ fail ArgumentError, 'type cannot be nil'
247
+ end
248
+
249
+ @type = type
250
+ end
251
+
252
+ # Custom attribute writer method with validation
253
+ # @param [Object] reporting_order Value to be assigned
254
+ def reporting_order=(reporting_order)
255
+ if reporting_order.nil?
256
+ fail ArgumentError, 'reporting_order cannot be nil'
257
+ end
258
+
259
+ @reporting_order = reporting_order
260
+ end
261
+
262
+ # Checks equality by comparing each attribute.
263
+ # @param [Object] Object to be compared
264
+ def ==(o)
265
+ return true if self.equal?(o)
266
+ self.class == o.class &&
267
+ name == o.name &&
268
+ question == o.question &&
269
+ help_text == o.help_text &&
270
+ type == o.type &&
271
+ num_stars == o.num_stars &&
272
+ min == o.min &&
273
+ max == o.max &&
274
+ default_value == o.default_value &&
275
+ label_negative == o.label_negative &&
276
+ label_positive == o.label_positive &&
277
+ custom_options == o.custom_options &&
278
+ sub_question_ids == o.sub_question_ids &&
279
+ always_show_sub_questions == o.always_show_sub_questions &&
280
+ reporting_order == o.reporting_order
281
+ end
282
+
283
+ # @see the `==` method
284
+ # @param [Object] Object to be compared
285
+ def eql?(o)
286
+ self == o
287
+ end
288
+
289
+ # Calculates hash code according to all attributes.
290
+ # @return [Integer] Hash code
291
+ def hash
292
+ [name, question, help_text, type, num_stars, min, max, default_value, label_negative, label_positive, custom_options, sub_question_ids, always_show_sub_questions, reporting_order].hash
293
+ end
294
+
295
+ # Builds the object from hash
296
+ # @param [Hash] attributes Model attributes in the form of hash
297
+ # @return [Object] Returns the model itself
298
+ def self.build_from_hash(attributes)
299
+ return nil unless attributes.is_a?(Hash)
300
+ attributes = attributes.transform_keys(&:to_sym)
301
+ transformed_hash = {}
302
+ openapi_types.each_pair do |key, type|
303
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
304
+ transformed_hash["#{key}"] = nil
305
+ elsif type =~ /\AArray<(.*)>/i
306
+ # check to ensure the input is an array given that the attribute
307
+ # is documented as an array but the input is not
308
+ if attributes[attribute_map[key]].is_a?(Array)
309
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
310
+ end
311
+ elsif !attributes[attribute_map[key]].nil?
312
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
313
+ end
314
+ end
315
+ new(transformed_hash)
316
+ end
317
+
318
+ # Returns the object in the form of hash
319
+ # @return [Hash] Returns the object in the form of hash
320
+ def to_hash
321
+ hash = {}
322
+ self.class.attribute_map.each_pair do |attr, param|
323
+ value = self.send(attr)
324
+ if value.nil?
325
+ is_nullable = self.class.openapi_nullable.include?(attr)
326
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
327
+ end
328
+
329
+ hash[param] = _to_hash(value)
330
+ end
331
+ hash
332
+ end
333
+
334
+ end
335
+
336
+ end
@@ -0,0 +1,212 @@
1
+ =begin
2
+ #fastcomments
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 0.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FastCommentsClient
17
+ class CreateQuestionConfigResponse < ApiModelBase
18
+ attr_accessor :status
19
+
20
+ attr_accessor :question_config
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'status' => :'status',
48
+ :'question_config' => :'questionConfig'
49
+ }
50
+ end
51
+
52
+ # Returns attribute mapping this model knows about
53
+ def self.acceptable_attribute_map
54
+ attribute_map
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ acceptable_attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'status' => :'APIStatus',
66
+ :'question_config' => :'QuestionConfig'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FastCommentsClient::CreateQuestionConfigResponse` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FastCommentsClient::CreateQuestionConfigResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'status')
93
+ self.status = attributes[:'status']
94
+ else
95
+ self.status = nil
96
+ end
97
+
98
+ if attributes.key?(:'question_config')
99
+ self.question_config = attributes[:'question_config']
100
+ else
101
+ self.question_config = nil
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
109
+ invalid_properties = Array.new
110
+ if @status.nil?
111
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
112
+ end
113
+
114
+ if @question_config.nil?
115
+ invalid_properties.push('invalid value for "question_config", question_config cannot be nil.')
116
+ end
117
+
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ return false if @status.nil?
126
+ return false if @question_config.nil?
127
+ true
128
+ end
129
+
130
+ # Custom attribute writer method with validation
131
+ # @param [Object] status Value to be assigned
132
+ def status=(status)
133
+ if status.nil?
134
+ fail ArgumentError, 'status cannot be nil'
135
+ end
136
+
137
+ @status = status
138
+ end
139
+
140
+ # Custom attribute writer method with validation
141
+ # @param [Object] question_config Value to be assigned
142
+ def question_config=(question_config)
143
+ if question_config.nil?
144
+ fail ArgumentError, 'question_config cannot be nil'
145
+ end
146
+
147
+ @question_config = question_config
148
+ end
149
+
150
+ # Checks equality by comparing each attribute.
151
+ # @param [Object] Object to be compared
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ status == o.status &&
156
+ question_config == o.question_config
157
+ end
158
+
159
+ # @see the `==` method
160
+ # @param [Object] Object to be compared
161
+ def eql?(o)
162
+ self == o
163
+ end
164
+
165
+ # Calculates hash code according to all attributes.
166
+ # @return [Integer] Hash code
167
+ def hash
168
+ [status, question_config].hash
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def self.build_from_hash(attributes)
175
+ return nil unless attributes.is_a?(Hash)
176
+ attributes = attributes.transform_keys(&:to_sym)
177
+ transformed_hash = {}
178
+ openapi_types.each_pair do |key, type|
179
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
180
+ transformed_hash["#{key}"] = nil
181
+ elsif type =~ /\AArray<(.*)>/i
182
+ # check to ensure the input is an array given that the attribute
183
+ # is documented as an array but the input is not
184
+ if attributes[attribute_map[key]].is_a?(Array)
185
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
186
+ end
187
+ elsif !attributes[attribute_map[key]].nil?
188
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
189
+ end
190
+ end
191
+ new(transformed_hash)
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ end
211
+
212
+ end
@@ -0,0 +1,103 @@
1
+ =begin
2
+ #fastcomments
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 0.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FastCommentsClient
17
+ module CreateQuestionResult200Response
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'APIError',
23
+ :'CreateQuestionResultResponse'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ return find_and_cast_into_type(klass, data)
41
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
42
+ end
43
+ end
44
+
45
+ openapi_any_of.include?(:AnyType) ? data : nil
46
+ end
47
+
48
+ private
49
+
50
+ SchemaMismatchError = Class.new(StandardError)
51
+
52
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
53
+ def find_and_cast_into_type(klass, data)
54
+ return if data.nil?
55
+
56
+ case klass.to_s
57
+ when 'Boolean'
58
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
59
+ when 'Float'
60
+ return data if data.instance_of?(Float)
61
+ when 'Integer'
62
+ return data if data.instance_of?(Integer)
63
+ when 'Time'
64
+ return Time.parse(data)
65
+ when 'Date'
66
+ return Date.iso8601(data)
67
+ when 'String'
68
+ return data if data.instance_of?(String)
69
+ when 'Object' # "type: object"
70
+ return data if data.instance_of?(Hash)
71
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
72
+ if data.instance_of?(Array)
73
+ sub_type = Regexp.last_match[:sub_type]
74
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
75
+ end
76
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ else # model
82
+ const = FastCommentsClient.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
85
+ model = const.build(data)
86
+ return model if model
87
+ else
88
+ # raise if data contains keys that are not known to the model
89
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
90
+ model = const.build_from_hash(data)
91
+ return model if model
92
+ end
93
+ end
94
+ end
95
+
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
99
+ end
100
+ end
101
+ end
102
+
103
+ end