clerk-sdk-ruby 5.0.0 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/clerk/authenticate_request.rb +4 -4
- data/lib/clerk/billing.rb +318 -0
- data/lib/clerk/models/components/{commercepriceresponse.rb → billingpriceresponse.rb} +2 -2
- data/lib/clerk/models/components/{commercepriceresponse.rbi → billingpriceresponse.rbi} +2 -2
- data/lib/clerk/models/components/{commercepriceresponse_object.rb → billingpriceresponse_object.rb} +2 -2
- data/lib/clerk/models/components/billingpriceresponse_object.rbi +11 -0
- data/lib/clerk/models/components/commercepricetransitiondetails.rb +1 -1
- data/lib/clerk/models/components/createbillingpricerequest.rb +48 -0
- data/lib/clerk/models/components/createbillingpricerequest.rbi +21 -0
- data/lib/clerk/models/components/externalaccountwithverification.rb +6 -1
- data/lib/clerk/models/components/externalaccountwithverification.rbi +2 -0
- data/lib/clerk/models/components/organizationmembership.rb +1 -1
- data/lib/clerk/models/components/paginatedbillingpriceresponse.rb +36 -0
- data/lib/clerk/models/components/paginatedbillingpriceresponse.rbi +15 -0
- data/lib/clerk/models/components.rb +4 -2
- data/lib/clerk/models/operations/createbillingprice_response.rb +44 -0
- data/lib/clerk/models/operations/createbillingprice_response.rbi +19 -0
- data/lib/clerk/models/operations/createbulkwaitlistentries_requestbody.rb +37 -0
- data/lib/clerk/models/operations/createbulkwaitlistentries_requestbody.rbi +15 -0
- data/lib/clerk/models/operations/createbulkwaitlistentries_response.rb +44 -0
- data/lib/clerk/models/operations/createbulkwaitlistentries_response.rbi +19 -0
- data/lib/clerk/models/operations/getbillingpricelist_request.rb +49 -0
- data/lib/clerk/models/operations/getbillingpricelist_request.rbi +19 -0
- data/lib/clerk/models/operations/getbillingpricelist_response.rb +44 -0
- data/lib/clerk/models/operations/getbillingpricelist_response.rbi +19 -0
- data/lib/clerk/models/operations/getuserlist_request.rb +25 -1
- data/lib/clerk/models/operations/getuserlist_request.rbi +8 -0
- data/lib/clerk/models/operations/getuserscount_request.rb +26 -1
- data/lib/clerk/models/operations/getuserscount_request.rbi +8 -0
- data/lib/clerk/models/operations/updateinstanceauthconfig_request.rb +1 -1
- data/lib/clerk/models/operations.rb +5 -0
- data/lib/clerk/sdkconfiguration.rb +3 -3
- data/lib/clerk/waitlistentries.rb +151 -0
- metadata +20 -6
- data/lib/clerk/models/components/commercepriceresponse_object.rbi +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a6b3d3df9ae9049e4f6a405b3dfb84a501e6a68add7336b9ccc05451495802d
|
|
4
|
+
data.tar.gz: aa66d041b802f5dcc2d653681598f2804c2aeb216dfd9c123094d90feca05a9a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb11c00c14b8e2765753821b3db999ad635a5f08f9707afa0135f91925f1ad05ca355e0dda1437bb5baa6465211c7911f423ebefa8700fa242f683e87b50a738
|
|
7
|
+
data.tar.gz: 3f43bec58df6099b25bb0a17c7cba3afa2330f6e75caa93e56029cf5e64314cfddaeb3bf69c64238117c93ba39d88c6c9c0ff981c4110419ea8f587b19a38635
|
|
@@ -154,7 +154,7 @@ module Clerk
|
|
|
154
154
|
|
|
155
155
|
return signed_out(reason: AuthErrorReason::SESSION_TOKEN_MISSING, headers: headers) unless session_token
|
|
156
156
|
|
|
157
|
-
verify_token_with_retry(env, session_token)
|
|
157
|
+
verify_token_with_retry(env, session_token, headers:)
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
def handle_handshake_maybe_status(env, **opts)
|
|
@@ -230,16 +230,16 @@ module Clerk
|
|
|
230
230
|
|
|
231
231
|
# Verify session token and provide a 1-day leeway for development if initial verification
|
|
232
232
|
# fails for development instance due to invalid exp or iat
|
|
233
|
-
def verify_token_with_retry(env, token)
|
|
233
|
+
def verify_token_with_retry(env, token, headers: {})
|
|
234
234
|
claims = verify_token(token)
|
|
235
|
-
signed_in(env, claims, token) if claims
|
|
235
|
+
signed_in(env, claims, token, **headers) if claims
|
|
236
236
|
rescue JWT::ExpiredSignature, JWT::InvalidIatError => e
|
|
237
237
|
if auth_context.development_instance?
|
|
238
238
|
# TODO: log possible Clock skew detected
|
|
239
239
|
|
|
240
240
|
# Retry with a generous clock skew allowance (1 day)
|
|
241
241
|
claims = verify_token(token, timeout: 86_400)
|
|
242
|
-
return signed_in(env, claims, token) if claims
|
|
242
|
+
return signed_in(env, claims, token, **headers) if claims
|
|
243
243
|
end
|
|
244
244
|
|
|
245
245
|
# Raise error if handshake resolution fails in production
|
data/lib/clerk/billing.rb
CHANGED
|
@@ -196,6 +196,324 @@ module Clerk
|
|
|
196
196
|
|
|
197
197
|
|
|
198
198
|
|
|
199
|
+
def list_prices(paginated: nil, limit: nil, offset: nil, plan_id: nil, retries: nil, timeout_ms: nil)
|
|
200
|
+
# list_prices - List all billing prices
|
|
201
|
+
# Returns a list of all prices for the instance. The prices are returned sorted by amount ascending,
|
|
202
|
+
# then by creation date descending. This includes both default and custom prices. Pagination is supported.
|
|
203
|
+
request = Models::Operations::GetBillingPriceListRequest.new(
|
|
204
|
+
paginated: paginated,
|
|
205
|
+
limit: limit,
|
|
206
|
+
offset: offset,
|
|
207
|
+
plan_id: plan_id
|
|
208
|
+
)
|
|
209
|
+
url, params = @sdk_configuration.get_server_details
|
|
210
|
+
base_url = Utils.template_url(url, params)
|
|
211
|
+
url = "#{base_url}/billing/prices"
|
|
212
|
+
headers = {}
|
|
213
|
+
|
|
214
|
+
query_params = Utils.get_query_params(Models::Operations::GetBillingPriceListRequest, request, nil)
|
|
215
|
+
headers['Accept'] = 'application/json'
|
|
216
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
217
|
+
retries ||= @sdk_configuration.retry_config
|
|
218
|
+
retries ||= Utils::RetryConfig.new(
|
|
219
|
+
backoff: Utils::BackoffStrategy.new(
|
|
220
|
+
exponent: 1.5,
|
|
221
|
+
initial_interval: 500,
|
|
222
|
+
max_elapsed_time: 3_600_000,
|
|
223
|
+
max_interval: 60_000
|
|
224
|
+
),
|
|
225
|
+
retry_connection_errors: true,
|
|
226
|
+
strategy: 'backoff'
|
|
227
|
+
)
|
|
228
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
229
|
+
retry_options[:retry_statuses] = [500, 501, 502, 503, 504, 505]
|
|
230
|
+
|
|
231
|
+
security = @sdk_configuration.security_source&.call
|
|
232
|
+
|
|
233
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
234
|
+
timeout ||= @sdk_configuration.timeout
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
connection = @sdk_configuration.client.dup
|
|
238
|
+
connection.request :retry, retry_options
|
|
239
|
+
|
|
240
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
241
|
+
config: @sdk_configuration,
|
|
242
|
+
base_url: base_url,
|
|
243
|
+
oauth2_scopes: nil,
|
|
244
|
+
operation_id: 'GetBillingPriceList',
|
|
245
|
+
security_source: @sdk_configuration.security_source
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
error = nil
|
|
249
|
+
http_response = nil
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
begin
|
|
253
|
+
http_response = connection.get(url) do |req|
|
|
254
|
+
req.headers.merge!(headers)
|
|
255
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
256
|
+
req.params = query_params
|
|
257
|
+
Utils.configure_request_security(req, security)
|
|
258
|
+
|
|
259
|
+
@sdk_configuration.hooks.before_request(
|
|
260
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
261
|
+
hook_ctx: hook_ctx
|
|
262
|
+
),
|
|
263
|
+
request: req
|
|
264
|
+
)
|
|
265
|
+
end
|
|
266
|
+
rescue StandardError => e
|
|
267
|
+
error = e
|
|
268
|
+
ensure
|
|
269
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
270
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
271
|
+
error: error,
|
|
272
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
273
|
+
hook_ctx: hook_ctx
|
|
274
|
+
),
|
|
275
|
+
response: http_response
|
|
276
|
+
)
|
|
277
|
+
else
|
|
278
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
279
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
280
|
+
hook_ctx: hook_ctx
|
|
281
|
+
),
|
|
282
|
+
response: http_response
|
|
283
|
+
)
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
if http_response.nil?
|
|
287
|
+
raise error if !error.nil?
|
|
288
|
+
raise 'no response'
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
293
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
294
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
295
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
296
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
297
|
+
hook_ctx: hook_ctx
|
|
298
|
+
),
|
|
299
|
+
response: http_response
|
|
300
|
+
)
|
|
301
|
+
response_data = http_response.env.response_body
|
|
302
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::PaginatedBillingPriceResponse)
|
|
303
|
+
response = Models::Operations::GetBillingPriceListResponse.new(
|
|
304
|
+
status_code: http_response.status,
|
|
305
|
+
content_type: content_type,
|
|
306
|
+
raw_response: http_response,
|
|
307
|
+
paginated_billing_price_response: obj
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
return response
|
|
311
|
+
else
|
|
312
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
313
|
+
end
|
|
314
|
+
elsif Utils.match_status_code(http_response.status, ['400', '401', '404', '422'])
|
|
315
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
316
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
317
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
318
|
+
hook_ctx: hook_ctx
|
|
319
|
+
),
|
|
320
|
+
response: http_response
|
|
321
|
+
)
|
|
322
|
+
response_data = http_response.env.response_body
|
|
323
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
324
|
+
obj.raw_response = http_response
|
|
325
|
+
raise obj
|
|
326
|
+
else
|
|
327
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
328
|
+
end
|
|
329
|
+
elsif Utils.match_status_code(http_response.status, ['500'])
|
|
330
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
331
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
332
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
333
|
+
hook_ctx: hook_ctx
|
|
334
|
+
),
|
|
335
|
+
response: http_response
|
|
336
|
+
)
|
|
337
|
+
response_data = http_response.env.response_body
|
|
338
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
339
|
+
obj.raw_response = http_response
|
|
340
|
+
raise obj
|
|
341
|
+
else
|
|
342
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
343
|
+
end
|
|
344
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
345
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
346
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
347
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
348
|
+
else
|
|
349
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
|
350
|
+
|
|
351
|
+
end
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
def create_price(request:, retries: nil, timeout_ms: nil)
|
|
357
|
+
# create_price - Create a custom billing price
|
|
358
|
+
# Creates a custom price for a billing plan. Custom prices allow you to offer different pricing
|
|
359
|
+
# to specific customers while maintaining the same plan structure.
|
|
360
|
+
url, params = @sdk_configuration.get_server_details
|
|
361
|
+
base_url = Utils.template_url(url, params)
|
|
362
|
+
url = "#{base_url}/billing/prices"
|
|
363
|
+
headers = {}
|
|
364
|
+
|
|
365
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :request, :json)
|
|
366
|
+
headers['content-type'] = req_content_type
|
|
367
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
|
368
|
+
|
|
369
|
+
if form
|
|
370
|
+
body = Utils.encode_form(form)
|
|
371
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
372
|
+
body = URI.encode_www_form(data)
|
|
373
|
+
else
|
|
374
|
+
body = data
|
|
375
|
+
end
|
|
376
|
+
headers['Accept'] = 'application/json'
|
|
377
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
378
|
+
retries ||= @sdk_configuration.retry_config
|
|
379
|
+
retries ||= Utils::RetryConfig.new(
|
|
380
|
+
backoff: Utils::BackoffStrategy.new(
|
|
381
|
+
exponent: 1.5,
|
|
382
|
+
initial_interval: 500,
|
|
383
|
+
max_elapsed_time: 3_600_000,
|
|
384
|
+
max_interval: 60_000
|
|
385
|
+
),
|
|
386
|
+
retry_connection_errors: true,
|
|
387
|
+
strategy: 'backoff'
|
|
388
|
+
)
|
|
389
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
390
|
+
retry_options[:retry_statuses] = [500, 501, 502, 503, 504, 505]
|
|
391
|
+
|
|
392
|
+
security = @sdk_configuration.security_source&.call
|
|
393
|
+
|
|
394
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
395
|
+
timeout ||= @sdk_configuration.timeout
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
connection = @sdk_configuration.client.dup
|
|
399
|
+
connection.request :retry, retry_options
|
|
400
|
+
|
|
401
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
402
|
+
config: @sdk_configuration,
|
|
403
|
+
base_url: base_url,
|
|
404
|
+
oauth2_scopes: nil,
|
|
405
|
+
operation_id: 'CreateBillingPrice',
|
|
406
|
+
security_source: @sdk_configuration.security_source
|
|
407
|
+
)
|
|
408
|
+
|
|
409
|
+
error = nil
|
|
410
|
+
http_response = nil
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
begin
|
|
414
|
+
http_response = connection.post(url) do |req|
|
|
415
|
+
req.body = body
|
|
416
|
+
req.headers.merge!(headers)
|
|
417
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
418
|
+
Utils.configure_request_security(req, security)
|
|
419
|
+
|
|
420
|
+
@sdk_configuration.hooks.before_request(
|
|
421
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
422
|
+
hook_ctx: hook_ctx
|
|
423
|
+
),
|
|
424
|
+
request: req
|
|
425
|
+
)
|
|
426
|
+
end
|
|
427
|
+
rescue StandardError => e
|
|
428
|
+
error = e
|
|
429
|
+
ensure
|
|
430
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
431
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
432
|
+
error: error,
|
|
433
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
434
|
+
hook_ctx: hook_ctx
|
|
435
|
+
),
|
|
436
|
+
response: http_response
|
|
437
|
+
)
|
|
438
|
+
else
|
|
439
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
440
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
441
|
+
hook_ctx: hook_ctx
|
|
442
|
+
),
|
|
443
|
+
response: http_response
|
|
444
|
+
)
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
if http_response.nil?
|
|
448
|
+
raise error if !error.nil?
|
|
449
|
+
raise 'no response'
|
|
450
|
+
end
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
454
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
455
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
456
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
457
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
458
|
+
hook_ctx: hook_ctx
|
|
459
|
+
),
|
|
460
|
+
response: http_response
|
|
461
|
+
)
|
|
462
|
+
response_data = http_response.env.response_body
|
|
463
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::BillingPriceResponse)
|
|
464
|
+
response = Models::Operations::CreateBillingPriceResponse.new(
|
|
465
|
+
status_code: http_response.status,
|
|
466
|
+
content_type: content_type,
|
|
467
|
+
raw_response: http_response,
|
|
468
|
+
billing_price_response: obj
|
|
469
|
+
)
|
|
470
|
+
|
|
471
|
+
return response
|
|
472
|
+
else
|
|
473
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
474
|
+
end
|
|
475
|
+
elsif Utils.match_status_code(http_response.status, ['400', '401', '404', '422'])
|
|
476
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
477
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
478
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
479
|
+
hook_ctx: hook_ctx
|
|
480
|
+
),
|
|
481
|
+
response: http_response
|
|
482
|
+
)
|
|
483
|
+
response_data = http_response.env.response_body
|
|
484
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
485
|
+
obj.raw_response = http_response
|
|
486
|
+
raise obj
|
|
487
|
+
else
|
|
488
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
489
|
+
end
|
|
490
|
+
elsif Utils.match_status_code(http_response.status, ['500'])
|
|
491
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
492
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
493
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
494
|
+
hook_ctx: hook_ctx
|
|
495
|
+
),
|
|
496
|
+
response: http_response
|
|
497
|
+
)
|
|
498
|
+
response_data = http_response.env.response_body
|
|
499
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
500
|
+
obj.raw_response = http_response
|
|
501
|
+
raise obj
|
|
502
|
+
else
|
|
503
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
504
|
+
end
|
|
505
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
506
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
507
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
508
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
509
|
+
else
|
|
510
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
|
511
|
+
|
|
512
|
+
end
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
199
517
|
def list_subscription_items(request:, retries: nil, timeout_ms: nil)
|
|
200
518
|
# list_subscription_items - List all subscription items
|
|
201
519
|
# Returns a list of all subscription items for the instance. The subscription items are returned sorted by creation date,
|
|
@@ -8,12 +8,12 @@ module Clerk
|
|
|
8
8
|
module Models
|
|
9
9
|
module Components
|
|
10
10
|
|
|
11
|
-
class
|
|
11
|
+
class BillingPriceResponse
|
|
12
12
|
|
|
13
13
|
include Crystalline::MetadataFields
|
|
14
14
|
|
|
15
15
|
# String representing the object's type. Objects of the same type share the same value.
|
|
16
|
-
field :object, Models::Components::
|
|
16
|
+
field :object, Models::Components::BillingPriceResponseObject, { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('object'), required: true, 'decoder': Utils.enum_from_string(Models::Components::BillingPriceResponseObject, false) } }
|
|
17
17
|
# Unique identifier for the price.
|
|
18
18
|
field :id, ::String, { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('id'), required: true } }
|
|
19
19
|
# Unique identifier for the associated plan.
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
class Clerk::Models::Components::
|
|
5
|
+
class Clerk::Models::Components::BillingPriceResponse
|
|
6
6
|
extend ::Crystalline::MetadataFields::ClassMethods
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class Clerk::Models::Components::
|
|
10
|
+
class Clerk::Models::Components::BillingPriceResponse
|
|
11
11
|
def object(); end
|
|
12
12
|
def object=(str_); end
|
|
13
13
|
def id(); end
|
data/lib/clerk/models/components/{commercepriceresponse_object.rb → billingpriceresponse_object.rb}
RENAMED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
module Clerk
|
|
8
8
|
module Models
|
|
9
9
|
module Components
|
|
10
|
-
#
|
|
11
|
-
class
|
|
10
|
+
# BillingPriceResponseObject - String representing the object's type. Objects of the same type share the same value.
|
|
11
|
+
class BillingPriceResponseObject
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
include ::Crystalline::Enum
|
|
@@ -15,7 +15,7 @@ module Clerk
|
|
|
15
15
|
|
|
16
16
|
field :previous_plan, Models::Components::SchemasCommercePlan, { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('previous_plan'), required: true } }
|
|
17
17
|
|
|
18
|
-
field :previous_price, Models::Components::
|
|
18
|
+
field :previous_price, Models::Components::BillingPriceResponse, { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('previous_price'), required: true } }
|
|
19
19
|
# Unix timestamp (milliseconds) when the new price takes effect.
|
|
20
20
|
field :effective_at, ::Integer, { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('effective_at'), required: true } }
|
|
21
21
|
# When the new price takes effect.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
# typed: false
|
|
4
|
+
# frozen_string_literal: true
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Clerk
|
|
8
|
+
module Models
|
|
9
|
+
module Components
|
|
10
|
+
|
|
11
|
+
class CreateBillingPriceRequest
|
|
12
|
+
|
|
13
|
+
include Crystalline::MetadataFields
|
|
14
|
+
|
|
15
|
+
# The ID of the plan this price belongs to.
|
|
16
|
+
field :plan_id, ::String, { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('plan_id'), required: true } }
|
|
17
|
+
# The amount in cents for the price. Must be at least $1 (100 cents).
|
|
18
|
+
field :amount, ::Integer, { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('amount'), required: true } }
|
|
19
|
+
# The monthly amount in cents when billed annually. Optional.
|
|
20
|
+
field :annual_monthly_amount, Crystalline::Nilable.new(::Integer), { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('annual_monthly_amount') } }
|
|
21
|
+
# An optional description for this custom price.
|
|
22
|
+
field :description, Crystalline::Nilable.new(::String), { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('description') } }
|
|
23
|
+
# The currency code (e.g., "USD"). Defaults to USD.
|
|
24
|
+
field :currency, Crystalline::Nilable.new(::String), { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('currency') } }
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def initialize(plan_id:, amount:, annual_monthly_amount: nil, description: nil, currency: 'USD')
|
|
28
|
+
@plan_id = plan_id
|
|
29
|
+
@amount = amount
|
|
30
|
+
@annual_monthly_amount = annual_monthly_amount
|
|
31
|
+
@description = description
|
|
32
|
+
@currency = currency
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def ==(other)
|
|
37
|
+
return false unless other.is_a? self.class
|
|
38
|
+
return false unless @plan_id == other.plan_id
|
|
39
|
+
return false unless @amount == other.amount
|
|
40
|
+
return false unless @annual_monthly_amount == other.annual_monthly_amount
|
|
41
|
+
return false unless @description == other.description
|
|
42
|
+
return false unless @currency == other.currency
|
|
43
|
+
true
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# typed: false
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Clerk::Models::Components::CreateBillingPriceRequest
|
|
6
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Clerk::Models::Components::CreateBillingPriceRequest
|
|
11
|
+
def plan_id(); end
|
|
12
|
+
def plan_id=(str_); end
|
|
13
|
+
def amount(); end
|
|
14
|
+
def amount=(str_); end
|
|
15
|
+
def annual_monthly_amount(); end
|
|
16
|
+
def annual_monthly_amount=(str_); end
|
|
17
|
+
def description(); end
|
|
18
|
+
def description=(str_); end
|
|
19
|
+
def currency(); end
|
|
20
|
+
def currency=(str_); end
|
|
21
|
+
end
|
|
@@ -46,6 +46,9 @@ module Clerk
|
|
|
46
46
|
field :verification, Crystalline::Nilable.new(Crystalline::Union.new(Models::Components::ExternalAccountWithVerificationOauth, Models::Components::GoogleOneTap)), { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('verification'), required: true }, 'discriminator': 'object', 'discriminator_mapping': { 'verification_oauth' => Models::Components::ExternalAccountWithVerificationOauth, 'verification_google_one_tap' => Models::Components::GoogleOneTap } }
|
|
47
47
|
|
|
48
48
|
field :additional_properties, Crystalline::Nilable.new(Crystalline::Hash.new(Symbol, ::Object)), { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('additional_properties') } }
|
|
49
|
+
# Whether the email was verified by the OAuth provider at creation time. null = unknown (pre-migration data or custom OAuth providers), true = provider confirmed email was verified, false = provider confirmed email was NOT verified
|
|
50
|
+
#
|
|
51
|
+
field :email_address_verified, Crystalline::Nilable.new(Crystalline::Boolean.new), { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('email_address_verified') } }
|
|
49
52
|
|
|
50
53
|
field :image_url, Crystalline::Nilable.new(::String), { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('image_url') } }
|
|
51
54
|
|
|
@@ -56,7 +59,7 @@ module Clerk
|
|
|
56
59
|
field :label, Crystalline::Nilable.new(::String), { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('label') } }
|
|
57
60
|
|
|
58
61
|
|
|
59
|
-
def initialize(object:, id:, provider:, identification_id:, provider_user_id:, approved_scopes:, email_address:, first_name:, last_name:, public_metadata:, created_at:, updated_at:, avatar_url: nil, verification: nil, additional_properties: nil, image_url: nil, username: nil, phone_number: nil, label: nil)
|
|
62
|
+
def initialize(object:, id:, provider:, identification_id:, provider_user_id:, approved_scopes:, email_address:, first_name:, last_name:, public_metadata:, created_at:, updated_at:, avatar_url: nil, verification: nil, additional_properties: nil, email_address_verified: nil, image_url: nil, username: nil, phone_number: nil, label: nil)
|
|
60
63
|
@object = object
|
|
61
64
|
@id = id
|
|
62
65
|
@provider = provider
|
|
@@ -72,6 +75,7 @@ module Clerk
|
|
|
72
75
|
@avatar_url = avatar_url
|
|
73
76
|
@verification = verification
|
|
74
77
|
@additional_properties = additional_properties
|
|
78
|
+
@email_address_verified = email_address_verified
|
|
75
79
|
@image_url = image_url
|
|
76
80
|
@username = username
|
|
77
81
|
@phone_number = phone_number
|
|
@@ -96,6 +100,7 @@ module Clerk
|
|
|
96
100
|
return false unless @avatar_url == other.avatar_url
|
|
97
101
|
return false unless @verification == other.verification
|
|
98
102
|
return false unless @additional_properties == other.additional_properties
|
|
103
|
+
return false unless @email_address_verified == other.email_address_verified
|
|
99
104
|
return false unless @image_url == other.image_url
|
|
100
105
|
return false unless @username == other.username
|
|
101
106
|
return false unless @phone_number == other.phone_number
|
|
@@ -38,6 +38,8 @@ class Clerk::Models::Components::ExternalAccountWithVerification
|
|
|
38
38
|
def verification=(str_); end
|
|
39
39
|
def additional_properties(); end
|
|
40
40
|
def additional_properties=(str_); end
|
|
41
|
+
def email_address_verified(); end
|
|
42
|
+
def email_address_verified=(str_); end
|
|
41
43
|
def image_url(); end
|
|
42
44
|
def image_url=(str_); end
|
|
43
45
|
def username(); end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
# typed: false
|
|
4
|
+
# frozen_string_literal: true
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Clerk
|
|
8
|
+
module Models
|
|
9
|
+
module Components
|
|
10
|
+
# A list of billing prices.
|
|
11
|
+
class PaginatedBillingPriceResponse
|
|
12
|
+
|
|
13
|
+
include Crystalline::MetadataFields
|
|
14
|
+
|
|
15
|
+
# Array of prices.
|
|
16
|
+
field :data, Crystalline::Array.new(Models::Components::BillingPriceResponse), { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('data'), required: true } }
|
|
17
|
+
# Total number of prices.
|
|
18
|
+
field :total_count, ::Integer, { 'format_json': { 'letter_case': ::Clerk::Utils.field_name('total_count'), required: true } }
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def initialize(data:, total_count:)
|
|
22
|
+
@data = data
|
|
23
|
+
@total_count = total_count
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def ==(other)
|
|
28
|
+
return false unless other.is_a? self.class
|
|
29
|
+
return false unless @data == other.data
|
|
30
|
+
return false unless @total_count == other.total_count
|
|
31
|
+
true
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# typed: false
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Clerk::Models::Components::PaginatedBillingPriceResponse
|
|
6
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Clerk::Models::Components::PaginatedBillingPriceResponse
|
|
11
|
+
def data(); end
|
|
12
|
+
def data=(str_); end
|
|
13
|
+
def total_count(); end
|
|
14
|
+
def total_count=(str_); end
|
|
15
|
+
end
|
|
@@ -16,6 +16,8 @@ module Clerk
|
|
|
16
16
|
autoload :BillingPaymentAttempt, 'clerk/models/components/billingpaymentattempt.rb'
|
|
17
17
|
autoload :BillingPaymentAttemptObject, 'clerk/models/components/billingpaymentattempt_object.rb'
|
|
18
18
|
autoload :BillingPaymentAttemptStatus, 'clerk/models/components/billingpaymentattempt_status.rb'
|
|
19
|
+
autoload :BillingPriceResponse, 'clerk/models/components/billingpriceresponse.rb'
|
|
20
|
+
autoload :BillingPriceResponseObject, 'clerk/models/components/billingpriceresponse_object.rb'
|
|
19
21
|
autoload :BillingStatement, 'clerk/models/components/billingstatement.rb'
|
|
20
22
|
autoload :BillingStatementStatus, 'clerk/models/components/billingstatement_status.rb'
|
|
21
23
|
autoload :BlocklistIdentifier, 'clerk/models/components/blocklistidentifier.rb'
|
|
@@ -36,8 +38,6 @@ module Clerk
|
|
|
36
38
|
autoload :CommercePaymentMethodResponseStatus, 'clerk/models/components/commercepaymentmethodresponse_status.rb'
|
|
37
39
|
autoload :CommercePlan, 'clerk/models/components/commerceplan.rb'
|
|
38
40
|
autoload :CommercePlanObject, 'clerk/models/components/commerceplan_object.rb'
|
|
39
|
-
autoload :CommercePriceResponse, 'clerk/models/components/commercepriceresponse.rb'
|
|
40
|
-
autoload :CommercePriceResponseObject, 'clerk/models/components/commercepriceresponse_object.rb'
|
|
41
41
|
autoload :CommercePriceTransitionDetails, 'clerk/models/components/commercepricetransitiondetails.rb'
|
|
42
42
|
autoload :CommercePriceTransitionResponse, 'clerk/models/components/commercepricetransitionresponse.rb'
|
|
43
43
|
autoload :CommercePriceTransitionResponseObject, 'clerk/models/components/commercepricetransitionresponse_object.rb'
|
|
@@ -59,6 +59,7 @@ module Clerk
|
|
|
59
59
|
autoload :CommerceSubscriptionStatus, 'clerk/models/components/commercesubscription_status.rb'
|
|
60
60
|
autoload :Cookies, 'clerk/models/components/cookies.rb'
|
|
61
61
|
autoload :CookiesObject, 'clerk/models/components/cookies_object.rb'
|
|
62
|
+
autoload :CreateBillingPriceRequest, 'clerk/models/components/createbillingpricerequest.rb'
|
|
62
63
|
autoload :DeletedObject, 'clerk/models/components/deletedobject.rb'
|
|
63
64
|
autoload :Domain, 'clerk/models/components/domain.rb'
|
|
64
65
|
autoload :DomainObject, 'clerk/models/components/domain_object.rb'
|
|
@@ -189,6 +190,7 @@ module Clerk
|
|
|
189
190
|
autoload :OrganizationObject, 'clerk/models/components/organization_object.rb'
|
|
190
191
|
autoload :Organizations, 'clerk/models/components/organizations.rb'
|
|
191
192
|
autoload :PaginatedBillingPaymentAttemptResponse, 'clerk/models/components/paginatedbillingpaymentattemptresponse.rb'
|
|
193
|
+
autoload :PaginatedBillingPriceResponse, 'clerk/models/components/paginatedbillingpriceresponse.rb'
|
|
192
194
|
autoload :PaginatedBillingStatementResponse, 'clerk/models/components/paginatedbillingstatementresponse.rb'
|
|
193
195
|
autoload :PaginatedCommercePlanResponse, 'clerk/models/components/paginatedcommerceplanresponse.rb'
|
|
194
196
|
autoload :PaginatedCommerceSubscriptionItemResponse, 'clerk/models/components/paginatedcommercesubscriptionitemresponse.rb'
|