clerk-http-client 1.0.0 → 2.0.0.beta2
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +155 -191
- data/clerk-http-client.gemspec +1 -1
- data/docs/ActorTokensApi.md +26 -26
- data/docs/AllowListBlockListApi.md +72 -74
- data/docs/BetaFeaturesApi.md +42 -41
- data/docs/ClientsApi.md +36 -37
- data/docs/CreateBulkInvitationsRequestInner.md +28 -0
- data/docs/CreateInvitationRequest.md +6 -4
- data/docs/{CreateOAuthApplicationRequest.md → CreateOauthApplicationRequest.md} +1 -1
- data/docs/CreateOrganizationInvitationBulkRequestInner.md +2 -2
- data/docs/CreateOrganizationInvitationRequest.md +5 -3
- data/docs/CreateOrganizationRequest.md +3 -3
- data/docs/CreateSAMLConnectionRequest.md +2 -0
- data/docs/CreateSessionRequest.md +18 -0
- data/docs/CreateSessionToken200Response.md +20 -0
- data/docs/CreateSessionTokenFromTemplateRequest.md +18 -0
- data/docs/CreateSessionTokenRequest.md +18 -0
- data/docs/CreateUserRequest.md +3 -3
- data/docs/CreateWaitlistEntryRequest.md +20 -0
- data/docs/DomainsApi.md +46 -48
- data/docs/EmailAddress.md +2 -0
- data/docs/EmailAddressVerification.md +3 -3
- data/docs/EmailAddressesApi.md +52 -52
- data/docs/EmailSMSTemplatesApi.md +60 -66
- data/docs/FromOauth.md +26 -0
- data/docs/FromOauthError.md +47 -0
- data/docs/{GetOAuthAccessToken200ResponseInner.md → GetOauthAccessToken200ResponseInner.md} +4 -2
- data/docs/Instance.md +24 -0
- data/docs/InstanceSettingsApi.md +114 -45
- data/docs/Invitation.md +1 -1
- data/docs/InvitationsApi.md +110 -38
- data/docs/JWKS.md +18 -0
- data/docs/JWKSApi.md +14 -15
- data/docs/JWKSKeysInner.md +32 -0
- data/docs/JWTTemplatesApi.md +62 -63
- data/docs/ListWaitlistEntries200Response.md +20 -0
- data/docs/MergeOrganizationMetadataRequest.md +2 -2
- data/docs/MiscellaneousApi.md +11 -7
- data/docs/{OAuthApplication.md → OauthApplication.md} +4 -0
- data/docs/{OAuthApplicationWithSecret.md → OauthApplicationWithSecret.md} +4 -0
- data/docs/{OAuthApplicationsApi.md → OauthApplicationsApi.md} +90 -94
- data/docs/Organization.md +2 -2
- data/docs/OrganizationDomainApi.md +15 -13
- data/docs/OrganizationDomainsApi.md +103 -33
- data/docs/OrganizationInvitation.md +6 -2
- data/docs/OrganizationInvitationWithPublicOrganizationData.md +4 -2
- data/docs/OrganizationInvitationsApi.md +76 -81
- data/docs/OrganizationMembership.md +2 -2
- data/docs/OrganizationMembershipsApi.md +66 -70
- data/docs/OrganizationWithLogo.md +2 -2
- data/docs/OrganizationsApi.md +87 -93
- data/docs/PhoneNumbersApi.md +52 -52
- data/docs/ProxyChecksApi.md +16 -15
- data/docs/{RedirectURLsApi.md → RedirectUrlsApi.md} +46 -48
- data/docs/RevokeInvitation200Response.md +1 -1
- data/docs/SAML.md +1 -1
- data/docs/SAMLAccount.md +1 -1
- data/docs/SAMLConnectionsApi.md +59 -60
- data/docs/SchemasSAMLConnection.md +2 -0
- data/docs/SessionsApi.md +203 -60
- data/docs/SignInTokensApi.md +26 -26
- data/docs/SignUp.md +4 -2
- data/docs/SignUpsApi.md +16 -15
- data/docs/TestingTokensApi.md +11 -12
- data/docs/UpdateOrganizationMembershipMetadataRequest.md +2 -2
- data/docs/UpdateOrganizationRequest.md +2 -2
- data/docs/UpdateSAMLConnectionRequest.md +2 -0
- data/docs/UpdateUserRequest.md +3 -3
- data/docs/User.md +3 -3
- data/docs/UsersApi.md +297 -294
- data/docs/WaitlistEntriesApi.md +157 -0
- data/docs/WaitlistEntry.md +32 -0
- data/docs/WaitlistEntryInvitation.md +36 -0
- data/docs/WebhooksApi.md +30 -33
- data/lib/clerk-http-client/api/actor_tokens_api.rb +10 -14
- data/lib/clerk-http-client/api/allow_list_block_list_api.rb +25 -33
- data/lib/clerk-http-client/api/beta_features_api.rb +13 -21
- data/lib/clerk-http-client/api/clients_api.rb +13 -17
- data/lib/clerk-http-client/api/domains_api.rb +16 -20
- data/lib/clerk-http-client/api/email_addresses_api.rb +19 -27
- data/lib/clerk-http-client/api/email_sms_templates_api.rb +19 -19
- data/lib/clerk-http-client/api/instance_settings_api.rb +78 -31
- data/lib/clerk-http-client/api/invitations_api.rb +82 -17
- data/lib/clerk-http-client/api/jwks_api.rb +7 -7
- data/lib/clerk-http-client/api/jwt_templates_api.rb +22 -30
- data/lib/clerk-http-client/api/miscellaneous_api.rb +4 -4
- data/lib/clerk-http-client/api/{o_auth_applications_api.rb → oauth_applications_api.rb} +53 -57
- data/lib/clerk-http-client/api/organization_domains_api.rb +92 -10
- data/lib/clerk-http-client/api/organization_invitations_api.rb +25 -29
- data/lib/clerk-http-client/api/organization_memberships_api.rb +22 -26
- data/lib/clerk-http-client/api/organizations_api.rb +30 -34
- data/lib/clerk-http-client/api/phone_numbers_api.rb +19 -27
- data/lib/clerk-http-client/api/proxy_checks_api.rb +7 -11
- data/lib/clerk-http-client/api/redirect_urls_api.rb +16 -20
- data/lib/clerk-http-client/api/saml_connections_api.rb +22 -23
- data/lib/clerk-http-client/api/sessions_api.rb +165 -20
- data/lib/clerk-http-client/api/sign_in_tokens_api.rb +10 -14
- data/lib/clerk-http-client/api/sign_ups_api.rb +7 -11
- data/lib/clerk-http-client/api/testing_tokens_api.rb +6 -6
- data/lib/clerk-http-client/api/users_api.rb +149 -92
- data/lib/clerk-http-client/api/waitlist_entries_api.rb +178 -0
- data/lib/clerk-http-client/api/webhooks_api.rb +10 -10
- data/lib/clerk-http-client/api_client.rb +1 -1
- data/lib/clerk-http-client/api_error.rb +1 -1
- data/lib/clerk-http-client/configuration.rb +1 -1
- data/lib/clerk-http-client/models/actor_token.rb +2 -1
- data/lib/clerk-http-client/models/add_domain_request.rb +2 -1
- data/lib/clerk-http-client/models/admin.rb +2 -1
- data/lib/clerk-http-client/models/allowlist_identifier.rb +2 -1
- data/lib/clerk-http-client/models/blocklist_identifier.rb +2 -1
- data/lib/clerk-http-client/models/blocklist_identifiers.rb +2 -1
- data/lib/clerk-http-client/models/change_production_instance_domain_request.rb +2 -1
- data/lib/clerk-http-client/models/clerk_error.rb +2 -1
- data/lib/clerk-http-client/models/clerk_errors.rb +2 -1
- data/lib/clerk-http-client/models/client.rb +2 -1
- data/lib/clerk-http-client/models/{c_name_target.rb → cname_target.rb} +2 -1
- data/lib/clerk-http-client/models/create_actor_token_request.rb +2 -1
- data/lib/clerk-http-client/models/create_allowlist_identifier_request.rb +2 -1
- data/lib/clerk-http-client/models/create_blocklist_identifier_request.rb +2 -1
- data/lib/clerk-http-client/models/create_bulk_invitations_request_inner.rb +306 -0
- data/lib/clerk-http-client/models/create_email_address_request.rb +2 -1
- data/lib/clerk-http-client/models/create_invitation_request.rb +58 -10
- data/lib/clerk-http-client/models/create_jwt_template_request.rb +2 -1
- data/lib/clerk-http-client/models/{create_o_auth_application_request.rb → create_oauth_application_request.rb} +2 -8
- data/lib/clerk-http-client/models/create_organization_domain_request.rb +2 -1
- data/lib/clerk-http-client/models/create_organization_invitation_bulk_request_inner.rb +12 -7
- data/lib/clerk-http-client/models/create_organization_invitation_request.rb +51 -11
- data/lib/clerk-http-client/models/create_organization_membership_request.rb +2 -1
- data/lib/clerk-http-client/models/create_organization_request.rb +10 -12
- data/lib/clerk-http-client/models/create_phone_number_request.rb +2 -1
- data/lib/clerk-http-client/models/create_redirect_url_request.rb +2 -1
- data/lib/clerk-http-client/models/create_saml_connection_request.rb +14 -2
- data/lib/clerk-http-client/models/create_saml_connection_request_attribute_mapping.rb +2 -1
- data/lib/clerk-http-client/models/create_session_request.rb +216 -0
- data/lib/clerk-http-client/models/create_session_token200_response.rb +258 -0
- data/lib/clerk-http-client/models/create_session_token_from_template_request.rb +241 -0
- data/lib/clerk-http-client/models/create_session_token_request.rb +241 -0
- data/lib/clerk-http-client/models/create_sign_in_token_request.rb +2 -1
- data/lib/clerk-http-client/models/create_user_request.rb +14 -7
- data/lib/clerk-http-client/models/create_waitlist_entry_request.rb +233 -0
- data/lib/clerk-http-client/models/deleted_object.rb +2 -1
- data/lib/clerk-http-client/models/disable_mfa200_response.rb +2 -1
- data/lib/clerk-http-client/models/domain.rb +2 -1
- data/lib/clerk-http-client/models/domains.rb +2 -1
- data/lib/clerk-http-client/models/email_address.rb +13 -2
- data/lib/clerk-http-client/models/email_address_verification.rb +6 -3
- data/lib/clerk-http-client/models/from_o_auth.rb +324 -0
- data/{resources/templates/partial_anyof_module.mustache → lib/clerk-http-client/models/from_o_auth_error.rb} +29 -19
- data/lib/clerk-http-client/models/from_oauth.rb +325 -0
- data/{resources/templates/partial_oneof_module.mustache → lib/clerk-http-client/models/from_oauth_error.rb} +24 -54
- data/lib/clerk-http-client/models/{get_o_auth_access_token200_response_inner.rb → get_oauth_access_token200_response_inner.rb} +21 -7
- data/lib/clerk-http-client/models/identification_link.rb +4 -3
- data/lib/clerk-http-client/models/instance.rb +280 -0
- data/lib/clerk-http-client/models/instance_restrictions.rb +2 -1
- data/lib/clerk-http-client/models/invitation.rb +6 -3
- data/lib/clerk-http-client/models/jwks.rb +217 -0
- data/lib/clerk-http-client/models/jwks_keys_inner.rb +278 -0
- data/lib/clerk-http-client/models/jwt_template.rb +2 -1
- data/lib/clerk-http-client/models/list_waitlist_entries200_response.rb +241 -0
- data/lib/clerk-http-client/models/merge_organization_metadata_request.rb +10 -5
- data/lib/clerk-http-client/models/o_auth_application.rb +34 -2
- data/lib/clerk-http-client/models/o_auth_application_with_secret.rb +34 -2
- data/lib/clerk-http-client/models/o_auth_applications.rb +1 -1
- data/lib/clerk-http-client/models/oauth.rb +2 -2
- data/lib/clerk-http-client/models/oauth_application.rb +482 -0
- data/lib/clerk-http-client/models/oauth_application_with_secret.rb +499 -0
- data/lib/clerk-http-client/models/oauth_applications.rb +241 -0
- data/lib/clerk-http-client/models/organization.rb +11 -5
- data/lib/clerk-http-client/models/organization_domain.rb +2 -1
- data/lib/clerk-http-client/models/organization_domain_verification.rb +2 -1
- data/lib/clerk-http-client/models/organization_domains.rb +2 -1
- data/lib/clerk-http-client/models/organization_invitation.rb +32 -6
- data/lib/clerk-http-client/models/organization_invitation_with_public_organization_data.rb +21 -6
- data/lib/clerk-http-client/models/organization_invitation_with_public_organization_data_public_organization_data.rb +2 -1
- data/lib/clerk-http-client/models/organization_invitations.rb +2 -1
- data/lib/clerk-http-client/models/organization_invitations_with_public_organization_data.rb +2 -1
- data/lib/clerk-http-client/models/organization_membership.rb +10 -5
- data/lib/clerk-http-client/models/organization_membership_public_user_data.rb +2 -1
- data/lib/clerk-http-client/models/organization_memberships.rb +2 -1
- data/lib/clerk-http-client/models/organization_settings.rb +2 -1
- data/lib/clerk-http-client/models/organization_with_logo.rb +11 -5
- data/lib/clerk-http-client/models/organizations.rb +2 -1
- data/lib/clerk-http-client/models/otp.rb +2 -1
- data/lib/clerk-http-client/models/passkey.rb +2 -1
- data/lib/clerk-http-client/models/phone_number.rb +2 -1
- data/lib/clerk-http-client/models/phone_number_verification.rb +4 -1
- data/lib/clerk-http-client/models/preview_template_request.rb +2 -1
- data/lib/clerk-http-client/models/proxy_check.rb +2 -1
- data/lib/clerk-http-client/models/redirect_url.rb +2 -1
- data/lib/clerk-http-client/models/revoke_invitation200_response.rb +6 -3
- data/lib/clerk-http-client/models/revoke_organization_invitation_request.rb +2 -1
- data/lib/clerk-http-client/models/saml.rb +3 -2
- data/lib/clerk-http-client/models/saml_account.rb +6 -3
- data/lib/clerk-http-client/models/saml_account_saml_connection.rb +4 -1
- data/lib/clerk-http-client/models/saml_account_verification.rb +4 -1
- data/lib/clerk-http-client/models/saml_connection.rb +2 -1
- data/lib/clerk-http-client/models/saml_connections.rb +2 -1
- data/lib/clerk-http-client/models/schemas_passkey.rb +2 -1
- data/lib/clerk-http-client/models/schemas_passkey_verification.rb +4 -1
- data/lib/clerk-http-client/models/schemas_saml_connection.rb +13 -2
- data/lib/clerk-http-client/models/schemas_saml_connection_attribute_mapping.rb +2 -1
- data/lib/clerk-http-client/models/session.rb +2 -1
- data/lib/clerk-http-client/models/session_latest_activity.rb +2 -1
- data/lib/clerk-http-client/models/sign_in_token.rb +2 -1
- data/lib/clerk-http-client/models/sign_up.rb +22 -6
- data/lib/clerk-http-client/models/svix_url.rb +2 -1
- data/lib/clerk-http-client/models/template.rb +2 -1
- data/lib/clerk-http-client/models/testing_token.rb +2 -1
- data/lib/clerk-http-client/models/ticket.rb +2 -1
- data/lib/clerk-http-client/models/toggle_template_delivery_request.rb +2 -1
- data/lib/clerk-http-client/models/total_count.rb +2 -1
- data/lib/clerk-http-client/models/totp.rb +2 -1
- data/lib/clerk-http-client/models/update_domain_request.rb +2 -1
- data/lib/clerk-http-client/models/update_email_address_request.rb +2 -1
- data/lib/clerk-http-client/models/update_instance_auth_config200_response.rb +2 -1
- data/lib/clerk-http-client/models/update_instance_auth_config_request.rb +2 -1
- data/lib/clerk-http-client/models/update_instance_organization_settings_request.rb +2 -1
- data/lib/clerk-http-client/models/update_instance_request.rb +2 -1
- data/lib/clerk-http-client/models/update_instance_restrictions_request.rb +2 -1
- data/lib/clerk-http-client/models/{update_o_auth_application_request.rb → update_oauth_application_request.rb} +2 -1
- data/lib/clerk-http-client/models/update_organization_domain_request.rb +2 -1
- data/lib/clerk-http-client/models/update_organization_membership_metadata_request.rb +10 -5
- data/lib/clerk-http-client/models/update_organization_membership_request.rb +2 -1
- data/lib/clerk-http-client/models/update_organization_request.rb +10 -5
- data/lib/clerk-http-client/models/update_phone_number_request.rb +2 -1
- data/lib/clerk-http-client/models/update_production_instance_domain_request.rb +2 -1
- data/lib/clerk-http-client/models/update_saml_connection_request.rb +14 -2
- data/lib/clerk-http-client/models/update_saml_connection_request_attribute_mapping.rb +2 -1
- data/lib/clerk-http-client/models/update_sign_up_request.rb +2 -1
- data/lib/clerk-http-client/models/update_user_metadata_request.rb +2 -1
- data/lib/clerk-http-client/models/update_user_request.rb +14 -7
- data/lib/clerk-http-client/models/upsert_template_request.rb +2 -1
- data/lib/clerk-http-client/models/user.rb +14 -7
- data/lib/clerk-http-client/models/verify_client_request.rb +2 -1
- data/lib/clerk-http-client/models/verify_domain_proxy_request.rb +2 -1
- data/lib/clerk-http-client/models/verify_password200_response.rb +2 -1
- data/lib/clerk-http-client/models/verify_password_request.rb +2 -1
- data/lib/clerk-http-client/models/verify_session_request.rb +2 -1
- data/lib/clerk-http-client/models/verify_totp200_response.rb +2 -1
- data/lib/clerk-http-client/models/verify_totp_request.rb +2 -1
- data/lib/clerk-http-client/models/waitlist_entry.rb +370 -0
- data/lib/clerk-http-client/models/waitlist_entry_invitation.rb +397 -0
- data/lib/clerk-http-client/models/web3_signature.rb +4 -3
- data/lib/clerk-http-client/models/web3_wallet.rb +2 -1
- data/lib/clerk-http-client/models/web3_wallet_verification.rb +4 -1
- data/lib/clerk-http-client/version.rb +1 -1
- data/lib/clerk-http-client.rb +56 -59
- data/spec/api/actor_tokens_api_spec.rb +1 -1
- data/spec/api/allow_list_block_list_api_spec.rb +2 -2
- data/spec/api/beta_features_api_spec.rb +2 -2
- data/spec/api/clients_api_spec.rb +1 -1
- data/spec/api/domains_api_spec.rb +1 -1
- data/spec/api/email_addresses_api_spec.rb +2 -2
- data/spec/api/instance_settings_api_spec.rb +3 -3
- data/spec/api/invitations_api_spec.rb +1 -1
- data/spec/api/jwt_templates_api_spec.rb +2 -2
- data/spec/api/{o_auth_applications_api_spec.rb → oauth_applications_api_spec.rb} +15 -15
- data/spec/api/organizations_api_spec.rb +1 -1
- data/spec/api/phone_numbers_api_spec.rb +2 -2
- data/spec/api/proxy_checks_api_spec.rb +1 -1
- data/spec/api/redirect_urls_api_spec.rb +1 -1
- data/spec/api/saml_connections_api_spec.rb +1 -1
- data/spec/api/sign_in_tokens_api_spec.rb +1 -1
- data/spec/api/sign_ups_api_spec.rb +1 -1
- data/spec/api/users_api_spec.rb +3 -3
- data/spec/api/waitlist_entries_api_spec.rb +63 -0
- data/spec/models/cname_target_spec.rb +48 -0
- data/spec/models/create_bulk_invitations_request_inner_spec.rb +66 -0
- data/spec/models/create_oauth_application_request_spec.rb +54 -0
- data/spec/models/create_session_request_spec.rb +36 -0
- data/spec/models/create_session_token200_response_spec.rb +46 -0
- data/spec/models/create_session_token_from_template_request_spec.rb +36 -0
- data/spec/models/create_session_token_request_spec.rb +36 -0
- data/spec/models/create_waitlist_entry_request_spec.rb +42 -0
- data/spec/models/from_o_auth_error_spec.rb +32 -0
- data/spec/models/from_o_auth_spec.rb +64 -0
- data/spec/models/from_oauth_error_spec.rb +32 -0
- data/spec/models/from_oauth_spec.rb +64 -0
- data/spec/models/get_oauth_access_token200_response_inner_spec.rb +90 -0
- data/spec/models/identification_link_spec.rb +1 -1
- data/spec/models/instance_spec.rb +58 -0
- data/spec/models/jwks_keys_inner_spec.rb +78 -0
- data/spec/models/jwks_spec.rb +36 -0
- data/spec/models/list_waitlist_entries200_response_spec.rb +42 -0
- data/spec/models/oauth_application_spec.rb +124 -0
- data/spec/models/oauth_application_with_secret_spec.rb +130 -0
- data/spec/models/oauth_applications_spec.rb +42 -0
- data/spec/models/oauth_spec.rb +1 -1
- data/spec/models/update_oauth_application_request_spec.rb +48 -0
- data/spec/models/waitlist_entry_invitation_spec.rb +98 -0
- data/spec/models/waitlist_entry_spec.rb +86 -0
- data/spec/spec_helper.rb +1 -1
- metadata +104 -65
- data/bin/fmt +0 -5
- data/bin/generate +0 -8
- data/bin/setup +0 -7
- data/openapitools.json +0 -7
- data/pkg/clerk-http-client-1.0.0.gem +0 -0
- data/resources/.DS_Store +0 -0
- data/resources/oas/bapi-2024-10-01.yml +0 -7238
- data/resources/templates/Gemfile.mustache +0 -9
- data/resources/templates/README.mustache +0 -163
- data/resources/templates/Rakefile.mustache +0 -10
- data/resources/templates/api.mustache +0 -257
- data/resources/templates/api_client.mustache +0 -246
- data/resources/templates/api_client_faraday_partial.mustache +0 -200
- data/resources/templates/api_client_httpx_partial.mustache +0 -134
- data/resources/templates/api_client_typhoeus_partial.mustache +0 -161
- data/resources/templates/api_doc.mustache +0 -132
- data/resources/templates/api_error.mustache +0 -50
- data/resources/templates/api_info.mustache +0 -12
- data/resources/templates/api_test.mustache +0 -47
- data/resources/templates/base_object.mustache +0 -114
- data/resources/templates/configuration.mustache +0 -491
- data/resources/templates/configuration_faraday_partial.mustache +0 -40
- data/resources/templates/configuration_httpx_partial.mustache +0 -11
- data/resources/templates/configuration_typhoeus_partial.mustache +0 -41
- data/resources/templates/gem.mustache +0 -89
- data/resources/templates/gemspec.mustache +0 -41
- data/resources/templates/git_push.sh.mustache +0 -57
- data/resources/templates/gitignore.mustache +0 -39
- data/resources/templates/gitlab-ci.mustache +0 -26
- data/resources/templates/model.mustache +0 -33
- data/resources/templates/model_doc.mustache +0 -12
- data/resources/templates/model_test.mustache +0 -82
- data/resources/templates/partial_model_enum_class.mustache +0 -23
- data/resources/templates/partial_model_generic.mustache +0 -377
- data/resources/templates/partial_model_generic_doc.mustache +0 -28
- data/resources/templates/partial_oneof_module_doc.mustache +0 -93
- data/resources/templates/rspec.mustache +0 -2
- data/resources/templates/rubocop.mustache +0 -148
- data/resources/templates/spec_helper.mustache +0 -103
- data/resources/templates/travis.mustache +0 -11
- data/resources/templates/version.mustache +0 -7
- data/sdk-generator-config.json +0 -25
- /data/docs/{CNameTarget.md → CnameTarget.md} +0 -0
- /data/docs/{CreateRedirectURLRequest.md → CreateRedirectUrlRequest.md} +0 -0
- /data/docs/{OAuthApplications.md → OauthApplications.md} +0 -0
- /data/docs/{RedirectURL.md → RedirectUrl.md} +0 -0
- /data/docs/{SvixURL.md → SvixUrl.md} +0 -0
- /data/docs/{UpdateOAuthApplicationRequest.md → UpdateOauthApplicationRequest.md} +0 -0
@@ -1,200 +0,0 @@
|
|
1
|
-
# Call an API with given options.
|
2
|
-
#
|
3
|
-
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
4
|
-
# the data deserialized from response body (could be nil), response status code and response headers.
|
5
|
-
def call_api(http_method, path, opts = {})
|
6
|
-
stream = nil
|
7
|
-
begin
|
8
|
-
response = connection(opts).public_send(http_method.to_sym.downcase) do |req|
|
9
|
-
request = build_request(http_method, path, req, opts)
|
10
|
-
stream = download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
|
11
|
-
end
|
12
|
-
|
13
|
-
if config.debugging
|
14
|
-
config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
15
|
-
end
|
16
|
-
|
17
|
-
unless response.success?
|
18
|
-
if response.status == 0 && response.respond_to?(:return_message)
|
19
|
-
# Errors from libcurl will be made visible here
|
20
|
-
fail ApiError.new(code: 0,
|
21
|
-
message: response.return_message)
|
22
|
-
else
|
23
|
-
fail ApiError.new(code: response.status,
|
24
|
-
response_headers: response.headers,
|
25
|
-
response_body: response.body),
|
26
|
-
response.reason_phrase
|
27
|
-
end
|
28
|
-
end
|
29
|
-
rescue Faraday::TimeoutError
|
30
|
-
fail ApiError.new('Connection timed out')
|
31
|
-
rescue Faraday::ConnectionFailed
|
32
|
-
fail ApiError.new('Connection failed')
|
33
|
-
end
|
34
|
-
|
35
|
-
if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
|
36
|
-
data = deserialize_file(response, stream)
|
37
|
-
elsif opts[:return_type]
|
38
|
-
data = deserialize(response, opts[:return_type])
|
39
|
-
else
|
40
|
-
data = nil
|
41
|
-
end
|
42
|
-
return data, response.status, response.headers
|
43
|
-
end
|
44
|
-
|
45
|
-
# Builds the HTTP request
|
46
|
-
#
|
47
|
-
# @param [String] http_method HTTP method/verb (e.g. POST)
|
48
|
-
# @param [String] path URL path (e.g. /account/new)
|
49
|
-
# @option opts [Hash] :header_params Header parameters
|
50
|
-
# @option opts [Hash] :query_params Query parameters
|
51
|
-
# @option opts [Hash] :form_params Query parameters
|
52
|
-
# @option opts [Object] :body HTTP body (JSON/XML)
|
53
|
-
# @return [Faraday::Request] A Faraday Request
|
54
|
-
def build_request(http_method, path, request, opts = {})
|
55
|
-
url = build_request_url(path, opts)
|
56
|
-
http_method = http_method.to_sym.downcase
|
57
|
-
|
58
|
-
header_params = @default_headers.merge(opts[:header_params] || {})
|
59
|
-
query_params = opts[:query_params] || {}
|
60
|
-
form_params = opts[:form_params] || {}
|
61
|
-
|
62
|
-
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
63
|
-
|
64
|
-
if [:post, :patch, :put, :delete].include?(http_method)
|
65
|
-
req_body = build_request_body(header_params, form_params, opts[:body])
|
66
|
-
if config.debugging
|
67
|
-
config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
request.headers = header_params
|
71
|
-
request.body = req_body
|
72
|
-
|
73
|
-
# Overload default options only if provided
|
74
|
-
request.options.params_encoder = config.params_encoder if config.params_encoder
|
75
|
-
request.options.timeout = config.timeout if config.timeout
|
76
|
-
|
77
|
-
request.url url
|
78
|
-
request.params = query_params
|
79
|
-
request
|
80
|
-
end
|
81
|
-
|
82
|
-
# Builds the HTTP request body
|
83
|
-
#
|
84
|
-
# @param [Hash] header_params Header parameters
|
85
|
-
# @param [Hash] form_params Query parameters
|
86
|
-
# @param [Object] body HTTP body (JSON/XML)
|
87
|
-
# @return [String] HTTP body data in the form of string
|
88
|
-
def build_request_body(header_params, form_params, body)
|
89
|
-
# http form
|
90
|
-
if header_params['Content-Type'] == 'application/x-www-form-urlencoded'
|
91
|
-
data = URI.encode_www_form(form_params)
|
92
|
-
elsif header_params['Content-Type'] == 'multipart/form-data'
|
93
|
-
data = {}
|
94
|
-
form_params.each do |key, value|
|
95
|
-
case value
|
96
|
-
when ::File, ::Tempfile
|
97
|
-
data[key] = Faraday::FilePart.new(value.path, Marcel::MimeType.for(Pathname.new(value.path)))
|
98
|
-
when ::Array, nil
|
99
|
-
# let Faraday handle Array and nil parameters
|
100
|
-
data[key] = value
|
101
|
-
else
|
102
|
-
data[key] = value.to_s
|
103
|
-
end
|
104
|
-
end
|
105
|
-
elsif body
|
106
|
-
data = body.is_a?(String) ? body : body.to_json
|
107
|
-
else
|
108
|
-
data = nil
|
109
|
-
end
|
110
|
-
data
|
111
|
-
end
|
112
|
-
|
113
|
-
def download_file(request)
|
114
|
-
stream = []
|
115
|
-
|
116
|
-
# handle streaming Responses
|
117
|
-
request.options.on_data = Proc.new do |chunk, overall_received_bytes|
|
118
|
-
stream << chunk
|
119
|
-
end
|
120
|
-
|
121
|
-
stream
|
122
|
-
end
|
123
|
-
|
124
|
-
def deserialize_file(response, stream)
|
125
|
-
body = response.body
|
126
|
-
encoding = body.encoding
|
127
|
-
|
128
|
-
# reconstruct content
|
129
|
-
content = stream.join
|
130
|
-
content = content.unpack('m').join if response.headers['Content-Transfer-Encoding'] == 'binary'
|
131
|
-
content = content.force_encoding(encoding)
|
132
|
-
|
133
|
-
# return byte stream
|
134
|
-
return content if @config.return_binary_data == true
|
135
|
-
|
136
|
-
# return file instead of binary data
|
137
|
-
content_disposition = response.headers['Content-Disposition']
|
138
|
-
if content_disposition && content_disposition =~ /filename=/i
|
139
|
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
140
|
-
prefix = sanitize_filename(filename)
|
141
|
-
else
|
142
|
-
prefix = 'download-'
|
143
|
-
end
|
144
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
145
|
-
|
146
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
147
|
-
tempfile.write(content)
|
148
|
-
tempfile.close
|
149
|
-
|
150
|
-
config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
151
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
152
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
153
|
-
"explicitly with `tempfile.delete`"
|
154
|
-
tempfile
|
155
|
-
end
|
156
|
-
|
157
|
-
def connection(opts)
|
158
|
-
opts[:header_params]['Content-Type'] == 'multipart/form-data' ? connection_multipart : connection_regular
|
159
|
-
end
|
160
|
-
|
161
|
-
def connection_multipart
|
162
|
-
@connection_multipart ||= build_connection do |conn|
|
163
|
-
conn.request :multipart
|
164
|
-
conn.request :url_encoded
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
def connection_regular
|
169
|
-
@connection_regular ||= build_connection
|
170
|
-
end
|
171
|
-
|
172
|
-
def build_connection
|
173
|
-
Faraday.new(url: config.base_url, ssl: ssl_options, proxy: config.proxy) do |conn|
|
174
|
-
basic_auth(conn)
|
175
|
-
config.configure_middleware(conn)
|
176
|
-
yield(conn) if block_given?
|
177
|
-
conn.adapter(Faraday.default_adapter)
|
178
|
-
config.configure_connection(conn)
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
def ssl_options
|
183
|
-
{
|
184
|
-
ca_file: config.ssl_ca_file,
|
185
|
-
verify: config.ssl_verify,
|
186
|
-
verify_mode: config.ssl_verify_mode,
|
187
|
-
client_cert: config.ssl_client_cert,
|
188
|
-
client_key: config.ssl_client_key
|
189
|
-
}
|
190
|
-
end
|
191
|
-
|
192
|
-
def basic_auth(conn)
|
193
|
-
if config.username && config.password
|
194
|
-
if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
|
195
|
-
conn.request(:authorization, :basic, config.username, config.password)
|
196
|
-
else
|
197
|
-
conn.request(:basic_auth, config.username, config.password)
|
198
|
-
end
|
199
|
-
end
|
200
|
-
end
|
@@ -1,134 +0,0 @@
|
|
1
|
-
# Call an API with given options.
|
2
|
-
#
|
3
|
-
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
4
|
-
# the data deserialized from response body (could be nil), response status code and response headers.
|
5
|
-
def call_api(http_method, path, opts = {})
|
6
|
-
begin
|
7
|
-
response = build_request(http_method.to_s, path, opts)
|
8
|
-
|
9
|
-
if config.debugging
|
10
|
-
config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
11
|
-
end
|
12
|
-
|
13
|
-
response.raise_for_status
|
14
|
-
|
15
|
-
rescue HTTPX::HTTPError
|
16
|
-
fail ApiError.new(code: response.status,
|
17
|
-
response_headers: response.headers.to_h,
|
18
|
-
response_body: response.body.to_s),
|
19
|
-
Net::HTTP::STATUS_CODES.fetch(response.status, "HTTP Error (#{response.status})")
|
20
|
-
rescue HTTPX::TimeoutError
|
21
|
-
fail ApiError.new('Connection timed out')
|
22
|
-
rescue HTTPX::ConnectionError, HTTPX::ResolveError
|
23
|
-
fail ApiError.new('Connection failed')
|
24
|
-
end
|
25
|
-
|
26
|
-
if opts[:return_type] == 'File'
|
27
|
-
data = deserialize_file(response)
|
28
|
-
elsif opts[:return_type]
|
29
|
-
data = deserialize(response, opts[:return_type])
|
30
|
-
else
|
31
|
-
data = nil
|
32
|
-
end
|
33
|
-
return data, response.status, response.headers.to_h
|
34
|
-
end
|
35
|
-
|
36
|
-
# Builds the HTTP request
|
37
|
-
#
|
38
|
-
# @param [String] http_method HTTP method/verb (e.g. POST)
|
39
|
-
# @param [String] path URL path (e.g. /account/new)
|
40
|
-
# @option opts [Hash] :header_params Header parameters
|
41
|
-
# @option opts [Hash] :query_params Query parameters
|
42
|
-
# @option opts [Hash] :form_params Query parameters
|
43
|
-
# @option opts [Object] :body HTTP body (JSON/XML)
|
44
|
-
# @return [HTTPX::Request] A Request object
|
45
|
-
def build_request(http_method, path, opts = {})
|
46
|
-
url = build_request_url(path, opts)
|
47
|
-
|
48
|
-
header_params = @default_headers.merge(opts[:header_params] || {})
|
49
|
-
query_params = opts[:query_params] || {}
|
50
|
-
form_params = opts[:form_params] || {}
|
51
|
-
|
52
|
-
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
53
|
-
|
54
|
-
if %w[POST PATCH PUT DELETE].include?(http_method)
|
55
|
-
body_params = build_request_body(header_params, form_params, opts[:body])
|
56
|
-
if config.debugging
|
57
|
-
config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
req_opts = {
|
61
|
-
:headers => HTTPX::Headers.new(header_params)
|
62
|
-
}
|
63
|
-
req_opts.merge!(body_params) if body_params
|
64
|
-
req_opts[:params] = query_params if query_params && !query_params.empty?
|
65
|
-
session.request(http_method, url, **req_opts)
|
66
|
-
end
|
67
|
-
|
68
|
-
# Builds the HTTP request body
|
69
|
-
#
|
70
|
-
# @param [Hash] header_params Header parameters
|
71
|
-
# @param [Hash] form_params Query parameters
|
72
|
-
# @param [Object] body HTTP body (JSON/XML)
|
73
|
-
# @return [Hash{Symbol => Object}] body options as HTTPX handles them
|
74
|
-
def build_request_body(header_params, form_params, body)
|
75
|
-
# http form
|
76
|
-
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
77
|
-
header_params['Content-Type'] == 'multipart/form-data'
|
78
|
-
header_params.delete('Content-Type') # httpx takes care of this
|
79
|
-
{ form: form_params }
|
80
|
-
elsif body
|
81
|
-
body.is_a?(String) ? { body: body } : { json: body }
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def deserialize_file(response)
|
86
|
-
body = response.body
|
87
|
-
if @config.return_binary_data == true
|
88
|
-
# TODO: force response encoding
|
89
|
-
body.to_s
|
90
|
-
else
|
91
|
-
content_disposition = response.headers['content-disposition']
|
92
|
-
if content_disposition && content_disposition =~ /filename=/i
|
93
|
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
94
|
-
prefix = sanitize_filename(filename)
|
95
|
-
else
|
96
|
-
prefix = 'download-'
|
97
|
-
end
|
98
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
99
|
-
encoding = response.body.encoding
|
100
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
101
|
-
response.copy_to(tempfile)
|
102
|
-
tempfile.close
|
103
|
-
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
104
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
105
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
106
|
-
"explicitly with `tempfile.delete`"
|
107
|
-
|
108
|
-
tempfile
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
def session
|
113
|
-
return @session if defined?(@session)
|
114
|
-
|
115
|
-
session = HTTPX.with(
|
116
|
-
ssl: @config.ssl,
|
117
|
-
timeout: ({ request_timeout: @config.timeout } if @config.timeout && @config.timeout.positive?),
|
118
|
-
origin: "#{@config.scheme}://#{@config.host}",
|
119
|
-
base_path: (@config.base_path.sub(/\/+\z/, '') if @config.base_path)
|
120
|
-
)
|
121
|
-
|
122
|
-
if @config.proxy
|
123
|
-
session = session.plugin(:proxy, proxy: @config.proxy)
|
124
|
-
end
|
125
|
-
|
126
|
-
if @config.username && @config.password
|
127
|
-
session = session.plugin(:basic_auth).basic_auth(@config.username, @config.password)
|
128
|
-
end
|
129
|
-
|
130
|
-
session = @config.configure(session)
|
131
|
-
|
132
|
-
@session = session
|
133
|
-
|
134
|
-
end
|
@@ -1,161 +0,0 @@
|
|
1
|
-
# Call an API with given options.
|
2
|
-
#
|
3
|
-
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
4
|
-
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
5
|
-
def call_api(http_method, path, opts = {})
|
6
|
-
request = build_request(http_method, path, opts)
|
7
|
-
tempfile = download_file(request) if opts[:return_type] == 'File'
|
8
|
-
response = request.run
|
9
|
-
|
10
|
-
if @config.debugging
|
11
|
-
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
12
|
-
end
|
13
|
-
|
14
|
-
unless response.success?
|
15
|
-
if response.timed_out?
|
16
|
-
fail ApiError.new('Connection timed out')
|
17
|
-
elsif response.code == 0
|
18
|
-
# Errors from libcurl will be made visible here
|
19
|
-
fail ApiError.new(:code => 0,
|
20
|
-
:message => response.return_message)
|
21
|
-
else
|
22
|
-
fail ApiError.new(:code => response.code,
|
23
|
-
:response_headers => response.headers,
|
24
|
-
:response_body => response.body),
|
25
|
-
response.status_message
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
if opts[:return_type] == 'File'
|
30
|
-
data = tempfile
|
31
|
-
elsif opts[:return_type]
|
32
|
-
data = deserialize(response, opts[:return_type])
|
33
|
-
else
|
34
|
-
data = nil
|
35
|
-
end
|
36
|
-
return data, response.code, response.headers
|
37
|
-
end
|
38
|
-
|
39
|
-
# Builds the HTTP request
|
40
|
-
#
|
41
|
-
# @param [String] http_method HTTP method/verb (e.g. POST)
|
42
|
-
# @param [String] path URL path (e.g. /account/new)
|
43
|
-
# @option opts [Hash] :header_params Header parameters
|
44
|
-
# @option opts [Hash] :query_params Query parameters
|
45
|
-
# @option opts [Hash] :form_params Query parameters
|
46
|
-
# @option opts [Object] :body HTTP body (JSON/XML)
|
47
|
-
# @return [Typhoeus::Request] A Typhoeus Request
|
48
|
-
def build_request(http_method, path, opts = {})
|
49
|
-
url = build_request_url(path, opts)
|
50
|
-
http_method = http_method.to_sym.downcase
|
51
|
-
|
52
|
-
header_params = @default_headers.merge(opts[:header_params] || {})
|
53
|
-
query_params = opts[:query_params] || {}
|
54
|
-
form_params = opts[:form_params] || {}
|
55
|
-
follow_location = opts[:follow_location] || true
|
56
|
-
|
57
|
-
{{#hasAuthMethods}}
|
58
|
-
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
59
|
-
{{/hasAuthMethods}}
|
60
|
-
|
61
|
-
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
62
|
-
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
63
|
-
|
64
|
-
req_opts = {
|
65
|
-
:method => http_method,
|
66
|
-
:headers => header_params,
|
67
|
-
:params => query_params,
|
68
|
-
:params_encoding => @config.params_encoding,
|
69
|
-
:timeout => @config.timeout,
|
70
|
-
:ssl_verifypeer => @config.verify_ssl,
|
71
|
-
:ssl_verifyhost => _verify_ssl_host,
|
72
|
-
:sslcert => @config.cert_file,
|
73
|
-
:sslkey => @config.key_file,
|
74
|
-
:verbose => @config.debugging,
|
75
|
-
:followlocation => follow_location
|
76
|
-
}
|
77
|
-
|
78
|
-
# set custom cert, if provided
|
79
|
-
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
80
|
-
|
81
|
-
if [:post, :patch, :put, :delete].include?(http_method)
|
82
|
-
req_body = build_request_body(header_params, form_params, opts[:body])
|
83
|
-
req_opts.update :body => req_body
|
84
|
-
if @config.debugging
|
85
|
-
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
Typhoeus::Request.new(url, req_opts)
|
90
|
-
end
|
91
|
-
|
92
|
-
# Builds the HTTP request body
|
93
|
-
#
|
94
|
-
# @param [Hash] header_params Header parameters
|
95
|
-
# @param [Hash] form_params Query parameters
|
96
|
-
# @param [Object] body HTTP body (JSON/XML)
|
97
|
-
# @return [String] HTTP body data in the form of string
|
98
|
-
def build_request_body(header_params, form_params, body)
|
99
|
-
# http form
|
100
|
-
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
101
|
-
header_params['Content-Type'] == 'multipart/form-data'
|
102
|
-
data = {}
|
103
|
-
form_params.each do |key, value|
|
104
|
-
case value
|
105
|
-
when ::File, ::Array, nil
|
106
|
-
# let typhoeus handle File, Array and nil parameters
|
107
|
-
data[key] = value
|
108
|
-
else
|
109
|
-
data[key] = value.to_s
|
110
|
-
end
|
111
|
-
end
|
112
|
-
elsif body
|
113
|
-
data = body.is_a?(String) ? body : body.to_json
|
114
|
-
else
|
115
|
-
data = nil
|
116
|
-
end
|
117
|
-
data
|
118
|
-
end
|
119
|
-
|
120
|
-
# Save response body into a file in (the defined) temporary folder, using the filename
|
121
|
-
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
122
|
-
# The response body is written to the file in chunks in order to handle files which
|
123
|
-
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
124
|
-
# process can use.
|
125
|
-
#
|
126
|
-
# @see Configuration#temp_folder_path
|
127
|
-
#
|
128
|
-
# @return [Tempfile] the tempfile generated
|
129
|
-
def download_file(request)
|
130
|
-
tempfile = nil
|
131
|
-
encoding = nil
|
132
|
-
request.on_headers do |response|
|
133
|
-
content_disposition = response.headers['Content-Disposition']
|
134
|
-
if content_disposition && content_disposition =~ /filename=/i
|
135
|
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
136
|
-
prefix = sanitize_filename(filename)
|
137
|
-
else
|
138
|
-
prefix = 'download-'
|
139
|
-
end
|
140
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
141
|
-
encoding = response.body.encoding
|
142
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
143
|
-
end
|
144
|
-
request.on_body do |chunk|
|
145
|
-
chunk.force_encoding(encoding)
|
146
|
-
tempfile.write(chunk)
|
147
|
-
end
|
148
|
-
# run the request to ensure the tempfile is created successfully before returning it
|
149
|
-
request.run
|
150
|
-
if tempfile
|
151
|
-
tempfile.close
|
152
|
-
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
153
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
154
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
155
|
-
"explicitly with `tempfile.delete`"
|
156
|
-
else
|
157
|
-
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
158
|
-
end
|
159
|
-
|
160
|
-
tempfile
|
161
|
-
end
|
@@ -1,132 +0,0 @@
|
|
1
|
-
# {{moduleName}}::{{classname}}{{#description}}
|
2
|
-
|
3
|
-
{{.}}{{/description}}
|
4
|
-
|
5
|
-
All URIs are relative to *{{basePath}}*
|
6
|
-
|
7
|
-
| Method | HTTP request | Description |
|
8
|
-
| ------ | ------------ | ----------- |
|
9
|
-
{{#operations}}
|
10
|
-
{{#operation}}
|
11
|
-
| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} |
|
12
|
-
{{/operation}}
|
13
|
-
{{/operations}}
|
14
|
-
|
15
|
-
{{#operations}}
|
16
|
-
{{#operation}}
|
17
|
-
|
18
|
-
## {{operationId}}
|
19
|
-
|
20
|
-
> {{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}} {{/returnType}}{{operationId}}{{#hasParams}}({{^vendorExtensions.x-group-parameters}}{{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}opts{{/vendorExtensions.x-group-parameters}}){{/hasParams}}
|
21
|
-
|
22
|
-
{{{summary}}}{{#notes}}
|
23
|
-
|
24
|
-
{{{.}}}{{/notes}}
|
25
|
-
|
26
|
-
### Examples
|
27
|
-
|
28
|
-
```ruby
|
29
|
-
require 'time'
|
30
|
-
require '{{{gemName}}}'
|
31
|
-
{{#hasAuthMethods}}
|
32
|
-
# setup authorization
|
33
|
-
{{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
|
34
|
-
# Configure HTTP basic authorization: {{{name}}}
|
35
|
-
config.username = 'YOUR USERNAME'
|
36
|
-
config.password = 'YOUR PASSWORD'{{/isBasicBasic}}{{#isBasicBearer}}
|
37
|
-
# Configure Bearer authorization{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}: {{{name}}}
|
38
|
-
config.access_token = 'YOUR_BEARER_TOKEN'{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
|
39
|
-
# Configure API key authorization: {{{name}}}
|
40
|
-
config.api_key['{{{keyParamName}}}'] = 'YOUR API KEY'
|
41
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
42
|
-
# config.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}}
|
43
|
-
# Configure OAuth2 access token for authorization: {{{name}}}
|
44
|
-
config.access_token = 'YOUR ACCESS TOKEN'{{/isOAuth}}
|
45
|
-
{{/authMethods}}end
|
46
|
-
{{/hasAuthMethods}}
|
47
|
-
|
48
|
-
api_instance = {{{moduleName}}}::{{{classname}}}.new
|
49
|
-
{{^vendorExtensions.x-group-parameters}}
|
50
|
-
{{#requiredParams}}
|
51
|
-
{{{paramName}}} = {{{vendorExtensions.x-ruby-example}}} # {{{dataType}}} | {{{description}}}
|
52
|
-
{{/requiredParams}}
|
53
|
-
{{#optionalParams}}
|
54
|
-
{{#-first}}
|
55
|
-
opts = {
|
56
|
-
{{/-first}}
|
57
|
-
{{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}}
|
58
|
-
{{#-last}}
|
59
|
-
}
|
60
|
-
{{/-last}}
|
61
|
-
{{/optionalParams}}
|
62
|
-
{{/vendorExtensions.x-group-parameters}}
|
63
|
-
{{#vendorExtensions.x-group-parameters}}
|
64
|
-
{{#hasParams}}
|
65
|
-
opts = {
|
66
|
-
{{#requiredParams}}
|
67
|
-
{{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}, # {{{dataType}}} | {{{description}}} (required)
|
68
|
-
{{/requiredParams}}
|
69
|
-
{{#optionalParams}}
|
70
|
-
{{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}, # {{{dataType}}} | {{{description}}}
|
71
|
-
{{/optionalParams}}
|
72
|
-
}
|
73
|
-
{{/hasParams}}
|
74
|
-
{{/vendorExtensions.x-group-parameters}}
|
75
|
-
|
76
|
-
begin
|
77
|
-
{{#summary}}# {{{.}}}{{/summary}}
|
78
|
-
{{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{^vendorExtensions.x-group-parameters}}{{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}opts{{/vendorExtensions.x-group-parameters}}){{/hasParams}}
|
79
|
-
{{#returnType}}
|
80
|
-
p result
|
81
|
-
{{/returnType}}
|
82
|
-
rescue {{{moduleName}}}::ApiError => e
|
83
|
-
puts "Error when calling {{classname}}->{{{operationId}}}: #{e}"
|
84
|
-
end
|
85
|
-
```
|
86
|
-
|
87
|
-
#### Using the {{operationId}}_with_http_info variant
|
88
|
-
|
89
|
-
This returns an Array which contains the response data{{^returnType}} (`nil` in this case){{/returnType}}, status code and headers.
|
90
|
-
|
91
|
-
> <Array({{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil{{/returnType}}, Integer, Hash)> {{operationId}}_with_http_info{{#hasParams}}({{^vendorExtensions.x-group-parameters}}{{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}opts{{/vendorExtensions.x-group-parameters}}){{/hasParams}}
|
92
|
-
|
93
|
-
```ruby
|
94
|
-
begin
|
95
|
-
{{#summary}}# {{{.}}}{{/summary}}
|
96
|
-
data, status_code, headers = api_instance.{{{operationId}}}_with_http_info{{#hasParams}}({{^vendorExtensions.x-group-parameters}}{{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}opts{{/vendorExtensions.x-group-parameters}}){{/hasParams}}
|
97
|
-
p status_code # => 2xx
|
98
|
-
p headers # => { ... }
|
99
|
-
p data # => {{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil{{/returnType}}
|
100
|
-
rescue {{{moduleName}}}::ApiError => e
|
101
|
-
puts "Error when calling {{classname}}->{{{operationId}}}_with_http_info: #{e}"
|
102
|
-
end
|
103
|
-
```
|
104
|
-
|
105
|
-
### Parameters
|
106
|
-
|
107
|
-
{{^allParams}}
|
108
|
-
This endpoint does not need any parameter.
|
109
|
-
{{/allParams}}
|
110
|
-
{{#allParams}}
|
111
|
-
{{#-first}}
|
112
|
-
| Name | Type | Description | Notes |
|
113
|
-
| ---- | ---- | ----------- | ----- |
|
114
|
-
{{/-first}}
|
115
|
-
| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{^required}}[optional]{{/required}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}} |
|
116
|
-
{{/allParams}}
|
117
|
-
|
118
|
-
### Return type
|
119
|
-
|
120
|
-
{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil (empty response body){{/returnType}}
|
121
|
-
|
122
|
-
### Authorization
|
123
|
-
|
124
|
-
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}
|
125
|
-
|
126
|
-
### HTTP request headers
|
127
|
-
|
128
|
-
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
129
|
-
- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
130
|
-
|
131
|
-
{{/operation}}
|
132
|
-
{{/operations}}
|
@@ -1,50 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
{{> api_info}}
|
3
|
-
=end
|
4
|
-
|
5
|
-
module {{moduleName}}
|
6
|
-
class ApiError < StandardError
|
7
|
-
attr_reader :code, :response_headers, :response_body
|
8
|
-
|
9
|
-
# Usage examples:
|
10
|
-
# ApiError.new
|
11
|
-
# ApiError.new("message")
|
12
|
-
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
13
|
-
# ApiError.new(:code => 404, :message => "Not Found")
|
14
|
-
def initialize(arg = nil)
|
15
|
-
if arg.is_a? Hash
|
16
|
-
if arg.key?(:message) || arg.key?('message')
|
17
|
-
super(arg[:message] || arg['message'])
|
18
|
-
else
|
19
|
-
super arg
|
20
|
-
end
|
21
|
-
|
22
|
-
arg.each do |k, v|
|
23
|
-
instance_variable_set "@#{k}", v
|
24
|
-
end
|
25
|
-
else
|
26
|
-
super arg
|
27
|
-
@message = arg
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
# Override to_s to display a friendly error message
|
32
|
-
def to_s
|
33
|
-
message
|
34
|
-
end
|
35
|
-
|
36
|
-
def message
|
37
|
-
if @message.nil?
|
38
|
-
msg = "Error message: the server returns an error"
|
39
|
-
else
|
40
|
-
msg = @message
|
41
|
-
end
|
42
|
-
|
43
|
-
msg += "\nHTTP status code: #{code}" if code
|
44
|
-
msg += "\nResponse headers: #{response_headers}" if response_headers
|
45
|
-
msg += "\nResponse body: #{response_body}" if response_body
|
46
|
-
|
47
|
-
msg
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
{{#appName}}
|
2
|
-
#{{{.}}}
|
3
|
-
|
4
|
-
{{/appName}}
|
5
|
-
{{#appDescription}}
|
6
|
-
#{{{.}}}
|
7
|
-
|
8
|
-
{{/appDescription}}
|
9
|
-
{{#version}}The version of the OpenAPI document: {{.}}{{/version}}
|
10
|
-
{{#infoEmail}}Contact: {{{.}}}{{/infoEmail}}
|
11
|
-
Generated by: https://openapi-generator.tech
|
12
|
-
Generator version: {{{generatorVersion}}}
|