schematichq 1.5.3 → 1.5.4
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/.fern/metadata.json +4 -4
- data/.fern/replay.lock +7 -1
- data/.fernignore +2 -0
- data/.rubocop.yml +4 -0
- data/README.md +1 -1
- data/WASM_VERSION +1 -1
- data/lib/schematic/accesstokens/client.rb +9 -1
- data/lib/schematic/accounts/client.rb +183 -21
- data/lib/schematic/billing/client.rb +325 -34
- data/lib/schematic/billing/types/create_billing_price_request_body.rb +1 -1
- data/lib/schematic/billing/types/create_billing_product_request_body.rb +1 -1
- data/lib/schematic/billing/types/create_billing_subscription_request_body.rb +1 -1
- data/lib/schematic/billing/types/create_coupon_request_body.rb +2 -2
- data/lib/schematic/billing/types/create_invoice_request_body.rb +1 -1
- data/lib/schematic/billing/types/get_billing_settings_response.rb +13 -0
- data/lib/schematic/billing/types/list_billing_prices_params.rb +1 -1
- data/lib/schematic/billing/types/list_billing_prices_request.rb +1 -1
- data/lib/schematic/billing/types/list_billing_product_prices_params.rb +1 -1
- data/lib/schematic/billing/types/list_billing_product_prices_request.rb +1 -1
- data/lib/schematic/billing/types/update_billing_settings_request_body.rb +11 -0
- data/lib/schematic/billing/types/update_billing_settings_response.rb +13 -0
- data/lib/schematic/catalogs/client.rb +121 -14
- data/lib/schematic/checkout/client.rb +80 -9
- data/lib/schematic/checkout/types/checkout_data_request_body.rb +1 -1
- data/lib/schematic/client.rb +5 -3
- data/lib/schematic/companies/client.rb +380 -44
- data/lib/schematic/components/client.rb +70 -8
- data/lib/schematic/components/types/create_component_request_body.rb +1 -1
- data/lib/schematic/components/types/update_component_request_body.rb +1 -1
- data/lib/schematic/componentspublic/client.rb +8 -1
- data/lib/schematic/credits/client.rb +409 -41
- data/lib/schematic/credits/types/acquire_credit_lease_request_body.rb +1 -1
- data/lib/schematic/credits/types/create_billing_credit_request_body.rb +1 -1
- data/lib/schematic/credits/types/create_company_credit_grant.rb +1 -1
- data/lib/schematic/credits/types/create_credit_bundle_request_body.rb +1 -1
- data/lib/schematic/credits/types/create_credit_spend_policy_request_body.rb +2 -2
- data/lib/schematic/credits/types/extend_credit_lease_request_body.rb +1 -1
- data/lib/schematic/credits/types/get_credit_balance_time_series_params.rb +18 -0
- data/lib/schematic/credits/types/get_credit_balance_time_series_request.rb +17 -0
- data/lib/schematic/credits/types/get_credit_balance_time_series_response.rb +13 -0
- data/lib/schematic/credits/types/reserve_credits_request_body.rb +1 -1
- data/lib/schematic/credits/types/update_credit_spend_policy_request_body.rb +2 -2
- data/lib/schematic/dataexports/client.rb +36 -6
- data/lib/schematic/entitlements/client.rb +244 -28
- data/lib/schematic/entitlements/types/create_billing_linked_plan_entitlement_request_body.rb +4 -2
- data/lib/schematic/entitlements/types/create_company_override_request_body.rb +3 -1
- data/lib/schematic/entitlements/types/create_plan_entitlement_request_body.rb +4 -2
- data/lib/schematic/entitlements/types/update_company_override_request_body.rb +3 -1
- data/lib/schematic/entitlements/types/update_plan_entitlement_request_body.rb +4 -2
- data/lib/schematic/errors/connection_error.rb +11 -0
- data/lib/schematic/errors/response_error.rb +23 -2
- data/lib/schematic/events/client.rb +78 -9
- data/lib/schematic/features/client.rb +160 -18
- data/lib/schematic/features/types/check_and_reserve_flag_request_body.rb +1 -1
- data/lib/schematic/features/types/create_billing_linked_feature_request_body.rb +2 -0
- data/lib/schematic/features/types/create_feature_request_body.rb +2 -0
- data/lib/schematic/features/types/update_feature_request_body.rb +2 -0
- data/lib/schematic/insights/client.rb +48 -6
- data/lib/schematic/integrationsapi/client.rb +120 -14
- data/lib/schematic/internal/http/base_request.rb +30 -0
- data/lib/schematic/internal/http/raw_client.rb +35 -5
- data/lib/schematic/internal/iterators/cursor_item_iterator.rb +7 -2
- data/lib/schematic/internal/iterators/cursor_page_iterator.rb +68 -14
- data/lib/schematic/internal/iterators/item_iterator.rb +61 -15
- data/lib/schematic/internal/iterators/offset_item_iterator.rb +7 -2
- data/lib/schematic/internal/iterators/offset_page_iterator.rb +57 -9
- data/lib/schematic/internal/json/request.rb +11 -2
- data/lib/schematic/internal/multipart/multipart_request.rb +1 -0
- data/lib/schematic/internal/types/model.rb +7 -3
- data/lib/schematic/internal/types/utils.rb +7 -0
- data/lib/schematic/licenses/client.rb +26 -3
- data/lib/schematic/planbundle/client.rb +27 -3
- data/lib/schematic/plangroups/client.rb +26 -3
- data/lib/schematic/planmigrations/client.rb +98 -11
- data/lib/schematic/plans/client.rb +213 -23
- data/lib/schematic/plans/types/get_plan_version_diff_params.rb +12 -0
- data/lib/schematic/plans/types/get_plan_version_diff_request.rb +13 -0
- data/lib/schematic/plans/types/get_plan_version_diff_response.rb +13 -0
- data/lib/schematic/plans/types/publish_plan_version_request_body.rb +2 -0
- data/lib/schematic/rules_engine.rb +14 -2
- data/lib/schematic/scheduledcheckout/client.rb +35 -4
- data/lib/schematic/schematic_client.rb +22 -11
- data/lib/schematic/types/billing_coupon_response_data.rb +2 -2
- data/lib/schematic/types/billing_credit_grant_response_data.rb +8 -8
- data/lib/schematic/types/billing_customer_subscription.rb +1 -1
- data/lib/schematic/types/billing_plan_credit_grant_response_data.rb +1 -1
- data/lib/schematic/types/billing_price_response_data.rb +1 -1
- data/lib/schematic/types/billing_price_view.rb +1 -1
- data/lib/schematic/types/billing_product_detail_response_data.rb +2 -2
- data/lib/schematic/types/billing_product_for_subscription_response_data.rb +2 -2
- data/lib/schematic/types/billing_product_price_response_data.rb +1 -1
- data/lib/schematic/types/billing_product_pricing.rb +1 -1
- data/lib/schematic/types/billing_product_response_data.rb +2 -2
- data/lib/schematic/types/billing_settings_response_data.rb +9 -0
- data/lib/schematic/types/billing_subscription_discount_view.rb +2 -2
- data/lib/schematic/types/billing_subscription_response_data.rb +1 -1
- data/lib/schematic/types/billing_subscription_view.rb +1 -1
- data/lib/schematic/types/catalog_config_ordered_plan.rb +2 -0
- data/lib/schematic/types/catalog_config_ordered_plan_response_data.rb +2 -0
- data/lib/schematic/types/catalog_config_plan_credit.rb +11 -0
- data/lib/schematic/types/catalog_config_plan_credit_response_data.rb +11 -0
- data/lib/schematic/types/change_subscription_internal_request_body.rb +1 -1
- data/lib/schematic/types/change_subscription_request_body.rb +1 -1
- data/lib/schematic/types/checkout_problem_code.rb +54 -0
- data/lib/schematic/types/checkout_problem_response_data.rb +31 -0
- data/lib/schematic/types/checkout_problem_source.rb +13 -0
- data/lib/schematic/types/checkout_subscription.rb +1 -1
- data/lib/schematic/types/company_billing_entity_subscription_response_data.rb +1 -1
- data/lib/schematic/types/company_credit_balance.rb +3 -3
- data/lib/schematic/types/company_credit_balance_response_data.rb +4 -4
- data/lib/schematic/types/company_detail_response_data.rb +1 -1
- data/lib/schematic/types/company_override_response_data.rb +3 -1
- data/lib/schematic/types/company_plan_credit_grant_view.rb +1 -1
- data/lib/schematic/types/company_plan_detail_response_data.rb +2 -0
- data/lib/schematic/types/company_subscription_response_data.rb +1 -1
- data/lib/schematic/types/company_user_usage_response_data.rb +2 -2
- data/lib/schematic/types/company_user_usage_row_response_data.rb +2 -2
- data/lib/schematic/types/component_response_data.rb +1 -1
- data/lib/schematic/types/condition.rb +3 -1
- data/lib/schematic/types/condition_response_data.rb +3 -1
- data/lib/schematic/types/condition_view.rb +3 -1
- data/lib/schematic/types/coupon_request_body.rb +2 -2
- data/lib/schematic/types/create_billing_plan_credit_grant_request_body.rb +1 -1
- data/lib/schematic/types/create_entitlement_in_bundle_request_body.rb +4 -2
- data/lib/schematic/types/create_entitlement_req_common.rb +3 -1
- data/lib/schematic/types/create_or_update_condition_request_body.rb +1 -1
- data/lib/schematic/types/credit_balance_event_response_data.rb +21 -0
- data/lib/schematic/types/credit_balance_feature_consumption_response_data.rb +13 -0
- data/lib/schematic/types/credit_balance_point_response_data.rb +15 -0
- data/lib/schematic/types/credit_balance_time_series_response_data.rb +15 -0
- data/lib/schematic/types/credit_bundle_currency_price.rb +1 -1
- data/lib/schematic/types/credit_bundle_currency_price_request_body.rb +1 -1
- data/lib/schematic/types/credit_bundle_currency_price_response_data.rb +1 -1
- data/lib/schematic/types/credit_burn_breakdown_line.rb +15 -0
- data/lib/schematic/types/credit_company_grant_view.rb +8 -8
- data/lib/schematic/types/credit_currency_price.rb +1 -1
- data/lib/schematic/types/credit_currency_price_request_body.rb +1 -1
- data/lib/schematic/types/credit_currency_price_response_data.rb +1 -1
- data/lib/schematic/types/credit_event_ledger_response_data.rb +10 -6
- data/lib/schematic/types/credit_grant_detail.rb +1 -1
- data/lib/schematic/types/credit_lease_response_data.rb +2 -2
- data/lib/schematic/types/credit_reservation_response_data.rb +2 -2
- data/lib/schematic/types/credit_spend_policy.rb +2 -2
- data/lib/schematic/types/credit_spend_policy_response_data.rb +4 -4
- data/lib/schematic/types/credit_transfer_response_data.rb +1 -1
- data/lib/schematic/types/credit_transfer_view.rb +1 -1
- data/lib/schematic/types/credit_usage.rb +5 -5
- data/lib/schematic/types/credit_usage_aggregation.rb +4 -4
- data/lib/schematic/types/credit_usage_reason.rb +1 -0
- data/lib/schematic/types/credits_in_plan.rb +11 -0
- data/lib/schematic/types/currency.rb +144 -0
- data/lib/schematic/types/currency_price_request_body.rb +1 -1
- data/lib/schematic/types/custom_plan_billing_response_data.rb +6 -0
- data/lib/schematic/types/entitlement_currency_prices_response_data.rb +1 -1
- data/lib/schematic/types/estimated_plan_total.rb +1 -1
- data/lib/schematic/types/feature_company_response_data.rb +7 -7
- data/lib/schematic/types/feature_detail_response_data.rb +2 -0
- data/lib/schematic/types/feature_entitlement.rb +8 -6
- data/lib/schematic/types/feature_event_source.rb +12 -0
- data/lib/schematic/types/feature_in_plan_response_data.rb +2 -0
- data/lib/schematic/types/feature_response_data.rb +2 -0
- data/lib/schematic/types/feature_usage_response_data.rb +7 -7
- data/lib/schematic/types/feature_view.rb +2 -0
- data/lib/schematic/types/flag_check_reservation_response_data.rb +3 -3
- data/lib/schematic/types/insights_summary_response_data.rb +1 -1
- data/lib/schematic/types/invoice_request_body.rb +1 -1
- data/lib/schematic/types/invoice_response_data.rb +1 -1
- data/lib/schematic/types/manage_plan_preview_response_response_data.rb +2 -0
- data/lib/schematic/types/manage_plan_request.rb +3 -1
- data/lib/schematic/types/manage_plan_response_response_data.rb +4 -0
- data/lib/schematic/types/mrr_response_data.rb +1 -1
- data/lib/schematic/types/onboarding_milestone_view.rb +1 -1
- data/lib/schematic/types/ordered_plans_in_group.rb +2 -0
- data/lib/schematic/types/plan_billing_source.rb +1 -0
- data/lib/schematic/types/plan_change_action.rb +1 -0
- data/lib/schematic/types/plan_change_amendment_status.rb +15 -0
- data/lib/schematic/types/plan_change_response_data.rb +4 -0
- data/lib/schematic/types/plan_credit_grant_view.rb +1 -1
- data/lib/schematic/types/plan_credit_order.rb +11 -0
- data/lib/schematic/types/plan_credit_visibility.rb +11 -0
- data/lib/schematic/types/plan_currency_price_request_body.rb +1 -1
- data/lib/schematic/types/plan_currency_prices_response_data.rb +1 -1
- data/lib/schematic/types/plan_entitlement_response_data.rb +3 -1
- data/lib/schematic/types/plan_group_plan_entitlements_order.rb +2 -0
- data/lib/schematic/types/plan_version_billing_product_change_response_data.rb +11 -0
- data/lib/schematic/types/plan_version_credit_grant_change_response_data.rb +17 -0
- data/lib/schematic/types/plan_version_diff_change_type.rb +13 -0
- data/lib/schematic/types/plan_version_diff_price_cadence.rb +14 -0
- data/lib/schematic/types/plan_version_diff_response_data.rb +23 -0
- data/lib/schematic/types/plan_version_entitlement_change_response_data.rb +17 -0
- data/lib/schematic/types/plan_version_field_change_response_data.rb +13 -0
- data/lib/schematic/types/plan_version_price_change_response_data.rb +15 -0
- data/lib/schematic/types/plan_view_public_response_data.rb +2 -0
- data/lib/schematic/types/preflight_request_body.rb +1 -1
- data/lib/schematic/types/preview_subscription_change_response_data.rb +3 -1
- data/lib/schematic/types/preview_subscription_discount_response_data.rb +2 -2
- data/lib/schematic/types/preview_subscription_finance_response_data.rb +2 -2
- data/lib/schematic/types/rulesengine_company.rb +1 -1
- data/lib/schematic/types/rulesengine_condition.rb +3 -1
- data/lib/schematic/types/rulesengine_credit_postpaid_config.rb +1 -1
- data/lib/schematic/types/rulesengine_credit_spend_policy.rb +2 -2
- data/lib/schematic/types/rulesengine_feature_entitlement.rb +8 -6
- data/lib/schematic/types/scheduled_downgrade_response_data.rb +1 -1
- data/lib/schematic/types/top_feature_by_usage_response_data.rb +1 -1
- data/lib/schematic/types/upcoming_invoice_response_data.rb +1 -1
- data/lib/schematic/types/update_billing_plan_credit_grant_request_body.rb +1 -1
- data/lib/schematic/types/update_entitlement_req_common.rb +3 -1
- data/lib/schematic/types/upsert_billing_product_request_body.rb +1 -1
- data/lib/schematic/types/usage_based_entitlement_request_body.rb +1 -1
- data/lib/schematic/types/usage_based_entitlement_response_data.rb +1 -1
- data/lib/schematic/types/user_credit_usage_response_data.rb +2 -2
- data/lib/schematic/types/user_daily_credit_point_response_data.rb +1 -1
- data/lib/schematic/types/user_feature_usage_response_data.rb +1 -1
- data/lib/schematic/version.rb +1 -1
- data/lib/schematic/wasm/rulesengine.wasm +0 -0
- data/lib/schematic/webhooks/client.rb +88 -10
- data/lib/schematic.rb +38 -3
- data/reference.md +340 -44
- metadata +37 -2
|
@@ -49,7 +49,15 @@ module Schematic
|
|
|
49
49
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::UpdateCompanyPlansResponse.load(response.body))
|
|
50
50
|
else
|
|
51
51
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
52
|
-
|
|
52
|
+
error_types = {
|
|
53
|
+
400 => Schematic::Types::ApiError,
|
|
54
|
+
401 => Schematic::Types::ApiError,
|
|
55
|
+
403 => Schematic::Types::ApiError,
|
|
56
|
+
404 => Schematic::Types::ApiError,
|
|
57
|
+
500 => Schematic::Types::ApiError
|
|
58
|
+
}
|
|
59
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
60
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
53
61
|
end
|
|
54
62
|
end
|
|
55
63
|
|
|
@@ -72,7 +80,7 @@ module Schematic
|
|
|
72
80
|
# client.plans.list_custom_plan_billings(
|
|
73
81
|
# company_id: "company_id",
|
|
74
82
|
# plan_id: "plan_id",
|
|
75
|
-
# plan_billing_source: "
|
|
83
|
+
# plan_billing_source: "amendment",
|
|
76
84
|
# status: "active",
|
|
77
85
|
# statuses: ["active"],
|
|
78
86
|
# limit: 1000000,
|
|
@@ -108,7 +116,15 @@ module Schematic
|
|
|
108
116
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::ListCustomPlanBillingsResponse.load(response.body))
|
|
109
117
|
else
|
|
110
118
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
111
|
-
|
|
119
|
+
error_types = {
|
|
120
|
+
400 => Schematic::Types::ApiError,
|
|
121
|
+
401 => Schematic::Types::ApiError,
|
|
122
|
+
403 => Schematic::Types::ApiError,
|
|
123
|
+
404 => Schematic::Types::ApiError,
|
|
124
|
+
500 => Schematic::Types::ApiError
|
|
125
|
+
}
|
|
126
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
127
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
112
128
|
end
|
|
113
129
|
end
|
|
114
130
|
|
|
@@ -132,14 +148,11 @@ module Schematic
|
|
|
132
148
|
# @return [Schematic::Plans::Types::MarkCustomPlanBillingPaidResponse]
|
|
133
149
|
def mark_custom_plan_billing_paid(request_options: {}, **params)
|
|
134
150
|
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
135
|
-
path_param_names = %i[custom_plan_billing_id]
|
|
136
|
-
body_params = params.except(*path_param_names)
|
|
137
|
-
|
|
138
151
|
request = Schematic::Internal::JSON::Request.new(
|
|
139
152
|
base_url: request_options[:base_url],
|
|
140
153
|
method: "PUT",
|
|
141
154
|
path: "custom-plan-billings/#{URI.encode_uri_component(params[:custom_plan_billing_id].to_s)}/mark-paid",
|
|
142
|
-
body:
|
|
155
|
+
body: params[:request],
|
|
143
156
|
request_options: request_options
|
|
144
157
|
)
|
|
145
158
|
begin
|
|
@@ -152,7 +165,15 @@ module Schematic
|
|
|
152
165
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::MarkCustomPlanBillingPaidResponse.load(response.body))
|
|
153
166
|
else
|
|
154
167
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
155
|
-
|
|
168
|
+
error_types = {
|
|
169
|
+
400 => Schematic::Types::ApiError,
|
|
170
|
+
401 => Schematic::Types::ApiError,
|
|
171
|
+
403 => Schematic::Types::ApiError,
|
|
172
|
+
404 => Schematic::Types::ApiError,
|
|
173
|
+
500 => Schematic::Types::ApiError
|
|
174
|
+
}
|
|
175
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
176
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
156
177
|
end
|
|
157
178
|
end
|
|
158
179
|
|
|
@@ -195,7 +216,15 @@ module Schematic
|
|
|
195
216
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::RetryCustomPlanBillingResponse.load(response.body))
|
|
196
217
|
else
|
|
197
218
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
198
|
-
|
|
219
|
+
error_types = {
|
|
220
|
+
400 => Schematic::Types::ApiError,
|
|
221
|
+
401 => Schematic::Types::ApiError,
|
|
222
|
+
403 => Schematic::Types::ApiError,
|
|
223
|
+
404 => Schematic::Types::ApiError,
|
|
224
|
+
500 => Schematic::Types::ApiError
|
|
225
|
+
}
|
|
226
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
227
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
199
228
|
end
|
|
200
229
|
end
|
|
201
230
|
|
|
@@ -233,7 +262,15 @@ module Schematic
|
|
|
233
262
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::CreateCustomPlanResponse.load(response.body))
|
|
234
263
|
else
|
|
235
264
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
236
|
-
|
|
265
|
+
error_types = {
|
|
266
|
+
400 => Schematic::Types::ApiError,
|
|
267
|
+
401 => Schematic::Types::ApiError,
|
|
268
|
+
403 => Schematic::Types::ApiError,
|
|
269
|
+
404 => Schematic::Types::ApiError,
|
|
270
|
+
500 => Schematic::Types::ApiError
|
|
271
|
+
}
|
|
272
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
273
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
237
274
|
end
|
|
238
275
|
end
|
|
239
276
|
|
|
@@ -331,7 +368,15 @@ module Schematic
|
|
|
331
368
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::ListPlansResponse.load(response.body))
|
|
332
369
|
else
|
|
333
370
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
334
|
-
|
|
371
|
+
error_types = {
|
|
372
|
+
400 => Schematic::Types::ApiError,
|
|
373
|
+
401 => Schematic::Types::ApiError,
|
|
374
|
+
403 => Schematic::Types::ApiError,
|
|
375
|
+
404 => Schematic::Types::ApiError,
|
|
376
|
+
500 => Schematic::Types::ApiError
|
|
377
|
+
}
|
|
378
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
379
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
335
380
|
end
|
|
336
381
|
end
|
|
337
382
|
|
|
@@ -369,7 +414,15 @@ module Schematic
|
|
|
369
414
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::CreatePlanResponse.load(response.body))
|
|
370
415
|
else
|
|
371
416
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
372
|
-
|
|
417
|
+
error_types = {
|
|
418
|
+
400 => Schematic::Types::ApiError,
|
|
419
|
+
401 => Schematic::Types::ApiError,
|
|
420
|
+
403 => Schematic::Types::ApiError,
|
|
421
|
+
404 => Schematic::Types::ApiError,
|
|
422
|
+
500 => Schematic::Types::ApiError
|
|
423
|
+
}
|
|
424
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
425
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
373
426
|
end
|
|
374
427
|
end
|
|
375
428
|
|
|
@@ -412,7 +465,14 @@ module Schematic
|
|
|
412
465
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::GetPlanResponse.load(response.body))
|
|
413
466
|
else
|
|
414
467
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
415
|
-
|
|
468
|
+
error_types = {
|
|
469
|
+
401 => Schematic::Types::ApiError,
|
|
470
|
+
403 => Schematic::Types::ApiError,
|
|
471
|
+
404 => Schematic::Types::ApiError,
|
|
472
|
+
500 => Schematic::Types::ApiError
|
|
473
|
+
}
|
|
474
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
475
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
416
476
|
end
|
|
417
477
|
end
|
|
418
478
|
|
|
@@ -454,7 +514,15 @@ module Schematic
|
|
|
454
514
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::UpdatePlanResponse.load(response.body))
|
|
455
515
|
else
|
|
456
516
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
457
|
-
|
|
517
|
+
error_types = {
|
|
518
|
+
400 => Schematic::Types::ApiError,
|
|
519
|
+
401 => Schematic::Types::ApiError,
|
|
520
|
+
403 => Schematic::Types::ApiError,
|
|
521
|
+
404 => Schematic::Types::ApiError,
|
|
522
|
+
500 => Schematic::Types::ApiError
|
|
523
|
+
}
|
|
524
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
525
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
458
526
|
end
|
|
459
527
|
end
|
|
460
528
|
|
|
@@ -489,7 +557,15 @@ module Schematic
|
|
|
489
557
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::DeletePlanResponse.load(response.body))
|
|
490
558
|
else
|
|
491
559
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
492
|
-
|
|
560
|
+
error_types = {
|
|
561
|
+
400 => Schematic::Types::ApiError,
|
|
562
|
+
401 => Schematic::Types::ApiError,
|
|
563
|
+
403 => Schematic::Types::ApiError,
|
|
564
|
+
404 => Schematic::Types::ApiError,
|
|
565
|
+
500 => Schematic::Types::ApiError
|
|
566
|
+
}
|
|
567
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
568
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
493
569
|
end
|
|
494
570
|
end
|
|
495
571
|
|
|
@@ -532,7 +608,15 @@ module Schematic
|
|
|
532
608
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::UpsertBillingProductPlanResponse.load(response.body))
|
|
533
609
|
else
|
|
534
610
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
535
|
-
|
|
611
|
+
error_types = {
|
|
612
|
+
400 => Schematic::Types::ApiError,
|
|
613
|
+
401 => Schematic::Types::ApiError,
|
|
614
|
+
403 => Schematic::Types::ApiError,
|
|
615
|
+
404 => Schematic::Types::ApiError,
|
|
616
|
+
500 => Schematic::Types::ApiError
|
|
617
|
+
}
|
|
618
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
619
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
536
620
|
end
|
|
537
621
|
end
|
|
538
622
|
|
|
@@ -572,7 +656,15 @@ module Schematic
|
|
|
572
656
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::UpsertPlanForBillingProductResponse.load(response.body))
|
|
573
657
|
else
|
|
574
658
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
575
|
-
|
|
659
|
+
error_types = {
|
|
660
|
+
400 => Schematic::Types::ApiError,
|
|
661
|
+
401 => Schematic::Types::ApiError,
|
|
662
|
+
403 => Schematic::Types::ApiError,
|
|
663
|
+
404 => Schematic::Types::ApiError,
|
|
664
|
+
500 => Schematic::Types::ApiError
|
|
665
|
+
}
|
|
666
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
667
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
576
668
|
end
|
|
577
669
|
end
|
|
578
670
|
|
|
@@ -622,7 +714,15 @@ module Schematic
|
|
|
622
714
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::ListBillingProductMatchCompaniesResponse.load(response.body))
|
|
623
715
|
else
|
|
624
716
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
625
|
-
|
|
717
|
+
error_types = {
|
|
718
|
+
400 => Schematic::Types::ApiError,
|
|
719
|
+
401 => Schematic::Types::ApiError,
|
|
720
|
+
403 => Schematic::Types::ApiError,
|
|
721
|
+
404 => Schematic::Types::ApiError,
|
|
722
|
+
500 => Schematic::Types::ApiError
|
|
723
|
+
}
|
|
724
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
725
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
626
726
|
end
|
|
627
727
|
end
|
|
628
728
|
|
|
@@ -672,7 +772,15 @@ module Schematic
|
|
|
672
772
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::CountBillingProductMatchCompaniesResponse.load(response.body))
|
|
673
773
|
else
|
|
674
774
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
675
|
-
|
|
775
|
+
error_types = {
|
|
776
|
+
400 => Schematic::Types::ApiError,
|
|
777
|
+
401 => Schematic::Types::ApiError,
|
|
778
|
+
403 => Schematic::Types::ApiError,
|
|
779
|
+
404 => Schematic::Types::ApiError,
|
|
780
|
+
500 => Schematic::Types::ApiError
|
|
781
|
+
}
|
|
782
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
783
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
676
784
|
end
|
|
677
785
|
end
|
|
678
786
|
|
|
@@ -770,7 +878,15 @@ module Schematic
|
|
|
770
878
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::CountPlansResponse.load(response.body))
|
|
771
879
|
else
|
|
772
880
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
773
|
-
|
|
881
|
+
error_types = {
|
|
882
|
+
400 => Schematic::Types::ApiError,
|
|
883
|
+
401 => Schematic::Types::ApiError,
|
|
884
|
+
403 => Schematic::Types::ApiError,
|
|
885
|
+
404 => Schematic::Types::ApiError,
|
|
886
|
+
500 => Schematic::Types::ApiError
|
|
887
|
+
}
|
|
888
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
889
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
774
890
|
end
|
|
775
891
|
end
|
|
776
892
|
|
|
@@ -814,7 +930,15 @@ module Schematic
|
|
|
814
930
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::ListPlanIssuesResponse.load(response.body))
|
|
815
931
|
else
|
|
816
932
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
817
|
-
|
|
933
|
+
error_types = {
|
|
934
|
+
400 => Schematic::Types::ApiError,
|
|
935
|
+
401 => Schematic::Types::ApiError,
|
|
936
|
+
403 => Schematic::Types::ApiError,
|
|
937
|
+
404 => Schematic::Types::ApiError,
|
|
938
|
+
500 => Schematic::Types::ApiError
|
|
939
|
+
}
|
|
940
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
941
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
818
942
|
end
|
|
819
943
|
end
|
|
820
944
|
|
|
@@ -857,7 +981,65 @@ module Schematic
|
|
|
857
981
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::DeletePlanVersionResponse.load(response.body))
|
|
858
982
|
else
|
|
859
983
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
860
|
-
|
|
984
|
+
error_types = {
|
|
985
|
+
400 => Schematic::Types::ApiError,
|
|
986
|
+
401 => Schematic::Types::ApiError,
|
|
987
|
+
403 => Schematic::Types::ApiError,
|
|
988
|
+
404 => Schematic::Types::ApiError,
|
|
989
|
+
500 => Schematic::Types::ApiError
|
|
990
|
+
}
|
|
991
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
992
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
993
|
+
end
|
|
994
|
+
end
|
|
995
|
+
|
|
996
|
+
# @param request_options [Hash]
|
|
997
|
+
# @param params [Hash]
|
|
998
|
+
# @option request_options [String] :base_url
|
|
999
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1000
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1001
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1002
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1003
|
+
# @option params [String] :plan_version_id
|
|
1004
|
+
# @option params [String, nil] :against
|
|
1005
|
+
#
|
|
1006
|
+
# @example
|
|
1007
|
+
# client.plans.get_plan_version_diff(
|
|
1008
|
+
# plan_version_id: "plan_version_id",
|
|
1009
|
+
# against: "against"
|
|
1010
|
+
# )
|
|
1011
|
+
#
|
|
1012
|
+
# @return [Schematic::Plans::Types::GetPlanVersionDiffResponse]
|
|
1013
|
+
def get_plan_version_diff(request_options: {}, **params)
|
|
1014
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1015
|
+
query_params = {}
|
|
1016
|
+
query_params["against"] = params[:against] if params.key?(:against)
|
|
1017
|
+
|
|
1018
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1019
|
+
base_url: request_options[:base_url],
|
|
1020
|
+
method: "GET",
|
|
1021
|
+
path: "plans/version/#{URI.encode_uri_component(params[:plan_version_id].to_s)}/diff",
|
|
1022
|
+
query: query_params,
|
|
1023
|
+
request_options: request_options
|
|
1024
|
+
)
|
|
1025
|
+
begin
|
|
1026
|
+
response = @client.send(request)
|
|
1027
|
+
rescue Net::HTTPRequestTimeout
|
|
1028
|
+
raise Schematic::Errors::TimeoutError
|
|
1029
|
+
end
|
|
1030
|
+
code = response.code.to_i
|
|
1031
|
+
if code.between?(200, 299)
|
|
1032
|
+
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::GetPlanVersionDiffResponse.load(response.body))
|
|
1033
|
+
else
|
|
1034
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1035
|
+
error_types = {
|
|
1036
|
+
401 => Schematic::Types::ApiError,
|
|
1037
|
+
403 => Schematic::Types::ApiError,
|
|
1038
|
+
404 => Schematic::Types::ApiError,
|
|
1039
|
+
500 => Schematic::Types::ApiError
|
|
1040
|
+
}
|
|
1041
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1042
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
861
1043
|
end
|
|
862
1044
|
end
|
|
863
1045
|
|
|
@@ -901,7 +1083,15 @@ module Schematic
|
|
|
901
1083
|
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::PublishPlanVersionResponse.load(response.body))
|
|
902
1084
|
else
|
|
903
1085
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
904
|
-
|
|
1086
|
+
error_types = {
|
|
1087
|
+
400 => Schematic::Types::ApiError,
|
|
1088
|
+
401 => Schematic::Types::ApiError,
|
|
1089
|
+
403 => Schematic::Types::ApiError,
|
|
1090
|
+
404 => Schematic::Types::ApiError,
|
|
1091
|
+
500 => Schematic::Types::ApiError
|
|
1092
|
+
}
|
|
1093
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1094
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
905
1095
|
end
|
|
906
1096
|
end
|
|
907
1097
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Plans
|
|
5
|
+
module Types
|
|
6
|
+
class GetPlanVersionDiffRequest < Internal::Types::Model
|
|
7
|
+
field :plan_version_id, -> { String }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :against, -> { String }, optional: true, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Plans
|
|
5
|
+
module Types
|
|
6
|
+
class GetPlanVersionDiffResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::PlanVersionDiffResponseData }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :params, -> { Schematic::Plans::Types::GetPlanVersionDiffParams }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -14,6 +14,8 @@ module Schematic
|
|
|
14
14
|
|
|
15
15
|
field :billing_start_date, -> { String }, optional: true, nullable: false
|
|
16
16
|
|
|
17
|
+
field :collection_method, -> { Schematic::Types::BillingCollectionMethod }, optional: true, nullable: false
|
|
18
|
+
|
|
17
19
|
field :coupon_external_id, -> { String }, optional: true, nullable: false
|
|
18
20
|
|
|
19
21
|
field :custom_field_values, -> { Internal::Types::Array[Schematic::Types::CheckoutFieldValue] }, optional: true, nullable: false
|
|
@@ -82,8 +82,20 @@ module Schematic
|
|
|
82
82
|
# "would this call still be allowed after it lands".
|
|
83
83
|
#
|
|
84
84
|
# options is a hash with any of :credit_cost (credit id to cost),
|
|
85
|
-
# :usage,
|
|
86
|
-
#
|
|
85
|
+
# :usage, :event_usage ({ event_subtype:, quantity: }), and
|
|
86
|
+
# :event_quantities ({ event_subtype:, quantity:, quantities: }). The engine
|
|
87
|
+
# reads them snake_case in both directions, so they go on the envelope as
|
|
88
|
+
# given.
|
|
89
|
+
#
|
|
90
|
+
# event_quantities prices an event against credit-balance conditions whose
|
|
91
|
+
# event_subtype matches, the way the API burns it: quantity times the
|
|
92
|
+
# condition's consumption_rate, plus each named quantity times its rate in
|
|
93
|
+
# the condition's quantity_rates. For an inference call, quantity is the
|
|
94
|
+
# request count and quantities the token counts as the event reports them
|
|
95
|
+
# (input tokens including the cached and cache-creation subsets). Keys
|
|
96
|
+
# without a rate cost nothing; an absent or zero quantity means one. It
|
|
97
|
+
# ranks below credit_cost and above event_usage and usage, and the engine
|
|
98
|
+
# reads its values as floats, so unlike event_usage they are not rounded.
|
|
87
99
|
def check_flag_with_options(flag, company = nil, user = nil, options = nil)
|
|
88
100
|
raise "WASM rules engine not initialized" unless @initialized
|
|
89
101
|
|
|
@@ -56,7 +56,15 @@ module Schematic
|
|
|
56
56
|
(response.body.to_s.empty? ? nil : Schematic::Scheduledcheckout::Types::ListScheduledCheckoutsResponse.load(response.body))
|
|
57
57
|
else
|
|
58
58
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
59
|
-
|
|
59
|
+
error_types = {
|
|
60
|
+
400 => Schematic::Types::ApiError,
|
|
61
|
+
401 => Schematic::Types::ApiError,
|
|
62
|
+
403 => Schematic::Types::ApiError,
|
|
63
|
+
404 => Schematic::Types::ApiError,
|
|
64
|
+
500 => Schematic::Types::ApiError
|
|
65
|
+
}
|
|
66
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
67
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
60
68
|
end
|
|
61
69
|
end
|
|
62
70
|
|
|
@@ -96,7 +104,15 @@ module Schematic
|
|
|
96
104
|
(response.body.to_s.empty? ? nil : Schematic::Scheduledcheckout::Types::CreateScheduledCheckoutResponse.load(response.body))
|
|
97
105
|
else
|
|
98
106
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
99
|
-
|
|
107
|
+
error_types = {
|
|
108
|
+
400 => Schematic::Types::ApiError,
|
|
109
|
+
401 => Schematic::Types::ApiError,
|
|
110
|
+
403 => Schematic::Types::ApiError,
|
|
111
|
+
404 => Schematic::Types::ApiError,
|
|
112
|
+
500 => Schematic::Types::ApiError
|
|
113
|
+
}
|
|
114
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
115
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
100
116
|
end
|
|
101
117
|
end
|
|
102
118
|
|
|
@@ -131,7 +147,14 @@ module Schematic
|
|
|
131
147
|
(response.body.to_s.empty? ? nil : Schematic::Scheduledcheckout::Types::GetScheduledCheckoutResponse.load(response.body))
|
|
132
148
|
else
|
|
133
149
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
134
|
-
|
|
150
|
+
error_types = {
|
|
151
|
+
401 => Schematic::Types::ApiError,
|
|
152
|
+
403 => Schematic::Types::ApiError,
|
|
153
|
+
404 => Schematic::Types::ApiError,
|
|
154
|
+
500 => Schematic::Types::ApiError
|
|
155
|
+
}
|
|
156
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
157
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
135
158
|
end
|
|
136
159
|
end
|
|
137
160
|
|
|
@@ -171,7 +194,15 @@ module Schematic
|
|
|
171
194
|
(response.body.to_s.empty? ? nil : Schematic::Scheduledcheckout::Types::UpdateScheduledCheckoutResponse.load(response.body))
|
|
172
195
|
else
|
|
173
196
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
174
|
-
|
|
197
|
+
error_types = {
|
|
198
|
+
400 => Schematic::Types::ApiError,
|
|
199
|
+
401 => Schematic::Types::ApiError,
|
|
200
|
+
403 => Schematic::Types::ApiError,
|
|
201
|
+
404 => Schematic::Types::ApiError,
|
|
202
|
+
500 => Schematic::Types::ApiError
|
|
203
|
+
}
|
|
204
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
205
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
175
206
|
end
|
|
176
207
|
end
|
|
177
208
|
end
|
|
@@ -175,9 +175,8 @@ module Schematic
|
|
|
175
175
|
|
|
176
176
|
# default_value overrides the registered flag default on every path that
|
|
177
177
|
# cannot answer from the flag itself: offline, an API error, or a response
|
|
178
|
-
# with no value. Leaving it nil keeps the registered default. timeout_ms
|
|
179
|
-
#
|
|
180
|
-
# transport does not yet apply a per-request timeout.
|
|
178
|
+
# with no value. Leaving it nil keeps the registered default. timeout_ms
|
|
179
|
+
# bounds each attempt of the API call.
|
|
181
180
|
def check_flag_with_entitlement(flag_key, company: nil, user: nil, preflight: nil, default_value: nil,
|
|
182
181
|
timeout_ms: nil)
|
|
183
182
|
get_default = -> { resolve_default_value(flag_key, default_value) }
|
|
@@ -345,10 +344,9 @@ module Schematic
|
|
|
345
344
|
# governs that fallback too, so a check that cannot reach the credit path
|
|
346
345
|
# still answers the way the caller asked.
|
|
347
346
|
#
|
|
348
|
-
# timeout_ms
|
|
349
|
-
#
|
|
350
|
-
#
|
|
351
|
-
# is configurable today.
|
|
347
|
+
# timeout_ms bounds each attempt of the API calls the check makes (the
|
|
348
|
+
# plain flag check, check-and-reserve, or a lease acquire or extend), and
|
|
349
|
+
# caps how long the check waits on another caller's acquire or extend.
|
|
352
350
|
def check(flag_key, company: nil, user: nil, usage: nil, event_subtype: nil, on_acquire_failure: nil,
|
|
353
351
|
default_value: nil, timeout_ms: nil)
|
|
354
352
|
options = {
|
|
@@ -657,6 +655,20 @@ module Schematic
|
|
|
657
655
|
# Cache providers that serialize (RedisCacheProvider) hand back a Hash, not
|
|
658
656
|
# the CheckFlagResponse that was stored; the in-memory cache returns the
|
|
659
657
|
# object itself. Normalize so callers can use the response API either way.
|
|
658
|
+
# The REST preflight body has no event_quantities yet; only the local
|
|
659
|
+
# engine applies it. Sending it would ask the API a question it cannot
|
|
660
|
+
# read, so it comes off here, and the check answers without it. A preflight
|
|
661
|
+
# left empty becomes nil, so the check is a plain, cacheable one.
|
|
662
|
+
def rest_preflight(flag_key, preflight)
|
|
663
|
+
return preflight unless preflight.is_a?(Hash)
|
|
664
|
+
return preflight unless preflight.key?(:event_quantities) || preflight.key?("event_quantities")
|
|
665
|
+
|
|
666
|
+
@logger.warn("Preflight event_quantities for flag '#{flag_key}' is only applied by local evaluation; " \
|
|
667
|
+
"the API check ignores it, so the check answers without it")
|
|
668
|
+
rest = preflight.reject { |key, _| key.to_s == "event_quantities" }
|
|
669
|
+
rest.empty? ? nil : rest
|
|
670
|
+
end
|
|
671
|
+
|
|
660
672
|
def coerce_cached_response(cached)
|
|
661
673
|
return cached unless cached.is_a?(Hash)
|
|
662
674
|
|
|
@@ -665,6 +677,7 @@ module Schematic
|
|
|
665
677
|
|
|
666
678
|
def check_flag_via_api(flag_key, company, user, preflight: nil, timeout_ms: nil, get_default: nil)
|
|
667
679
|
get_default ||= -> { get_flag_default(flag_key) }
|
|
680
|
+
preflight = rest_preflight(flag_key, preflight)
|
|
668
681
|
cache_key = build_cache_key(flag_key, company, user)
|
|
669
682
|
# The cache is keyed by flag, company and user, so a preflighted check and
|
|
670
683
|
# a plain one collide on one entry while asking different questions ("is
|
|
@@ -736,10 +749,8 @@ module Schematic
|
|
|
736
749
|
end
|
|
737
750
|
end
|
|
738
751
|
|
|
739
|
-
# The generated transport reads
|
|
740
|
-
#
|
|
741
|
-
# Sending it anyway means a per-check timeout starts working the moment the
|
|
742
|
-
# transport does, without another change here.
|
|
752
|
+
# The generated transport reads timeout_in_seconds per request, falling
|
|
753
|
+
# back to its client-wide timeout when the key is absent.
|
|
743
754
|
def api_request_options(timeout_ms)
|
|
744
755
|
return {} if timeout_ms.nil?
|
|
745
756
|
|
|
@@ -7,7 +7,7 @@ module Schematic
|
|
|
7
7
|
|
|
8
8
|
field :amount_off, -> { Integer }, optional: true, nullable: false
|
|
9
9
|
|
|
10
|
-
field :currency, -> {
|
|
10
|
+
field :currency, -> { Schematic::Types::Currency }, optional: true, nullable: false
|
|
11
11
|
|
|
12
12
|
field :duration, -> { String }, optional: true, nullable: false
|
|
13
13
|
|
|
@@ -27,7 +27,7 @@ module Schematic
|
|
|
27
27
|
|
|
28
28
|
field :name, -> { String }, optional: false, nullable: false
|
|
29
29
|
|
|
30
|
-
field :percent_off, -> {
|
|
30
|
+
field :percent_off, -> { Float }, optional: true, nullable: false
|
|
31
31
|
|
|
32
32
|
field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: false, nullable: false
|
|
33
33
|
|
|
@@ -19,7 +19,7 @@ module Schematic
|
|
|
19
19
|
|
|
20
20
|
field :credit_name, -> { String }, optional: false, nullable: false
|
|
21
21
|
|
|
22
|
-
field :currency, -> {
|
|
22
|
+
field :currency, -> { Schematic::Types::Currency }, optional: true, nullable: false
|
|
23
23
|
|
|
24
24
|
field :expires_at, -> { String }, optional: true, nullable: false
|
|
25
25
|
|
|
@@ -35,25 +35,25 @@ module Schematic
|
|
|
35
35
|
|
|
36
36
|
field :postpaid_charge_amount, -> { Integer }, optional: true, nullable: false
|
|
37
37
|
|
|
38
|
-
field :postpaid_charge_currency, -> {
|
|
38
|
+
field :postpaid_charge_currency, -> { Schematic::Types::Currency }, optional: true, nullable: false
|
|
39
39
|
|
|
40
|
-
field :postpaid_charged_credits, -> {
|
|
40
|
+
field :postpaid_charged_credits, -> { Float }, optional: true, nullable: false
|
|
41
41
|
|
|
42
42
|
field :price, -> { Schematic::Types::BillingPriceResponseData }, optional: true, nullable: false
|
|
43
43
|
|
|
44
|
-
field :quantity, -> {
|
|
44
|
+
field :quantity, -> { Float }, optional: false, nullable: false
|
|
45
45
|
|
|
46
|
-
field :quantity_remaining, -> {
|
|
46
|
+
field :quantity_remaining, -> { Float }, optional: false, nullable: false
|
|
47
47
|
|
|
48
|
-
field :quantity_used, -> {
|
|
48
|
+
field :quantity_used, -> { Float }, optional: false, nullable: false
|
|
49
49
|
|
|
50
50
|
field :renewal_enabled, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
51
51
|
|
|
52
52
|
field :renewal_period, -> { Schematic::Types::BillingPlanCreditGrantResetCadence }, optional: true, nullable: false
|
|
53
53
|
|
|
54
|
-
field :reserved, -> {
|
|
54
|
+
field :reserved, -> { Float }, optional: true, nullable: false
|
|
55
55
|
|
|
56
|
-
field :settled, -> {
|
|
56
|
+
field :settled, -> { Float }, optional: true, nullable: false
|
|
57
57
|
|
|
58
58
|
field :source_grant_id, -> { String }, optional: true, nullable: false
|
|
59
59
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Schematic
|
|
4
4
|
module Types
|
|
5
5
|
class BillingCustomerSubscription < Internal::Types::Model
|
|
6
|
-
field :currency, -> {
|
|
6
|
+
field :currency, -> { Schematic::Types::Currency }, optional: false, nullable: false
|
|
7
7
|
|
|
8
8
|
field :expired_at, -> { String }, optional: true, nullable: false
|
|
9
9
|
|
|
@@ -57,7 +57,7 @@ module Schematic
|
|
|
57
57
|
|
|
58
58
|
field :license_id, -> { String }, optional: true, nullable: false
|
|
59
59
|
|
|
60
|
-
field :overdraft_limit, -> {
|
|
60
|
+
field :overdraft_limit, -> { Float }, optional: true, nullable: false
|
|
61
61
|
|
|
62
62
|
field :plan, -> { Schematic::Types::PreviewObjectResponseData }, optional: true, nullable: false
|
|
63
63
|
|