clerk-http-client 0.0.1

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 (518) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +87 -0
  4. data/README.md +360 -0
  5. data/Rakefile +10 -0
  6. data/bin/fmt +5 -0
  7. data/bin/generate +8 -0
  8. data/bin/setup +7 -0
  9. data/clerk-http-client.gemspec +41 -0
  10. data/docs/ActorToken.md +34 -0
  11. data/docs/ActorTokensApi.md +147 -0
  12. data/docs/AddDomainRequest.md +22 -0
  13. data/docs/Admin.md +24 -0
  14. data/docs/AllowListBlockListApi.md +421 -0
  15. data/docs/AllowlistIdentifier.md +32 -0
  16. data/docs/BetaFeaturesApi.md +217 -0
  17. data/docs/BlocklistIdentifier.md +30 -0
  18. data/docs/BlocklistIdentifiers.md +20 -0
  19. data/docs/CNameTarget.md +22 -0
  20. data/docs/ChangeProductionInstanceDomainRequest.md +20 -0
  21. data/docs/ClerkError.md +26 -0
  22. data/docs/ClerkErrors.md +20 -0
  23. data/docs/Client.md +34 -0
  24. data/docs/ClientsApi.md +221 -0
  25. data/docs/CreateActorTokenRequest.md +24 -0
  26. data/docs/CreateAllowlistIdentifierRequest.md +20 -0
  27. data/docs/CreateBlocklistIdentifierRequest.md +18 -0
  28. data/docs/CreateEmailAddressRequest.md +24 -0
  29. data/docs/CreateInvitationRequest.md +28 -0
  30. data/docs/CreateJWTTemplateRequest.md +30 -0
  31. data/docs/CreateOAuthApplicationRequest.md +24 -0
  32. data/docs/CreateOrganizationDomainRequest.md +22 -0
  33. data/docs/CreateOrganizationInvitationBulkRequestInner.md +28 -0
  34. data/docs/CreateOrganizationInvitationRequest.md +28 -0
  35. data/docs/CreateOrganizationMembershipRequest.md +20 -0
  36. data/docs/CreateOrganizationRequest.md +30 -0
  37. data/docs/CreatePhoneNumberRequest.md +26 -0
  38. data/docs/CreateRedirectURLRequest.md +18 -0
  39. data/docs/CreateSAMLConnectionRequest.md +34 -0
  40. data/docs/CreateSAMLConnectionRequestAttributeMapping.md +24 -0
  41. data/docs/CreateSessionTokenFromTemplate200Response.md +20 -0
  42. data/docs/CreateSignInTokenRequest.md +20 -0
  43. data/docs/CreateUserRequest.md +62 -0
  44. data/docs/DeletedObject.md +24 -0
  45. data/docs/DisableMFA200Response.md +18 -0
  46. data/docs/Domain.md +34 -0
  47. data/docs/Domains.md +20 -0
  48. data/docs/DomainsApi.md +286 -0
  49. data/docs/EmailAddress.md +32 -0
  50. data/docs/EmailAddressVerification.md +51 -0
  51. data/docs/EmailAddressesApi.md +289 -0
  52. data/docs/EmailSMSTemplatesApi.md +449 -0
  53. data/docs/GetOAuthAccessToken200ResponseInner.md +34 -0
  54. data/docs/IdentificationLink.md +20 -0
  55. data/docs/InstanceRestrictions.md +26 -0
  56. data/docs/InstanceSettingsApi.md +216 -0
  57. data/docs/Invitation.md +36 -0
  58. data/docs/InvitationsApi.md +223 -0
  59. data/docs/JWKSApi.md +74 -0
  60. data/docs/JWTTemplate.md +36 -0
  61. data/docs/JWTTemplatesApi.md +354 -0
  62. data/docs/MergeOrganizationMetadataRequest.md +20 -0
  63. data/docs/MiscellaneousApi.md +75 -0
  64. data/docs/OAuthApplication.md +42 -0
  65. data/docs/OAuthApplicationWithSecret.md +44 -0
  66. data/docs/OAuthApplications.md +20 -0
  67. data/docs/OAuthApplicationsApi.md +433 -0
  68. data/docs/OTP.md +24 -0
  69. data/docs/Oauth.md +28 -0
  70. data/docs/OauthError.md +47 -0
  71. data/docs/Organization.md +40 -0
  72. data/docs/OrganizationDomain.md +38 -0
  73. data/docs/OrganizationDomainApi.md +81 -0
  74. data/docs/OrganizationDomainVerification.md +24 -0
  75. data/docs/OrganizationDomains.md +20 -0
  76. data/docs/OrganizationDomainsApi.md +231 -0
  77. data/docs/OrganizationInvitation.md +38 -0
  78. data/docs/OrganizationInvitationWithPublicOrganizationData.md +40 -0
  79. data/docs/OrganizationInvitationWithPublicOrganizationDataPublicOrganizationData.md +26 -0
  80. data/docs/OrganizationInvitations.md +20 -0
  81. data/docs/OrganizationInvitationsApi.md +533 -0
  82. data/docs/OrganizationInvitationsWithPublicOrganizationData.md +20 -0
  83. data/docs/OrganizationMembership.md +38 -0
  84. data/docs/OrganizationMembershipPublicUserData.md +30 -0
  85. data/docs/OrganizationMemberships.md +20 -0
  86. data/docs/OrganizationMembershipsApi.md +453 -0
  87. data/docs/OrganizationSettings.md +36 -0
  88. data/docs/OrganizationWithLogo.md +46 -0
  89. data/docs/Organizations.md +20 -0
  90. data/docs/OrganizationsApi.md +591 -0
  91. data/docs/Passkey.md +26 -0
  92. data/docs/PhoneNumber.md +38 -0
  93. data/docs/PhoneNumberVerification.md +49 -0
  94. data/docs/PhoneNumbersApi.md +289 -0
  95. data/docs/PreviewTemplateRequest.md +24 -0
  96. data/docs/ProxyCheck.md +32 -0
  97. data/docs/ProxyChecksApi.md +77 -0
  98. data/docs/RedirectURL.md +26 -0
  99. data/docs/RedirectURLsApi.md +284 -0
  100. data/docs/RevokeInvitation200Response.md +36 -0
  101. data/docs/RevokeOrganizationInvitationRequest.md +18 -0
  102. data/docs/SAML.md +28 -0
  103. data/docs/SAMLAccount.md +38 -0
  104. data/docs/SAMLAccountSamlConnection.md +47 -0
  105. data/docs/SAMLAccountVerification.md +49 -0
  106. data/docs/SAMLConnection.md +38 -0
  107. data/docs/SAMLConnections.md +20 -0
  108. data/docs/SAMLConnectionsApi.md +363 -0
  109. data/docs/SchemasPasskey.md +26 -0
  110. data/docs/SchemasPasskeyVerification.md +47 -0
  111. data/docs/SchemasSAMLConnection.md +60 -0
  112. data/docs/SchemasSAMLConnectionAttributeMapping.md +24 -0
  113. data/docs/Session.md +42 -0
  114. data/docs/SessionLatestActivity.md +34 -0
  115. data/docs/SessionsApi.md +373 -0
  116. data/docs/SignInToken.md +32 -0
  117. data/docs/SignInTokensApi.md +147 -0
  118. data/docs/SignUp.md +62 -0
  119. data/docs/SignUpsApi.md +79 -0
  120. data/docs/SvixURL.md +18 -0
  121. data/docs/TOTP.md +28 -0
  122. data/docs/Template.md +60 -0
  123. data/docs/TestingToken.md +22 -0
  124. data/docs/TestingTokensApi.md +74 -0
  125. data/docs/Ticket.md +24 -0
  126. data/docs/ToggleTemplateDeliveryRequest.md +18 -0
  127. data/docs/TotalCount.md +20 -0
  128. data/docs/UpdateDomainRequest.md +22 -0
  129. data/docs/UpdateEmailAddressRequest.md +20 -0
  130. data/docs/UpdateInstanceAuthConfig200Response.md +28 -0
  131. data/docs/UpdateInstanceAuthConfigRequest.md +28 -0
  132. data/docs/UpdateInstanceOrganizationSettingsRequest.md +30 -0
  133. data/docs/UpdateInstanceRequest.md +34 -0
  134. data/docs/UpdateInstanceRestrictionsRequest.md +26 -0
  135. data/docs/UpdateOAuthApplicationRequest.md +22 -0
  136. data/docs/UpdateOrganizationDomainRequest.md +20 -0
  137. data/docs/UpdateOrganizationMembershipMetadataRequest.md +20 -0
  138. data/docs/UpdateOrganizationMembershipRequest.md +18 -0
  139. data/docs/UpdateOrganizationRequest.md +30 -0
  140. data/docs/UpdatePhoneNumberRequest.md +22 -0
  141. data/docs/UpdateProductionInstanceDomainRequest.md +18 -0
  142. data/docs/UpdateSAMLConnectionRequest.md +42 -0
  143. data/docs/UpdateSAMLConnectionRequestAttributeMapping.md +24 -0
  144. data/docs/UpdateSignUpRequest.md +18 -0
  145. data/docs/UpdateUserMetadataRequest.md +22 -0
  146. data/docs/UpdateUserRequest.md +66 -0
  147. data/docs/UpsertTemplateRequest.md +30 -0
  148. data/docs/User.md +94 -0
  149. data/docs/UsersApi.md +1829 -0
  150. data/docs/VerifyClientRequest.md +18 -0
  151. data/docs/VerifyDomainProxyRequest.md +20 -0
  152. data/docs/VerifyPassword200Response.md +18 -0
  153. data/docs/VerifyPasswordRequest.md +18 -0
  154. data/docs/VerifySessionRequest.md +18 -0
  155. data/docs/VerifyTOTP200Response.md +20 -0
  156. data/docs/VerifyTOTPRequest.md +18 -0
  157. data/docs/Web3Signature.md +28 -0
  158. data/docs/Web3Wallet.md +28 -0
  159. data/docs/Web3WalletVerification.md +49 -0
  160. data/docs/WebhooksApi.md +207 -0
  161. data/docs/WellKnownJWKS.md +18 -0
  162. data/docs/WellKnownJWKSKeysInner.md +28 -0
  163. data/git_push.sh +57 -0
  164. data/lib/clerk-http-client/api/actor_tokens_api.rb +157 -0
  165. data/lib/clerk-http-client/api/allow_list_block_list_api.rb +410 -0
  166. data/lib/clerk-http-client/api/beta_features_api.rb +228 -0
  167. data/lib/clerk-http-client/api/clients_api.rb +234 -0
  168. data/lib/clerk-http-client/api/domains_api.rb +292 -0
  169. data/lib/clerk-http-client/api/email_addresses_api.rb +298 -0
  170. data/lib/clerk-http-client/api/email_sms_templates_api.rb +488 -0
  171. data/lib/clerk-http-client/api/instance_settings_api.rb +232 -0
  172. data/lib/clerk-http-client/api/invitations_api.rb +241 -0
  173. data/lib/clerk-http-client/api/jwks_api.rb +81 -0
  174. data/lib/clerk-http-client/api/jwt_templates_api.rb +355 -0
  175. data/lib/clerk-http-client/api/miscellaneous_api.rb +85 -0
  176. data/lib/clerk-http-client/api/o_auth_applications_api.rb +440 -0
  177. data/lib/clerk-http-client/api/organization_domain_api.rb +104 -0
  178. data/lib/clerk-http-client/api/organization_domains_api.rb +258 -0
  179. data/lib/clerk-http-client/api/organization_invitations_api.rb +586 -0
  180. data/lib/clerk-http-client/api/organization_memberships_api.rb +499 -0
  181. data/lib/clerk-http-client/api/organizations_api.rb +606 -0
  182. data/lib/clerk-http-client/api/phone_numbers_api.rb +298 -0
  183. data/lib/clerk-http-client/api/proxy_checks_api.rb +92 -0
  184. data/lib/clerk-http-client/api/redirect_urls_api.rb +281 -0
  185. data/lib/clerk-http-client/api/saml_connections_api.rb +375 -0
  186. data/lib/clerk-http-client/api/sessions_api.rb +385 -0
  187. data/lib/clerk-http-client/api/sign_in_tokens_api.rb +157 -0
  188. data/lib/clerk-http-client/api/sign_ups_api.rb +98 -0
  189. data/lib/clerk-http-client/api/testing_tokens_api.rb +81 -0
  190. data/lib/clerk-http-client/api/users_api.rb +1828 -0
  191. data/lib/clerk-http-client/api/webhooks_api.rb +199 -0
  192. data/lib/clerk-http-client/api_client.rb +437 -0
  193. data/lib/clerk-http-client/api_error.rb +58 -0
  194. data/lib/clerk-http-client/configuration.rb +393 -0
  195. data/lib/clerk-http-client/models/actor_token.rb +385 -0
  196. data/lib/clerk-http-client/models/add_domain_request.rb +249 -0
  197. data/lib/clerk-http-client/models/admin.rb +303 -0
  198. data/lib/clerk-http-client/models/allowlist_identifier.rb +327 -0
  199. data/lib/clerk-http-client/models/blocklist_identifier.rb +318 -0
  200. data/lib/clerk-http-client/models/blocklist_identifiers.rb +240 -0
  201. data/lib/clerk-http-client/models/c_name_target.rb +254 -0
  202. data/lib/clerk-http-client/models/change_production_instance_domain_request.rb +225 -0
  203. data/lib/clerk-http-client/models/clerk_error.rb +271 -0
  204. data/lib/clerk-http-client/models/clerk_errors.rb +232 -0
  205. data/lib/clerk-http-client/models/client.rb +380 -0
  206. data/lib/clerk-http-client/models/create_actor_token_request.rb +263 -0
  207. data/lib/clerk-http-client/models/create_allowlist_identifier_request.rb +234 -0
  208. data/lib/clerk-http-client/models/create_blocklist_identifier_request.rb +222 -0
  209. data/lib/clerk-http-client/models/create_email_address_request.rb +247 -0
  210. data/lib/clerk-http-client/models/create_invitation_request.rb +303 -0
  211. data/lib/clerk-http-client/models/create_jwt_template_request.rb +327 -0
  212. data/lib/clerk-http-client/models/create_o_auth_application_request.rb +261 -0
  213. data/lib/clerk-http-client/models/create_organization_domain_request.rb +236 -0
  214. data/lib/clerk-http-client/models/create_organization_invitation_bulk_request_inner.rb +280 -0
  215. data/lib/clerk-http-client/models/create_organization_invitation_request.rb +280 -0
  216. data/lib/clerk-http-client/models/create_organization_membership_request.rb +239 -0
  217. data/lib/clerk-http-client/models/create_organization_request.rb +289 -0
  218. data/lib/clerk-http-client/models/create_phone_number_request.rb +258 -0
  219. data/lib/clerk-http-client/models/create_redirect_url_request.rb +215 -0
  220. data/lib/clerk-http-client/models/create_saml_connection_request.rb +355 -0
  221. data/lib/clerk-http-client/models/create_saml_connection_request_attribute_mapping.rb +242 -0
  222. data/lib/clerk-http-client/models/create_session_token_from_template200_response.rb +257 -0
  223. data/lib/clerk-http-client/models/create_sign_in_token_request.rb +227 -0
  224. data/lib/clerk-http-client/models/create_user_request.rb +453 -0
  225. data/lib/clerk-http-client/models/deleted_object.rb +255 -0
  226. data/lib/clerk-http-client/models/disable_mfa200_response.rb +214 -0
  227. data/lib/clerk-http-client/models/domain.rb +368 -0
  228. data/lib/clerk-http-client/models/domains.rb +240 -0
  229. data/lib/clerk-http-client/models/email_address.rb +361 -0
  230. data/lib/clerk-http-client/models/email_address_verification.rb +106 -0
  231. data/lib/clerk-http-client/models/get_o_auth_access_token200_response_inner.rb +295 -0
  232. data/lib/clerk-http-client/models/identification_link.rb +271 -0
  233. data/lib/clerk-http-client/models/instance_restrictions.rb +285 -0
  234. data/lib/clerk-http-client/models/invitation.rb +388 -0
  235. data/lib/clerk-http-client/models/jwt_template.rb +387 -0
  236. data/lib/clerk-http-client/models/merge_organization_metadata_request.rb +225 -0
  237. data/lib/clerk-http-client/models/o_auth_application.rb +449 -0
  238. data/lib/clerk-http-client/models/o_auth_application_with_secret.rb +466 -0
  239. data/lib/clerk-http-client/models/o_auth_applications.rb +240 -0
  240. data/lib/clerk-http-client/models/oauth.rb +328 -0
  241. data/lib/clerk-http-client/models/oauth_error.rb +104 -0
  242. data/lib/clerk-http-client/models/organization.rb +413 -0
  243. data/lib/clerk-http-client/models/organization_domain.rb +364 -0
  244. data/lib/clerk-http-client/models/organization_domain_verification.rb +281 -0
  245. data/lib/clerk-http-client/models/organization_domains.rb +240 -0
  246. data/lib/clerk-http-client/models/organization_invitation.rb +342 -0
  247. data/lib/clerk-http-client/models/organization_invitation_with_public_organization_data.rb +351 -0
  248. data/lib/clerk-http-client/models/organization_invitation_with_public_organization_data_public_organization_data.rb +250 -0
  249. data/lib/clerk-http-client/models/organization_invitations.rb +240 -0
  250. data/lib/clerk-http-client/models/organization_invitations_with_public_organization_data.rb +240 -0
  251. data/lib/clerk-http-client/models/organization_membership.rb +346 -0
  252. data/lib/clerk-http-client/models/organization_membership_public_user_data.rb +272 -0
  253. data/lib/clerk-http-client/models/organization_memberships.rb +240 -0
  254. data/lib/clerk-http-client/models/organization_settings.rb +391 -0
  255. data/lib/clerk-http-client/models/organization_with_logo.rb +454 -0
  256. data/lib/clerk-http-client/models/organizations.rb +240 -0
  257. data/lib/clerk-http-client/models/otp.rb +315 -0
  258. data/lib/clerk-http-client/models/passkey.rb +324 -0
  259. data/lib/clerk-http-client/models/phone_number.rb +391 -0
  260. data/lib/clerk-http-client/models/phone_number_verification.rb +105 -0
  261. data/lib/clerk-http-client/models/preview_template_request.rb +246 -0
  262. data/lib/clerk-http-client/models/proxy_check.rb +367 -0
  263. data/lib/clerk-http-client/models/redirect_url.rb +321 -0
  264. data/lib/clerk-http-client/models/revoke_invitation200_response.rb +395 -0
  265. data/lib/clerk-http-client/models/revoke_organization_invitation_request.rb +216 -0
  266. data/lib/clerk-http-client/models/saml.rb +331 -0
  267. data/lib/clerk-http-client/models/saml_account.rb +381 -0
  268. data/lib/clerk-http-client/models/saml_account_saml_connection.rb +104 -0
  269. data/lib/clerk-http-client/models/saml_account_verification.rb +105 -0
  270. data/lib/clerk-http-client/models/saml_connection.rb +362 -0
  271. data/lib/clerk-http-client/models/saml_connections.rb +240 -0
  272. data/lib/clerk-http-client/models/schemas_passkey.rb +310 -0
  273. data/lib/clerk-http-client/models/schemas_passkey_verification.rb +104 -0
  274. data/lib/clerk-http-client/models/schemas_saml_connection.rb +541 -0
  275. data/lib/clerk-http-client/models/schemas_saml_connection_attribute_mapping.rb +241 -0
  276. data/lib/clerk-http-client/models/session.rb +444 -0
  277. data/lib/clerk-http-client/models/session_latest_activity.rb +300 -0
  278. data/lib/clerk-http-client/models/sign_in_token.rb +368 -0
  279. data/lib/clerk-http-client/models/sign_up.rb +517 -0
  280. data/lib/clerk-http-client/models/svix_url.rb +221 -0
  281. data/lib/clerk-http-client/models/template.rb +460 -0
  282. data/lib/clerk-http-client/models/testing_token.rb +289 -0
  283. data/lib/clerk-http-client/models/ticket.rb +303 -0
  284. data/lib/clerk-http-client/models/toggle_template_delivery_request.rb +216 -0
  285. data/lib/clerk-http-client/models/total_count.rb +272 -0
  286. data/lib/clerk-http-client/models/totp.rb +289 -0
  287. data/lib/clerk-http-client/models/update_domain_request.rb +238 -0
  288. data/lib/clerk-http-client/models/update_email_address_request.rb +227 -0
  289. data/lib/clerk-http-client/models/update_instance_auth_config200_response.rb +294 -0
  290. data/lib/clerk-http-client/models/update_instance_auth_config_request.rb +273 -0
  291. data/lib/clerk-http-client/models/update_instance_organization_settings_request.rb +277 -0
  292. data/lib/clerk-http-client/models/update_instance_request.rb +300 -0
  293. data/lib/clerk-http-client/models/update_instance_restrictions_request.rb +255 -0
  294. data/lib/clerk-http-client/models/update_o_auth_application_request.rb +237 -0
  295. data/lib/clerk-http-client/models/update_organization_domain_request.rb +227 -0
  296. data/lib/clerk-http-client/models/update_organization_membership_metadata_request.rb +225 -0
  297. data/lib/clerk-http-client/models/update_organization_membership_request.rb +222 -0
  298. data/lib/clerk-http-client/models/update_organization_request.rb +279 -0
  299. data/lib/clerk-http-client/models/update_phone_number_request.rb +238 -0
  300. data/lib/clerk-http-client/models/update_production_instance_domain_request.rb +215 -0
  301. data/lib/clerk-http-client/models/update_saml_connection_request.rb +347 -0
  302. data/lib/clerk-http-client/models/update_saml_connection_request_attribute_mapping.rb +242 -0
  303. data/lib/clerk-http-client/models/update_sign_up_request.rb +216 -0
  304. data/lib/clerk-http-client/models/update_user_metadata_request.rb +241 -0
  305. data/lib/clerk-http-client/models/update_user_request.rb +472 -0
  306. data/lib/clerk-http-client/models/upsert_template_request.rb +278 -0
  307. data/lib/clerk-http-client/models/user.rb +633 -0
  308. data/lib/clerk-http-client/models/verify_client_request.rb +215 -0
  309. data/lib/clerk-http-client/models/verify_domain_proxy_request.rb +225 -0
  310. data/lib/clerk-http-client/models/verify_password200_response.rb +214 -0
  311. data/lib/clerk-http-client/models/verify_password_request.rb +222 -0
  312. data/lib/clerk-http-client/models/verify_session_request.rb +215 -0
  313. data/lib/clerk-http-client/models/verify_totp200_response.rb +257 -0
  314. data/lib/clerk-http-client/models/verify_totp_request.rb +222 -0
  315. data/lib/clerk-http-client/models/web3_signature.rb +323 -0
  316. data/lib/clerk-http-client/models/web3_wallet.rb +327 -0
  317. data/lib/clerk-http-client/models/web3_wallet_verification.rb +105 -0
  318. data/lib/clerk-http-client/models/well_known_jwks.rb +216 -0
  319. data/lib/clerk-http-client/models/well_known_jwks_keys_inner.rb +259 -0
  320. data/lib/clerk-http-client/version.rb +15 -0
  321. data/lib/clerk-http-client.rb +321 -0
  322. data/openapitools.json +7 -0
  323. data/pkg/clerk-http-client-1.0.0.gem +0 -0
  324. data/resources/.DS_Store +0 -0
  325. data/resources/oas/bapi-2024-10-01.yml +7238 -0
  326. data/resources/templates/Gemfile.mustache +9 -0
  327. data/resources/templates/README.mustache +163 -0
  328. data/resources/templates/Rakefile.mustache +10 -0
  329. data/resources/templates/api.mustache +257 -0
  330. data/resources/templates/api_client.mustache +246 -0
  331. data/resources/templates/api_client_faraday_partial.mustache +200 -0
  332. data/resources/templates/api_client_httpx_partial.mustache +134 -0
  333. data/resources/templates/api_client_typhoeus_partial.mustache +161 -0
  334. data/resources/templates/api_doc.mustache +132 -0
  335. data/resources/templates/api_error.mustache +50 -0
  336. data/resources/templates/api_info.mustache +12 -0
  337. data/resources/templates/api_test.mustache +47 -0
  338. data/resources/templates/base_object.mustache +114 -0
  339. data/resources/templates/configuration.mustache +491 -0
  340. data/resources/templates/configuration_faraday_partial.mustache +40 -0
  341. data/resources/templates/configuration_httpx_partial.mustache +11 -0
  342. data/resources/templates/configuration_typhoeus_partial.mustache +41 -0
  343. data/resources/templates/gem.mustache +89 -0
  344. data/resources/templates/gemspec.mustache +41 -0
  345. data/resources/templates/git_push.sh.mustache +57 -0
  346. data/resources/templates/gitignore.mustache +39 -0
  347. data/resources/templates/gitlab-ci.mustache +26 -0
  348. data/resources/templates/model.mustache +33 -0
  349. data/resources/templates/model_doc.mustache +12 -0
  350. data/resources/templates/model_test.mustache +82 -0
  351. data/resources/templates/partial_anyof_module.mustache +94 -0
  352. data/resources/templates/partial_model_enum_class.mustache +23 -0
  353. data/resources/templates/partial_model_generic.mustache +377 -0
  354. data/resources/templates/partial_model_generic_doc.mustache +28 -0
  355. data/resources/templates/partial_oneof_module.mustache +137 -0
  356. data/resources/templates/partial_oneof_module_doc.mustache +93 -0
  357. data/resources/templates/rspec.mustache +2 -0
  358. data/resources/templates/rubocop.mustache +148 -0
  359. data/resources/templates/spec_helper.mustache +103 -0
  360. data/resources/templates/travis.mustache +11 -0
  361. data/resources/templates/version.mustache +7 -0
  362. data/sdk-generator-config.json +20 -0
  363. data/spec/api/actor_tokens_api_spec.rb +59 -0
  364. data/spec/api/allow_list_block_list_api_spec.rb +105 -0
  365. data/spec/api/beta_features_api_spec.rb +71 -0
  366. data/spec/api/clients_api_spec.rb +72 -0
  367. data/spec/api/domains_api_spec.rb +83 -0
  368. data/spec/api/email_addresses_api_spec.rb +84 -0
  369. data/spec/api/email_sms_templates_api_spec.rb +115 -0
  370. data/spec/api/instance_settings_api_spec.rb +71 -0
  371. data/spec/api/invitations_api_spec.rb +73 -0
  372. data/spec/api/jwks_api_spec.rb +46 -0
  373. data/spec/api/jwt_templates_api_spec.rb +94 -0
  374. data/spec/api/miscellaneous_api_spec.rb +48 -0
  375. data/spec/api/o_auth_applications_api_spec.rb +109 -0
  376. data/spec/api/organization_domain_api_spec.rb +49 -0
  377. data/spec/api/organization_domains_api_spec.rb +77 -0
  378. data/spec/api/organization_invitations_api_spec.rb +133 -0
  379. data/spec/api/organization_memberships_api_spec.rb +118 -0
  380. data/spec/api/organizations_api_spec.rb +139 -0
  381. data/spec/api/phone_numbers_api_spec.rb +84 -0
  382. data/spec/api/proxy_checks_api_spec.rb +47 -0
  383. data/spec/api/redirect_urls_api_spec.rb +82 -0
  384. data/spec/api/saml_connections_api_spec.rb +97 -0
  385. data/spec/api/sessions_api_spec.rb +101 -0
  386. data/spec/api/sign_in_tokens_api_spec.rb +59 -0
  387. data/spec/api/sign_ups_api_spec.rb +48 -0
  388. data/spec/api/testing_tokens_api_spec.rb +46 -0
  389. data/spec/api/users_api_spec.rb +366 -0
  390. data/spec/api/webhooks_api_spec.rb +68 -0
  391. data/spec/models/actor_token_spec.rb +92 -0
  392. data/spec/models/add_domain_request_spec.rb +48 -0
  393. data/spec/models/admin_spec.rb +62 -0
  394. data/spec/models/allowlist_identifier_spec.rb +86 -0
  395. data/spec/models/blocklist_identifier_spec.rb +80 -0
  396. data/spec/models/blocklist_identifiers_spec.rb +42 -0
  397. data/spec/models/c_name_target_spec.rb +48 -0
  398. data/spec/models/change_production_instance_domain_request_spec.rb +42 -0
  399. data/spec/models/clerk_error_spec.rb +60 -0
  400. data/spec/models/clerk_errors_spec.rb +42 -0
  401. data/spec/models/client_spec.rb +88 -0
  402. data/spec/models/create_actor_token_request_spec.rb +54 -0
  403. data/spec/models/create_allowlist_identifier_request_spec.rb +42 -0
  404. data/spec/models/create_blocklist_identifier_request_spec.rb +36 -0
  405. data/spec/models/create_email_address_request_spec.rb +54 -0
  406. data/spec/models/create_invitation_request_spec.rb +66 -0
  407. data/spec/models/create_jwt_template_request_spec.rb +72 -0
  408. data/spec/models/create_o_auth_application_request_spec.rb +54 -0
  409. data/spec/models/create_organization_domain_request_spec.rb +48 -0
  410. data/spec/models/create_organization_invitation_bulk_request_inner_spec.rb +66 -0
  411. data/spec/models/create_organization_invitation_request_spec.rb +66 -0
  412. data/spec/models/create_organization_membership_request_spec.rb +42 -0
  413. data/spec/models/create_organization_request_spec.rb +72 -0
  414. data/spec/models/create_phone_number_request_spec.rb +60 -0
  415. data/spec/models/create_redirect_url_request_spec.rb +36 -0
  416. data/spec/models/create_saml_connection_request_attribute_mapping_spec.rb +54 -0
  417. data/spec/models/create_saml_connection_request_spec.rb +88 -0
  418. data/spec/models/create_session_token_from_template200_response_spec.rb +46 -0
  419. data/spec/models/create_sign_in_token_request_spec.rb +42 -0
  420. data/spec/models/create_user_request_spec.rb +168 -0
  421. data/spec/models/deleted_object_spec.rb +54 -0
  422. data/spec/models/disable_mfa200_response_spec.rb +36 -0
  423. data/spec/models/domain_spec.rb +88 -0
  424. data/spec/models/domains_spec.rb +42 -0
  425. data/spec/models/email_address_spec.rb +82 -0
  426. data/spec/models/email_address_verification_spec.rb +32 -0
  427. data/spec/models/get_o_auth_access_token200_response_inner_spec.rb +84 -0
  428. data/spec/models/identification_link_spec.rb +46 -0
  429. data/spec/models/instance_restrictions_spec.rb +64 -0
  430. data/spec/models/invitation_spec.rb +98 -0
  431. data/spec/models/jwt_template_spec.rb +94 -0
  432. data/spec/models/merge_organization_metadata_request_spec.rb +42 -0
  433. data/spec/models/o_auth_application_spec.rb +112 -0
  434. data/spec/models/o_auth_application_with_secret_spec.rb +118 -0
  435. data/spec/models/o_auth_applications_spec.rb +42 -0
  436. data/spec/models/oauth_error_spec.rb +32 -0
  437. data/spec/models/oauth_spec.rb +74 -0
  438. data/spec/models/organization_domain_spec.rb +104 -0
  439. data/spec/models/organization_domain_verification_spec.rb +58 -0
  440. data/spec/models/organization_domains_spec.rb +42 -0
  441. data/spec/models/organization_invitation_spec.rb +100 -0
  442. data/spec/models/organization_invitation_with_public_organization_data_public_organization_data_spec.rb +60 -0
  443. data/spec/models/organization_invitation_with_public_organization_data_spec.rb +106 -0
  444. data/spec/models/organization_invitations_spec.rb +42 -0
  445. data/spec/models/organization_invitations_with_public_organization_data_spec.rb +42 -0
  446. data/spec/models/organization_membership_public_user_data_spec.rb +72 -0
  447. data/spec/models/organization_membership_spec.rb +100 -0
  448. data/spec/models/organization_memberships_spec.rb +42 -0
  449. data/spec/models/organization_settings_spec.rb +98 -0
  450. data/spec/models/organization_spec.rb +106 -0
  451. data/spec/models/organization_with_logo_spec.rb +124 -0
  452. data/spec/models/organizations_spec.rb +42 -0
  453. data/spec/models/otp_spec.rb +62 -0
  454. data/spec/models/passkey_spec.rb +72 -0
  455. data/spec/models/phone_number_spec.rb +100 -0
  456. data/spec/models/phone_number_verification_spec.rb +32 -0
  457. data/spec/models/preview_template_request_spec.rb +54 -0
  458. data/spec/models/proxy_check_spec.rb +82 -0
  459. data/spec/models/redirect_url_spec.rb +64 -0
  460. data/spec/models/revoke_invitation200_response_spec.rb +98 -0
  461. data/spec/models/revoke_organization_invitation_request_spec.rb +36 -0
  462. data/spec/models/saml_account_saml_connection_spec.rb +32 -0
  463. data/spec/models/saml_account_spec.rb +100 -0
  464. data/spec/models/saml_account_verification_spec.rb +32 -0
  465. data/spec/models/saml_connection_spec.rb +96 -0
  466. data/spec/models/saml_connections_spec.rb +42 -0
  467. data/spec/models/saml_spec.rb +74 -0
  468. data/spec/models/schemas_passkey_spec.rb +64 -0
  469. data/spec/models/schemas_passkey_verification_spec.rb +32 -0
  470. data/spec/models/schemas_saml_connection_attribute_mapping_spec.rb +54 -0
  471. data/spec/models/schemas_saml_connection_spec.rb +166 -0
  472. data/spec/models/session_latest_activity_spec.rb +84 -0
  473. data/spec/models/session_spec.rb +116 -0
  474. data/spec/models/sign_in_token_spec.rb +86 -0
  475. data/spec/models/sign_up_spec.rb +176 -0
  476. data/spec/models/svix_url_spec.rb +36 -0
  477. data/spec/models/template_spec.rb +166 -0
  478. data/spec/models/testing_token_spec.rb +52 -0
  479. data/spec/models/ticket_spec.rb +62 -0
  480. data/spec/models/toggle_template_delivery_request_spec.rb +36 -0
  481. data/spec/models/total_count_spec.rb +46 -0
  482. data/spec/models/totp_spec.rb +66 -0
  483. data/spec/models/update_domain_request_spec.rb +48 -0
  484. data/spec/models/update_email_address_request_spec.rb +42 -0
  485. data/spec/models/update_instance_auth_config200_response_spec.rb +70 -0
  486. data/spec/models/update_instance_auth_config_request_spec.rb +66 -0
  487. data/spec/models/update_instance_organization_settings_request_spec.rb +72 -0
  488. data/spec/models/update_instance_request_spec.rb +84 -0
  489. data/spec/models/update_instance_restrictions_request_spec.rb +60 -0
  490. data/spec/models/update_o_auth_application_request_spec.rb +48 -0
  491. data/spec/models/update_organization_domain_request_spec.rb +42 -0
  492. data/spec/models/update_organization_membership_metadata_request_spec.rb +42 -0
  493. data/spec/models/update_organization_membership_request_spec.rb +36 -0
  494. data/spec/models/update_organization_request_spec.rb +72 -0
  495. data/spec/models/update_phone_number_request_spec.rb +48 -0
  496. data/spec/models/update_production_instance_domain_request_spec.rb +36 -0
  497. data/spec/models/update_saml_connection_request_attribute_mapping_spec.rb +54 -0
  498. data/spec/models/update_saml_connection_request_spec.rb +108 -0
  499. data/spec/models/update_sign_up_request_spec.rb +36 -0
  500. data/spec/models/update_user_metadata_request_spec.rb +48 -0
  501. data/spec/models/update_user_request_spec.rb +180 -0
  502. data/spec/models/upsert_template_request_spec.rb +72 -0
  503. data/spec/models/user_spec.rb +268 -0
  504. data/spec/models/verify_client_request_spec.rb +36 -0
  505. data/spec/models/verify_domain_proxy_request_spec.rb +42 -0
  506. data/spec/models/verify_password200_response_spec.rb +36 -0
  507. data/spec/models/verify_password_request_spec.rb +36 -0
  508. data/spec/models/verify_session_request_spec.rb +36 -0
  509. data/spec/models/verify_totp200_response_spec.rb +46 -0
  510. data/spec/models/verify_totp_request_spec.rb +36 -0
  511. data/spec/models/web3_signature_spec.rb +74 -0
  512. data/spec/models/web3_wallet_spec.rb +70 -0
  513. data/spec/models/web3_wallet_verification_spec.rb +32 -0
  514. data/spec/models/well_known_jwks_keys_inner_spec.rb +66 -0
  515. data/spec/models/well_known_jwks_spec.rb +36 -0
  516. data/spec/spec_helper.rb +111 -0
  517. data/test.rb +2 -0
  518. metadata +782 -0
@@ -0,0 +1,47 @@
1
+ =begin
2
+ {{> api_info}}
3
+ =end
4
+
5
+ require 'spec_helper'
6
+ require 'json'
7
+
8
+ # Unit tests for {{moduleName}}::{{classname}}
9
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
10
+ # Please update as you see appropriate
11
+ {{#operations}}describe '{{classname}}' do
12
+ before do
13
+ # run before each test
14
+ @api_instance = {{moduleName}}::{{classname}}.new
15
+ end
16
+
17
+ after do
18
+ # run after each test
19
+ end
20
+
21
+ describe 'test an instance of {{classname}}' do
22
+ it 'should create an instance of {{classname}}' do
23
+ expect(@api_instance).to be_instance_of({{moduleName}}::{{classname}})
24
+ end
25
+ end
26
+
27
+ {{#operation}}
28
+ # unit tests for {{operationId}}
29
+ {{#summary}}
30
+ # {{.}}
31
+ {{/summary}}
32
+ {{#notes}}
33
+ # {{.}}
34
+ {{/notes}}
35
+ {{#allParams}}{{#required}} # @param {{paramName}} {{description}}
36
+ {{/required}}{{/allParams}} # @param [Hash] opts the optional parameters
37
+ {{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}
38
+ {{/required}}{{/allParams}} # @return [{{{returnType}}}{{^returnType}}nil{{/returnType}}]
39
+ describe '{{operationId}} test' do
40
+ it 'should work' do
41
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
42
+ end
43
+ end
44
+
45
+ {{/operation}}
46
+ end
47
+ {{/operations}}
@@ -0,0 +1,114 @@
1
+ # Builds the object from hash
2
+ # @param [Hash] attributes Model attributes in the form of hash
3
+ # @return [Object] Returns the model itself
4
+ def self.build_from_hash(attributes)
5
+ return nil unless attributes.is_a?(Hash)
6
+ {{#parent}}
7
+ super(attributes)
8
+ {{/parent}}
9
+ attributes = attributes.transform_keys(&:to_sym)
10
+ transformed_hash = {}
11
+ openapi_types.each_pair do |key, type|
12
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
13
+ transformed_hash["#{key}"] = nil
14
+ elsif type =~ /\AArray<(.*)>/i
15
+ # check to ensure the input is an array given that the attribute
16
+ # is documented as an array but the input is not
17
+ if attributes[attribute_map[key]].is_a?(Array)
18
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
19
+ end
20
+ elsif !attributes[attribute_map[key]].nil?
21
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
22
+ end
23
+ end
24
+ new(transformed_hash)
25
+ end
26
+
27
+ # Deserializes the data based on type
28
+ # @param string type Data type
29
+ # @param string value Value to be deserialized
30
+ # @return [Object] Deserialized data
31
+ def self._deserialize(type, value)
32
+ case type.to_sym
33
+ when :Time
34
+ Time.parse(value)
35
+ when :Date
36
+ Date.parse(value)
37
+ when :String
38
+ value.to_s
39
+ when :Integer
40
+ value.to_i
41
+ when :Float
42
+ value.to_f
43
+ when :Boolean
44
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
45
+ true
46
+ else
47
+ false
48
+ end
49
+ when :Object
50
+ # generic object (usually a Hash), return directly
51
+ value
52
+ when /\AArray<(?<inner_type>.+)>\z/
53
+ inner_type = Regexp.last_match[:inner_type]
54
+ value.map { |v| _deserialize(inner_type, v) }
55
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
56
+ k_type = Regexp.last_match[:k_type]
57
+ v_type = Regexp.last_match[:v_type]
58
+ {}.tap do |hash|
59
+ value.each do |k, v|
60
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
61
+ end
62
+ end
63
+ else # model
64
+ # models (e.g. Pet) or oneOf
65
+ klass = {{moduleName}}.const_get(type)
66
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
67
+ end
68
+ end
69
+
70
+ # Returns the string representation of the object
71
+ # @return [String] String presentation of the object
72
+ def to_s
73
+ to_hash.to_s
74
+ end
75
+
76
+ # to_body is an alias to to_hash (backward compatibility)
77
+ # @return [Hash] Returns the object in the form of hash
78
+ def to_body
79
+ to_hash
80
+ end
81
+
82
+ # Returns the object in the form of hash
83
+ # @return [Hash] Returns the object in the form of hash
84
+ def to_hash
85
+ hash = {{^parent}}{}{{/parent}}{{#parent}}super{{/parent}}
86
+ self.class.attribute_map.each_pair do |attr, param|
87
+ value = self.send(attr)
88
+ if value.nil?
89
+ is_nullable = self.class.openapi_nullable.include?(attr)
90
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
91
+ end
92
+
93
+ hash[param] = _to_hash(value)
94
+ end
95
+ hash
96
+ end
97
+
98
+ # Outputs non-array value in the form of hash
99
+ # For object, use to_hash. Otherwise, just return the value
100
+ # @param [Object] value Any valid value
101
+ # @return [Hash] Returns the value in the form of hash
102
+ def _to_hash(value)
103
+ if value.is_a?(Array)
104
+ value.compact.map { |v| _to_hash(v) }
105
+ elsif value.is_a?(Hash)
106
+ {}.tap do |hash|
107
+ value.each { |k, v| hash[k] = _to_hash(v) }
108
+ end
109
+ elsif value.respond_to? :to_hash
110
+ value.to_hash
111
+ else
112
+ value
113
+ end
114
+ end
@@ -0,0 +1,491 @@
1
+ =begin
2
+ {{> api_info}}
3
+ =end
4
+
5
+ module {{moduleName}}
6
+ class Configuration
7
+ # Defines url scheme
8
+ attr_accessor :scheme
9
+
10
+ # Defines url host
11
+ attr_accessor :host
12
+
13
+ # Defines url base path
14
+ attr_accessor :base_path
15
+
16
+ # Define server configuration index
17
+ attr_accessor :server_index
18
+
19
+ # Define server operation configuration index
20
+ attr_accessor :server_operation_index
21
+
22
+ # Default server variables
23
+ attr_accessor :server_variables
24
+
25
+ # Default server operation variables
26
+ attr_accessor :server_operation_variables
27
+
28
+ # Defines API keys used with API Key authentications.
29
+ #
30
+ # @return [Hash] key: parameter name, value: parameter value (API key)
31
+ #
32
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
33
+ # config.api_key['api_key'] = 'xxx'
34
+ attr_accessor :api_key
35
+
36
+ # Defines API key prefixes used with API Key authentications.
37
+ #
38
+ # @return [Hash] key: parameter name, value: API key prefix
39
+ #
40
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
41
+ # config.api_key_prefix['api_key'] = 'Token'
42
+ attr_accessor :api_key_prefix
43
+
44
+ # Defines the username used with HTTP basic authentication.
45
+ #
46
+ # @return [String]
47
+ attr_accessor :username
48
+
49
+ # Defines the password used with HTTP basic authentication.
50
+ #
51
+ # @return [String]
52
+ attr_accessor :password
53
+
54
+ # Defines the access token (Bearer) used with OAuth2.
55
+ attr_accessor :access_token
56
+
57
+ # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
58
+ # Overrides the access_token if set
59
+ # @return [Proc]
60
+ attr_accessor :access_token_getter
61
+
62
+ # Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
63
+ # HTTP responses with return type `File` will be returned as a stream of binary data.
64
+ # Default to false.
65
+ attr_accessor :return_binary_data
66
+
67
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
68
+ # details will be logged with `logger.debug` (see the `logger` attribute).
69
+ # Default to false.
70
+ #
71
+ # @return [true, false]
72
+ attr_accessor :debugging
73
+
74
+ # Set this to ignore operation servers for the API client. This is useful when you need to
75
+ # send requests to a different server than the one specified in the OpenAPI document.
76
+ # Will default to the base url defined in the spec but can be overridden by setting
77
+ # `scheme`, `host`, `base_path` directly.
78
+ # Default to false.
79
+ # @return [true, false]
80
+ attr_accessor :ignore_operation_servers
81
+
82
+ # Defines the logger used for debugging.
83
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
84
+ #
85
+ # @return [#debug]
86
+ attr_accessor :logger
87
+
88
+ # Defines the temporary folder to store downloaded files
89
+ # (for API endpoints that have file response).
90
+ # Default to use `Tempfile`.
91
+ #
92
+ # @return [String]
93
+ attr_accessor :temp_folder_path
94
+
95
+ # The time limit for HTTP request in seconds.
96
+ # Default to 0 (never times out).
97
+ attr_accessor :timeout
98
+
99
+ # Set this to false to skip client side validation in the operation.
100
+ # Default to true.
101
+ # @return [true, false]
102
+ attr_accessor :client_side_validation
103
+
104
+ {{#isTyphoeus}}
105
+ {{> configuration_typhoeus_partial}}
106
+ {{/isTyphoeus}}
107
+ {{#isFaraday}}
108
+ {{> configuration_faraday_partial}}
109
+ {{/isFaraday}}
110
+ {{#isHttpx}}
111
+ {{> configuration_httpx_partial}}
112
+ {{/isHttpx}}
113
+
114
+ attr_accessor :inject_format
115
+
116
+ attr_accessor :force_ending_format
117
+
118
+ def initialize
119
+ @scheme = '{{scheme}}'
120
+ @host = '{{host}}{{#port}}:{{{.}}}{{/port}}'
121
+ @base_path = '{{contextPath}}'
122
+ @server_index = nil
123
+ @server_operation_index = {}
124
+ @server_variables = {}
125
+ @server_operation_variables = {}
126
+ @api_key = {}
127
+ @api_key_prefix = {}
128
+ @client_side_validation = true
129
+ {{#isFaraday}}
130
+ @ssl_verify = true
131
+ @ssl_verify_mode = nil
132
+ @ssl_ca_file = nil
133
+ @ssl_client_cert = nil
134
+ @ssl_client_key = nil
135
+ @middlewares = Hash.new { |h, k| h[k] = [] }
136
+ @configure_connection_blocks = []
137
+ @timeout = 60
138
+ # return data as binary instead of file
139
+ @return_binary_data = false
140
+ @params_encoder = nil
141
+ {{/isFaraday}}
142
+ {{#isTyphoeus}}
143
+ @verify_ssl = true
144
+ @verify_ssl_host = true
145
+ @cert_file = nil
146
+ @key_file = nil
147
+ @timeout = 0
148
+ @params_encoding = nil
149
+ {{/isTyphoeus}}
150
+ {{#isHttpx}}
151
+ @ssl = nil
152
+ @proxy = nil
153
+ @timeout = 60
154
+ @configure_session_blocks = []
155
+ {{/isHttpx}}
156
+ @debugging = false
157
+ @ignore_operation_servers = false
158
+ @inject_format = false
159
+ @force_ending_format = false
160
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
161
+
162
+ yield(self) if block_given?
163
+ end
164
+
165
+ # The default Configuration object.
166
+ def self.default
167
+ @@default ||= Configuration.new
168
+ end
169
+
170
+ def configure
171
+ yield(self) if block_given?
172
+ end
173
+
174
+ def scheme=(scheme)
175
+ # remove :// from scheme
176
+ @scheme = scheme.sub(/:\/\//, '')
177
+ end
178
+
179
+ def host=(host)
180
+ # remove http(s):// and anything after a slash
181
+ @host = host.sub(/https?:\/\//, '').split('/').first
182
+ end
183
+
184
+ def base_path=(base_path)
185
+ # Add leading and trailing slashes to base_path
186
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
187
+ @base_path = '' if @base_path == '/'
188
+ end
189
+
190
+ # Returns base URL for specified operation based on server settings
191
+ def base_url(operation = nil)
192
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
193
+ if operation_server_settings.key?(operation) then
194
+ index = server_operation_index.fetch(operation, server_index)
195
+ server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
196
+ else
197
+ server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
198
+ end
199
+ end
200
+
201
+ # Gets API key (with prefix if set).
202
+ # @param [String] param_name the parameter name of API key auth
203
+ def api_key_with_prefix(param_name, param_alias = nil)
204
+ key = @api_key[param_name]
205
+ key = @api_key.fetch(param_alias, key) unless param_alias.nil?
206
+ if @api_key_prefix[param_name]
207
+ "#{@api_key_prefix[param_name]} #{key}"
208
+ else
209
+ key
210
+ end
211
+ end
212
+
213
+ # Gets access_token using access_token_getter or uses the static access_token
214
+ def access_token_with_refresh
215
+ return access_token if access_token_getter.nil?
216
+ access_token_getter.call
217
+ end
218
+
219
+ # Gets Basic Auth token string
220
+ def basic_auth_token
221
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
222
+ end
223
+
224
+ # Returns Auth Settings hash for api client.
225
+ def auth_settings
226
+ {
227
+ {{#authMethods}}
228
+ {{#isApiKey}}
229
+ '{{name}}' =>
230
+ {
231
+ type: 'api_key',
232
+ in: {{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{#isKeyInQuery}}'query'{{/isKeyInQuery}},
233
+ key: '{{keyParamName}}',
234
+ value: api_key_with_prefix('{{keyParamName}}'{{#vendorExtensions.x-auth-id-alias}}, '{{.}}'{{/vendorExtensions.x-auth-id-alias}})
235
+ },
236
+ {{/isApiKey}}
237
+ {{#isBasic}}
238
+ {{#isBasicBasic}}
239
+ '{{name}}' =>
240
+ {
241
+ type: 'basic',
242
+ in: 'header',
243
+ key: 'Authorization',
244
+ value: basic_auth_token
245
+ },
246
+ {{/isBasicBasic}}
247
+ {{#isBasicBearer}}
248
+ '{{name}}' =>
249
+ {
250
+ type: 'bearer',
251
+ in: 'header',
252
+ {{#bearerFormat}}
253
+ format: '{{{.}}}',
254
+ {{/bearerFormat}}
255
+ key: 'Authorization',
256
+ value: "Bearer #{access_token_with_refresh}"
257
+ },
258
+ {{/isBasicBearer}}
259
+ {{/isBasic}}
260
+ {{#isOAuth}}
261
+ '{{name}}' =>
262
+ {
263
+ type: 'oauth2',
264
+ in: 'header',
265
+ key: 'Authorization',
266
+ value: "Bearer #{access_token_with_refresh}"
267
+ },
268
+ {{/isOAuth}}
269
+ {{/authMethods}}
270
+ }
271
+ end
272
+
273
+ # Returns an array of Server setting
274
+ def server_settings
275
+ [
276
+ {{#servers}}
277
+ {
278
+ url: "{{{url}}}",
279
+ description: "{{{description}}}{{^description}}No description provided{{/description}}",
280
+ {{#variables}}
281
+ {{#-first}}
282
+ variables: {
283
+ {{/-first}}
284
+ {{{name}}}: {
285
+ description: "{{{description}}}{{^description}}No description provided{{/description}}",
286
+ default_value: "{{{defaultValue}}}",
287
+ {{#enumValues}}
288
+ {{#-first}}
289
+ enum_values: [
290
+ {{/-first}}
291
+ "{{{.}}}"{{^-last}},{{/-last}}
292
+ {{#-last}}
293
+ ]
294
+ {{/-last}}
295
+ {{/enumValues}}
296
+ }{{^-last}},{{/-last}}
297
+ {{#-last}}
298
+ }
299
+ {{/-last}}
300
+ {{/variables}}
301
+ }{{^-last}},{{/-last}}
302
+ {{/servers}}
303
+ ]
304
+ end
305
+
306
+ def operation_server_settings
307
+ {
308
+ {{#apiInfo}}
309
+ {{#apis}}
310
+ {{#operations}}
311
+ {{#operation}}
312
+ {{#servers}}
313
+ {{#-first}}
314
+ "{{{classname}}}.{{{nickname}}}": [
315
+ {{/-first}}
316
+ {
317
+ url: "{{{url}}}",
318
+ description: "{{{description}}}{{^description}}No description provided{{/description}}",
319
+ {{#variables}}
320
+ {{#-first}}
321
+ variables: {
322
+ {{/-first}}
323
+ {{{name}}}: {
324
+ description: "{{{description}}}{{^description}}No description provided{{/description}}",
325
+ default_value: "{{{defaultValue}}}",
326
+ {{#enumValues}}
327
+ {{#-first}}
328
+ enum_values: [
329
+ {{/-first}}
330
+ "{{{.}}}"{{^-last}},{{/-last}}
331
+ {{#-last}}
332
+ ]
333
+ {{/-last}}
334
+ {{/enumValues}}
335
+ }{{^-last}},{{/-last}}
336
+ {{#-last}}
337
+ }
338
+ {{/-last}}
339
+ {{/variables}}
340
+ }{{^-last}},{{/-last}}
341
+ {{#-last}}
342
+ ],
343
+ {{/-last}}
344
+ {{/servers}}
345
+ {{/operation}}
346
+ {{/operations}}
347
+ {{/apis}}
348
+ {{/apiInfo}}
349
+ }
350
+ end
351
+
352
+ # Returns URL based on server settings
353
+ #
354
+ # @param index array index of the server settings
355
+ # @param variables hash of variable and the corresponding value
356
+ def server_url(index, variables = {}, servers = nil)
357
+ servers = server_settings if servers == nil
358
+
359
+ # check array index out of bound
360
+ if (index.nil? || index < 0 || index >= servers.size)
361
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
362
+ end
363
+
364
+ server = servers[index]
365
+ url = server[:url]
366
+
367
+ return url unless server.key? :variables
368
+
369
+ # go through variable and assign a value
370
+ server[:variables].each do |name, variable|
371
+ if variables.key?(name)
372
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
373
+ url.gsub! "{" + name.to_s + "}", variables[name]
374
+ else
375
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
376
+ end
377
+ else
378
+ # use default value
379
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
380
+ end
381
+ end
382
+
383
+ url
384
+ end
385
+
386
+ {{#isFaraday}}
387
+ # Configure Faraday connection directly.
388
+ #
389
+ # ```
390
+ # c.configure_faraday_connection do |conn|
391
+ # conn.use Faraday::HttpCache, shared_cache: false, logger: logger
392
+ # conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger|
393
+ # logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]')
394
+ # end
395
+ # end
396
+ #
397
+ # c.configure_faraday_connection do |conn|
398
+ # conn.adapter :typhoeus
399
+ # end
400
+ # ```
401
+ #
402
+ # @param block [Proc] `#call`able object that takes one arg, the connection
403
+ def configure_faraday_connection(&block)
404
+ @configure_connection_blocks << block
405
+ end
406
+
407
+ def configure_connection(conn)
408
+ @configure_connection_blocks.each do |block|
409
+ block.call(conn)
410
+ end
411
+ end
412
+
413
+ # Adds middleware to the stack
414
+ def use(*middleware)
415
+ set_faraday_middleware(:use, *middleware)
416
+ end
417
+
418
+ # Adds request middleware to the stack
419
+ def request(*middleware)
420
+ set_faraday_middleware(:request, *middleware)
421
+ end
422
+
423
+ # Adds response middleware to the stack
424
+ def response(*middleware)
425
+ set_faraday_middleware(:response, *middleware)
426
+ end
427
+
428
+ # Adds Faraday middleware setting information to the stack
429
+ #
430
+ # @example Use the `set_faraday_middleware` method to set middleware information
431
+ # config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503])
432
+ # config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug })
433
+ # config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false)
434
+ # config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 })
435
+ # config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger)
436
+ # config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware)
437
+ #
438
+ # @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143
439
+ def set_faraday_middleware(operation, key, *args, &block)
440
+ unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation)
441
+ fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \
442
+ " :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete."
443
+ end
444
+
445
+ @middlewares[operation] << [key, args, block]
446
+ end
447
+ ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true)
448
+
449
+ # Set up middleware on the connection
450
+ def configure_middleware(connection)
451
+ return if @middlewares.empty?
452
+
453
+ [:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation|
454
+ next unless @middlewares.key?(operation)
455
+
456
+ @middlewares[operation].each do |key, args, block|
457
+ connection.builder.send(operation, key, *args, &block)
458
+ end
459
+ end
460
+
461
+ if @middlewares.key?(:delete)
462
+ @middlewares[:delete].each do |key, _args, _block|
463
+ connection.builder.delete(key)
464
+ end
465
+ end
466
+ end
467
+ {{/isFaraday}}
468
+
469
+ {{#isHttpx}}
470
+ # Configure Httpx session directly.
471
+ #
472
+ # ```
473
+ # c.configure_session do |http|
474
+ # http.plugin(:follow_redirects).with(debug: STDOUT, debug_level: 1)
475
+ # end
476
+ # ```
477
+ #
478
+ # @param block [Proc] `#call`able object that takes one arg, the connection
479
+ def configure_session(&block)
480
+ @configure_session_blocks << block
481
+ end
482
+
483
+
484
+ def configure(session)
485
+ @configure_session_blocks.reduce(session) do |configured_sess, block|
486
+ block.call(configured_sess)
487
+ end
488
+ end
489
+ {{/isHttpx}}
490
+ end
491
+ end
@@ -0,0 +1,40 @@
1
+ ### TLS/SSL setting
2
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
3
+ # Default to true.
4
+ #
5
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
6
+ #
7
+ # @return [true, false]
8
+ attr_accessor :ssl_verify
9
+
10
+ ### TLS/SSL setting
11
+ # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
12
+ #
13
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
14
+ #
15
+ attr_accessor :ssl_verify_mode
16
+
17
+ ### TLS/SSL setting
18
+ # Set this to customize the certificate file to verify the peer.
19
+ #
20
+ # @return [String] the path to the certificate file
21
+ attr_accessor :ssl_ca_file
22
+
23
+ ### TLS/SSL setting
24
+ # Client certificate file (for client certificate)
25
+ attr_accessor :ssl_client_cert
26
+
27
+ ### TLS/SSL setting
28
+ # Client private key file (for client certificate)
29
+ attr_accessor :ssl_client_key
30
+
31
+ ### Proxy setting
32
+ # HTTP Proxy settings
33
+ attr_accessor :proxy
34
+
35
+ # Set this to customize parameters encoder of array parameter.
36
+ # Default to nil. Faraday uses NestedParamsEncoder when nil.
37
+ #
38
+ # @see The params_encoder option of Faraday. Related source code:
39
+ # https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders
40
+ attr_accessor :params_encoder
@@ -0,0 +1,11 @@
1
+ ### TLS/SSL setting
2
+ # You can use this to customize SSL Context settings (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL/SSLContext.html
3
+ # to know which ones).
4
+ #
5
+ # @return [Hash{Symbol => Object}, OpenSSL::SSL::SSLContext, nil]
6
+ attr_accessor :ssl
7
+
8
+ ### Proxy setting
9
+ # HTTP Proxy settings (see https://honeyryderchuck.gitlab.io/httpx/wiki/Proxy#options)
10
+ # @return [Hash{Symbol => Object}, nil]
11
+ attr_accessor :proxy