kinde_sdk 1.2.1 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/kinde_api/README.md +100 -27
- data/kinde_api/docs/APIsApi.md +356 -0
- data/kinde_api/docs/AddAPIsRequest.md +20 -0
- data/kinde_api/docs/Api.md +28 -0
- data/kinde_api/docs/ApiApplicationsInner.md +24 -0
- data/kinde_api/docs/Apis.md +24 -0
- data/kinde_api/docs/Applications.md +22 -0
- data/kinde_api/docs/ApplicationsApi.md +368 -0
- data/kinde_api/docs/BusinessApi.md +183 -0
- data/kinde_api/docs/CallbacksApi.md +385 -25
- data/kinde_api/docs/ConnectedAppsApi.md +12 -6
- data/kinde_api/docs/CreateApplicationRequest.md +20 -0
- data/kinde_api/docs/CreateApplicationResponse.md +22 -0
- data/kinde_api/docs/CreateApplicationResponseApplication.md +22 -0
- data/kinde_api/docs/CreateFeatureFlagRequest.md +28 -0
- data/kinde_api/docs/CreateOrganizationRequest.md +16 -2
- data/kinde_api/docs/CreateOrganizationUserPermissionRequest.md +18 -0
- data/kinde_api/docs/CreateUserRequest.md +2 -0
- data/kinde_api/docs/EnvironmentsApi.md +23 -23
- data/kinde_api/docs/FeatureFlagsApi.md +19 -29
- data/kinde_api/docs/GetApplicationResponse.md +22 -0
- data/kinde_api/docs/GetApplicationResponseApplication.md +26 -0
- data/kinde_api/docs/GetApplicationsResponse.md +2 -2
- data/kinde_api/docs/{GetOrganizationsUsersResponse.md → GetOrganizationUsersResponse.md} +2 -2
- data/kinde_api/docs/GetOrganizationsUserPermissionsResponse.md +22 -0
- data/kinde_api/docs/GetPermissionsResponse.md +24 -0
- data/kinde_api/docs/GetRolesResponse.md +24 -0
- data/kinde_api/docs/GetSubscriberResponse.md +22 -0
- data/kinde_api/docs/GetSubscribersResponse.md +24 -0
- data/kinde_api/docs/IndustriesApi.md +81 -0
- data/kinde_api/docs/LogoutRedirectUrls.md +18 -0
- data/kinde_api/docs/OAuthApi.md +153 -4
- data/kinde_api/docs/Organization.md +3 -1
- data/kinde_api/docs/OrganizationUserPermission.md +26 -0
- data/kinde_api/docs/OrganizationUserPermissionRolesInner.md +20 -0
- data/kinde_api/docs/OrganizationUserRolePermissions.md +22 -0
- data/kinde_api/docs/OrganizationUserRolePermissionsPermissions.md +18 -0
- data/kinde_api/docs/OrganizationsApi.md +334 -40
- data/kinde_api/docs/Permissions.md +3 -1
- data/kinde_api/docs/PermissionsApi.md +84 -14
- data/kinde_api/docs/ReplaceLogoutRedirectURLsRequest.md +18 -0
- data/kinde_api/docs/ReplaceRedirectCallbackURLsRequest.md +18 -0
- data/kinde_api/docs/Role.md +24 -0
- data/kinde_api/docs/Roles.md +2 -0
- data/kinde_api/docs/RolesApi.md +310 -18
- data/kinde_api/docs/RolesPermissionResponseInner.md +24 -0
- data/kinde_api/docs/Subscriber.md +24 -0
- data/kinde_api/docs/SubscribersApi.md +12 -14
- data/kinde_api/docs/SubscribersSubscriber.md +26 -0
- data/kinde_api/docs/TimezonesApi.md +81 -0
- data/kinde_api/docs/TokenErrorResponse.md +20 -0
- data/kinde_api/docs/TokenIntrospect.md +26 -0
- data/kinde_api/docs/UpdateAPIApplicationsRequest.md +18 -0
- data/kinde_api/docs/UpdateAPIApplicationsRequestApplicationsInner.md +20 -0
- data/kinde_api/docs/UpdateApplicationRequest.md +24 -0
- data/kinde_api/docs/UpdateEnvironementFeatureFlagOverrideRequest.md +18 -0
- data/kinde_api/docs/UpdateOrganizationRequest.md +15 -1
- data/kinde_api/docs/UpdateOrganizationUsersRequest.md +1 -1
- data/kinde_api/docs/UpdateRolePermissionsRequest.md +18 -0
- data/kinde_api/docs/UpdateRolePermissionsRequestPermissionsInner.md +20 -0
- data/kinde_api/docs/UpdateRolePermissionsResponse.md +24 -0
- data/kinde_api/docs/UpdateRolesRequest.md +24 -0
- data/kinde_api/docs/UpdateUserResponse.md +30 -0
- data/kinde_api/docs/User.md +7 -7
- data/kinde_api/docs/UserIdentitiesInner.md +20 -0
- data/kinde_api/docs/UsersApi.md +171 -23
- data/kinde_api/docs/UsersResponse.md +1 -1
- data/kinde_api/docs/UsersResponseUsersInner.md +42 -0
- data/kinde_api/lib/kinde_api/api/apis_api.rb +346 -0
- data/kinde_api/lib/kinde_api/api/applications_api.rb +362 -0
- data/kinde_api/lib/kinde_api/api/business_api.rb +212 -0
- data/kinde_api/lib/kinde_api/api/callbacks_api.rb +463 -80
- data/kinde_api/lib/kinde_api/api/connected_apps_api.rb +66 -54
- data/kinde_api/lib/kinde_api/api/environments_api.rb +86 -69
- data/kinde_api/lib/kinde_api/api/feature_flags_api.rb +98 -119
- data/kinde_api/lib/kinde_api/api/industries_api.rb +84 -0
- data/kinde_api/lib/kinde_api/api/o_auth_api.rb +168 -38
- data/kinde_api/lib/kinde_api/api/organizations_api.rb +632 -250
- data/kinde_api/lib/kinde_api/api/permissions_api.rb +133 -66
- data/kinde_api/lib/kinde_api/api/roles_api.rb +361 -76
- data/kinde_api/lib/kinde_api/api/subscribers_api.rb +66 -68
- data/kinde_api/lib/kinde_api/api/timezones_api.rb +84 -0
- data/kinde_api/lib/kinde_api/api/users_api.rb +267 -115
- data/kinde_api/lib/kinde_api/api_client.rb +64 -68
- data/kinde_api/lib/kinde_api/api_error.rb +16 -16
- data/kinde_api/lib/kinde_api/configuration.rb +18 -19
- data/kinde_api/lib/kinde_api/models/add_apis_request.rb +235 -0
- data/kinde_api/lib/kinde_api/models/add_organization_users_request.rb +42 -38
- data/kinde_api/lib/kinde_api/models/add_organization_users_request_users_inner.rb +51 -51
- data/kinde_api/lib/kinde_api/models/add_organization_users_response.rb +50 -50
- data/kinde_api/lib/kinde_api/models/api.rb +262 -0
- data/kinde_api/lib/kinde_api/models/api_applications_inner.rb +237 -0
- data/kinde_api/lib/kinde_api/models/api_result.rb +40 -36
- data/kinde_api/lib/kinde_api/models/apis.rb +246 -0
- data/kinde_api/lib/kinde_api/models/applications.rb +232 -0
- data/kinde_api/lib/kinde_api/models/connected_apps_access_token.rb +45 -42
- data/kinde_api/lib/kinde_api/models/connected_apps_auth_url.rb +45 -42
- data/kinde_api/lib/kinde_api/models/create_application_request.rb +266 -0
- data/kinde_api/lib/kinde_api/models/create_application_response.rb +238 -0
- data/kinde_api/lib/kinde_api/models/create_application_response_application.rb +239 -0
- data/kinde_api/lib/kinde_api/models/create_feature_flag_request.rb +326 -0
- data/kinde_api/lib/kinde_api/models/create_organization_request.rb +129 -75
- data/kinde_api/lib/kinde_api/models/create_organization_response.rb +50 -53
- data/kinde_api/lib/kinde_api/models/create_organization_response_organization.rb +41 -36
- data/kinde_api/lib/kinde_api/models/create_organization_user_permission_request.rb +223 -0
- data/kinde_api/lib/kinde_api/models/create_organization_user_role_request.rb +41 -36
- data/kinde_api/lib/kinde_api/models/create_permission_request.rb +49 -48
- data/kinde_api/lib/kinde_api/models/create_role_request.rb +53 -54
- data/kinde_api/lib/kinde_api/models/create_subscriber_success_response.rb +41 -36
- data/kinde_api/lib/kinde_api/models/create_subscriber_success_response_subscriber.rb +41 -36
- data/kinde_api/lib/kinde_api/models/create_user_request.rb +55 -45
- data/kinde_api/lib/kinde_api/models/create_user_request_identities_inner.rb +51 -47
- data/kinde_api/lib/kinde_api/models/create_user_request_identities_inner_details.rb +41 -36
- data/kinde_api/lib/kinde_api/models/create_user_request_profile.rb +45 -42
- data/kinde_api/lib/kinde_api/models/create_user_response.rb +50 -50
- data/kinde_api/lib/kinde_api/models/error.rb +44 -42
- data/kinde_api/lib/kinde_api/models/error_response.rb +42 -38
- data/kinde_api/lib/kinde_api/models/get_application_response.rb +238 -0
- data/kinde_api/lib/kinde_api/models/get_application_response_application.rb +255 -0
- data/kinde_api/lib/kinde_api/models/get_applications_response.rb +56 -57
- data/kinde_api/lib/kinde_api/models/get_environment_feature_flags_response.rb +54 -55
- data/kinde_api/lib/kinde_api/models/get_organization_feature_flags_response.rb +50 -50
- data/kinde_api/lib/kinde_api/models/get_organization_feature_flags_response_feature_flags_value.rb +52 -50
- data/kinde_api/lib/kinde_api/models/{get_organizations_users_response.rb → get_organization_users_response.rb} +55 -56
- data/kinde_api/lib/kinde_api/models/get_organizations_response.rb +54 -55
- data/kinde_api/lib/kinde_api/models/get_organizations_user_permissions_response.rb +239 -0
- data/kinde_api/lib/kinde_api/models/get_organizations_user_roles_response.rb +54 -55
- data/kinde_api/lib/kinde_api/models/get_permissions_response.rb +248 -0
- data/kinde_api/lib/kinde_api/models/get_redirect_callback_urls_response.rb +42 -38
- data/kinde_api/lib/kinde_api/models/get_roles_response.rb +248 -0
- data/kinde_api/lib/kinde_api/models/get_subscriber_response.rb +239 -0
- data/kinde_api/lib/kinde_api/models/get_subscribers_response.rb +248 -0
- data/kinde_api/lib/kinde_api/models/logout_redirect_urls.rb +224 -0
- data/kinde_api/lib/kinde_api/models/organization.rb +56 -54
- data/kinde_api/lib/kinde_api/models/organization_user.rb +63 -79
- data/kinde_api/lib/kinde_api/models/organization_user_permission.rb +243 -0
- data/kinde_api/lib/kinde_api/models/organization_user_permission_roles_inner.rb +227 -0
- data/kinde_api/lib/kinde_api/models/organization_user_role.rb +50 -53
- data/kinde_api/lib/kinde_api/models/organization_user_role_permissions.rb +232 -0
- data/kinde_api/lib/kinde_api/models/{application.rb → organization_user_role_permissions_permissions.rb} +43 -47
- data/kinde_api/lib/kinde_api/models/permissions.rb +59 -50
- data/kinde_api/lib/kinde_api/models/redirect_callback_urls.rb +42 -38
- data/kinde_api/lib/kinde_api/models/replace_logout_redirect_urls_request.rb +224 -0
- data/kinde_api/lib/kinde_api/models/replace_redirect_callback_urls_request.rb +224 -0
- data/kinde_api/lib/kinde_api/models/role.rb +236 -0
- data/kinde_api/lib/kinde_api/models/roles.rb +57 -49
- data/kinde_api/lib/kinde_api/models/roles_permission_response_inner.rb +237 -0
- data/kinde_api/lib/kinde_api/models/subscriber.rb +237 -0
- data/kinde_api/lib/kinde_api/models/subscribers_subscriber.rb +242 -0
- data/kinde_api/lib/kinde_api/models/success_response.rb +46 -45
- data/kinde_api/lib/kinde_api/models/token_error_response.rb +231 -0
- data/kinde_api/lib/kinde_api/models/token_introspect.rb +257 -0
- data/kinde_api/lib/kinde_api/models/update_api_applications_request.rb +228 -0
- data/kinde_api/lib/kinde_api/models/update_api_applications_request_applications_inner.rb +236 -0
- data/kinde_api/lib/kinde_api/models/update_application_request.rb +250 -0
- data/kinde_api/lib/kinde_api/models/update_environement_feature_flag_override_request.rb +228 -0
- data/kinde_api/lib/kinde_api/models/update_organization_request.rb +119 -67
- data/kinde_api/lib/kinde_api/models/update_organization_users_request.rb +43 -39
- data/kinde_api/lib/kinde_api/models/update_organization_users_request_users_inner.rb +55 -57
- data/kinde_api/lib/kinde_api/models/update_organization_users_response.rb +57 -65
- data/kinde_api/lib/kinde_api/models/update_role_permissions_request.rb +224 -0
- data/kinde_api/lib/kinde_api/models/update_role_permissions_request_permissions_inner.rb +231 -0
- data/kinde_api/lib/kinde_api/models/update_role_permissions_response.rb +240 -0
- data/kinde_api/lib/kinde_api/models/update_roles_request.rb +255 -0
- data/kinde_api/lib/kinde_api/models/update_user_request.rb +53 -54
- data/kinde_api/lib/kinde_api/models/update_user_response.rb +273 -0
- data/kinde_api/lib/kinde_api/models/user.rb +104 -120
- data/kinde_api/lib/kinde_api/models/user_identities_inner.rb +227 -0
- data/kinde_api/lib/kinde_api/models/user_identity.rb +45 -42
- data/kinde_api/lib/kinde_api/models/user_identity_result.rb +41 -36
- data/kinde_api/lib/kinde_api/models/user_profile.rb +62 -66
- data/kinde_api/lib/kinde_api/models/user_profile_v2.rb +74 -84
- data/kinde_api/lib/kinde_api/models/users_response.rb +54 -55
- data/kinde_api/lib/kinde_api/models/users_response_users_inner.rb +328 -0
- data/kinde_api/lib/kinde_api/version.rb +11 -11
- data/kinde_api/lib/kinde_api.rb +71 -16
- data/kinde_api/spec/api/apis_api_spec.rb +94 -0
- data/kinde_api/spec/api/applications_api_spec.rb +97 -0
- data/kinde_api/spec/api/business_api_spec.rb +74 -0
- data/kinde_api/spec/api/callbacks_api_spec.rb +85 -22
- data/kinde_api/spec/api/connected_apps_api_spec.rb +16 -15
- data/kinde_api/spec/api/environments_api_spec.rb +19 -20
- data/kinde_api/spec/api/feature_flags_api_spec.rb +17 -23
- data/kinde_api/spec/api/industries_api_spec.rb +47 -0
- data/kinde_api/spec/api/o_auth_api_spec.rb +41 -15
- data/kinde_api/spec/api/organizations_api_spec.rb +93 -39
- data/kinde_api/spec/api/permissions_api_spec.rb +30 -19
- data/kinde_api/spec/api/roles_api_spec.rb +71 -19
- data/kinde_api/spec/api/subscribers_api_spec.rb +18 -20
- data/kinde_api/spec/api/timezones_api_spec.rb +47 -0
- data/kinde_api/spec/api/users_api_spec.rb +51 -24
- data/kinde_api/spec/api_client_spec.rb +20 -15
- data/kinde_api/spec/configuration_spec.rb +11 -11
- data/kinde_api/spec/models/add_apis_request_spec.rb +39 -0
- data/kinde_api/spec/models/add_organization_users_request_spec.rb +11 -12
- data/kinde_api/spec/models/add_organization_users_request_users_inner_spec.rb +14 -15
- data/kinde_api/spec/models/add_organization_users_response_spec.rb +14 -15
- data/kinde_api/spec/models/api_applications_inner_spec.rb +51 -0
- data/kinde_api/spec/models/api_result_spec.rb +11 -12
- data/kinde_api/spec/models/api_spec.rb +63 -0
- data/kinde_api/spec/models/apis_spec.rb +51 -0
- data/kinde_api/spec/models/applications_spec.rb +45 -0
- data/kinde_api/spec/models/connected_apps_access_token_spec.rb +13 -14
- data/kinde_api/spec/models/connected_apps_auth_url_spec.rb +13 -14
- data/kinde_api/spec/models/create_application_request_spec.rb +43 -0
- data/kinde_api/spec/models/create_application_response_application_spec.rb +45 -0
- data/kinde_api/spec/models/create_application_response_spec.rb +45 -0
- data/kinde_api/spec/models/create_feature_flag_request_spec.rb +71 -0
- data/kinde_api/spec/models/create_organization_request_spec.rb +58 -17
- data/kinde_api/spec/models/create_organization_response_organization_spec.rb +11 -12
- data/kinde_api/spec/models/create_organization_response_spec.rb +14 -15
- data/kinde_api/spec/models/create_organization_user_permission_request_spec.rb +33 -0
- data/kinde_api/spec/models/create_organization_user_role_request_spec.rb +11 -12
- data/kinde_api/spec/models/create_permission_request_spec.rb +14 -15
- data/kinde_api/spec/models/create_role_request_spec.rb +15 -16
- data/kinde_api/spec/models/create_subscriber_success_response_spec.rb +11 -12
- data/kinde_api/spec/models/create_subscriber_success_response_subscriber_spec.rb +11 -12
- data/kinde_api/spec/models/create_user_request_identities_inner_details_spec.rb +11 -12
- data/kinde_api/spec/models/create_user_request_identities_inner_spec.rb +13 -14
- data/kinde_api/spec/models/create_user_request_profile_spec.rb +13 -14
- data/kinde_api/spec/models/create_user_request_spec.rb +19 -14
- data/kinde_api/spec/models/create_user_response_spec.rb +14 -15
- data/kinde_api/spec/models/error_response_spec.rb +11 -12
- data/kinde_api/spec/models/error_spec.rb +13 -14
- data/kinde_api/spec/models/get_application_response_application_spec.rb +57 -0
- data/kinde_api/spec/models/get_application_response_spec.rb +45 -0
- data/kinde_api/spec/models/get_applications_response_spec.rb +16 -17
- data/kinde_api/spec/models/get_environment_feature_flags_response_spec.rb +15 -16
- data/kinde_api/spec/models/get_organization_feature_flags_response_feature_flags_value_spec.rb +13 -14
- data/kinde_api/spec/models/get_organization_feature_flags_response_spec.rb +14 -15
- data/kinde_api/spec/models/get_organization_users_response_spec.rb +51 -0
- data/kinde_api/spec/models/get_organizations_response_spec.rb +15 -16
- data/kinde_api/spec/models/get_organizations_user_permissions_response_spec.rb +45 -0
- data/kinde_api/spec/models/get_organizations_user_roles_response_spec.rb +15 -16
- data/kinde_api/spec/models/get_permissions_response_spec.rb +51 -0
- data/kinde_api/spec/models/get_redirect_callback_urls_response_spec.rb +11 -12
- data/kinde_api/spec/models/get_roles_response_spec.rb +51 -0
- data/kinde_api/spec/models/get_subscriber_response_spec.rb +45 -0
- data/kinde_api/spec/models/get_subscribers_response_spec.rb +51 -0
- data/kinde_api/spec/models/logout_redirect_urls_spec.rb +33 -0
- data/kinde_api/spec/models/organization_spec.rb +19 -14
- data/kinde_api/spec/models/organization_user_permission_roles_inner_spec.rb +39 -0
- data/kinde_api/spec/models/organization_user_permission_spec.rb +57 -0
- data/kinde_api/spec/models/organization_user_role_permissions_permissions_spec.rb +33 -0
- data/kinde_api/spec/models/organization_user_role_permissions_spec.rb +45 -0
- data/kinde_api/spec/models/organization_user_role_spec.rb +14 -15
- data/kinde_api/spec/models/organization_user_spec.rb +17 -18
- data/kinde_api/spec/models/permissions_spec.rb +20 -15
- data/kinde_api/spec/models/redirect_callback_urls_spec.rb +11 -12
- data/kinde_api/spec/models/replace_logout_redirect_urls_request_spec.rb +33 -0
- data/kinde_api/spec/models/replace_redirect_callback_urls_request_spec.rb +33 -0
- data/kinde_api/spec/models/role_spec.rb +51 -0
- data/kinde_api/spec/models/roles_permission_response_inner_spec.rb +51 -0
- data/kinde_api/spec/models/roles_spec.rb +20 -15
- data/kinde_api/spec/models/subscriber_spec.rb +51 -0
- data/kinde_api/spec/models/subscribers_subscriber_spec.rb +57 -0
- data/kinde_api/spec/models/success_response_spec.rb +13 -14
- data/kinde_api/spec/models/token_error_response_spec.rb +39 -0
- data/kinde_api/spec/models/token_introspect_spec.rb +57 -0
- data/kinde_api/spec/models/update_api_applications_request_applications_inner_spec.rb +39 -0
- data/kinde_api/spec/models/update_api_applications_request_spec.rb +33 -0
- data/kinde_api/spec/models/update_application_request_spec.rb +51 -0
- data/kinde_api/spec/models/update_environement_feature_flag_override_request_spec.rb +33 -0
- data/kinde_api/spec/models/update_organization_request_spec.rb +57 -16
- data/kinde_api/spec/models/update_organization_users_request_spec.rb +11 -12
- data/kinde_api/spec/models/update_organization_users_request_users_inner_spec.rb +15 -16
- data/kinde_api/spec/models/update_organization_users_response_spec.rb +15 -16
- data/kinde_api/spec/models/update_role_permissions_request_permissions_inner_spec.rb +39 -0
- data/kinde_api/spec/models/update_role_permissions_request_spec.rb +33 -0
- data/kinde_api/spec/models/update_role_permissions_response_spec.rb +51 -0
- data/kinde_api/spec/models/update_roles_request_spec.rb +51 -0
- data/kinde_api/spec/models/update_user_request_spec.rb +15 -16
- data/kinde_api/spec/models/update_user_response_spec.rb +69 -0
- data/kinde_api/spec/models/user_identities_inner_spec.rb +39 -0
- data/kinde_api/spec/models/user_identity_result_spec.rb +11 -12
- data/kinde_api/spec/models/user_identity_spec.rb +13 -14
- data/kinde_api/spec/models/user_profile_spec.rb +17 -18
- data/kinde_api/spec/models/user_profile_v2_spec.rb +19 -20
- data/kinde_api/spec/models/user_spec.rb +33 -34
- data/kinde_api/spec/models/users_response_spec.rb +15 -16
- data/kinde_api/spec/models/users_response_users_inner_spec.rb +105 -0
- data/kinde_api/spec/spec_helper.rb +61 -63
- data/lib/kinde_sdk/version.rb +1 -1
- data/spec/kinde_sdk_spec.rb +0 -46
- metadata +201 -29
- data/Gemfile +0 -15
- data/LICENSE +0 -21
- data/README.md +0 -445
- data/Rakefile +0 -10
- data/kinde_api/.gitignore +0 -39
- data/kinde_api/.rspec +0 -2
- data/kinde_api/docs/Application.md +0 -20
- data/kinde_api/spec/models/application_spec.rb +0 -40
- data/kinde_api/spec/models/get_organizations_users_response_spec.rb +0 -52
- data/kinde_sdk.gemspec +0 -33
- data/openapitools.json +0 -7
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'date'
|
2
4
|
require 'json'
|
3
5
|
require 'logger'
|
@@ -21,7 +23,7 @@ module KindeApi
|
|
21
23
|
@config = config
|
22
24
|
@user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
|
23
25
|
@default_headers = {
|
24
|
-
|
26
|
+
'Accept-Encoding' => '*',
|
25
27
|
'Content-Type' => 'application/json',
|
26
28
|
'User-Agent' => @user_agent
|
27
29
|
}
|
@@ -39,31 +41,25 @@ module KindeApi
|
|
39
41
|
request = build_request(http_method, path, opts)
|
40
42
|
response = request.run
|
41
43
|
|
42
|
-
if @config.debugging
|
43
|
-
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
44
|
-
end
|
44
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" if @config.debugging
|
45
45
|
|
46
46
|
unless response.success?
|
47
47
|
if response.timed_out?
|
48
|
-
|
49
|
-
elsif response.code
|
48
|
+
raise ApiError, 'Connection timed out'
|
49
|
+
elsif response.code.zero?
|
50
50
|
# Errors from libcurl will be made visible here
|
51
|
-
|
52
|
-
|
51
|
+
raise ApiError.new(code: 0,
|
52
|
+
message: response.return_message)
|
53
53
|
else
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
raise ApiError.new(code: response.code,
|
55
|
+
response_headers: response.headers,
|
56
|
+
response_body: response.body),
|
57
|
+
response.status_message
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
if opts[:return_type]
|
62
|
-
|
63
|
-
else
|
64
|
-
data = nil
|
65
|
-
end
|
66
|
-
return data, response.code, response.headers
|
61
|
+
data = (deserialize(response, opts[:return_type]) if opts[:return_type])
|
62
|
+
[data, response.code, response.headers]
|
67
63
|
end
|
68
64
|
|
69
65
|
# Builds the HTTP request
|
@@ -90,28 +86,26 @@ module KindeApi
|
|
90
86
|
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
91
87
|
|
92
88
|
req_opts = {
|
93
|
-
:
|
94
|
-
:
|
95
|
-
:
|
96
|
-
:
|
97
|
-
:
|
98
|
-
:
|
99
|
-
:
|
100
|
-
:
|
101
|
-
:
|
102
|
-
:
|
103
|
-
:
|
89
|
+
method: http_method,
|
90
|
+
headers: header_params,
|
91
|
+
params: query_params,
|
92
|
+
params_encoding: @config.params_encoding,
|
93
|
+
timeout: @config.timeout,
|
94
|
+
ssl_verifypeer: @config.verify_ssl,
|
95
|
+
ssl_verifyhost: _verify_ssl_host,
|
96
|
+
sslcert: @config.cert_file,
|
97
|
+
sslkey: @config.key_file,
|
98
|
+
verbose: @config.debugging,
|
99
|
+
followlocation: follow_location
|
104
100
|
}
|
105
101
|
|
106
102
|
# set custom cert, if provided
|
107
103
|
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
108
104
|
|
109
|
-
if [
|
105
|
+
if %i[post patch put delete].include?(http_method)
|
110
106
|
req_body = build_request_body(header_params, form_params, opts[:body])
|
111
|
-
req_opts.update :
|
112
|
-
if @config.debugging
|
113
|
-
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
114
|
-
end
|
107
|
+
req_opts.update body: req_body
|
108
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" if @config.debugging
|
115
109
|
end
|
116
110
|
|
117
111
|
request = Typhoeus::Request.new(url, req_opts)
|
@@ -128,16 +122,16 @@ module KindeApi
|
|
128
122
|
def build_request_body(header_params, form_params, body)
|
129
123
|
# http form
|
130
124
|
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
131
|
-
|
125
|
+
header_params['Content-Type'] == 'multipart/form-data'
|
132
126
|
data = {}
|
133
127
|
form_params.each do |key, value|
|
134
|
-
case value
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
128
|
+
data[key] = case value
|
129
|
+
when ::File, ::Array, nil
|
130
|
+
# let typhoeus handle File, Array and nil parameters
|
131
|
+
value
|
132
|
+
else
|
133
|
+
value.to_s
|
134
|
+
end
|
141
135
|
end
|
142
136
|
elsif body
|
143
137
|
data = body.is_a?(String) ? body : body.to_json
|
@@ -165,22 +159,22 @@ module KindeApi
|
|
165
159
|
else
|
166
160
|
prefix = 'download-'
|
167
161
|
end
|
168
|
-
prefix
|
162
|
+
prefix += '-' unless prefix.end_with?('-')
|
169
163
|
encoding = response.body.encoding
|
170
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding:
|
164
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding:)
|
171
165
|
@tempfile = tempfile
|
172
166
|
end
|
173
167
|
request.on_body do |chunk|
|
174
168
|
chunk.force_encoding(encoding)
|
175
169
|
tempfile.write(chunk)
|
176
170
|
end
|
177
|
-
request.on_complete do |
|
171
|
+
request.on_complete do |_response|
|
178
172
|
if tempfile
|
179
173
|
tempfile.close
|
180
174
|
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
181
175
|
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
182
176
|
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
183
|
-
|
177
|
+
'explicitly with `tempfile.delete`'
|
184
178
|
end
|
185
179
|
end
|
186
180
|
end
|
@@ -196,7 +190,7 @@ module KindeApi
|
|
196
190
|
# @param [String] mime MIME
|
197
191
|
# @return [Boolean] True if the MIME is application/json
|
198
192
|
def json_mime?(mime)
|
199
|
-
prepared_mime = mime.to_s.downcase.strip.split(
|
193
|
+
prepared_mime = mime.to_s.downcase.strip.split(';')[0]
|
200
194
|
result = %w[*/* application/json text/plain].find { |i| i == prepared_mime }
|
201
195
|
result != nil
|
202
196
|
end
|
@@ -220,16 +214,14 @@ module KindeApi
|
|
220
214
|
# ensuring a default content type
|
221
215
|
content_type = response.headers['Content-Type'] || 'application/json'
|
222
216
|
|
223
|
-
|
217
|
+
raise "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
224
218
|
|
225
219
|
begin
|
226
|
-
data = JSON.parse("[#{body}]", :
|
220
|
+
data = JSON.parse("[#{body}]", symbolize_names: true)[0]
|
227
221
|
rescue JSON::ParserError => e
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
raise e
|
232
|
-
end
|
222
|
+
raise e unless %w[String Date Time].include?(return_type)
|
223
|
+
|
224
|
+
data = body
|
233
225
|
end
|
234
226
|
|
235
227
|
convert_to_type data, return_type
|
@@ -241,6 +233,7 @@ module KindeApi
|
|
241
233
|
# @return [Mixed] Data in a particular type
|
242
234
|
def convert_to_type(data, return_type)
|
243
235
|
return nil if data.nil?
|
236
|
+
|
244
237
|
case return_type
|
245
238
|
when 'String'
|
246
239
|
data.to_s
|
@@ -261,11 +254,11 @@ module KindeApi
|
|
261
254
|
data
|
262
255
|
when /\AArray<(.+)>\z/
|
263
256
|
# e.g. Array<Pet>
|
264
|
-
sub_type =
|
257
|
+
sub_type = ::Regexp.last_match(1)
|
265
258
|
data.map { |item| convert_to_type(item, sub_type) }
|
266
|
-
when /\AHash
|
259
|
+
when /\AHash<String, (.+)>\z/
|
267
260
|
# e.g. Hash<String, Integer>
|
268
|
-
sub_type =
|
261
|
+
sub_type = ::Regexp.last_match(1)
|
269
262
|
{}.tap do |hash|
|
270
263
|
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
271
264
|
end
|
@@ -282,12 +275,12 @@ module KindeApi
|
|
282
275
|
# @param [String] filename the filename to be sanitized
|
283
276
|
# @return [String] the sanitized filename
|
284
277
|
def sanitize_filename(filename)
|
285
|
-
filename.gsub(
|
278
|
+
filename.gsub(%r{.*[/\\]}, '')
|
286
279
|
end
|
287
280
|
|
288
|
-
def build_request_url(path,
|
281
|
+
def build_request_url(path, _opts = {})
|
289
282
|
# Add leading and trailing slashes to path
|
290
|
-
path = "/#{path}".gsub(
|
283
|
+
path = "/#{path}".gsub(%r{/+}, '/')
|
291
284
|
@config.base_url + path
|
292
285
|
end
|
293
286
|
|
@@ -300,10 +293,11 @@ module KindeApi
|
|
300
293
|
Array(auth_names).each do |auth_name|
|
301
294
|
auth_setting = @config.auth_settings[auth_name]
|
302
295
|
next unless auth_setting
|
296
|
+
|
303
297
|
case auth_setting[:in]
|
304
298
|
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
305
299
|
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
306
|
-
else
|
300
|
+
else raise ArgumentError, 'Authentication token must be in `query` or `header`'
|
307
301
|
end
|
308
302
|
end
|
309
303
|
end
|
@@ -321,6 +315,7 @@ module KindeApi
|
|
321
315
|
# @return [String] the Accept header (e.g. application/json)
|
322
316
|
def select_header_accept(accepts)
|
323
317
|
return nil if accepts.nil? || accepts.empty?
|
318
|
+
|
324
319
|
# use JSON when present, otherwise use all of the provided
|
325
320
|
json_accept = accepts.find { |s| json_mime?(s) }
|
326
321
|
json_accept || accepts.join(',')
|
@@ -332,6 +327,7 @@ module KindeApi
|
|
332
327
|
def select_header_content_type(content_types)
|
333
328
|
# return nil by default
|
334
329
|
return if content_types.nil? || content_types.empty?
|
330
|
+
|
335
331
|
# use JSON when present, otherwise use the first one
|
336
332
|
json_content_type = content_types.find { |s| json_mime?(s) }
|
337
333
|
json_content_type || content_types.first
|
@@ -342,12 +338,12 @@ module KindeApi
|
|
342
338
|
# @return [String] JSON string representation of the object
|
343
339
|
def object_to_http_body(model)
|
344
340
|
return model if model.nil? || model.is_a?(String)
|
345
|
-
|
346
|
-
if model.is_a?(Array)
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
341
|
+
|
342
|
+
local_body = if model.is_a?(Array)
|
343
|
+
model.map { |m| object_to_hash(m) }
|
344
|
+
else
|
345
|
+
object_to_hash(model)
|
346
|
+
end
|
351
347
|
local_body.to_json
|
352
348
|
end
|
353
349
|
|
@@ -378,7 +374,7 @@ module KindeApi
|
|
378
374
|
# return the array directly as typhoeus will handle it as expected
|
379
375
|
param
|
380
376
|
else
|
381
|
-
|
377
|
+
raise "unknown collection format: #{collection_format.inspect}"
|
382
378
|
end
|
383
379
|
end
|
384
380
|
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# #Kinde Management API
|
4
|
+
#
|
5
|
+
# Provides endpoints to manage your Kinde Businesses
|
6
|
+
#
|
7
|
+
# The version of the OpenAPI document: 1
|
8
|
+
# Contact: support@kinde.com
|
9
|
+
# Generated by: https://openapi-generator.tech
|
10
|
+
# OpenAPI Generator version: 7.0.0-SNAPSHOT
|
11
|
+
#
|
12
12
|
|
13
13
|
module KindeApi
|
14
14
|
class ApiError < StandardError
|
@@ -42,11 +42,11 @@ module KindeApi
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def message
|
45
|
-
if @message.nil?
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
msg = if @message.nil?
|
46
|
+
'Error message: the server returns an error'
|
47
|
+
else
|
48
|
+
@message
|
49
|
+
end
|
50
50
|
|
51
51
|
msg += "\nHTTP status code: #{code}" if code
|
52
52
|
msg += "\nResponse headers: #{response_headers}" if response_headers
|
@@ -1,14 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# #Kinde Management API
|
4
|
+
#
|
5
|
+
# Provides endpoints to manage your Kinde Businesses
|
6
|
+
#
|
7
|
+
# The version of the OpenAPI document: 1
|
8
|
+
# Contact: support@kinde.com
|
9
|
+
# Generated by: https://openapi-generator.tech
|
10
|
+
# OpenAPI Generator version: 6.4.0
|
11
|
+
#
|
12
12
|
|
13
13
|
module KindeApi
|
14
14
|
class Configuration
|
@@ -126,9 +126,7 @@ module KindeApi
|
|
126
126
|
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
127
127
|
attr_accessor :params_encoding
|
128
128
|
|
129
|
-
attr_accessor :inject_format
|
130
|
-
|
131
|
-
attr_accessor :force_ending_format
|
129
|
+
attr_accessor :inject_format, :force_ending_format
|
132
130
|
|
133
131
|
def initialize
|
134
132
|
@scheme = 'https'
|
@@ -146,7 +144,7 @@ module KindeApi
|
|
146
144
|
@debugging = false
|
147
145
|
@inject_format = false
|
148
146
|
@force_ending_format = false
|
149
|
-
@logger = defined?(Rails) ? Rails.logger : Logger.new(
|
147
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new($stdout)
|
150
148
|
|
151
149
|
yield(self) if block_given?
|
152
150
|
end
|
@@ -162,17 +160,17 @@ module KindeApi
|
|
162
160
|
|
163
161
|
def scheme=(scheme)
|
164
162
|
# remove :// from scheme
|
165
|
-
@scheme = scheme.sub(
|
163
|
+
@scheme = scheme.sub(%r{://}, '')
|
166
164
|
end
|
167
165
|
|
168
166
|
def host=(host)
|
169
167
|
# remove http(s):// and anything after a slash
|
170
|
-
@host = host.sub(
|
168
|
+
@host = host.sub(%r{https?://}, '').split('/').first
|
171
169
|
end
|
172
170
|
|
173
171
|
def base_path=(base_path)
|
174
172
|
# Add leading and trailing slashes to base_path
|
175
|
-
@base_path = "/#{base_path}".gsub(
|
173
|
+
@base_path = "/#{base_path}".gsub(%r{/+}, '/')
|
176
174
|
@base_path = '' if @base_path == '/'
|
177
175
|
end
|
178
176
|
|
@@ -196,12 +194,13 @@ module KindeApi
|
|
196
194
|
# Gets access_token using access_token_getter or uses the static access_token
|
197
195
|
def access_token_with_refresh
|
198
196
|
return access_token if access_token_getter.nil?
|
197
|
+
|
199
198
|
access_token_getter.call
|
200
199
|
end
|
201
200
|
|
202
201
|
# Gets Basic Auth token string
|
203
202
|
def basic_auth_token
|
204
|
-
|
203
|
+
"Basic #{["#{username}:#{password}"].pack('m').delete("\r\n")}"
|
205
204
|
end
|
206
205
|
|
207
206
|
# Returns Auth Settings hash for api client.
|
@@ -0,0 +1,235 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# #Kinde Management API
|
4
|
+
#
|
5
|
+
# Provides endpoints to manage your Kinde Businesses
|
6
|
+
#
|
7
|
+
# The version of the OpenAPI document: 1
|
8
|
+
# Contact: support@kinde.com
|
9
|
+
# Generated by: https://openapi-generator.tech
|
10
|
+
# OpenAPI Generator version: 7.0.0-SNAPSHOT
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module KindeApi
|
17
|
+
class AddAPIsRequest
|
18
|
+
attr_accessor :name, :audience
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
'name': :name,
|
24
|
+
'audience': :audience
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns all the JSON keys this model knows about
|
29
|
+
def self.acceptable_attributes
|
30
|
+
attribute_map.values
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.openapi_types
|
35
|
+
{
|
36
|
+
'name': :String,
|
37
|
+
'audience': :String
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# List of attributes with nullable: true
|
42
|
+
def self.openapi_nullable
|
43
|
+
Set.new([])
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
unless attributes.is_a?(Hash)
|
50
|
+
raise ArgumentError,
|
51
|
+
'The input argument (attributes) must be a hash in `KindeApi::AddAPIsRequest` initialize method'
|
52
|
+
end
|
53
|
+
|
54
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
55
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
56
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
57
|
+
raise ArgumentError,
|
58
|
+
"`#{k}` is not a valid attribute in `KindeApi::AddAPIsRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
59
|
+
end
|
60
|
+
|
61
|
+
h[k.to_sym] = v
|
62
|
+
end
|
63
|
+
|
64
|
+
self.name = attributes[:name] if attributes.key?(:name)
|
65
|
+
|
66
|
+
return unless attributes.key?(:audience)
|
67
|
+
|
68
|
+
self.audience = attributes[:audience]
|
69
|
+
end
|
70
|
+
|
71
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
72
|
+
# @return Array for valid properties with the reasons
|
73
|
+
def list_invalid_properties
|
74
|
+
invalid_properties = []
|
75
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.') if @name.nil?
|
76
|
+
|
77
|
+
invalid_properties.push('invalid value for "audience", audience cannot be nil.') if @audience.nil?
|
78
|
+
|
79
|
+
invalid_properties
|
80
|
+
end
|
81
|
+
|
82
|
+
# Check to see if the all the properties in the model are valid
|
83
|
+
# @return true if the model is valid
|
84
|
+
def valid?
|
85
|
+
return false if @name.nil?
|
86
|
+
return false if @audience.nil?
|
87
|
+
|
88
|
+
true
|
89
|
+
end
|
90
|
+
|
91
|
+
# Checks equality by comparing each attribute.
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def ==(other)
|
94
|
+
return true if equal?(other)
|
95
|
+
|
96
|
+
self.class == other.class &&
|
97
|
+
name == other.name &&
|
98
|
+
audience == other.audience
|
99
|
+
end
|
100
|
+
|
101
|
+
# @see the `==` method
|
102
|
+
# @param [Object] Object to be compared
|
103
|
+
def eql?(other)
|
104
|
+
self == other
|
105
|
+
end
|
106
|
+
|
107
|
+
# Calculates hash code according to all attributes.
|
108
|
+
# @return [Integer] Hash code
|
109
|
+
def hash
|
110
|
+
[name, audience].hash
|
111
|
+
end
|
112
|
+
|
113
|
+
# Builds the object from hash
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
# @return [Object] Returns the model itself
|
116
|
+
def self.build_from_hash(attributes)
|
117
|
+
new.build_from_hash(attributes)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Builds the object from hash
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
# @return [Object] Returns the model itself
|
123
|
+
def build_from_hash(attributes)
|
124
|
+
return nil unless attributes.is_a?(Hash)
|
125
|
+
|
126
|
+
attributes = attributes.transform_keys(&:to_sym)
|
127
|
+
self.class.openapi_types.each_pair do |key, type|
|
128
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
129
|
+
send("#{key}=", nil)
|
130
|
+
elsif type =~ /\AArray<(.*)>/i
|
131
|
+
# check to ensure the input is an array given that the attribute
|
132
|
+
# is documented as an array but the input is not
|
133
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
134
|
+
send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
|
135
|
+
_deserialize(::Regexp.last_match(1), v)
|
136
|
+
end)
|
137
|
+
end
|
138
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
139
|
+
send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
self
|
144
|
+
end
|
145
|
+
|
146
|
+
# Deserializes the data based on type
|
147
|
+
# @param string type Data type
|
148
|
+
# @param string value Value to be deserialized
|
149
|
+
# @return [Object] Deserialized data
|
150
|
+
def _deserialize(type, value)
|
151
|
+
case type.to_sym
|
152
|
+
when :Time
|
153
|
+
Time.parse(value)
|
154
|
+
when :Date
|
155
|
+
Date.parse(value)
|
156
|
+
when :String
|
157
|
+
value.to_s
|
158
|
+
when :Integer
|
159
|
+
value.to_i
|
160
|
+
when :Float
|
161
|
+
value.to_f
|
162
|
+
when :Boolean
|
163
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
164
|
+
true
|
165
|
+
else
|
166
|
+
false
|
167
|
+
end
|
168
|
+
when :Object
|
169
|
+
# generic object (usually a Hash), return directly
|
170
|
+
value
|
171
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
172
|
+
inner_type = Regexp.last_match[:inner_type]
|
173
|
+
value.map { |v| _deserialize(inner_type, v) }
|
174
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
175
|
+
k_type = Regexp.last_match[:k_type]
|
176
|
+
v_type = Regexp.last_match[:v_type]
|
177
|
+
{}.tap do |hash|
|
178
|
+
value.each do |k, v|
|
179
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
else # model
|
183
|
+
# models (e.g. Pet) or oneOf
|
184
|
+
klass = KindeApi.const_get(type)
|
185
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns the string representation of the object
|
190
|
+
# @return [String] String presentation of the object
|
191
|
+
def to_s
|
192
|
+
to_hash.to_s
|
193
|
+
end
|
194
|
+
|
195
|
+
# to_body is an alias to to_hash (backward compatibility)
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
197
|
+
def to_body
|
198
|
+
to_hash
|
199
|
+
end
|
200
|
+
|
201
|
+
# Returns the object in the form of hash
|
202
|
+
# @return [Hash] Returns the object in the form of hash
|
203
|
+
def to_hash
|
204
|
+
hash = {}
|
205
|
+
self.class.attribute_map.each_pair do |attr, param|
|
206
|
+
value = send(attr)
|
207
|
+
if value.nil?
|
208
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
209
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
210
|
+
end
|
211
|
+
|
212
|
+
hash[param] = _to_hash(value)
|
213
|
+
end
|
214
|
+
hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Outputs non-array value in the form of hash
|
218
|
+
# For object, use to_hash. Otherwise, just return the value
|
219
|
+
# @param [Object] value Any valid value
|
220
|
+
# @return [Hash] Returns the value in the form of hash
|
221
|
+
def _to_hash(value)
|
222
|
+
if value.is_a?(Array)
|
223
|
+
value.compact.map { |v| _to_hash(v) }
|
224
|
+
elsif value.is_a?(Hash)
|
225
|
+
{}.tap do |hash|
|
226
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
227
|
+
end
|
228
|
+
elsif value.respond_to? :to_hash
|
229
|
+
value.to_hash
|
230
|
+
else
|
231
|
+
value
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|