schematichq 1.5.2 → 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 +14 -338
- data/.fernignore +8 -0
- data/.rubocop.yml +4 -0
- data/README.md +141 -0
- data/WASM_VERSION +1 -1
- data/custom.gemspec.rb +6 -0
- data/lib/schematic/accesstokens/client.rb +9 -1
- data/lib/schematic/accounts/client.rb +183 -21
- data/lib/schematic/accounts/types/update_environment_request_body.rb +2 -0
- 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 +458 -46
- data/lib/schematic/credits/leases/check.rb +477 -0
- data/lib/schematic/credits/leases/lease_manager.rb +565 -0
- data/lib/schematic/credits/leases/lease_store.rb +240 -0
- data/lib/schematic/credits/leases/redis_lease_store.rb +358 -0
- data/lib/schematic/credits/leases/redis_reservation_store.rb +326 -0
- data/lib/schematic/credits/leases/reservation_store.rb +161 -0
- data/lib/schematic/credits/leases/server_check.rb +237 -0
- data/lib/schematic/credits/leases/track.rb +66 -0
- data/lib/schematic/credits/leases/types.rb +329 -0
- data/lib/schematic/credits/leases/wire_client.rb +83 -0
- data/lib/schematic/credits/types/acquire_credit_lease_request_body.rb +3 -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 +5 -1
- data/lib/schematic/credits/types/extend_credit_lease_request_body.rb +3 -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/get_credit_spend_policy_usage_params.rb +16 -0
- data/lib/schematic/credits/types/get_credit_spend_policy_usage_request.rb +15 -0
- data/lib/schematic/credits/types/get_credit_spend_policy_usage_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 +5 -1
- data/lib/schematic/dataexports/client.rb +36 -6
- data/lib/schematic/datastream/client.rb +32 -2
- data/lib/schematic/entitlements/client.rb +406 -25
- data/lib/schematic/entitlements/types/count_company_user_usage_params.rb +24 -0
- data/lib/schematic/entitlements/types/count_company_user_usage_request.rb +23 -0
- data/lib/schematic/entitlements/types/count_company_user_usage_response.rb +13 -0
- 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/get_company_user_usage_metrics_params.rb +16 -0
- data/lib/schematic/entitlements/types/get_company_user_usage_metrics_request.rb +15 -0
- data/lib/schematic/entitlements/types/get_company_user_usage_metrics_response.rb +13 -0
- data/lib/schematic/entitlements/types/list_company_user_usage_params.rb +24 -0
- data/lib/schematic/entitlements/types/list_company_user_usage_request.rb +23 -0
- data/lib/schematic/entitlements/types/list_company_user_usage_response.rb +13 -0
- 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 +28 -3
- data/lib/schematic/plangroups/types/create_plan_group_request_body.rb +2 -0
- data/lib/schematic/plangroups/types/update_plan_group_request_body.rb +2 -0
- data/lib/schematic/planmigrations/client.rb +104 -11
- data/lib/schematic/planmigrations/types/count_migrations_params.rb +2 -0
- data/lib/schematic/planmigrations/types/count_migrations_request.rb +2 -0
- data/lib/schematic/planmigrations/types/create_migration_input.rb +2 -0
- data/lib/schematic/planmigrations/types/list_migrations_params.rb +2 -0
- data/lib/schematic/planmigrations/types/list_migrations_request.rb +2 -0
- 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 +6 -0
- data/lib/schematic/plans/types/retry_custom_plan_billing_request_body.rb +2 -0
- data/lib/schematic/rules_engine.rb +49 -0
- data/lib/schematic/scheduledcheckout/client.rb +35 -4
- data/lib/schematic/schematic_client.rb +841 -33
- 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/capture_raw_event.rb +4 -0
- 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/check_flags_response_data.rb +2 -0
- 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 +3 -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 +4 -0
- data/lib/schematic/types/company_subscription_response_data.rb +1 -1
- data/lib/schematic/types/company_user_usage_metrics_response_data.rb +15 -0
- data/lib/schematic/types/company_user_usage_response_data.rb +19 -0
- data/lib/schematic/types/company_user_usage_row_response_data.rb +17 -0
- data/lib/schematic/types/component_display_settings.rb +2 -0
- data/lib/schematic/types/component_response_data.rb +1 -1
- data/lib/schematic/types/component_settings_response_data.rb +2 -0
- 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 +14 -6
- data/lib/schematic/types/credit_event_type.rb +3 -0
- 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_ledger_entry_kind.rb +17 -0
- data/lib/schematic/types/credit_reservation_response_data.rb +2 -2
- data/lib/schematic/types/credit_spend_policy.rb +25 -0
- data/lib/schematic/types/credit_spend_policy_response_data.rb +13 -1
- data/lib/schematic/types/credit_spend_window.rb +11 -0
- data/lib/schematic/types/credit_spend_window_unit.rb +13 -0
- 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 +8 -0
- data/lib/schematic/types/entitlement_currency_prices_response_data.rb +1 -1
- data/lib/schematic/types/environment_detail_response_data.rb +2 -0
- data/lib/schematic/types/environment_response_data.rb +2 -0
- data/lib/schematic/types/estimated_plan_total.rb +13 -0
- 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/pending_migration_response_data.rb +6 -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_migration_response_data.rb +2 -0
- data/lib/schematic/types/plan_version_migration_strategy.rb +1 -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/rules_engine_schema_version.rb +1 -1
- data/lib/schematic/types/rulesengine_company.rb +3 -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 +25 -0
- data/lib/schematic/types/rulesengine_credit_spend_policy_scope.rb +13 -0
- data/lib/schematic/types/rulesengine_credit_spend_window.rb +11 -0
- data/lib/schematic/types/rulesengine_feature_entitlement.rb +8 -6
- data/lib/schematic/types/rulesengine_user.rb +2 -0
- 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/types/user_usage_metric.rb +12 -0
- 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 +64 -5
- data/lib/schematichq.rb +10 -0
- data/reference.md +888 -127
- metadata +71 -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
|
|
@@ -12,6 +12,10 @@ module Schematic
|
|
|
12
12
|
|
|
13
13
|
field :billing_cycle_anchor, -> { String }, optional: true, nullable: false
|
|
14
14
|
|
|
15
|
+
field :billing_start_date, -> { String }, optional: true, nullable: false
|
|
16
|
+
|
|
17
|
+
field :collection_method, -> { Schematic::Types::BillingCollectionMethod }, optional: true, nullable: false
|
|
18
|
+
|
|
15
19
|
field :coupon_external_id, -> { String }, optional: true, nullable: false
|
|
16
20
|
|
|
17
21
|
field :custom_field_values, -> { Internal::Types::Array[Schematic::Types::CheckoutFieldValue] }, optional: true, nullable: false
|
|
@@ -32,6 +36,8 @@ module Schematic
|
|
|
32
36
|
|
|
33
37
|
field :require_no_migration, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
34
38
|
|
|
39
|
+
field :scheduled_at, -> { String }, optional: true, nullable: false
|
|
40
|
+
|
|
35
41
|
field :send_invoice, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
36
42
|
|
|
37
43
|
field :tax_id, -> { Schematic::Types::TaxIdInput }, optional: true, nullable: false
|
|
@@ -10,6 +10,8 @@ module Schematic
|
|
|
10
10
|
|
|
11
11
|
field :billing_cycle_anchor, -> { String }, optional: true, nullable: false
|
|
12
12
|
|
|
13
|
+
field :billing_start_date, -> { String }, optional: true, nullable: false
|
|
14
|
+
|
|
13
15
|
field :customer_email, -> { String }, optional: false, nullable: false
|
|
14
16
|
|
|
15
17
|
field :days_until_due, -> { Integer }, optional: true, nullable: false
|
|
@@ -73,12 +73,38 @@ module Schematic
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def check_flag(flag, company = nil, user = nil)
|
|
76
|
+
check_flag_with_options(flag, company, user, nil)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Evaluate a flag with preflight options: a simulated usage, an event-scoped
|
|
80
|
+
# usage, or a pre-computed per-credit cost. The engine applies them to the
|
|
81
|
+
# conditions they match without mutating any state, so a caller can ask
|
|
82
|
+
# "would this call still be allowed after it lands".
|
|
83
|
+
#
|
|
84
|
+
# options is a hash with any of :credit_cost (credit id to cost),
|
|
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.
|
|
99
|
+
def check_flag_with_options(flag, company = nil, user = nil, options = nil)
|
|
76
100
|
raise "WASM rules engine not initialized" unless @initialized
|
|
77
101
|
|
|
78
102
|
# Build combined JSON envelope (same format as Python/C#)
|
|
79
103
|
envelope = { flag: strip_nulls(flag) }
|
|
80
104
|
envelope[:company] = strip_nulls(company) if company
|
|
81
105
|
envelope[:user] = strip_nulls(user) if user
|
|
106
|
+
# Omitted entirely when empty, so the engine uses its own defaults.
|
|
107
|
+
envelope[:options] = strip_nulls(engine_options(options)) if options && !options.empty?
|
|
82
108
|
|
|
83
109
|
json_bytes = JSON.generate(envelope).encode("UTF-8")
|
|
84
110
|
|
|
@@ -123,6 +149,29 @@ module Schematic
|
|
|
123
149
|
|
|
124
150
|
private
|
|
125
151
|
|
|
152
|
+
# The options as the engine takes them. usage and event_usage.quantity
|
|
153
|
+
# deserialize as i64 there, so a value with a decimal point fails the whole
|
|
154
|
+
# check. Rounded through the helper every other wire field uses, so a caller
|
|
155
|
+
# passing a preflight straight to check_flag_with_entitlement is asked the
|
|
156
|
+
# same question a lease check asks, and an infinite usage is handed over
|
|
157
|
+
# rather than raising out of ceil.
|
|
158
|
+
def engine_options(options)
|
|
159
|
+
out = options.dup
|
|
160
|
+
usage_key = out.key?(:usage) ? :usage : "usage"
|
|
161
|
+
out[usage_key] = Credits::Leases.wire_quantity(out[usage_key]) if out[usage_key].is_a?(Numeric)
|
|
162
|
+
event_key = out.key?(:event_usage) ? :event_usage : "event_usage"
|
|
163
|
+
event_usage = out[event_key]
|
|
164
|
+
return out unless event_usage.is_a?(Hash)
|
|
165
|
+
|
|
166
|
+
quantity_key = event_usage.key?(:quantity) ? :quantity : "quantity"
|
|
167
|
+
return out unless event_usage[quantity_key].is_a?(Numeric)
|
|
168
|
+
|
|
169
|
+
out[event_key] = event_usage.merge(
|
|
170
|
+
quantity_key => Credits::Leases.wire_quantity(event_usage[quantity_key])
|
|
171
|
+
)
|
|
172
|
+
out
|
|
173
|
+
end
|
|
174
|
+
|
|
126
175
|
def export_func(name)
|
|
127
176
|
exp = @instance.export(name)
|
|
128
177
|
raise "WASM export '#{name}' not found" unless exp
|
|
@@ -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
|