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.
Files changed (235) hide show
  1. checksums.yaml +4 -4
  2. data/kinde_api/README.md +3 -1
  3. data/kinde_api/docs/ConnectedAppsApi.md +12 -6
  4. data/kinde_api/docs/CreateOrganizationRequest.md +14 -2
  5. data/kinde_api/docs/CreateUserRequest.md +2 -0
  6. data/kinde_api/docs/OrganizationsApi.md +6 -8
  7. data/kinde_api/docs/Permissions.md +3 -1
  8. data/kinde_api/docs/RolesApi.md +2 -2
  9. data/kinde_api/docs/UpdateOrganizationRequest.md +13 -1
  10. data/kinde_api/docs/UsersApi.md +80 -10
  11. data/kinde_api/lib/kinde_api/api/apis_api.rb +95 -96
  12. data/kinde_api/lib/kinde_api/api/applications_api.rb +95 -85
  13. data/kinde_api/lib/kinde_api/api/business_api.rb +58 -56
  14. data/kinde_api/lib/kinde_api/api/callbacks_api.rb +164 -144
  15. data/kinde_api/lib/kinde_api/api/connected_apps_api.rb +66 -54
  16. data/kinde_api/lib/kinde_api/api/environments_api.rb +71 -58
  17. data/kinde_api/lib/kinde_api/api/feature_flags_api.rb +82 -62
  18. data/kinde_api/lib/kinde_api/api/industries_api.rb +22 -23
  19. data/kinde_api/lib/kinde_api/api/o_auth_api.rb +63 -72
  20. data/kinde_api/lib/kinde_api/api/organizations_api.rb +376 -287
  21. data/kinde_api/lib/kinde_api/api/permissions_api.rb +72 -68
  22. data/kinde_api/lib/kinde_api/api/roles_api.rb +137 -134
  23. data/kinde_api/lib/kinde_api/api/subscribers_api.rb +58 -57
  24. data/kinde_api/lib/kinde_api/api/timezones_api.rb +22 -23
  25. data/kinde_api/lib/kinde_api/api/users_api.rb +204 -128
  26. data/kinde_api/lib/kinde_api/api_client.rb +68 -79
  27. data/kinde_api/lib/kinde_api/api_error.rb +16 -16
  28. data/kinde_api/lib/kinde_api/configuration.rb +23 -100
  29. data/kinde_api/lib/kinde_api/models/add_apis_request.rb +49 -52
  30. data/kinde_api/lib/kinde_api/models/add_organization_users_request.rb +42 -40
  31. data/kinde_api/lib/kinde_api/models/add_organization_users_request_users_inner.rb +51 -53
  32. data/kinde_api/lib/kinde_api/models/add_organization_users_response.rb +50 -52
  33. data/kinde_api/lib/kinde_api/models/api.rb +61 -70
  34. data/kinde_api/lib/kinde_api/models/api_applications_inner.rb +54 -63
  35. data/kinde_api/lib/kinde_api/models/api_result.rb +40 -38
  36. data/kinde_api/lib/kinde_api/models/apis.rb +52 -56
  37. data/kinde_api/lib/kinde_api/models/applications.rb +50 -55
  38. data/kinde_api/lib/kinde_api/models/connected_apps_access_token.rb +45 -44
  39. data/kinde_api/lib/kinde_api/models/connected_apps_auth_url.rb +45 -44
  40. data/kinde_api/lib/kinde_api/models/create_application_request.rb +51 -49
  41. data/kinde_api/lib/kinde_api/models/create_application_response.rb +49 -50
  42. data/kinde_api/lib/kinde_api/models/create_application_response_application.rb +49 -50
  43. data/kinde_api/lib/kinde_api/models/create_feature_flag_request.rb +77 -87
  44. data/kinde_api/lib/kinde_api/models/create_organization_request.rb +125 -83
  45. data/kinde_api/lib/kinde_api/models/create_organization_response.rb +50 -55
  46. data/kinde_api/lib/kinde_api/models/create_organization_response_organization.rb +41 -38
  47. data/kinde_api/lib/kinde_api/models/create_organization_user_permission_request.rb +41 -38
  48. data/kinde_api/lib/kinde_api/models/create_organization_user_role_request.rb +41 -38
  49. data/kinde_api/lib/kinde_api/models/create_permission_request.rb +49 -50
  50. data/kinde_api/lib/kinde_api/models/create_role_request.rb +53 -56
  51. data/kinde_api/lib/kinde_api/models/create_subscriber_success_response.rb +41 -38
  52. data/kinde_api/lib/kinde_api/models/create_subscriber_success_response_subscriber.rb +41 -38
  53. data/kinde_api/lib/kinde_api/models/create_user_request.rb +55 -47
  54. data/kinde_api/lib/kinde_api/models/create_user_request_identities_inner.rb +51 -49
  55. data/kinde_api/lib/kinde_api/models/create_user_request_identities_inner_details.rb +41 -38
  56. data/kinde_api/lib/kinde_api/models/create_user_request_profile.rb +45 -44
  57. data/kinde_api/lib/kinde_api/models/create_user_response.rb +50 -52
  58. data/kinde_api/lib/kinde_api/models/error.rb +44 -44
  59. data/kinde_api/lib/kinde_api/models/error_response.rb +42 -40
  60. data/kinde_api/lib/kinde_api/models/get_application_response.rb +49 -50
  61. data/kinde_api/lib/kinde_api/models/get_application_response_application.rb +57 -62
  62. data/kinde_api/lib/kinde_api/models/get_applications_response.rb +54 -57
  63. data/kinde_api/lib/kinde_api/models/get_environment_feature_flags_response.rb +54 -57
  64. data/kinde_api/lib/kinde_api/models/get_organization_feature_flags_response.rb +50 -52
  65. data/kinde_api/lib/kinde_api/models/get_organization_feature_flags_response_feature_flags_value.rb +52 -52
  66. data/kinde_api/lib/kinde_api/models/get_organization_users_response.rb +54 -57
  67. data/kinde_api/lib/kinde_api/models/get_organizations_response.rb +54 -57
  68. data/kinde_api/lib/kinde_api/models/get_organizations_user_permissions_response.rb +50 -52
  69. data/kinde_api/lib/kinde_api/models/get_organizations_user_roles_response.rb +54 -57
  70. data/kinde_api/lib/kinde_api/models/get_permissions_response.rb +54 -57
  71. data/kinde_api/lib/kinde_api/models/get_redirect_callback_urls_response.rb +42 -40
  72. data/kinde_api/lib/kinde_api/models/get_roles_response.rb +54 -57
  73. data/kinde_api/lib/kinde_api/models/get_subscriber_response.rb +50 -52
  74. data/kinde_api/lib/kinde_api/models/get_subscribers_response.rb +54 -57
  75. data/kinde_api/lib/kinde_api/models/logout_redirect_urls.rb +42 -40
  76. data/kinde_api/lib/kinde_api/models/organization.rb +54 -63
  77. data/kinde_api/lib/kinde_api/models/organization_user.rb +63 -81
  78. data/kinde_api/lib/kinde_api/models/organization_user_permission.rb +59 -73
  79. data/kinde_api/lib/kinde_api/models/organization_user_permission_roles_inner.rb +46 -47
  80. data/kinde_api/lib/kinde_api/models/organization_user_role.rb +50 -55
  81. data/kinde_api/lib/kinde_api/models/organization_user_role_permissions.rb +50 -55
  82. data/kinde_api/lib/kinde_api/models/organization_user_role_permissions_permissions.rb +41 -38
  83. data/kinde_api/lib/kinde_api/models/permissions.rb +59 -52
  84. data/kinde_api/lib/kinde_api/models/redirect_callback_urls.rb +42 -40
  85. data/kinde_api/lib/kinde_api/models/replace_logout_redirect_urls_request.rb +42 -40
  86. data/kinde_api/lib/kinde_api/models/replace_redirect_callback_urls_request.rb +42 -40
  87. data/kinde_api/lib/kinde_api/models/role.rb +53 -63
  88. data/kinde_api/lib/kinde_api/models/roles.rb +52 -56
  89. data/kinde_api/lib/kinde_api/models/roles_permission_response_inner.rb +54 -63
  90. data/kinde_api/lib/kinde_api/models/subscriber.rb +54 -63
  91. data/kinde_api/lib/kinde_api/models/subscribers_subscriber.rb +58 -71
  92. data/kinde_api/lib/kinde_api/models/success_response.rb +46 -47
  93. data/kinde_api/lib/kinde_api/models/token_error_response.rb +45 -44
  94. data/kinde_api/lib/kinde_api/models/token_introspect.rb +58 -63
  95. data/kinde_api/lib/kinde_api/models/update_api_applications_request.rb +44 -42
  96. data/kinde_api/lib/kinde_api/models/update_api_applications_request_applications_inner.rb +47 -46
  97. data/kinde_api/lib/kinde_api/models/update_application_request.rb +55 -59
  98. data/kinde_api/lib/kinde_api/models/update_environement_feature_flag_override_request.rb +43 -40
  99. data/kinde_api/lib/kinde_api/models/update_organization_request.rb +115 -75
  100. data/kinde_api/lib/kinde_api/models/update_organization_users_request.rb +42 -40
  101. data/kinde_api/lib/kinde_api/models/update_organization_users_request_users_inner.rb +55 -59
  102. data/kinde_api/lib/kinde_api/models/update_organization_users_response.rb +57 -67
  103. data/kinde_api/lib/kinde_api/models/update_role_permissions_request.rb +42 -40
  104. data/kinde_api/lib/kinde_api/models/update_role_permissions_request_permissions_inner.rb +45 -44
  105. data/kinde_api/lib/kinde_api/models/update_role_permissions_response.rb +56 -66
  106. data/kinde_api/lib/kinde_api/models/update_roles_request.rb +56 -61
  107. data/kinde_api/lib/kinde_api/models/update_user_request.rb +53 -56
  108. data/kinde_api/lib/kinde_api/models/update_user_response.rb +66 -73
  109. data/kinde_api/lib/kinde_api/models/user.rb +97 -118
  110. data/kinde_api/lib/kinde_api/models/user_identities_inner.rb +46 -47
  111. data/kinde_api/lib/kinde_api/models/user_identity.rb +45 -44
  112. data/kinde_api/lib/kinde_api/models/user_identity_result.rb +41 -38
  113. data/kinde_api/lib/kinde_api/models/user_profile.rb +62 -68
  114. data/kinde_api/lib/kinde_api/models/user_profile_v2.rb +74 -86
  115. data/kinde_api/lib/kinde_api/models/users_response.rb +54 -57
  116. data/kinde_api/lib/kinde_api/models/users_response_users_inner.rb +98 -118
  117. data/kinde_api/lib/kinde_api/version.rb +11 -11
  118. data/kinde_api/lib/kinde_api.rb +30 -20
  119. data/kinde_api/spec/api/apis_api_spec.rb +20 -21
  120. data/kinde_api/spec/api/applications_api_spec.rb +18 -19
  121. data/kinde_api/spec/api/business_api_spec.rb +12 -13
  122. data/kinde_api/spec/api/callbacks_api_spec.rb +27 -28
  123. data/kinde_api/spec/api/connected_apps_api_spec.rb +16 -15
  124. data/kinde_api/spec/api/environments_api_spec.rb +14 -15
  125. data/kinde_api/spec/api/feature_flags_api_spec.rb +13 -14
  126. data/kinde_api/spec/api/industries_api_spec.rb +12 -13
  127. data/kinde_api/spec/api/o_auth_api_spec.rb +16 -17
  128. data/kinde_api/spec/api/organizations_api_spec.rb +34 -35
  129. data/kinde_api/spec/api/permissions_api_spec.rb +15 -16
  130. data/kinde_api/spec/api/roles_api_spec.rb +20 -21
  131. data/kinde_api/spec/api/subscribers_api_spec.rb +15 -16
  132. data/kinde_api/spec/api/timezones_api_spec.rb +12 -13
  133. data/kinde_api/spec/api/users_api_spec.rb +36 -24
  134. data/kinde_api/spec/api_client_spec.rb +21 -27
  135. data/kinde_api/spec/configuration_spec.rb +11 -11
  136. data/kinde_api/spec/models/add_apis_request_spec.rb +13 -14
  137. data/kinde_api/spec/models/add_organization_users_request_spec.rb +11 -12
  138. data/kinde_api/spec/models/add_organization_users_request_users_inner_spec.rb +14 -15
  139. data/kinde_api/spec/models/add_organization_users_response_spec.rb +14 -15
  140. data/kinde_api/spec/models/api_applications_inner_spec.rb +15 -16
  141. data/kinde_api/spec/models/api_result_spec.rb +11 -12
  142. data/kinde_api/spec/models/api_spec.rb +17 -18
  143. data/kinde_api/spec/models/apis_spec.rb +15 -16
  144. data/kinde_api/spec/models/applications_spec.rb +14 -15
  145. data/kinde_api/spec/models/connected_apps_access_token_spec.rb +13 -14
  146. data/kinde_api/spec/models/connected_apps_auth_url_spec.rb +13 -14
  147. data/kinde_api/spec/models/create_application_request_spec.rb +13 -14
  148. data/kinde_api/spec/models/create_application_response_application_spec.rb +14 -15
  149. data/kinde_api/spec/models/create_application_response_spec.rb +14 -15
  150. data/kinde_api/spec/models/create_feature_flag_request_spec.rb +17 -18
  151. data/kinde_api/spec/models/create_organization_request_spec.rb +53 -18
  152. data/kinde_api/spec/models/create_organization_response_organization_spec.rb +11 -12
  153. data/kinde_api/spec/models/create_organization_response_spec.rb +14 -15
  154. data/kinde_api/spec/models/create_organization_user_permission_request_spec.rb +11 -12
  155. data/kinde_api/spec/models/create_organization_user_role_request_spec.rb +11 -12
  156. data/kinde_api/spec/models/create_permission_request_spec.rb +14 -15
  157. data/kinde_api/spec/models/create_role_request_spec.rb +15 -16
  158. data/kinde_api/spec/models/create_subscriber_success_response_spec.rb +11 -12
  159. data/kinde_api/spec/models/create_subscriber_success_response_subscriber_spec.rb +11 -12
  160. data/kinde_api/spec/models/create_user_request_identities_inner_details_spec.rb +11 -12
  161. data/kinde_api/spec/models/create_user_request_identities_inner_spec.rb +13 -14
  162. data/kinde_api/spec/models/create_user_request_profile_spec.rb +13 -14
  163. data/kinde_api/spec/models/create_user_request_spec.rb +19 -14
  164. data/kinde_api/spec/models/create_user_response_spec.rb +14 -15
  165. data/kinde_api/spec/models/error_response_spec.rb +11 -12
  166. data/kinde_api/spec/models/error_spec.rb +13 -14
  167. data/kinde_api/spec/models/get_application_response_application_spec.rb +16 -17
  168. data/kinde_api/spec/models/get_application_response_spec.rb +14 -15
  169. data/kinde_api/spec/models/get_applications_response_spec.rb +15 -16
  170. data/kinde_api/spec/models/get_environment_feature_flags_response_spec.rb +15 -16
  171. data/kinde_api/spec/models/get_organization_feature_flags_response_feature_flags_value_spec.rb +13 -14
  172. data/kinde_api/spec/models/get_organization_feature_flags_response_spec.rb +14 -15
  173. data/kinde_api/spec/models/get_organization_users_response_spec.rb +15 -16
  174. data/kinde_api/spec/models/get_organizations_response_spec.rb +15 -16
  175. data/kinde_api/spec/models/get_organizations_user_permissions_response_spec.rb +14 -15
  176. data/kinde_api/spec/models/get_organizations_user_roles_response_spec.rb +15 -16
  177. data/kinde_api/spec/models/get_permissions_response_spec.rb +15 -16
  178. data/kinde_api/spec/models/get_redirect_callback_urls_response_spec.rb +11 -12
  179. data/kinde_api/spec/models/get_roles_response_spec.rb +15 -16
  180. data/kinde_api/spec/models/get_subscriber_response_spec.rb +14 -15
  181. data/kinde_api/spec/models/get_subscribers_response_spec.rb +15 -16
  182. data/kinde_api/spec/models/logout_redirect_urls_spec.rb +11 -12
  183. data/kinde_api/spec/models/organization_spec.rb +15 -16
  184. data/kinde_api/spec/models/organization_user_permission_roles_inner_spec.rb +13 -14
  185. data/kinde_api/spec/models/organization_user_permission_spec.rb +16 -17
  186. data/kinde_api/spec/models/organization_user_role_permissions_permissions_spec.rb +11 -12
  187. data/kinde_api/spec/models/organization_user_role_permissions_spec.rb +14 -15
  188. data/kinde_api/spec/models/organization_user_role_spec.rb +14 -15
  189. data/kinde_api/spec/models/organization_user_spec.rb +17 -18
  190. data/kinde_api/spec/models/permissions_spec.rb +20 -15
  191. data/kinde_api/spec/models/redirect_callback_urls_spec.rb +11 -12
  192. data/kinde_api/spec/models/replace_logout_redirect_urls_request_spec.rb +11 -12
  193. data/kinde_api/spec/models/replace_redirect_callback_urls_request_spec.rb +11 -12
  194. data/kinde_api/spec/models/role_spec.rb +15 -16
  195. data/kinde_api/spec/models/roles_permission_response_inner_spec.rb +15 -16
  196. data/kinde_api/spec/models/roles_spec.rb +15 -16
  197. data/kinde_api/spec/models/subscriber_spec.rb +15 -16
  198. data/kinde_api/spec/models/subscribers_subscriber_spec.rb +16 -17
  199. data/kinde_api/spec/models/success_response_spec.rb +13 -14
  200. data/kinde_api/spec/models/token_error_response_spec.rb +13 -14
  201. data/kinde_api/spec/models/token_introspect_spec.rb +16 -17
  202. data/kinde_api/spec/models/update_api_applications_request_applications_inner_spec.rb +13 -14
  203. data/kinde_api/spec/models/update_api_applications_request_spec.rb +11 -12
  204. data/kinde_api/spec/models/update_application_request_spec.rb +15 -16
  205. data/kinde_api/spec/models/update_environement_feature_flag_override_request_spec.rb +11 -12
  206. data/kinde_api/spec/models/update_organization_request_spec.rb +52 -17
  207. data/kinde_api/spec/models/update_organization_users_request_spec.rb +11 -12
  208. data/kinde_api/spec/models/update_organization_users_request_users_inner_spec.rb +15 -16
  209. data/kinde_api/spec/models/update_organization_users_response_spec.rb +15 -16
  210. data/kinde_api/spec/models/update_role_permissions_request_permissions_inner_spec.rb +13 -14
  211. data/kinde_api/spec/models/update_role_permissions_request_spec.rb +11 -12
  212. data/kinde_api/spec/models/update_role_permissions_response_spec.rb +15 -16
  213. data/kinde_api/spec/models/update_roles_request_spec.rb +15 -16
  214. data/kinde_api/spec/models/update_user_request_spec.rb +15 -16
  215. data/kinde_api/spec/models/update_user_response_spec.rb +17 -18
  216. data/kinde_api/spec/models/user_identities_inner_spec.rb +13 -14
  217. data/kinde_api/spec/models/user_identity_result_spec.rb +11 -12
  218. data/kinde_api/spec/models/user_identity_spec.rb +13 -14
  219. data/kinde_api/spec/models/user_profile_spec.rb +17 -18
  220. data/kinde_api/spec/models/user_profile_v2_spec.rb +19 -20
  221. data/kinde_api/spec/models/user_spec.rb +24 -25
  222. data/kinde_api/spec/models/users_response_spec.rb +15 -16
  223. data/kinde_api/spec/models/users_response_users_inner_spec.rb +24 -25
  224. data/kinde_api/spec/spec_helper.rb +61 -63
  225. data/lib/kinde_sdk/version.rb +1 -1
  226. metadata +12 -21
  227. data/Gemfile +0 -15
  228. data/Gemfile.lock +0 -128
  229. data/LICENSE +0 -21
  230. data/README.md +0 -23
  231. data/Rakefile +0 -10
  232. data/kinde_api/.gitignore +0 -39
  233. data/kinde_api/.rspec +0 -2
  234. data/kinde_sdk.gemspec +0 -33
  235. data/openapitools.json +0 -7
@@ -1,14 +1,4 @@
1
- =begin
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
- fail ApiError.new('Connection timed out')
60
- elsif response.code == 0
48
+ raise ApiError, 'Connection timed out'
49
+ elsif response.code.zero?
61
50
  # Errors from libcurl will be made visible here
62
- fail ApiError.new(:code => 0,
63
- :message => response.return_message)
51
+ raise ApiError.new(code: 0,
52
+ message: response.return_message)
64
53
  else
65
- fail ApiError.new(:code => response.code,
66
- :response_headers => response.headers,
67
- :response_body => response.body),
68
- response.status_message
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
- data = deserialize(response, opts[:return_type])
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
- :method => http_method,
105
- :headers => header_params,
106
- :params => query_params,
107
- :params_encoding => @config.params_encoding,
108
- :timeout => @config.timeout,
109
- :ssl_verifypeer => @config.verify_ssl,
110
- :ssl_verifyhost => _verify_ssl_host,
111
- :sslcert => @config.cert_file,
112
- :sslkey => @config.key_file,
113
- :verbose => @config.debugging,
114
- :followlocation => follow_location
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 [:post, :patch, :put, :delete].include?(http_method)
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 :body => req_body
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
- header_params['Content-Type'] == 'multipart/form-data'
125
+ header_params['Content-Type'] == 'multipart/form-data'
143
126
  data = {}
144
127
  form_params.each do |key, value|
145
- case value
146
- when ::File, ::Array, nil
147
- # let typhoeus handle File, Array and nil parameters
148
- data[key] = value
149
- else
150
- data[key] = value.to_s
151
- end
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 = prefix + '-' unless prefix.end_with?('-')
162
+ prefix += '-' unless prefix.end_with?('-')
180
163
  encoding = response.body.encoding
181
- tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: 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 |response|
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
- "explicitly with `tempfile.delete`"
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
- (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
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
- fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
217
+ raise "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
231
218
 
232
219
  begin
233
- data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
220
+ data = JSON.parse("[#{body}]", symbolize_names: true)[0]
234
221
  rescue JSON::ParserError => e
235
- if %w(String Date Time).include?(return_type)
236
- data = body
237
- else
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 = $1
257
+ sub_type = ::Regexp.last_match(1)
272
258
  data.map { |item| convert_to_type(item, sub_type) }
273
- when /\AHash\<String, (.+)\>\z/
259
+ when /\AHash<String, (.+)>\z/
274
260
  # e.g. Hash<String, Integer>
275
- sub_type = $1
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, opts = {})
281
+ def build_request_url(path, _opts = {})
296
282
  # Add leading and trailing slashes to path
297
- path = "/#{path}".gsub(/\/+/, '/')
298
- @config.base_url(opts[:operation]) + path
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 fail ArgumentError, 'Authentication token must be in `query` or `header`'
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
- local_body = nil
353
- if model.is_a?(Array)
354
- local_body = model.map { |m| object_to_hash(m) }
355
- else
356
- local_body = object_to_hash(model)
357
- end
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
- fail "unknown collection format: #{collection_format.inspect}"
377
+ raise "unknown collection format: #{collection_format.inspect}"
389
378
  end
390
379
  end
391
380
  end
@@ -1,14 +1,14 @@
1
- =begin
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
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
- msg = "Error message: the server returns an error"
47
- else
48
- msg = @message
49
- end
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
- =begin
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
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(STDOUT)
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(/https?:\/\//, '').split('/').first
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(operation = nil)
198
- index = server_operation_index.fetch(operation, server_index)
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
- return access_token if access_token_getter.nil?
219
- access_token_getter.call
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
- 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
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