qsafe-sdk 1.0.4

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 (313) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +134 -0
  4. data/Rakefile +10 -0
  5. data/docs/APIKeysApi.md +427 -0
  6. data/docs/ApiKey.md +40 -0
  7. data/docs/AuthResponse.md +20 -0
  8. data/docs/AuthResponseData.md +26 -0
  9. data/docs/AuthenticationApi.md +276 -0
  10. data/docs/ChangePassword200Response.md +20 -0
  11. data/docs/ChangePasswordRequest.md +20 -0
  12. data/docs/CreateApiKey201Response.md +20 -0
  13. data/docs/CreateApiKey201ResponseData.md +20 -0
  14. data/docs/CreateApiKeyRequest.md +28 -0
  15. data/docs/CryptographicOperationsApi.md +331 -0
  16. data/docs/DebugApi.md +84 -0
  17. data/docs/DebugRedisTest200Response.md +30 -0
  18. data/docs/DebugRedisTest200ResponseRateLimitTest.md +22 -0
  19. data/docs/DebugRedisTest200ResponseServicesStatus.md +24 -0
  20. data/docs/DebugRedisTest500Response.md +20 -0
  21. data/docs/DecryptData200Response.md +20 -0
  22. data/docs/DecryptData200ResponseData.md +24 -0
  23. data/docs/DecryptRequest.md +28 -0
  24. data/docs/DecryptRequestEphemeralCrypto.md +24 -0
  25. data/docs/EncryptData200Response.md +20 -0
  26. data/docs/EncryptData200ResponseData.md +28 -0
  27. data/docs/EncryptData200ResponseDataEphemeralStorage.md +22 -0
  28. data/docs/EncryptRequest.md +26 -0
  29. data/docs/EncryptRequestEphemeralStorage.md +22 -0
  30. data/docs/Error.md +28 -0
  31. data/docs/GenerateKeypair201Response.md +20 -0
  32. data/docs/GenerateKeypairRequest.md +24 -0
  33. data/docs/GenerateKeypairRequestKeyPolicy.md +20 -0
  34. data/docs/GetApiKey200Response.md +20 -0
  35. data/docs/GetApiKeyUsage200Response.md +20 -0
  36. data/docs/GetApiKeyUsage200ResponseData.md +22 -0
  37. data/docs/GetApiKeyUsage200ResponseDataDailyUsageInner.md +20 -0
  38. data/docs/GetAuthInfo200Response.md +20 -0
  39. data/docs/GetAuthInfo200ResponseData.md +26 -0
  40. data/docs/GetHealth200Response.md +22 -0
  41. data/docs/GetHealth200ResponseServices.md +22 -0
  42. data/docs/GetHealth200ResponseServicesApi.md +22 -0
  43. data/docs/GetHealth200ResponseServicesEphemeralStorage.md +18 -0
  44. data/docs/GetHealth200ResponseServicesRedis.md +20 -0
  45. data/docs/GetRateLimitStatus200Response.md +20 -0
  46. data/docs/GetRateLimitStatus200ResponseData.md +22 -0
  47. data/docs/GetRateLimitStatus200ResponseDataCurrentUsage.md +22 -0
  48. data/docs/GetRateLimitStatus200ResponseDataLimits.md +22 -0
  49. data/docs/GetRateLimitStatus200ResponseDataResetTimes.md +22 -0
  50. data/docs/HealthApi.md +69 -0
  51. data/docs/Keypair.md +40 -0
  52. data/docs/KeypairsApi.md +341 -0
  53. data/docs/ListApiKeys200Response.md +20 -0
  54. data/docs/ListApiKeys200ResponseData.md +22 -0
  55. data/docs/ListApiKeys200ResponseDataPagination.md +22 -0
  56. data/docs/ListKeypairs200Response.md +20 -0
  57. data/docs/ListKeypairs200ResponseData.md +22 -0
  58. data/docs/ListKeypairs200ResponseDataPagination.md +22 -0
  59. data/docs/LoginRequest.md +20 -0
  60. data/docs/RegisterRequest.md +24 -0
  61. data/docs/RevokeKeypair200Response.md +22 -0
  62. data/docs/RevokeKeypairRequest.md +22 -0
  63. data/docs/RotateApiKey200Response.md +20 -0
  64. data/docs/RotateApiKey200ResponseData.md +20 -0
  65. data/docs/SignData200Response.md +20 -0
  66. data/docs/SignData200ResponseData.md +30 -0
  67. data/docs/SignData200ResponseDataEphemeralStorage.md +22 -0
  68. data/docs/SignRequest.md +26 -0
  69. data/docs/SignRequestEphemeralStorage.md +20 -0
  70. data/docs/UpdateApiKeyRequest.md +28 -0
  71. data/docs/UpdateKeypair200Response.md +20 -0
  72. data/docs/UpdateKeypairRequest.md +24 -0
  73. data/docs/User.md +32 -0
  74. data/docs/UtilitiesApi.md +81 -0
  75. data/docs/VerifyRequest.md +26 -0
  76. data/docs/VerifySignature200Response.md +20 -0
  77. data/docs/VerifySignature200ResponseData.md +22 -0
  78. data/docs/VerifySignature200ResponseDataSignatureInfo.md +20 -0
  79. data/docs/VerifySignature200ResponseDataVerificationResult.md +22 -0
  80. data/git_push.sh +57 -0
  81. data/lib/qsafe/api/api_keys_api.rb +430 -0
  82. data/lib/qsafe/api/authentication_api.rb +275 -0
  83. data/lib/qsafe/api/cryptographic_operations_api.rb +314 -0
  84. data/lib/qsafe/api/debug_api.rb +79 -0
  85. data/lib/qsafe/api/health_api.rb +79 -0
  86. data/lib/qsafe/api/keypairs_api.rb +345 -0
  87. data/lib/qsafe/api/utilities_api.rb +79 -0
  88. data/lib/qsafe/api_client.rb +394 -0
  89. data/lib/qsafe/api_error.rb +58 -0
  90. data/lib/qsafe/configuration.rb +327 -0
  91. data/lib/qsafe/models/api_key.rb +325 -0
  92. data/lib/qsafe/models/auth_response.rb +223 -0
  93. data/lib/qsafe/models/auth_response_data.rb +242 -0
  94. data/lib/qsafe/models/change_password200_response.rb +223 -0
  95. data/lib/qsafe/models/change_password_request.rb +256 -0
  96. data/lib/qsafe/models/create_api_key201_response.rb +233 -0
  97. data/lib/qsafe/models/create_api_key_request.rb +350 -0
  98. data/lib/qsafe/models/debug_redis_test200_response.rb +304 -0
  99. data/lib/qsafe/models/debug_redis_test200_response_rate_limit_test.rb +232 -0
  100. data/lib/qsafe/models/debug_redis_test200_response_services_status.rb +241 -0
  101. data/lib/qsafe/models/debug_redis_test500_response.rb +223 -0
  102. data/lib/qsafe/models/decrypt_data200_response.rb +223 -0
  103. data/lib/qsafe/models/decrypt_data200_response_data.rb +242 -0
  104. data/lib/qsafe/models/decrypt_request.rb +301 -0
  105. data/lib/qsafe/models/decrypt_request_ephemeral_crypto.rb +276 -0
  106. data/lib/qsafe/models/encrypt_data200_response.rb +223 -0
  107. data/lib/qsafe/models/encrypt_data200_response_data.rb +263 -0
  108. data/lib/qsafe/models/encrypt_request.rb +322 -0
  109. data/lib/qsafe/models/encrypt_request_ephemeral_storage.rb +289 -0
  110. data/lib/qsafe/models/error.rb +275 -0
  111. data/lib/qsafe/models/generate_keypair201_response.rb +233 -0
  112. data/lib/qsafe/models/generate_keypair_request.rb +297 -0
  113. data/lib/qsafe/models/generate_keypair_request_key_policy.rb +266 -0
  114. data/lib/qsafe/models/get_api_key200_response.rb +223 -0
  115. data/lib/qsafe/models/get_api_key_usage200_response.rb +223 -0
  116. data/lib/qsafe/models/get_api_key_usage200_response_data.rb +236 -0
  117. data/lib/qsafe/models/get_api_key_usage200_response_data_daily_usage_inner.rb +223 -0
  118. data/lib/qsafe/models/get_auth_info200_response.rb +223 -0
  119. data/lib/qsafe/models/get_auth_info200_response_data.rb +284 -0
  120. data/lib/qsafe/models/get_health200_response.rb +232 -0
  121. data/lib/qsafe/models/get_health200_response_services.rb +232 -0
  122. data/lib/qsafe/models/get_health200_response_services_api.rb +232 -0
  123. data/lib/qsafe/models/get_health200_response_services_ephemeral_storage.rb +214 -0
  124. data/lib/qsafe/models/get_health200_response_services_redis.rb +223 -0
  125. data/lib/qsafe/models/get_rate_limit_status200_response.rb +223 -0
  126. data/lib/qsafe/models/get_rate_limit_status200_response_data.rb +232 -0
  127. data/lib/qsafe/models/get_rate_limit_status200_response_data_current_usage.rb +232 -0
  128. data/lib/qsafe/models/get_rate_limit_status200_response_data_limits.rb +232 -0
  129. data/lib/qsafe/models/get_rate_limit_status200_response_data_reset_times.rb +232 -0
  130. data/lib/qsafe/models/keypair.rb +379 -0
  131. data/lib/qsafe/models/list_api_keys200_response.rb +223 -0
  132. data/lib/qsafe/models/list_api_keys200_response_data.rb +234 -0
  133. data/lib/qsafe/models/list_api_keys200_response_data_pagination.rb +232 -0
  134. data/lib/qsafe/models/list_keypairs200_response.rb +223 -0
  135. data/lib/qsafe/models/list_keypairs200_response_data.rb +234 -0
  136. data/lib/qsafe/models/list_keypairs200_response_data_pagination.rb +232 -0
  137. data/lib/qsafe/models/login_request.rb +237 -0
  138. data/lib/qsafe/models/register_request.rb +345 -0
  139. data/lib/qsafe/models/revoke_keypair200_response.rb +232 -0
  140. data/lib/qsafe/models/revoke_keypair_request.rb +301 -0
  141. data/lib/qsafe/models/rotate_api_key200_response.rb +232 -0
  142. data/lib/qsafe/models/sign_data200_response.rb +223 -0
  143. data/lib/qsafe/models/sign_data200_response_data.rb +262 -0
  144. data/lib/qsafe/models/sign_request.rb +321 -0
  145. data/lib/qsafe/models/sign_request_ephemeral_storage.rb +279 -0
  146. data/lib/qsafe/models/update_api_key_request.rb +343 -0
  147. data/lib/qsafe/models/update_keypair200_response.rb +223 -0
  148. data/lib/qsafe/models/update_keypair_request.rb +317 -0
  149. data/lib/qsafe/models/user.rb +293 -0
  150. data/lib/qsafe/models/verify_request.rb +389 -0
  151. data/lib/qsafe/models/verify_signature200_response.rb +223 -0
  152. data/lib/qsafe/models/verify_signature200_response_data.rb +251 -0
  153. data/lib/qsafe/version.rb +15 -0
  154. data/lib/qsafe-sdk/api/api_keys_api.rb +430 -0
  155. data/lib/qsafe-sdk/api/authentication_api.rb +275 -0
  156. data/lib/qsafe-sdk/api/cryptographic_operations_api.rb +314 -0
  157. data/lib/qsafe-sdk/api/debug_api.rb +79 -0
  158. data/lib/qsafe-sdk/api/health_api.rb +79 -0
  159. data/lib/qsafe-sdk/api/keypairs_api.rb +345 -0
  160. data/lib/qsafe-sdk/api/utilities_api.rb +79 -0
  161. data/lib/qsafe-sdk/api_client.rb +394 -0
  162. data/lib/qsafe-sdk/api_error.rb +58 -0
  163. data/lib/qsafe-sdk/configuration.rb +327 -0
  164. data/lib/qsafe-sdk/models/api_key.rb +345 -0
  165. data/lib/qsafe-sdk/models/auth_response.rb +223 -0
  166. data/lib/qsafe-sdk/models/auth_response_data.rb +252 -0
  167. data/lib/qsafe-sdk/models/change_password200_response.rb +223 -0
  168. data/lib/qsafe-sdk/models/change_password_request.rb +256 -0
  169. data/lib/qsafe-sdk/models/create_api_key201_response.rb +223 -0
  170. data/lib/qsafe-sdk/models/create_api_key201_response_data.rb +224 -0
  171. data/lib/qsafe-sdk/models/create_api_key_request.rb +350 -0
  172. data/lib/qsafe-sdk/models/debug_redis_test200_response.rb +304 -0
  173. data/lib/qsafe-sdk/models/debug_redis_test200_response_rate_limit_test.rb +232 -0
  174. data/lib/qsafe-sdk/models/debug_redis_test200_response_services_status.rb +241 -0
  175. data/lib/qsafe-sdk/models/debug_redis_test500_response.rb +223 -0
  176. data/lib/qsafe-sdk/models/decrypt_data200_response.rb +223 -0
  177. data/lib/qsafe-sdk/models/decrypt_data200_response_data.rb +242 -0
  178. data/lib/qsafe-sdk/models/decrypt_request.rb +301 -0
  179. data/lib/qsafe-sdk/models/decrypt_request_ephemeral_crypto.rb +276 -0
  180. data/lib/qsafe-sdk/models/encrypt_data200_response.rb +223 -0
  181. data/lib/qsafe-sdk/models/encrypt_data200_response_data.rb +262 -0
  182. data/lib/qsafe-sdk/models/encrypt_data200_response_data_ephemeral_storage.rb +235 -0
  183. data/lib/qsafe-sdk/models/encrypt_request.rb +322 -0
  184. data/lib/qsafe-sdk/models/encrypt_request_ephemeral_storage.rb +289 -0
  185. data/lib/qsafe-sdk/models/error.rb +275 -0
  186. data/lib/qsafe-sdk/models/generate_keypair201_response.rb +223 -0
  187. data/lib/qsafe-sdk/models/generate_keypair_request.rb +297 -0
  188. data/lib/qsafe-sdk/models/generate_keypair_request_key_policy.rb +266 -0
  189. data/lib/qsafe-sdk/models/get_api_key200_response.rb +223 -0
  190. data/lib/qsafe-sdk/models/get_api_key_usage200_response.rb +223 -0
  191. data/lib/qsafe-sdk/models/get_api_key_usage200_response_data.rb +236 -0
  192. data/lib/qsafe-sdk/models/get_api_key_usage200_response_data_daily_usage_inner.rb +223 -0
  193. data/lib/qsafe-sdk/models/get_auth_info200_response.rb +223 -0
  194. data/lib/qsafe-sdk/models/get_auth_info200_response_data.rb +284 -0
  195. data/lib/qsafe-sdk/models/get_health200_response.rb +232 -0
  196. data/lib/qsafe-sdk/models/get_health200_response_services.rb +232 -0
  197. data/lib/qsafe-sdk/models/get_health200_response_services_api.rb +232 -0
  198. data/lib/qsafe-sdk/models/get_health200_response_services_ephemeral_storage.rb +214 -0
  199. data/lib/qsafe-sdk/models/get_health200_response_services_redis.rb +223 -0
  200. data/lib/qsafe-sdk/models/get_rate_limit_status200_response.rb +223 -0
  201. data/lib/qsafe-sdk/models/get_rate_limit_status200_response_data.rb +232 -0
  202. data/lib/qsafe-sdk/models/get_rate_limit_status200_response_data_current_usage.rb +232 -0
  203. data/lib/qsafe-sdk/models/get_rate_limit_status200_response_data_limits.rb +232 -0
  204. data/lib/qsafe-sdk/models/get_rate_limit_status200_response_data_reset_times.rb +232 -0
  205. data/lib/qsafe-sdk/models/keypair.rb +379 -0
  206. data/lib/qsafe-sdk/models/list_api_keys200_response.rb +223 -0
  207. data/lib/qsafe-sdk/models/list_api_keys200_response_data.rb +234 -0
  208. data/lib/qsafe-sdk/models/list_api_keys200_response_data_pagination.rb +232 -0
  209. data/lib/qsafe-sdk/models/list_keypairs200_response.rb +223 -0
  210. data/lib/qsafe-sdk/models/list_keypairs200_response_data.rb +234 -0
  211. data/lib/qsafe-sdk/models/list_keypairs200_response_data_pagination.rb +232 -0
  212. data/lib/qsafe-sdk/models/login_request.rb +237 -0
  213. data/lib/qsafe-sdk/models/register_request.rb +345 -0
  214. data/lib/qsafe-sdk/models/revoke_keypair200_response.rb +232 -0
  215. data/lib/qsafe-sdk/models/revoke_keypair_request.rb +301 -0
  216. data/lib/qsafe-sdk/models/rotate_api_key200_response.rb +223 -0
  217. data/lib/qsafe-sdk/models/rotate_api_key200_response_data.rb +224 -0
  218. data/lib/qsafe-sdk/models/sign_data200_response.rb +223 -0
  219. data/lib/qsafe-sdk/models/sign_data200_response_data.rb +270 -0
  220. data/lib/qsafe-sdk/models/sign_data200_response_data_ephemeral_storage.rb +234 -0
  221. data/lib/qsafe-sdk/models/sign_request.rb +321 -0
  222. data/lib/qsafe-sdk/models/sign_request_ephemeral_storage.rb +279 -0
  223. data/lib/qsafe-sdk/models/update_api_key_request.rb +343 -0
  224. data/lib/qsafe-sdk/models/update_keypair200_response.rb +223 -0
  225. data/lib/qsafe-sdk/models/update_keypair_request.rb +317 -0
  226. data/lib/qsafe-sdk/models/user.rb +312 -0
  227. data/lib/qsafe-sdk/models/verify_request.rb +389 -0
  228. data/lib/qsafe-sdk/models/verify_signature200_response.rb +223 -0
  229. data/lib/qsafe-sdk/models/verify_signature200_response_data.rb +232 -0
  230. data/lib/qsafe-sdk/models/verify_signature200_response_data_signature_info.rb +223 -0
  231. data/lib/qsafe-sdk/models/verify_signature200_response_data_verification_result.rb +233 -0
  232. data/lib/qsafe-sdk/version.rb +15 -0
  233. data/lib/qsafe-sdk.rb +114 -0
  234. data/lib/qsafe.rb +108 -0
  235. data/qsafe-sdk.gemspec +39 -0
  236. data/qsafe.gemspec +39 -0
  237. data/spec/api/api_keys_api_spec.rb +105 -0
  238. data/spec/api/authentication_api_spec.rb +78 -0
  239. data/spec/api/cryptographic_operations_api_spec.rb +85 -0
  240. data/spec/api/debug_api_spec.rb +46 -0
  241. data/spec/api/health_api_spec.rb +46 -0
  242. data/spec/api/keypairs_api_spec.rb +89 -0
  243. data/spec/api/utilities_api_spec.rb +46 -0
  244. data/spec/models/api_key_spec.rb +94 -0
  245. data/spec/models/auth_response_data_spec.rb +54 -0
  246. data/spec/models/auth_response_spec.rb +42 -0
  247. data/spec/models/change_password200_response_spec.rb +42 -0
  248. data/spec/models/change_password_request_spec.rb +42 -0
  249. data/spec/models/create_api_key201_response_data_spec.rb +42 -0
  250. data/spec/models/create_api_key201_response_spec.rb +48 -0
  251. data/spec/models/create_api_key_request_spec.rb +70 -0
  252. data/spec/models/debug_redis_test200_response_rate_limit_test_spec.rb +48 -0
  253. data/spec/models/debug_redis_test200_response_services_status_spec.rb +54 -0
  254. data/spec/models/debug_redis_test200_response_spec.rb +76 -0
  255. data/spec/models/debug_redis_test500_response_spec.rb +42 -0
  256. data/spec/models/decrypt_data200_response_data_spec.rb +54 -0
  257. data/spec/models/decrypt_data200_response_spec.rb +42 -0
  258. data/spec/models/decrypt_request_ephemeral_crypto_spec.rb +54 -0
  259. data/spec/models/decrypt_request_spec.rb +66 -0
  260. data/spec/models/encrypt_data200_response_data_ephemeral_storage_spec.rb +48 -0
  261. data/spec/models/encrypt_data200_response_data_spec.rb +66 -0
  262. data/spec/models/encrypt_data200_response_spec.rb +42 -0
  263. data/spec/models/encrypt_request_ephemeral_storage_spec.rb +48 -0
  264. data/spec/models/encrypt_request_spec.rb +64 -0
  265. data/spec/models/error_spec.rb +66 -0
  266. data/spec/models/generate_keypair201_response_spec.rb +48 -0
  267. data/spec/models/generate_keypair_request_key_policy_spec.rb +46 -0
  268. data/spec/models/generate_keypair_request_spec.rb +62 -0
  269. data/spec/models/get_api_key200_response_spec.rb +42 -0
  270. data/spec/models/get_api_key_usage200_response_data_daily_usage_inner_spec.rb +42 -0
  271. data/spec/models/get_api_key_usage200_response_data_spec.rb +48 -0
  272. data/spec/models/get_api_key_usage200_response_spec.rb +42 -0
  273. data/spec/models/get_auth_info200_response_data_spec.rb +64 -0
  274. data/spec/models/get_auth_info200_response_spec.rb +42 -0
  275. data/spec/models/get_health200_response_services_api_spec.rb +48 -0
  276. data/spec/models/get_health200_response_services_ephemeral_storage_spec.rb +36 -0
  277. data/spec/models/get_health200_response_services_redis_spec.rb +42 -0
  278. data/spec/models/get_health200_response_services_spec.rb +48 -0
  279. data/spec/models/get_health200_response_spec.rb +48 -0
  280. data/spec/models/get_rate_limit_status200_response_data_current_usage_spec.rb +48 -0
  281. data/spec/models/get_rate_limit_status200_response_data_limits_spec.rb +48 -0
  282. data/spec/models/get_rate_limit_status200_response_data_reset_times_spec.rb +48 -0
  283. data/spec/models/get_rate_limit_status200_response_data_spec.rb +48 -0
  284. data/spec/models/get_rate_limit_status200_response_spec.rb +42 -0
  285. data/spec/models/keypair_spec.rb +114 -0
  286. data/spec/models/list_api_keys200_response_data_pagination_spec.rb +48 -0
  287. data/spec/models/list_api_keys200_response_data_spec.rb +48 -0
  288. data/spec/models/list_api_keys200_response_spec.rb +42 -0
  289. data/spec/models/list_keypairs200_response_data_pagination_spec.rb +48 -0
  290. data/spec/models/list_keypairs200_response_data_spec.rb +48 -0
  291. data/spec/models/list_keypairs200_response_spec.rb +42 -0
  292. data/spec/models/login_request_spec.rb +42 -0
  293. data/spec/models/register_request_spec.rb +54 -0
  294. data/spec/models/revoke_keypair200_response_spec.rb +48 -0
  295. data/spec/models/revoke_keypair_request_spec.rb +52 -0
  296. data/spec/models/rotate_api_key200_response_data_spec.rb +42 -0
  297. data/spec/models/rotate_api_key200_response_spec.rb +48 -0
  298. data/spec/models/sign_data200_response_data_ephemeral_storage_spec.rb +48 -0
  299. data/spec/models/sign_data200_response_data_spec.rb +66 -0
  300. data/spec/models/sign_data200_response_spec.rb +42 -0
  301. data/spec/models/sign_request_ephemeral_storage_spec.rb +42 -0
  302. data/spec/models/sign_request_spec.rb +64 -0
  303. data/spec/models/update_api_key_request_spec.rb +70 -0
  304. data/spec/models/update_keypair200_response_spec.rb +42 -0
  305. data/spec/models/update_keypair_request_spec.rb +58 -0
  306. data/spec/models/user_spec.rb +70 -0
  307. data/spec/models/verify_request_spec.rb +64 -0
  308. data/spec/models/verify_signature200_response_data_signature_info_spec.rb +42 -0
  309. data/spec/models/verify_signature200_response_data_spec.rb +60 -0
  310. data/spec/models/verify_signature200_response_data_verification_result_spec.rb +48 -0
  311. data/spec/models/verify_signature200_response_spec.rb +42 -0
  312. data/spec/spec_helper.rb +111 -0
  313. metadata +477 -0
@@ -0,0 +1,266 @@
1
+ =begin
2
+ #QSafe PQC API
3
+
4
+ #Post-quantum cryptography SaaS API supporting ML-KEM (Kyber) and ML-DSA (Dilithium) algorithms. Provides keypair management and cryptographic operations (encrypt, decrypt, sign, verify). ## Authentication - **JWT Bearer Token** — user-based auth, obtained from `/auth/login` or `/auth/register` - **API Key (header)** — programmatic access via `X-API-Key` header - **API Key (query)** — programmatic access via `?api_key=` query parameter ## Quick Start 1. Register → `POST /auth/register` 2. Login → `POST /auth/login` → copy `data.token` 3. Generate keypair → `POST /generate-keypair` 4. Encrypt / Sign with the keypair ID
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: rushikesh.n.kakadiya@gmail.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.9.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module QSafe
17
+ class GenerateKeypairRequestKeyPolicy
18
+ attr_accessor :expiration_days
19
+
20
+ attr_accessor :allowed_operations
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
+ :'expiration_days' => :'expirationDays',
48
+ :'allowed_operations' => :'allowedOperations'
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'expiration_days' => :'Integer',
61
+ :'allowed_operations' => :'Array<String>'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `QSafe::GenerateKeypairRequestKeyPolicy` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `QSafe::GenerateKeypairRequestKeyPolicy`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'expiration_days')
87
+ self.expiration_days = attributes[:'expiration_days']
88
+ end
89
+
90
+ if attributes.key?(:'allowed_operations')
91
+ if (value = attributes[:'allowed_operations']).is_a?(Array)
92
+ self.allowed_operations = value
93
+ end
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ if !@expiration_days.nil? && @expiration_days < 1
103
+ invalid_properties.push('invalid value for "expiration_days", must be greater than or equal to 1.')
104
+ end
105
+
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ warn '[DEPRECATED] the `valid?` method is obsolete'
113
+ return false if !@expiration_days.nil? && @expiration_days < 1
114
+ true
115
+ end
116
+
117
+ # Custom attribute writer method with validation
118
+ # @param [Object] expiration_days Value to be assigned
119
+ def expiration_days=(expiration_days)
120
+ if expiration_days.nil?
121
+ fail ArgumentError, 'expiration_days cannot be nil'
122
+ end
123
+
124
+ if expiration_days < 1
125
+ fail ArgumentError, 'invalid value for "expiration_days", must be greater than or equal to 1.'
126
+ end
127
+
128
+ @expiration_days = expiration_days
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ expiration_days == o.expiration_days &&
137
+ allowed_operations == o.allowed_operations
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [expiration_days, allowed_operations].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ attributes = attributes.transform_keys(&:to_sym)
158
+ transformed_hash = {}
159
+ openapi_types.each_pair do |key, type|
160
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = nil
162
+ elsif type =~ /\AArray<(.*)>/i
163
+ # check to ensure the input is an array given that the attribute
164
+ # is documented as an array but the input is not
165
+ if attributes[attribute_map[key]].is_a?(Array)
166
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
167
+ end
168
+ elsif !attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
170
+ end
171
+ end
172
+ new(transformed_hash)
173
+ end
174
+
175
+ # Deserializes the data based on type
176
+ # @param string type Data type
177
+ # @param string value Value to be deserialized
178
+ # @return [Object] Deserialized data
179
+ def self._deserialize(type, value)
180
+ case type.to_sym
181
+ when :Time
182
+ Time.parse(value)
183
+ when :Date
184
+ Date.parse(value)
185
+ when :String
186
+ value.to_s
187
+ when :Integer
188
+ value.to_i
189
+ when :Float
190
+ value.to_f
191
+ when :Boolean
192
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
+ true
194
+ else
195
+ false
196
+ end
197
+ when :Object
198
+ # generic object (usually a Hash), return directly
199
+ value
200
+ when /\AArray<(?<inner_type>.+)>\z/
201
+ inner_type = Regexp.last_match[:inner_type]
202
+ value.map { |v| _deserialize(inner_type, v) }
203
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
+ k_type = Regexp.last_match[:k_type]
205
+ v_type = Regexp.last_match[:v_type]
206
+ {}.tap do |hash|
207
+ value.each do |k, v|
208
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
+ end
210
+ end
211
+ else # model
212
+ # models (e.g. Pet) or oneOf
213
+ klass = QSafe.const_get(type)
214
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ if value.nil?
237
+ is_nullable = self.class.openapi_nullable.include?(attr)
238
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
+ end
240
+
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+
264
+ end
265
+
266
+ end
@@ -0,0 +1,223 @@
1
+ =begin
2
+ #QSafe PQC API
3
+
4
+ #Post-quantum cryptography SaaS API supporting ML-KEM (Kyber) and ML-DSA (Dilithium) algorithms. Provides keypair management and cryptographic operations (encrypt, decrypt, sign, verify). ## Authentication - **JWT Bearer Token** — user-based auth, obtained from `/auth/login` or `/auth/register` - **API Key (header)** — programmatic access via `X-API-Key` header - **API Key (query)** — programmatic access via `?api_key=` query parameter ## Quick Start 1. Register → `POST /auth/register` 2. Login → `POST /auth/login` → copy `data.token` 3. Generate keypair → `POST /generate-keypair` 4. Encrypt / Sign with the keypair ID
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: rushikesh.n.kakadiya@gmail.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.9.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module QSafe
17
+ class GetApiKey200Response
18
+ attr_accessor :success
19
+
20
+ attr_accessor :data
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'success' => :'success',
26
+ :'data' => :'data'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'success' => :'Boolean',
39
+ :'data' => :'ApiKey'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `QSafe::GetApiKey200Response` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `QSafe::GetApiKey200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'success')
65
+ self.success = attributes[:'success']
66
+ end
67
+
68
+ if attributes.key?(:'data')
69
+ self.data = attributes[:'data']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ success == o.success &&
94
+ data == o.data
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [success, data].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
124
+ end
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
128
+ end
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def self._deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = QSafe.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end
@@ -0,0 +1,223 @@
1
+ =begin
2
+ #QSafe PQC API
3
+
4
+ #Post-quantum cryptography SaaS API supporting ML-KEM (Kyber) and ML-DSA (Dilithium) algorithms. Provides keypair management and cryptographic operations (encrypt, decrypt, sign, verify). ## Authentication - **JWT Bearer Token** — user-based auth, obtained from `/auth/login` or `/auth/register` - **API Key (header)** — programmatic access via `X-API-Key` header - **API Key (query)** — programmatic access via `?api_key=` query parameter ## Quick Start 1. Register → `POST /auth/register` 2. Login → `POST /auth/login` → copy `data.token` 3. Generate keypair → `POST /generate-keypair` 4. Encrypt / Sign with the keypair ID
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: rushikesh.n.kakadiya@gmail.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.9.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module QSafe
17
+ class GetApiKeyUsage200Response
18
+ attr_accessor :success
19
+
20
+ attr_accessor :data
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'success' => :'success',
26
+ :'data' => :'data'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'success' => :'Boolean',
39
+ :'data' => :'GetApiKeyUsage200ResponseData'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `QSafe::GetApiKeyUsage200Response` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `QSafe::GetApiKeyUsage200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'success')
65
+ self.success = attributes[:'success']
66
+ end
67
+
68
+ if attributes.key?(:'data')
69
+ self.data = attributes[:'data']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ success == o.success &&
94
+ data == o.data
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [success, data].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
124
+ end
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
128
+ end
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def self._deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = QSafe.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end