clerk-sdk-ruby 8.0.0 → 8.0.1
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/actortokens.rb +1 -1
- data/lib/clerk/billing.rb +336 -0
- data/lib/clerk/directories.rb +1534 -0
- data/lib/clerk/domains.rb +7 -4
- data/lib/clerk/models/components/amount_off.rb +44 -0
- data/lib/clerk/models/components/amount_off.rbi +19 -0
- data/lib/clerk/models/components/applycommercediscountrequest.rb +32 -0
- data/lib/clerk/models/components/applycommercediscountrequest.rbi +13 -0
- data/lib/clerk/models/components/automation_disposition.rb +21 -0
- data/lib/clerk/models/components/automation_disposition.rbi +11 -0
- data/lib/clerk/models/components/billingstatement.rb +1 -1
- data/lib/clerk/models/components/{group.rb → billingstatement_group.rb} +1 -1
- data/lib/clerk/models/components/{group.rbi → billingstatement_group.rbi} +2 -2
- data/lib/clerk/models/components/biometriccredential.rb +72 -0
- data/lib/clerk/models/components/biometriccredential.rbi +33 -0
- data/lib/clerk/models/components/biometriccredential_algorithm.rb +19 -0
- data/lib/clerk/models/components/biometriccredential_algorithm.rbi +11 -0
- data/lib/clerk/models/components/biometriccredential_list.rb +36 -0
- data/lib/clerk/models/components/biometriccredential_list.rbi +15 -0
- data/lib/clerk/models/components/biometriccredential_object.rb +19 -0
- data/lib/clerk/models/components/biometriccredential_object.rbi +11 -0
- data/lib/clerk/models/components/biometriccredential_platform.rb +20 -0
- data/lib/clerk/models/components/biometriccredential_platform.rbi +11 -0
- data/lib/clerk/models/components/biometriccredential_status.rb +20 -0
- data/lib/clerk/models/components/biometriccredential_status.rbi +11 -0
- data/lib/clerk/models/components/commercediscountredemptionresponse.rb +93 -0
- data/lib/clerk/models/components/commercediscountredemptionresponse.rbi +43 -0
- data/lib/clerk/models/components/commercediscountredemptionresponse_amount.rb +45 -0
- data/lib/clerk/models/components/commercediscountredemptionresponse_amount.rbi +19 -0
- data/lib/clerk/models/components/commercediscountredemptionresponse_object.rb +19 -0
- data/lib/clerk/models/components/commercediscountredemptionresponse_object.rbi +11 -0
- data/lib/clerk/models/components/commercediscountredemptionresponse_status.rb +21 -0
- data/lib/clerk/models/components/commercediscountredemptionresponse_status.rbi +11 -0
- data/lib/clerk/models/components/createbillingpricerequest.rb +2 -2
- data/lib/clerk/models/components/directory.rb +80 -0
- data/lib/clerk/models/components/directory.rbi +37 -0
- data/lib/clerk/models/components/directory_custom_attribute.rb +52 -0
- data/lib/clerk/models/components/directory_custom_attribute.rbi +23 -0
- data/lib/clerk/models/components/directory_group.rb +36 -0
- data/lib/clerk/models/components/directory_group.rbi +15 -0
- data/lib/clerk/models/components/directory_list.rb +36 -0
- data/lib/clerk/models/components/directory_list.rbi +15 -0
- data/lib/clerk/models/components/directory_object.rb +19 -0
- data/lib/clerk/models/components/directory_object.rbi +11 -0
- data/lib/clerk/models/components/directorygrouprolemapping.rb +76 -0
- data/lib/clerk/models/components/directorygrouprolemapping.rbi +35 -0
- data/lib/clerk/models/components/directorygrouprolemapping_deleted.rb +43 -0
- data/lib/clerk/models/components/directorygrouprolemapping_deleted.rbi +17 -0
- data/lib/clerk/models/components/directorygrouprolemapping_deleted_object.rb +19 -0
- data/lib/clerk/models/components/directorygrouprolemapping_deleted_object.rbi +11 -0
- data/lib/clerk/models/components/directorygrouprolemapping_list.rb +36 -0
- data/lib/clerk/models/components/directorygrouprolemapping_list.rbi +15 -0
- data/lib/clerk/models/components/directorygrouprolemapping_object.rb +19 -0
- data/lib/clerk/models/components/directorygrouprolemapping_object.rbi +11 -0
- data/lib/clerk/models/components/dnstarget.rb +49 -0
- data/lib/clerk/models/components/dnstarget.rbi +21 -0
- data/lib/clerk/models/components/domain.rb +7 -2
- data/lib/clerk/models/components/domain.rbi +2 -0
- data/lib/clerk/models/components/effect.rb +20 -0
- data/lib/clerk/models/components/{platform.rbi → effect.rbi} +2 -2
- data/lib/clerk/models/components/enterpriseconnection_custom_attribute.rb +5 -1
- data/lib/clerk/models/components/enterpriseconnection_custom_attribute.rbi +2 -0
- data/lib/clerk/models/components/instance.rb +13 -1
- data/lib/clerk/models/components/instance.rbi +6 -0
- data/lib/clerk/models/components/instanceprotect.rb +10 -2
- data/lib/clerk/models/components/instanceprotect.rbi +4 -0
- data/lib/clerk/models/components/instancesettings.rb +1 -1
- data/lib/clerk/models/components/level.rb +21 -0
- data/lib/clerk/models/components/{algorithm.rbi → level.rbi} +2 -2
- data/lib/clerk/models/components/oauthapplication.rb +7 -2
- data/lib/clerk/models/components/oauthapplication.rbi +2 -0
- data/lib/clerk/models/components/oauthapplicationsettings.rb +11 -2
- data/lib/clerk/models/components/oauthapplicationsettings.rbi +4 -0
- data/lib/clerk/models/components/oauthapplicationwithsecret.rb +7 -2
- data/lib/clerk/models/components/oauthapplicationwithsecret.rbi +2 -0
- data/lib/clerk/models/components/organization.rb +6 -1
- data/lib/clerk/models/components/organization.rbi +2 -0
- data/lib/clerk/models/components/organizationmembership_organization.rb +6 -1
- data/lib/clerk/models/components/organizationmembership_organization.rbi +2 -0
- data/lib/clerk/models/components/organizationwithlogo.rb +6 -1
- data/lib/clerk/models/components/organizationwithlogo.rbi +2 -0
- data/lib/clerk/models/components/record_type.rb +20 -0
- data/lib/clerk/models/components/record_type.rbi +11 -0
- data/lib/clerk/models/components/reverification.rb +74 -0
- data/lib/clerk/models/components/reverification.rbi +31 -0
- data/lib/clerk/models/components/reverification_object.rb +20 -0
- data/lib/clerk/models/components/reverification_object.rbi +11 -0
- data/lib/clerk/models/components/reverification_status.rb +21 -0
- data/lib/clerk/models/components/reverification_status.rbi +11 -0
- data/lib/clerk/models/components/scim_group.rb +36 -0
- data/lib/clerk/models/components/scim_group.rbi +15 -0
- data/lib/clerk/models/components/scimdirectory.rb +8 -8
- data/lib/clerk/models/components/scimdirectory_custom_attribute.rb +5 -1
- data/lib/clerk/models/components/scimdirectory_custom_attribute.rbi +2 -0
- data/lib/clerk/models/components/scimdirectory_list.rb +2 -2
- data/lib/clerk/models/components/scimgrouprolemapping.rb +14 -2
- data/lib/clerk/models/components/scimgrouprolemapping.rbi +6 -0
- data/lib/clerk/models/components/scimusermetadata.rb +64 -0
- data/lib/clerk/models/components/scimusermetadata.rbi +27 -0
- data/lib/clerk/models/components/scimusermetadata_group.rb +36 -0
- data/lib/clerk/models/components/scimusermetadata_group.rbi +15 -0
- data/lib/clerk/models/components/source.rb +21 -0
- data/lib/clerk/models/components/source.rbi +11 -0
- data/lib/clerk/models/components/trusteddevice.rb +2 -2
- data/lib/clerk/models/components/{algorithm.rb → trusteddevice_algorithm.rb} +1 -1
- data/lib/clerk/models/components/trusteddevice_algorithm.rbi +11 -0
- data/lib/clerk/models/components/{platform.rb → trusteddevice_platform.rb} +1 -1
- data/lib/clerk/models/components/trusteddevice_platform.rbi +11 -0
- data/lib/clerk/models/components/user.rb +16 -3
- data/lib/clerk/models/components/user.rbi +4 -0
- data/lib/clerk/models/components/user_directory.rb +65 -0
- data/lib/clerk/models/components/user_directory.rbi +27 -0
- data/lib/clerk/models/components/user_scim.rb +27 -6
- data/lib/clerk/models/components/user_scim.rbi +10 -0
- data/lib/clerk/models/components.rb +38 -3
- data/lib/clerk/models/operations/adddomain_request.rb +3 -6
- data/lib/clerk/models/operations/applybillingsubscriptionitemdiscount_request.rb +36 -0
- data/lib/clerk/models/operations/applybillingsubscriptionitemdiscount_request.rbi +15 -0
- data/lib/clerk/models/operations/applybillingsubscriptionitemdiscount_response.rb +44 -0
- data/lib/clerk/models/operations/applybillingsubscriptionitemdiscount_response.rbi +19 -0
- data/lib/clerk/models/operations/clerkidpoauthaccesstoken.rb +5 -1
- data/lib/clerk/models/operations/clerkidpoauthaccesstoken.rbi +2 -0
- data/lib/clerk/models/operations/createdirectory_group_role_mapping.rb +52 -0
- data/lib/clerk/models/operations/createdirectory_group_role_mapping.rbi +23 -0
- data/lib/clerk/models/operations/createdirectory_request.rb +44 -0
- data/lib/clerk/models/operations/createdirectory_request.rbi +19 -0
- data/lib/clerk/models/operations/createdirectory_response.rb +44 -0
- data/lib/clerk/models/operations/createdirectory_response.rbi +19 -0
- data/lib/clerk/models/operations/createdirectorygrouprolemapping_request.rb +36 -0
- data/lib/clerk/models/operations/createdirectorygrouprolemapping_request.rbi +15 -0
- data/lib/clerk/models/operations/createdirectorygrouprolemapping_requestbody.rb +46 -0
- data/lib/clerk/models/operations/createdirectorygrouprolemapping_requestbody.rbi +19 -0
- data/lib/clerk/models/operations/createdirectorygrouprolemapping_response.rb +44 -0
- data/lib/clerk/models/operations/createdirectorygrouprolemapping_response.rbi +19 -0
- data/lib/clerk/models/operations/createenterpriseconnection_custom_attribute.rb +5 -1
- data/lib/clerk/models/operations/createenterpriseconnection_custom_attribute.rbi +2 -0
- data/lib/clerk/models/operations/createoauthapplication_request.rb +6 -2
- data/lib/clerk/models/operations/createoauthapplication_request.rbi +2 -0
- data/lib/clerk/models/operations/{group_role_mapping.rb → createscimdirectory_group_role_mapping.rb} +1 -1
- data/lib/clerk/models/operations/{group_role_mapping.rbi → createscimdirectory_group_role_mapping.rbi} +2 -2
- data/lib/clerk/models/operations/createscimdirectory_request.rb +4 -4
- data/lib/clerk/models/operations/createscimdirectory_response.rb +1 -1
- data/lib/clerk/models/operations/createscimgrouprolemapping_request.rb +1 -1
- data/lib/clerk/models/operations/createuser_request.rb +8 -2
- data/lib/clerk/models/operations/createuser_request.rbi +2 -0
- data/lib/clerk/models/operations/deletedirectory_request.rb +32 -0
- data/lib/clerk/models/operations/deletedirectory_request.rbi +13 -0
- data/lib/clerk/models/operations/deletedirectory_response.rb +44 -0
- data/lib/clerk/models/operations/deletedirectory_response.rbi +19 -0
- data/lib/clerk/models/operations/deletedirectorygrouprolemapping_request.rb +36 -0
- data/lib/clerk/models/operations/deletedirectorygrouprolemapping_request.rbi +15 -0
- data/lib/clerk/models/operations/deletedirectorygrouprolemapping_response.rb +44 -0
- data/lib/clerk/models/operations/deletedirectorygrouprolemapping_response.rbi +19 -0
- data/lib/clerk/models/operations/deletedomain_request.rb +1 -1
- data/lib/clerk/models/operations/deletescimdirectory_request.rb +1 -1
- data/lib/clerk/models/operations/deletescimgrouprolemapping_request.rb +1 -1
- data/lib/clerk/models/operations/getdirectory_request.rb +32 -0
- data/lib/clerk/models/operations/getdirectory_request.rbi +13 -0
- data/lib/clerk/models/operations/getdirectory_response.rb +44 -0
- data/lib/clerk/models/operations/getdirectory_response.rbi +19 -0
- data/lib/clerk/models/operations/getreverification_request.rb +36 -0
- data/lib/clerk/models/operations/getreverification_request.rbi +15 -0
- data/lib/clerk/models/operations/getreverification_response.rb +44 -0
- data/lib/clerk/models/operations/getreverification_response.rbi +19 -0
- data/lib/clerk/models/operations/getscimdirectory_request.rb +1 -1
- data/lib/clerk/models/operations/getscimdirectory_response.rb +1 -1
- data/lib/clerk/models/operations/getuserlist_request.rb +13 -1
- data/lib/clerk/models/operations/getuserlist_request.rbi +2 -0
- data/lib/clerk/models/operations/listdirectories_request.rb +39 -0
- data/lib/clerk/models/operations/listdirectories_request.rbi +15 -0
- data/lib/clerk/models/operations/listdirectories_response.rb +44 -0
- data/lib/clerk/models/operations/listdirectories_response.rbi +19 -0
- data/lib/clerk/models/operations/listdirectorygrouprolemappings_request.rb +32 -0
- data/lib/clerk/models/operations/listdirectorygrouprolemappings_request.rbi +13 -0
- data/lib/clerk/models/operations/listdirectorygrouprolemappings_response.rb +44 -0
- data/lib/clerk/models/operations/listdirectorygrouprolemappings_response.rbi +19 -0
- data/lib/clerk/models/operations/listoauthapplications_request.rb +2 -0
- data/lib/clerk/models/operations/listscimdirectories_response.rb +1 -1
- data/lib/clerk/models/operations/listscimgrouprolemappings_request.rb +1 -1
- data/lib/clerk/models/operations/listuserbiometriccredentials_request.rb +32 -0
- data/lib/clerk/models/operations/listuserbiometriccredentials_request.rbi +13 -0
- data/lib/clerk/models/operations/listuserbiometriccredentials_response.rb +44 -0
- data/lib/clerk/models/operations/listuserbiometriccredentials_response.rbi +19 -0
- data/lib/clerk/models/operations/removebillingsubscriptionitemdiscount_request.rb +36 -0
- data/lib/clerk/models/operations/removebillingsubscriptionitemdiscount_request.rbi +15 -0
- data/lib/clerk/models/operations/removebillingsubscriptionitemdiscount_response.rb +44 -0
- data/lib/clerk/models/operations/removebillingsubscriptionitemdiscount_response.rbi +19 -0
- data/lib/clerk/models/operations/replacedirectorygrouprolemappings_mapping.rb +40 -0
- data/lib/clerk/models/operations/replacedirectorygrouprolemappings_mapping.rbi +17 -0
- data/lib/clerk/models/operations/replacedirectorygrouprolemappings_request.rb +36 -0
- data/lib/clerk/models/operations/replacedirectorygrouprolemappings_request.rbi +15 -0
- data/lib/clerk/models/operations/replacedirectorygrouprolemappings_requestbody.rb +32 -0
- data/lib/clerk/models/operations/replacedirectorygrouprolemappings_requestbody.rbi +13 -0
- data/lib/clerk/models/operations/replacedirectorygrouprolemappings_response.rb +44 -0
- data/lib/clerk/models/operations/replacedirectorygrouprolemappings_response.rbi +19 -0
- data/lib/clerk/models/operations/{mapping.rb → replacescimgrouprolemappings_mapping.rb} +1 -1
- data/lib/clerk/models/operations/{mapping.rbi → replacescimgrouprolemappings_mapping.rbi} +2 -2
- data/lib/clerk/models/operations/replacescimgrouprolemappings_request.rb +1 -1
- data/lib/clerk/models/operations/replacescimgrouprolemappings_requestbody.rb +1 -1
- data/lib/clerk/models/operations/revokeuserbiometriccredential_request.rb +36 -0
- data/lib/clerk/models/operations/revokeuserbiometriccredential_request.rbi +15 -0
- data/lib/clerk/models/operations/revokeuserbiometriccredential_response.rb +44 -0
- data/lib/clerk/models/operations/revokeuserbiometriccredential_response.rbi +19 -0
- data/lib/clerk/models/operations/rotatedirectoryapikey_request.rb +32 -0
- data/lib/clerk/models/operations/rotatedirectoryapikey_request.rbi +13 -0
- data/lib/clerk/models/operations/rotatedirectoryapikey_response.rb +44 -0
- data/lib/clerk/models/operations/rotatedirectoryapikey_response.rbi +19 -0
- data/lib/clerk/models/operations/rotatescimdirectoryapikey_request.rb +1 -1
- data/lib/clerk/models/operations/rotatescimdirectoryapikey_response.rb +1 -1
- data/lib/clerk/models/operations/updatedirectory_request.rb +36 -0
- data/lib/clerk/models/operations/updatedirectory_request.rbi +15 -0
- data/lib/clerk/models/operations/updatedirectory_requestbody.rb +49 -0
- data/lib/clerk/models/operations/updatedirectory_requestbody.rbi +21 -0
- data/lib/clerk/models/operations/updatedirectory_response.rb +44 -0
- data/lib/clerk/models/operations/updatedirectory_response.rbi +19 -0
- data/lib/clerk/models/operations/updateenterpriseconnection_custom_attribute.rb +5 -1
- data/lib/clerk/models/operations/updateenterpriseconnection_custom_attribute.rbi +2 -0
- data/lib/clerk/models/operations/updateinstance_request.rb +15 -5
- data/lib/clerk/models/operations/updateinstance_request.rbi +6 -2
- data/lib/clerk/models/operations/updateinstanceoauthapplicationsettings_request.rb +11 -2
- data/lib/clerk/models/operations/updateinstanceoauthapplicationsettings_request.rbi +4 -0
- data/lib/clerk/models/operations/updateinstanceprotect_request.rb +1 -1
- data/lib/clerk/models/operations/updateoauthapplication_requestbody.rb +9 -5
- data/lib/clerk/models/operations/updateoauthapplication_requestbody.rbi +4 -2
- data/lib/clerk/models/operations/updateorganization_requestbody.rb +6 -1
- data/lib/clerk/models/operations/updateorganization_requestbody.rbi +2 -0
- data/lib/clerk/models/operations/updatescimdirectory_request.rb +1 -1
- data/lib/clerk/models/operations/updatescimdirectory_requestbody.rb +4 -4
- data/lib/clerk/models/operations/updatescimdirectory_response.rb +1 -1
- data/lib/clerk/models/operations/updateuser_requestbody.rb +1 -1
- data/lib/clerk/models/operations.rb +37 -2
- data/lib/clerk/openapiclient.rb +2 -1
- data/lib/clerk/phonenumbers.rb +10 -2
- data/lib/clerk/scimdirectories.rb +23 -20
- data/lib/clerk/sdk.rb +21 -1
- data/lib/clerk/sdkconfiguration.rb +3 -3
- data/lib/clerk/sessions.rb +146 -0
- data/lib/clerk/users.rb +329 -1
- data/lib/clerk/utils/utils.rb +6 -2
- data/lib/clerk_sdk_ruby.rb +1 -0
- data/test/clerk/org_permissions_v2_test.rb +130 -0
- metadata +154 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c68b0c8c9ffcef4bc371862734e5f104af79329ff91f8d44af09ac88a20639a0
|
|
4
|
+
data.tar.gz: 693984728b0289453c34ecb712080d2906e848b7d423c7eceb1ae96b0acfa04a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e815d65a530453800d06aff6489ee55f912ff2007b0ffc613b108323e1973a1c33328ea0a4153646755771548fc02fb45d311eafb908cc003db71ba72760aeff
|
|
7
|
+
data.tar.gz: 4f1a8082727a827184f06dccac0fd2222f40f5029c967e0e93dd566ac22298c95acfbf214a663bf320c75b8ee7ac3ae5865d727d526509c4816542b92858afe3
|
data/lib/clerk/actortokens.rb
CHANGED
|
@@ -162,7 +162,7 @@ module Clerk
|
|
|
162
162
|
else
|
|
163
163
|
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'
|
|
164
164
|
end
|
|
165
|
-
elsif Utils.match_status_code(http_response.status, ['400', '402', '422'])
|
|
165
|
+
elsif Utils.match_status_code(http_response.status, ['400', '402', '403', '422'])
|
|
166
166
|
if Utils.match_content_type(content_type, 'application/json')
|
|
167
167
|
http_response = @sdk_configuration.hooks.after_success(
|
|
168
168
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
data/lib/clerk/billing.rb
CHANGED
|
@@ -1189,6 +1189,342 @@ module Clerk
|
|
|
1189
1189
|
|
|
1190
1190
|
|
|
1191
1191
|
|
|
1192
|
+
def apply_subscription_item_discount(body:, subscription_item_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
1193
|
+
# apply_subscription_item_discount - Apply a discount to a subscription item
|
|
1194
|
+
# Applies an existing discount to a subscription item.
|
|
1195
|
+
# Manual application is an override path: self-serve distribution rules are not enforced.
|
|
1196
|
+
# At most one active discount is allowed per subscription item; applying a different
|
|
1197
|
+
# discount replaces the currently active one. Re-applying the same active discount returns a conflict.
|
|
1198
|
+
request = Models::Operations::ApplyBillingSubscriptionItemDiscountRequest.new(
|
|
1199
|
+
subscription_item_id: subscription_item_id,
|
|
1200
|
+
body: body
|
|
1201
|
+
)
|
|
1202
|
+
url, params = @sdk_configuration.get_server_details
|
|
1203
|
+
base_url = Utils.template_url(url, params)
|
|
1204
|
+
url = Utils.generate_url(
|
|
1205
|
+
Models::Operations::ApplyBillingSubscriptionItemDiscountRequest,
|
|
1206
|
+
base_url,
|
|
1207
|
+
'/billing/subscription_items/{subscription_item_id}/discounts',
|
|
1208
|
+
request
|
|
1209
|
+
)
|
|
1210
|
+
headers = {}
|
|
1211
|
+
|
|
1212
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
1213
|
+
headers['content-type'] = req_content_type
|
|
1214
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
|
1215
|
+
|
|
1216
|
+
if form && !form.empty?
|
|
1217
|
+
body = Utils.encode_form(form)
|
|
1218
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
1219
|
+
body = URI.encode_www_form(data)
|
|
1220
|
+
else
|
|
1221
|
+
body = data
|
|
1222
|
+
end
|
|
1223
|
+
headers['Accept'] = 'application/json'
|
|
1224
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1225
|
+
retries ||= @sdk_configuration.retry_config
|
|
1226
|
+
retries ||= Utils::RetryConfig.new(
|
|
1227
|
+
backoff: Utils::BackoffStrategy.new(
|
|
1228
|
+
exponent: 1.5,
|
|
1229
|
+
initial_interval: 500,
|
|
1230
|
+
max_elapsed_time: 3_600_000,
|
|
1231
|
+
max_interval: 60_000
|
|
1232
|
+
),
|
|
1233
|
+
retry_connection_errors: true,
|
|
1234
|
+
strategy: 'backoff'
|
|
1235
|
+
)
|
|
1236
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
1237
|
+
retry_options[:retry_statuses] = [500, 501, 502, 503, 504, 505]
|
|
1238
|
+
|
|
1239
|
+
security = @sdk_configuration.security_source&.call
|
|
1240
|
+
|
|
1241
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1242
|
+
timeout ||= @sdk_configuration.timeout
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
connection = @sdk_configuration.client.dup
|
|
1246
|
+
connection.use Utils::RetryMiddleware, retry_options
|
|
1247
|
+
|
|
1248
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1249
|
+
config: @sdk_configuration,
|
|
1250
|
+
base_url: base_url,
|
|
1251
|
+
oauth2_scopes: nil,
|
|
1252
|
+
operation_id: 'ApplyBillingSubscriptionItemDiscount',
|
|
1253
|
+
security_source: @sdk_configuration.security_source
|
|
1254
|
+
)
|
|
1255
|
+
|
|
1256
|
+
error = nil
|
|
1257
|
+
http_response = nil
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
begin
|
|
1261
|
+
http_response = connection.post(url) do |req|
|
|
1262
|
+
req.body = body
|
|
1263
|
+
req.headers.merge!(headers)
|
|
1264
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1265
|
+
Utils.configure_request_security(req, security)
|
|
1266
|
+
http_headers&.each do |key, value|
|
|
1267
|
+
req.headers[key.to_s] = value
|
|
1268
|
+
end
|
|
1269
|
+
|
|
1270
|
+
@sdk_configuration.hooks.before_request(
|
|
1271
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1272
|
+
hook_ctx: hook_ctx
|
|
1273
|
+
),
|
|
1274
|
+
request: req
|
|
1275
|
+
)
|
|
1276
|
+
end
|
|
1277
|
+
rescue StandardError => e
|
|
1278
|
+
error = e
|
|
1279
|
+
ensure
|
|
1280
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
1281
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
1282
|
+
error: error,
|
|
1283
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1284
|
+
hook_ctx: hook_ctx
|
|
1285
|
+
),
|
|
1286
|
+
response: http_response
|
|
1287
|
+
)
|
|
1288
|
+
else
|
|
1289
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1290
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1291
|
+
hook_ctx: hook_ctx
|
|
1292
|
+
),
|
|
1293
|
+
response: http_response
|
|
1294
|
+
)
|
|
1295
|
+
end
|
|
1296
|
+
|
|
1297
|
+
if http_response.nil?
|
|
1298
|
+
raise error if !error.nil?
|
|
1299
|
+
raise 'no response'
|
|
1300
|
+
end
|
|
1301
|
+
end
|
|
1302
|
+
|
|
1303
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
1304
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
1305
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1306
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1307
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1308
|
+
hook_ctx: hook_ctx
|
|
1309
|
+
),
|
|
1310
|
+
response: http_response
|
|
1311
|
+
)
|
|
1312
|
+
response_data = http_response.env.response_body
|
|
1313
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::CommerceDiscountRedemptionResponse)
|
|
1314
|
+
response = Models::Operations::ApplyBillingSubscriptionItemDiscountResponse.new(
|
|
1315
|
+
status_code: http_response.status,
|
|
1316
|
+
content_type: content_type,
|
|
1317
|
+
raw_response: http_response,
|
|
1318
|
+
commerce_discount_redemption_response: obj
|
|
1319
|
+
)
|
|
1320
|
+
|
|
1321
|
+
return response
|
|
1322
|
+
else
|
|
1323
|
+
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'
|
|
1324
|
+
end
|
|
1325
|
+
elsif Utils.match_status_code(http_response.status, ['400', '401', '403', '404', '409', '422'])
|
|
1326
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1327
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1328
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1329
|
+
hook_ctx: hook_ctx
|
|
1330
|
+
),
|
|
1331
|
+
response: http_response
|
|
1332
|
+
)
|
|
1333
|
+
response_data = http_response.env.response_body
|
|
1334
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
1335
|
+
obj.raw_response = http_response
|
|
1336
|
+
raise obj
|
|
1337
|
+
else
|
|
1338
|
+
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'
|
|
1339
|
+
end
|
|
1340
|
+
elsif Utils.match_status_code(http_response.status, ['500'])
|
|
1341
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1342
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1343
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1344
|
+
hook_ctx: hook_ctx
|
|
1345
|
+
),
|
|
1346
|
+
response: http_response
|
|
1347
|
+
)
|
|
1348
|
+
response_data = http_response.env.response_body
|
|
1349
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
1350
|
+
obj.raw_response = http_response
|
|
1351
|
+
raise obj
|
|
1352
|
+
else
|
|
1353
|
+
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'
|
|
1354
|
+
end
|
|
1355
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1356
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1357
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1358
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1359
|
+
else
|
|
1360
|
+
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'
|
|
1361
|
+
|
|
1362
|
+
end
|
|
1363
|
+
end
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
def remove_subscription_item_discount(subscription_item_id:, discount_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
1368
|
+
# remove_subscription_item_discount - Remove a discount from a subscription item
|
|
1369
|
+
# Removes the active discount from a subscription item.
|
|
1370
|
+
# The discount_id must match the subscription item's currently active discount.
|
|
1371
|
+
request = Models::Operations::RemoveBillingSubscriptionItemDiscountRequest.new(
|
|
1372
|
+
subscription_item_id: subscription_item_id,
|
|
1373
|
+
discount_id: discount_id
|
|
1374
|
+
)
|
|
1375
|
+
url, params = @sdk_configuration.get_server_details
|
|
1376
|
+
base_url = Utils.template_url(url, params)
|
|
1377
|
+
url = Utils.generate_url(
|
|
1378
|
+
Models::Operations::RemoveBillingSubscriptionItemDiscountRequest,
|
|
1379
|
+
base_url,
|
|
1380
|
+
'/billing/subscription_items/{subscription_item_id}/discounts/{discount_id}',
|
|
1381
|
+
request
|
|
1382
|
+
)
|
|
1383
|
+
headers = {}
|
|
1384
|
+
|
|
1385
|
+
headers['Accept'] = 'application/json'
|
|
1386
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
1387
|
+
retries ||= @sdk_configuration.retry_config
|
|
1388
|
+
retries ||= Utils::RetryConfig.new(
|
|
1389
|
+
backoff: Utils::BackoffStrategy.new(
|
|
1390
|
+
exponent: 1.5,
|
|
1391
|
+
initial_interval: 500,
|
|
1392
|
+
max_elapsed_time: 3_600_000,
|
|
1393
|
+
max_interval: 60_000
|
|
1394
|
+
),
|
|
1395
|
+
retry_connection_errors: true,
|
|
1396
|
+
strategy: 'backoff'
|
|
1397
|
+
)
|
|
1398
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
1399
|
+
retry_options[:retry_statuses] = [500, 501, 502, 503, 504, 505]
|
|
1400
|
+
|
|
1401
|
+
security = @sdk_configuration.security_source&.call
|
|
1402
|
+
|
|
1403
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
1404
|
+
timeout ||= @sdk_configuration.timeout
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
connection = @sdk_configuration.client.dup
|
|
1408
|
+
connection.use Utils::RetryMiddleware, retry_options
|
|
1409
|
+
|
|
1410
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
1411
|
+
config: @sdk_configuration,
|
|
1412
|
+
base_url: base_url,
|
|
1413
|
+
oauth2_scopes: nil,
|
|
1414
|
+
operation_id: 'RemoveBillingSubscriptionItemDiscount',
|
|
1415
|
+
security_source: @sdk_configuration.security_source
|
|
1416
|
+
)
|
|
1417
|
+
|
|
1418
|
+
error = nil
|
|
1419
|
+
http_response = nil
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
begin
|
|
1423
|
+
http_response = connection.delete(url) do |req|
|
|
1424
|
+
req.headers.merge!(headers)
|
|
1425
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
1426
|
+
Utils.configure_request_security(req, security)
|
|
1427
|
+
http_headers&.each do |key, value|
|
|
1428
|
+
req.headers[key.to_s] = value
|
|
1429
|
+
end
|
|
1430
|
+
|
|
1431
|
+
@sdk_configuration.hooks.before_request(
|
|
1432
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
1433
|
+
hook_ctx: hook_ctx
|
|
1434
|
+
),
|
|
1435
|
+
request: req
|
|
1436
|
+
)
|
|
1437
|
+
end
|
|
1438
|
+
rescue StandardError => e
|
|
1439
|
+
error = e
|
|
1440
|
+
ensure
|
|
1441
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
1442
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
1443
|
+
error: error,
|
|
1444
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
1445
|
+
hook_ctx: hook_ctx
|
|
1446
|
+
),
|
|
1447
|
+
response: http_response
|
|
1448
|
+
)
|
|
1449
|
+
else
|
|
1450
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1451
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1452
|
+
hook_ctx: hook_ctx
|
|
1453
|
+
),
|
|
1454
|
+
response: http_response
|
|
1455
|
+
)
|
|
1456
|
+
end
|
|
1457
|
+
|
|
1458
|
+
if http_response.nil?
|
|
1459
|
+
raise error if !error.nil?
|
|
1460
|
+
raise 'no response'
|
|
1461
|
+
end
|
|
1462
|
+
end
|
|
1463
|
+
|
|
1464
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
1465
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
1466
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1467
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1468
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1469
|
+
hook_ctx: hook_ctx
|
|
1470
|
+
),
|
|
1471
|
+
response: http_response
|
|
1472
|
+
)
|
|
1473
|
+
response_data = http_response.env.response_body
|
|
1474
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::CommerceDiscountRedemptionResponse)
|
|
1475
|
+
response = Models::Operations::RemoveBillingSubscriptionItemDiscountResponse.new(
|
|
1476
|
+
status_code: http_response.status,
|
|
1477
|
+
content_type: content_type,
|
|
1478
|
+
raw_response: http_response,
|
|
1479
|
+
commerce_discount_redemption_response: obj
|
|
1480
|
+
)
|
|
1481
|
+
|
|
1482
|
+
return response
|
|
1483
|
+
else
|
|
1484
|
+
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'
|
|
1485
|
+
end
|
|
1486
|
+
elsif Utils.match_status_code(http_response.status, ['400', '401', '403', '404', '409', '422'])
|
|
1487
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1488
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1489
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1490
|
+
hook_ctx: hook_ctx
|
|
1491
|
+
),
|
|
1492
|
+
response: http_response
|
|
1493
|
+
)
|
|
1494
|
+
response_data = http_response.env.response_body
|
|
1495
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
1496
|
+
obj.raw_response = http_response
|
|
1497
|
+
raise obj
|
|
1498
|
+
else
|
|
1499
|
+
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'
|
|
1500
|
+
end
|
|
1501
|
+
elsif Utils.match_status_code(http_response.status, ['500'])
|
|
1502
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
1503
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
1504
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
1505
|
+
hook_ctx: hook_ctx
|
|
1506
|
+
),
|
|
1507
|
+
response: http_response
|
|
1508
|
+
)
|
|
1509
|
+
response_data = http_response.env.response_body
|
|
1510
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ClerkErrors)
|
|
1511
|
+
obj.raw_response = http_response
|
|
1512
|
+
raise obj
|
|
1513
|
+
else
|
|
1514
|
+
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'
|
|
1515
|
+
end
|
|
1516
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
1517
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1518
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
1519
|
+
raise ::Clerk::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
1520
|
+
else
|
|
1521
|
+
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'
|
|
1522
|
+
|
|
1523
|
+
end
|
|
1524
|
+
end
|
|
1525
|
+
|
|
1526
|
+
|
|
1527
|
+
|
|
1192
1528
|
def list_statements(paginated: nil, limit: nil, offset: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
1193
1529
|
# list_statements - List all billing statements
|
|
1194
1530
|
# Returns a list of all billing statements for the instance. The statements are returned sorted by creation date,
|