kinde_sdk 1.2.2 → 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 +3 -1
- data/kinde_api/docs/ConnectedAppsApi.md +12 -6
- data/kinde_api/docs/CreateOrganizationRequest.md +14 -2
- data/kinde_api/docs/CreateUserRequest.md +2 -0
- data/kinde_api/docs/OrganizationsApi.md +6 -8
- data/kinde_api/docs/Permissions.md +3 -1
- data/kinde_api/docs/RolesApi.md +2 -2
- data/kinde_api/docs/UpdateOrganizationRequest.md +13 -1
- data/kinde_api/docs/UsersApi.md +80 -10
- data/kinde_api/lib/kinde_api/api/apis_api.rb +95 -96
- data/kinde_api/lib/kinde_api/api/applications_api.rb +95 -85
- data/kinde_api/lib/kinde_api/api/business_api.rb +58 -56
- data/kinde_api/lib/kinde_api/api/callbacks_api.rb +164 -144
- data/kinde_api/lib/kinde_api/api/connected_apps_api.rb +66 -54
- data/kinde_api/lib/kinde_api/api/environments_api.rb +71 -58
- data/kinde_api/lib/kinde_api/api/feature_flags_api.rb +82 -62
- data/kinde_api/lib/kinde_api/api/industries_api.rb +22 -23
- data/kinde_api/lib/kinde_api/api/o_auth_api.rb +63 -72
- data/kinde_api/lib/kinde_api/api/organizations_api.rb +376 -287
- data/kinde_api/lib/kinde_api/api/permissions_api.rb +72 -68
- data/kinde_api/lib/kinde_api/api/roles_api.rb +137 -134
- data/kinde_api/lib/kinde_api/api/subscribers_api.rb +58 -57
- data/kinde_api/lib/kinde_api/api/timezones_api.rb +22 -23
- data/kinde_api/lib/kinde_api/api/users_api.rb +204 -128
- data/kinde_api/lib/kinde_api/api_client.rb +68 -79
- data/kinde_api/lib/kinde_api/api_error.rb +16 -16
- data/kinde_api/lib/kinde_api/configuration.rb +23 -100
- data/kinde_api/lib/kinde_api/models/add_apis_request.rb +49 -52
- data/kinde_api/lib/kinde_api/models/add_organization_users_request.rb +42 -40
- data/kinde_api/lib/kinde_api/models/add_organization_users_request_users_inner.rb +51 -53
- data/kinde_api/lib/kinde_api/models/add_organization_users_response.rb +50 -52
- data/kinde_api/lib/kinde_api/models/api.rb +61 -70
- data/kinde_api/lib/kinde_api/models/api_applications_inner.rb +54 -63
- data/kinde_api/lib/kinde_api/models/api_result.rb +40 -38
- data/kinde_api/lib/kinde_api/models/apis.rb +52 -56
- data/kinde_api/lib/kinde_api/models/applications.rb +50 -55
- data/kinde_api/lib/kinde_api/models/connected_apps_access_token.rb +45 -44
- data/kinde_api/lib/kinde_api/models/connected_apps_auth_url.rb +45 -44
- data/kinde_api/lib/kinde_api/models/create_application_request.rb +51 -49
- data/kinde_api/lib/kinde_api/models/create_application_response.rb +49 -50
- data/kinde_api/lib/kinde_api/models/create_application_response_application.rb +49 -50
- data/kinde_api/lib/kinde_api/models/create_feature_flag_request.rb +77 -87
- data/kinde_api/lib/kinde_api/models/create_organization_request.rb +125 -83
- data/kinde_api/lib/kinde_api/models/create_organization_response.rb +50 -55
- data/kinde_api/lib/kinde_api/models/create_organization_response_organization.rb +41 -38
- data/kinde_api/lib/kinde_api/models/create_organization_user_permission_request.rb +41 -38
- data/kinde_api/lib/kinde_api/models/create_organization_user_role_request.rb +41 -38
- data/kinde_api/lib/kinde_api/models/create_permission_request.rb +49 -50
- data/kinde_api/lib/kinde_api/models/create_role_request.rb +53 -56
- data/kinde_api/lib/kinde_api/models/create_subscriber_success_response.rb +41 -38
- data/kinde_api/lib/kinde_api/models/create_subscriber_success_response_subscriber.rb +41 -38
- data/kinde_api/lib/kinde_api/models/create_user_request.rb +55 -47
- data/kinde_api/lib/kinde_api/models/create_user_request_identities_inner.rb +51 -49
- data/kinde_api/lib/kinde_api/models/create_user_request_identities_inner_details.rb +41 -38
- data/kinde_api/lib/kinde_api/models/create_user_request_profile.rb +45 -44
- data/kinde_api/lib/kinde_api/models/create_user_response.rb +50 -52
- data/kinde_api/lib/kinde_api/models/error.rb +44 -44
- data/kinde_api/lib/kinde_api/models/error_response.rb +42 -40
- data/kinde_api/lib/kinde_api/models/get_application_response.rb +49 -50
- data/kinde_api/lib/kinde_api/models/get_application_response_application.rb +57 -62
- data/kinde_api/lib/kinde_api/models/get_applications_response.rb +54 -57
- data/kinde_api/lib/kinde_api/models/get_environment_feature_flags_response.rb +54 -57
- data/kinde_api/lib/kinde_api/models/get_organization_feature_flags_response.rb +50 -52
- data/kinde_api/lib/kinde_api/models/get_organization_feature_flags_response_feature_flags_value.rb +52 -52
- data/kinde_api/lib/kinde_api/models/get_organization_users_response.rb +54 -57
- data/kinde_api/lib/kinde_api/models/get_organizations_response.rb +54 -57
- data/kinde_api/lib/kinde_api/models/get_organizations_user_permissions_response.rb +50 -52
- data/kinde_api/lib/kinde_api/models/get_organizations_user_roles_response.rb +54 -57
- data/kinde_api/lib/kinde_api/models/get_permissions_response.rb +54 -57
- data/kinde_api/lib/kinde_api/models/get_redirect_callback_urls_response.rb +42 -40
- data/kinde_api/lib/kinde_api/models/get_roles_response.rb +54 -57
- data/kinde_api/lib/kinde_api/models/get_subscriber_response.rb +50 -52
- data/kinde_api/lib/kinde_api/models/get_subscribers_response.rb +54 -57
- data/kinde_api/lib/kinde_api/models/logout_redirect_urls.rb +42 -40
- data/kinde_api/lib/kinde_api/models/organization.rb +54 -63
- data/kinde_api/lib/kinde_api/models/organization_user.rb +63 -81
- data/kinde_api/lib/kinde_api/models/organization_user_permission.rb +59 -73
- data/kinde_api/lib/kinde_api/models/organization_user_permission_roles_inner.rb +46 -47
- data/kinde_api/lib/kinde_api/models/organization_user_role.rb +50 -55
- data/kinde_api/lib/kinde_api/models/organization_user_role_permissions.rb +50 -55
- data/kinde_api/lib/kinde_api/models/organization_user_role_permissions_permissions.rb +41 -38
- data/kinde_api/lib/kinde_api/models/permissions.rb +59 -52
- data/kinde_api/lib/kinde_api/models/redirect_callback_urls.rb +42 -40
- data/kinde_api/lib/kinde_api/models/replace_logout_redirect_urls_request.rb +42 -40
- data/kinde_api/lib/kinde_api/models/replace_redirect_callback_urls_request.rb +42 -40
- data/kinde_api/lib/kinde_api/models/role.rb +53 -63
- data/kinde_api/lib/kinde_api/models/roles.rb +52 -56
- data/kinde_api/lib/kinde_api/models/roles_permission_response_inner.rb +54 -63
- data/kinde_api/lib/kinde_api/models/subscriber.rb +54 -63
- data/kinde_api/lib/kinde_api/models/subscribers_subscriber.rb +58 -71
- data/kinde_api/lib/kinde_api/models/success_response.rb +46 -47
- data/kinde_api/lib/kinde_api/models/token_error_response.rb +45 -44
- data/kinde_api/lib/kinde_api/models/token_introspect.rb +58 -63
- data/kinde_api/lib/kinde_api/models/update_api_applications_request.rb +44 -42
- data/kinde_api/lib/kinde_api/models/update_api_applications_request_applications_inner.rb +47 -46
- data/kinde_api/lib/kinde_api/models/update_application_request.rb +55 -59
- data/kinde_api/lib/kinde_api/models/update_environement_feature_flag_override_request.rb +43 -40
- data/kinde_api/lib/kinde_api/models/update_organization_request.rb +115 -75
- data/kinde_api/lib/kinde_api/models/update_organization_users_request.rb +42 -40
- data/kinde_api/lib/kinde_api/models/update_organization_users_request_users_inner.rb +55 -59
- data/kinde_api/lib/kinde_api/models/update_organization_users_response.rb +57 -67
- data/kinde_api/lib/kinde_api/models/update_role_permissions_request.rb +42 -40
- data/kinde_api/lib/kinde_api/models/update_role_permissions_request_permissions_inner.rb +45 -44
- data/kinde_api/lib/kinde_api/models/update_role_permissions_response.rb +56 -66
- data/kinde_api/lib/kinde_api/models/update_roles_request.rb +56 -61
- data/kinde_api/lib/kinde_api/models/update_user_request.rb +53 -56
- data/kinde_api/lib/kinde_api/models/update_user_response.rb +66 -73
- data/kinde_api/lib/kinde_api/models/user.rb +97 -118
- data/kinde_api/lib/kinde_api/models/user_identities_inner.rb +46 -47
- data/kinde_api/lib/kinde_api/models/user_identity.rb +45 -44
- data/kinde_api/lib/kinde_api/models/user_identity_result.rb +41 -38
- data/kinde_api/lib/kinde_api/models/user_profile.rb +62 -68
- data/kinde_api/lib/kinde_api/models/user_profile_v2.rb +74 -86
- data/kinde_api/lib/kinde_api/models/users_response.rb +54 -57
- data/kinde_api/lib/kinde_api/models/users_response_users_inner.rb +98 -118
- data/kinde_api/lib/kinde_api/version.rb +11 -11
- data/kinde_api/lib/kinde_api.rb +30 -20
- data/kinde_api/spec/api/apis_api_spec.rb +20 -21
- data/kinde_api/spec/api/applications_api_spec.rb +18 -19
- data/kinde_api/spec/api/business_api_spec.rb +12 -13
- data/kinde_api/spec/api/callbacks_api_spec.rb +27 -28
- data/kinde_api/spec/api/connected_apps_api_spec.rb +16 -15
- data/kinde_api/spec/api/environments_api_spec.rb +14 -15
- data/kinde_api/spec/api/feature_flags_api_spec.rb +13 -14
- data/kinde_api/spec/api/industries_api_spec.rb +12 -13
- data/kinde_api/spec/api/o_auth_api_spec.rb +16 -17
- data/kinde_api/spec/api/organizations_api_spec.rb +34 -35
- data/kinde_api/spec/api/permissions_api_spec.rb +15 -16
- data/kinde_api/spec/api/roles_api_spec.rb +20 -21
- data/kinde_api/spec/api/subscribers_api_spec.rb +15 -16
- data/kinde_api/spec/api/timezones_api_spec.rb +12 -13
- data/kinde_api/spec/api/users_api_spec.rb +36 -24
- data/kinde_api/spec/api_client_spec.rb +21 -27
- data/kinde_api/spec/configuration_spec.rb +11 -11
- data/kinde_api/spec/models/add_apis_request_spec.rb +13 -14
- 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 +15 -16
- data/kinde_api/spec/models/api_result_spec.rb +11 -12
- data/kinde_api/spec/models/api_spec.rb +17 -18
- data/kinde_api/spec/models/apis_spec.rb +15 -16
- data/kinde_api/spec/models/applications_spec.rb +14 -15
- 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 +13 -14
- data/kinde_api/spec/models/create_application_response_application_spec.rb +14 -15
- data/kinde_api/spec/models/create_application_response_spec.rb +14 -15
- data/kinde_api/spec/models/create_feature_flag_request_spec.rb +17 -18
- data/kinde_api/spec/models/create_organization_request_spec.rb +53 -18
- 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 +11 -12
- 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 +16 -17
- data/kinde_api/spec/models/get_application_response_spec.rb +14 -15
- data/kinde_api/spec/models/get_applications_response_spec.rb +15 -16
- 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 +15 -16
- data/kinde_api/spec/models/get_organizations_response_spec.rb +15 -16
- data/kinde_api/spec/models/get_organizations_user_permissions_response_spec.rb +14 -15
- data/kinde_api/spec/models/get_organizations_user_roles_response_spec.rb +15 -16
- data/kinde_api/spec/models/get_permissions_response_spec.rb +15 -16
- data/kinde_api/spec/models/get_redirect_callback_urls_response_spec.rb +11 -12
- data/kinde_api/spec/models/get_roles_response_spec.rb +15 -16
- data/kinde_api/spec/models/get_subscriber_response_spec.rb +14 -15
- data/kinde_api/spec/models/get_subscribers_response_spec.rb +15 -16
- data/kinde_api/spec/models/logout_redirect_urls_spec.rb +11 -12
- data/kinde_api/spec/models/organization_spec.rb +15 -16
- data/kinde_api/spec/models/organization_user_permission_roles_inner_spec.rb +13 -14
- data/kinde_api/spec/models/organization_user_permission_spec.rb +16 -17
- data/kinde_api/spec/models/organization_user_role_permissions_permissions_spec.rb +11 -12
- data/kinde_api/spec/models/organization_user_role_permissions_spec.rb +14 -15
- 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 +11 -12
- data/kinde_api/spec/models/replace_redirect_callback_urls_request_spec.rb +11 -12
- data/kinde_api/spec/models/role_spec.rb +15 -16
- data/kinde_api/spec/models/roles_permission_response_inner_spec.rb +15 -16
- data/kinde_api/spec/models/roles_spec.rb +15 -16
- data/kinde_api/spec/models/subscriber_spec.rb +15 -16
- data/kinde_api/spec/models/subscribers_subscriber_spec.rb +16 -17
- data/kinde_api/spec/models/success_response_spec.rb +13 -14
- data/kinde_api/spec/models/token_error_response_spec.rb +13 -14
- data/kinde_api/spec/models/token_introspect_spec.rb +16 -17
- data/kinde_api/spec/models/update_api_applications_request_applications_inner_spec.rb +13 -14
- data/kinde_api/spec/models/update_api_applications_request_spec.rb +11 -12
- data/kinde_api/spec/models/update_application_request_spec.rb +15 -16
- data/kinde_api/spec/models/update_environement_feature_flag_override_request_spec.rb +11 -12
- data/kinde_api/spec/models/update_organization_request_spec.rb +52 -17
- 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 +13 -14
- data/kinde_api/spec/models/update_role_permissions_request_spec.rb +11 -12
- data/kinde_api/spec/models/update_role_permissions_response_spec.rb +15 -16
- data/kinde_api/spec/models/update_roles_request_spec.rb +15 -16
- data/kinde_api/spec/models/update_user_request_spec.rb +15 -16
- data/kinde_api/spec/models/update_user_response_spec.rb +17 -18
- data/kinde_api/spec/models/user_identities_inner_spec.rb +13 -14
- 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 +24 -25
- data/kinde_api/spec/models/users_response_spec.rb +15 -16
- data/kinde_api/spec/models/users_response_users_inner_spec.rb +24 -25
- data/kinde_api/spec/spec_helper.rb +61 -63
- data/lib/kinde_sdk/version.rb +1 -1
- metadata +12 -21
- data/Gemfile +0 -15
- data/Gemfile.lock +0 -128
- data/LICENSE +0 -21
- data/README.md +0 -23
- data/Rakefile +0 -10
- data/kinde_api/.gitignore +0 -39
- data/kinde_api/.rspec +0 -2
- data/kinde_sdk.gemspec +0 -33
- data/openapitools.json +0 -7
@@ -1,14 +1,4 @@
|
|
1
|
-
|
2
|
-
#Kinde Management API
|
3
|
-
|
4
|
-
#Provides endpoints to manage your Kinde Businesses
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 1
|
7
|
-
Contact: support@kinde.com
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 6.4.0
|
10
|
-
|
11
|
-
=end
|
1
|
+
# frozen_string_literal: true
|
12
2
|
|
13
3
|
require 'date'
|
14
4
|
require 'json'
|
@@ -33,6 +23,7 @@ module KindeApi
|
|
33
23
|
@config = config
|
34
24
|
@user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
|
35
25
|
@default_headers = {
|
26
|
+
'Accept-Encoding' => '*',
|
36
27
|
'Content-Type' => 'application/json',
|
37
28
|
'User-Agent' => @user_agent
|
38
29
|
}
|
@@ -50,31 +41,25 @@ module KindeApi
|
|
50
41
|
request = build_request(http_method, path, opts)
|
51
42
|
response = request.run
|
52
43
|
|
53
|
-
if @config.debugging
|
54
|
-
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
55
|
-
end
|
44
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" if @config.debugging
|
56
45
|
|
57
46
|
unless response.success?
|
58
47
|
if response.timed_out?
|
59
|
-
|
60
|
-
elsif response.code
|
48
|
+
raise ApiError, 'Connection timed out'
|
49
|
+
elsif response.code.zero?
|
61
50
|
# Errors from libcurl will be made visible here
|
62
|
-
|
63
|
-
|
51
|
+
raise ApiError.new(code: 0,
|
52
|
+
message: response.return_message)
|
64
53
|
else
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
54
|
+
raise ApiError.new(code: response.code,
|
55
|
+
response_headers: response.headers,
|
56
|
+
response_body: response.body),
|
57
|
+
response.status_message
|
69
58
|
end
|
70
59
|
end
|
71
60
|
|
72
|
-
if opts[:return_type]
|
73
|
-
|
74
|
-
else
|
75
|
-
data = nil
|
76
|
-
end
|
77
|
-
return data, response.code, response.headers
|
61
|
+
data = (deserialize(response, opts[:return_type]) if opts[:return_type])
|
62
|
+
[data, response.code, response.headers]
|
78
63
|
end
|
79
64
|
|
80
65
|
# Builds the HTTP request
|
@@ -101,28 +86,26 @@ module KindeApi
|
|
101
86
|
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
102
87
|
|
103
88
|
req_opts = {
|
104
|
-
:
|
105
|
-
:
|
106
|
-
:
|
107
|
-
:
|
108
|
-
:
|
109
|
-
:
|
110
|
-
:
|
111
|
-
:
|
112
|
-
:
|
113
|
-
:
|
114
|
-
:
|
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
|
115
100
|
}
|
116
101
|
|
117
102
|
# set custom cert, if provided
|
118
103
|
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
119
104
|
|
120
|
-
if [
|
105
|
+
if %i[post patch put delete].include?(http_method)
|
121
106
|
req_body = build_request_body(header_params, form_params, opts[:body])
|
122
|
-
req_opts.update :
|
123
|
-
if @config.debugging
|
124
|
-
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
125
|
-
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
|
126
109
|
end
|
127
110
|
|
128
111
|
request = Typhoeus::Request.new(url, req_opts)
|
@@ -139,16 +122,16 @@ module KindeApi
|
|
139
122
|
def build_request_body(header_params, form_params, body)
|
140
123
|
# http form
|
141
124
|
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
142
|
-
|
125
|
+
header_params['Content-Type'] == 'multipart/form-data'
|
143
126
|
data = {}
|
144
127
|
form_params.each do |key, value|
|
145
|
-
case value
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
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
|
152
135
|
end
|
153
136
|
elsif body
|
154
137
|
data = body.is_a?(String) ? body : body.to_json
|
@@ -176,22 +159,22 @@ module KindeApi
|
|
176
159
|
else
|
177
160
|
prefix = 'download-'
|
178
161
|
end
|
179
|
-
prefix
|
162
|
+
prefix += '-' unless prefix.end_with?('-')
|
180
163
|
encoding = response.body.encoding
|
181
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding:
|
164
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding:)
|
182
165
|
@tempfile = tempfile
|
183
166
|
end
|
184
167
|
request.on_body do |chunk|
|
185
168
|
chunk.force_encoding(encoding)
|
186
169
|
tempfile.write(chunk)
|
187
170
|
end
|
188
|
-
request.on_complete do |
|
171
|
+
request.on_complete do |_response|
|
189
172
|
if tempfile
|
190
173
|
tempfile.close
|
191
174
|
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
192
175
|
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
193
176
|
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
194
|
-
|
177
|
+
'explicitly with `tempfile.delete`'
|
195
178
|
end
|
196
179
|
end
|
197
180
|
end
|
@@ -201,11 +184,15 @@ module KindeApi
|
|
201
184
|
# application/json
|
202
185
|
# application/json; charset=UTF8
|
203
186
|
# APPLICATION/JSON
|
187
|
+
# text/plain
|
188
|
+
# text/plain; charset=utf-8
|
204
189
|
# */*
|
205
190
|
# @param [String] mime MIME
|
206
191
|
# @return [Boolean] True if the MIME is application/json
|
207
192
|
def json_mime?(mime)
|
208
|
-
|
193
|
+
prepared_mime = mime.to_s.downcase.strip.split(';')[0]
|
194
|
+
result = %w[*/* application/json text/plain].find { |i| i == prepared_mime }
|
195
|
+
result != nil
|
209
196
|
end
|
210
197
|
|
211
198
|
# Deserialize the response to the given return type.
|
@@ -227,16 +214,14 @@ module KindeApi
|
|
227
214
|
# ensuring a default content type
|
228
215
|
content_type = response.headers['Content-Type'] || 'application/json'
|
229
216
|
|
230
|
-
|
217
|
+
raise "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
231
218
|
|
232
219
|
begin
|
233
|
-
data = JSON.parse("[#{body}]", :
|
220
|
+
data = JSON.parse("[#{body}]", symbolize_names: true)[0]
|
234
221
|
rescue JSON::ParserError => e
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
raise e
|
239
|
-
end
|
222
|
+
raise e unless %w[String Date Time].include?(return_type)
|
223
|
+
|
224
|
+
data = body
|
240
225
|
end
|
241
226
|
|
242
227
|
convert_to_type data, return_type
|
@@ -248,6 +233,7 @@ module KindeApi
|
|
248
233
|
# @return [Mixed] Data in a particular type
|
249
234
|
def convert_to_type(data, return_type)
|
250
235
|
return nil if data.nil?
|
236
|
+
|
251
237
|
case return_type
|
252
238
|
when 'String'
|
253
239
|
data.to_s
|
@@ -268,11 +254,11 @@ module KindeApi
|
|
268
254
|
data
|
269
255
|
when /\AArray<(.+)>\z/
|
270
256
|
# e.g. Array<Pet>
|
271
|
-
sub_type =
|
257
|
+
sub_type = ::Regexp.last_match(1)
|
272
258
|
data.map { |item| convert_to_type(item, sub_type) }
|
273
|
-
when /\AHash
|
259
|
+
when /\AHash<String, (.+)>\z/
|
274
260
|
# e.g. Hash<String, Integer>
|
275
|
-
sub_type =
|
261
|
+
sub_type = ::Regexp.last_match(1)
|
276
262
|
{}.tap do |hash|
|
277
263
|
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
278
264
|
end
|
@@ -289,13 +275,13 @@ module KindeApi
|
|
289
275
|
# @param [String] filename the filename to be sanitized
|
290
276
|
# @return [String] the sanitized filename
|
291
277
|
def sanitize_filename(filename)
|
292
|
-
filename.gsub(
|
278
|
+
filename.gsub(%r{.*[/\\]}, '')
|
293
279
|
end
|
294
280
|
|
295
|
-
def build_request_url(path,
|
281
|
+
def build_request_url(path, _opts = {})
|
296
282
|
# Add leading and trailing slashes to path
|
297
|
-
path = "/#{path}".gsub(
|
298
|
-
@config.base_url
|
283
|
+
path = "/#{path}".gsub(%r{/+}, '/')
|
284
|
+
@config.base_url + path
|
299
285
|
end
|
300
286
|
|
301
287
|
# Update header and query params based on authentication settings.
|
@@ -307,10 +293,11 @@ module KindeApi
|
|
307
293
|
Array(auth_names).each do |auth_name|
|
308
294
|
auth_setting = @config.auth_settings[auth_name]
|
309
295
|
next unless auth_setting
|
296
|
+
|
310
297
|
case auth_setting[:in]
|
311
298
|
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
312
299
|
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
313
|
-
else
|
300
|
+
else raise ArgumentError, 'Authentication token must be in `query` or `header`'
|
314
301
|
end
|
315
302
|
end
|
316
303
|
end
|
@@ -328,6 +315,7 @@ module KindeApi
|
|
328
315
|
# @return [String] the Accept header (e.g. application/json)
|
329
316
|
def select_header_accept(accepts)
|
330
317
|
return nil if accepts.nil? || accepts.empty?
|
318
|
+
|
331
319
|
# use JSON when present, otherwise use all of the provided
|
332
320
|
json_accept = accepts.find { |s| json_mime?(s) }
|
333
321
|
json_accept || accepts.join(',')
|
@@ -339,6 +327,7 @@ module KindeApi
|
|
339
327
|
def select_header_content_type(content_types)
|
340
328
|
# return nil by default
|
341
329
|
return if content_types.nil? || content_types.empty?
|
330
|
+
|
342
331
|
# use JSON when present, otherwise use the first one
|
343
332
|
json_content_type = content_types.find { |s| json_mime?(s) }
|
344
333
|
json_content_type || content_types.first
|
@@ -349,12 +338,12 @@ module KindeApi
|
|
349
338
|
# @return [String] JSON string representation of the object
|
350
339
|
def object_to_http_body(model)
|
351
340
|
return model if model.nil? || model.is_a?(String)
|
352
|
-
|
353
|
-
if model.is_a?(Array)
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
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
|
358
347
|
local_body.to_json
|
359
348
|
end
|
360
349
|
|
@@ -385,7 +374,7 @@ module KindeApi
|
|
385
374
|
# return the array directly as typhoeus will handle it as expected
|
386
375
|
param
|
387
376
|
else
|
388
|
-
|
377
|
+
raise "unknown collection format: #{collection_format.inspect}"
|
389
378
|
end
|
390
379
|
end
|
391
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
|
@@ -21,18 +21,6 @@ module KindeApi
|
|
21
21
|
# Defines url base path
|
22
22
|
attr_accessor :base_path
|
23
23
|
|
24
|
-
# Define server configuration index
|
25
|
-
attr_accessor :server_index
|
26
|
-
|
27
|
-
# Define server operation configuration index
|
28
|
-
attr_accessor :server_operation_index
|
29
|
-
|
30
|
-
# Default server variables
|
31
|
-
attr_accessor :server_variables
|
32
|
-
|
33
|
-
# Default server operation variables
|
34
|
-
attr_accessor :server_operation_variables
|
35
|
-
|
36
24
|
# Defines API keys used with API Key authentications.
|
37
25
|
#
|
38
26
|
# @return [Hash] key: parameter name, value: parameter value (API key)
|
@@ -138,19 +126,12 @@ module KindeApi
|
|
138
126
|
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
139
127
|
attr_accessor :params_encoding
|
140
128
|
|
141
|
-
|
142
|
-
attr_accessor :inject_format
|
143
|
-
|
144
|
-
attr_accessor :force_ending_format
|
129
|
+
attr_accessor :inject_format, :force_ending_format
|
145
130
|
|
146
131
|
def initialize
|
147
132
|
@scheme = 'https'
|
148
133
|
@host = 'app.kinde.com'
|
149
134
|
@base_path = ''
|
150
|
-
@server_index = 0
|
151
|
-
@server_operation_index = {}
|
152
|
-
@server_variables = {}
|
153
|
-
@server_operation_variables = {}
|
154
135
|
@api_key = {}
|
155
136
|
@api_key_prefix = {}
|
156
137
|
@client_side_validation = true
|
@@ -163,7 +144,7 @@ module KindeApi
|
|
163
144
|
@debugging = false
|
164
145
|
@inject_format = false
|
165
146
|
@force_ending_format = false
|
166
|
-
@logger = defined?(Rails) ? Rails.logger : Logger.new(
|
147
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new($stdout)
|
167
148
|
|
168
149
|
yield(self) if block_given?
|
169
150
|
end
|
@@ -179,26 +160,23 @@ module KindeApi
|
|
179
160
|
|
180
161
|
def scheme=(scheme)
|
181
162
|
# remove :// from scheme
|
182
|
-
@scheme = scheme.sub(
|
163
|
+
@scheme = scheme.sub(%r{://}, '')
|
183
164
|
end
|
184
165
|
|
185
166
|
def host=(host)
|
186
167
|
# remove http(s):// and anything after a slash
|
187
|
-
@host = host.sub(
|
168
|
+
@host = host.sub(%r{https?://}, '').split('/').first
|
188
169
|
end
|
189
170
|
|
190
171
|
def base_path=(base_path)
|
191
172
|
# Add leading and trailing slashes to base_path
|
192
|
-
@base_path = "/#{base_path}".gsub(
|
173
|
+
@base_path = "/#{base_path}".gsub(%r{/+}, '/')
|
193
174
|
@base_path = '' if @base_path == '/'
|
194
175
|
end
|
195
176
|
|
196
177
|
# Returns base URL for specified operation based on server settings
|
197
|
-
def base_url
|
198
|
-
|
199
|
-
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
|
200
|
-
|
201
|
-
server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
178
|
+
def base_url
|
179
|
+
"#{scheme}://#{host}"
|
202
180
|
end
|
203
181
|
|
204
182
|
# Gets API key (with prefix if set).
|
@@ -215,13 +193,14 @@ module KindeApi
|
|
215
193
|
|
216
194
|
# Gets access_token using access_token_getter or uses the static access_token
|
217
195
|
def access_token_with_refresh
|
218
|
-
|
219
|
-
|
196
|
+
return access_token if access_token_getter.nil?
|
197
|
+
|
198
|
+
access_token_getter.call
|
220
199
|
end
|
221
200
|
|
222
201
|
# Gets Basic Auth token string
|
223
202
|
def basic_auth_token
|
224
|
-
|
203
|
+
"Basic #{["#{username}:#{password}"].pack('m').delete("\r\n")}"
|
225
204
|
end
|
226
205
|
|
227
206
|
# Returns Auth Settings hash for api client.
|
@@ -234,64 +213,8 @@ module KindeApi
|
|
234
213
|
format: 'JWT',
|
235
214
|
key: 'Authorization',
|
236
215
|
value: "Bearer #{access_token_with_refresh}"
|
237
|
-
}
|
216
|
+
}
|
238
217
|
}
|
239
218
|
end
|
240
|
-
|
241
|
-
# Returns an array of Server setting
|
242
|
-
def server_settings
|
243
|
-
[
|
244
|
-
{
|
245
|
-
url: "https://{businessName}.kinde.com",
|
246
|
-
description: "No description provided",
|
247
|
-
variables: {
|
248
|
-
businessName: {
|
249
|
-
description: "Business name created in the Kinde admin area.",
|
250
|
-
default_value: "app",
|
251
|
-
}
|
252
|
-
}
|
253
|
-
}
|
254
|
-
]
|
255
|
-
end
|
256
|
-
|
257
|
-
def operation_server_settings
|
258
|
-
{
|
259
|
-
}
|
260
|
-
end
|
261
|
-
|
262
|
-
# Returns URL based on server settings
|
263
|
-
#
|
264
|
-
# @param index array index of the server settings
|
265
|
-
# @param variables hash of variable and the corresponding value
|
266
|
-
def server_url(index, variables = {}, servers = nil)
|
267
|
-
servers = server_settings if servers == nil
|
268
|
-
|
269
|
-
# check array index out of bound
|
270
|
-
if (index < 0 || index >= servers.size)
|
271
|
-
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
272
|
-
end
|
273
|
-
|
274
|
-
server = servers[index]
|
275
|
-
url = server[:url]
|
276
|
-
|
277
|
-
return url unless server.key? :variables
|
278
|
-
|
279
|
-
# go through variable and assign a value
|
280
|
-
server[:variables].each do |name, variable|
|
281
|
-
if variables.key?(name)
|
282
|
-
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
283
|
-
url.gsub! "{" + name.to_s + "}", variables[name]
|
284
|
-
else
|
285
|
-
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
286
|
-
end
|
287
|
-
else
|
288
|
-
# use default value
|
289
|
-
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
url
|
294
|
-
end
|
295
|
-
|
296
219
|
end
|
297
220
|
end
|