From 08fae468cede34277d8e33d33c9775cb29df5d94 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Sat, 5 Sep 2026 06:36:56 +0000 Subject: [PATCH 1/2] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-ruby-sdk: 1.24.0 --- .fern/metadata.json | 8 +- lib/schematic.rb | 44 +- .../update_onboarding_state_request_body.rb | 2 + lib/schematic/billing/client.rb | 96 ++ .../list_company_billing_profiles_params.rb | 20 + .../list_company_billing_profiles_request.rb | 19 + .../list_company_billing_profiles_response.rb | 13 + ...te_company_billing_profile_request_body.rb | 23 + ...update_company_billing_profile_response.rb | 13 + lib/schematic/client.rb | 2 +- lib/schematic/credits/client.rb | 266 ++++ .../count_credit_spend_policies_params.rb | 24 + .../count_credit_spend_policies_request.rb | 23 + .../count_credit_spend_policies_response.rb | 13 + ...create_credit_spend_policy_request_body.rb | 19 + .../create_credit_spend_policy_response.rb | 13 + .../delete_credit_spend_policy_response.rb | 13 + .../types/get_credit_spend_policy_response.rb | 13 + .../list_credit_spend_policies_params.rb | 24 + .../list_credit_spend_policies_request.rb | 23 + .../list_credit_spend_policies_response.rb | 13 + ...update_credit_spend_policy_request_body.rb | 15 + .../update_credit_spend_policy_response.rb | 13 + lib/schematic/events/client.rb | 101 ++ ...lete_otlp_environment_settings_response.rb | 13 + .../get_otlp_environment_settings_response.rb | 13 + ..._otlp_environment_settings_request_body.rb | 19 + ...sert_otlp_environment_settings_response.rb | 13 + lib/schematic/integrationsapi/client.rb | 169 +++ .../claim_stripe_sandbox_keys_request_body.rb | 11 + .../claim_stripe_sandbox_keys_response.rb | 13 + .../get_stripe_sandbox_claim_link_response.rb | 13 + .../types/get_stripe_sandbox_keys_response.rb | 13 + ...stall_stripe_claimable_sandbox_response.rb | 13 + .../install_stripe_sandbox_request_body.rb | 17 + .../list_stripe_sandbox_countries_response.rb | 13 + ...aimed_stripe_sandbox_keys_response_data.rb | 13 + .../company_billing_profile_response_data.rb | 35 + .../types/company_detail_response_data.rb | 4 + .../types/company_override_response_data.rb | 4 + .../credit_spend_policy_response_data.rb | 25 + .../types/credit_spend_policy_scope.rb | 13 + lib/schematic/types/event_body_inference.rb | 2 + .../types/get_onboarding_state_resp.rb | 2 + ...otlp_environment_settings_response_data.rb | 23 + .../rule_condition_detail_response_data.rb | 2 + ...le_condition_plan_version_response_data.rb | 15 + .../types/stripe_integration_config.rb | 6 + .../types/stripe_sandbox_claim_link.rb | 15 + .../stripe_sandbox_countries_response_data.rb | 9 + .../stripe_sandbox_install_response_data.rb | 21 + .../stripe_sandbox_keys_response_data.rb | 13 + lib/schematic/version.rb | 2 +- reference.md | 1172 ++++++++++++++++- test/rules_engine_clock_test.rb | 75 -- 55 files changed, 2436 insertions(+), 148 deletions(-) create mode 100644 lib/schematic/billing/types/list_company_billing_profiles_params.rb create mode 100644 lib/schematic/billing/types/list_company_billing_profiles_request.rb create mode 100644 lib/schematic/billing/types/list_company_billing_profiles_response.rb create mode 100644 lib/schematic/billing/types/update_company_billing_profile_request_body.rb create mode 100644 lib/schematic/billing/types/update_company_billing_profile_response.rb create mode 100644 lib/schematic/credits/types/count_credit_spend_policies_params.rb create mode 100644 lib/schematic/credits/types/count_credit_spend_policies_request.rb create mode 100644 lib/schematic/credits/types/count_credit_spend_policies_response.rb create mode 100644 lib/schematic/credits/types/create_credit_spend_policy_request_body.rb create mode 100644 lib/schematic/credits/types/create_credit_spend_policy_response.rb create mode 100644 lib/schematic/credits/types/delete_credit_spend_policy_response.rb create mode 100644 lib/schematic/credits/types/get_credit_spend_policy_response.rb create mode 100644 lib/schematic/credits/types/list_credit_spend_policies_params.rb create mode 100644 lib/schematic/credits/types/list_credit_spend_policies_request.rb create mode 100644 lib/schematic/credits/types/list_credit_spend_policies_response.rb create mode 100644 lib/schematic/credits/types/update_credit_spend_policy_request_body.rb create mode 100644 lib/schematic/credits/types/update_credit_spend_policy_response.rb create mode 100644 lib/schematic/events/types/delete_otlp_environment_settings_response.rb create mode 100644 lib/schematic/events/types/get_otlp_environment_settings_response.rb create mode 100644 lib/schematic/events/types/upsert_otlp_environment_settings_request_body.rb create mode 100644 lib/schematic/events/types/upsert_otlp_environment_settings_response.rb create mode 100644 lib/schematic/integrationsapi/types/claim_stripe_sandbox_keys_request_body.rb create mode 100644 lib/schematic/integrationsapi/types/claim_stripe_sandbox_keys_response.rb create mode 100644 lib/schematic/integrationsapi/types/get_stripe_sandbox_claim_link_response.rb create mode 100644 lib/schematic/integrationsapi/types/get_stripe_sandbox_keys_response.rb create mode 100644 lib/schematic/integrationsapi/types/install_stripe_claimable_sandbox_response.rb create mode 100644 lib/schematic/integrationsapi/types/install_stripe_sandbox_request_body.rb create mode 100644 lib/schematic/integrationsapi/types/list_stripe_sandbox_countries_response.rb create mode 100644 lib/schematic/types/claimed_stripe_sandbox_keys_response_data.rb create mode 100644 lib/schematic/types/company_billing_profile_response_data.rb create mode 100644 lib/schematic/types/credit_spend_policy_response_data.rb create mode 100644 lib/schematic/types/credit_spend_policy_scope.rb create mode 100644 lib/schematic/types/otlp_environment_settings_response_data.rb create mode 100644 lib/schematic/types/rule_condition_plan_version_response_data.rb create mode 100644 lib/schematic/types/stripe_sandbox_claim_link.rb create mode 100644 lib/schematic/types/stripe_sandbox_countries_response_data.rb create mode 100644 lib/schematic/types/stripe_sandbox_install_response_data.rb create mode 100644 lib/schematic/types/stripe_sandbox_keys_response_data.rb delete mode 100644 test/rules_engine_clock_test.rb diff --git a/.fern/metadata.json b/.fern/metadata.json index 4080e00..7d28442 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { "cliVersion": "5.50.0", "generatorName": "fernapi/fern-ruby-sdk", - "generatorVersion": "1.23.2", + "generatorVersion": "1.24.0", "generatorConfig": { "module": "SchematicHQ", "rubocopVariableNumberStyle": "disabled", @@ -13,10 +13,10 @@ "webrick": ">= 1.0" } }, - "originGitCommit": "686551a0297d2f37075b3586b030ff32be5c94f7", + "originGitCommit": "31f498c0a9babdc0eec5ae88e1212a254b2f2561", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "1.4.16", + "requestedVersion": "1.4.17", "ciProvider": "github", - "sdkVersion": "1.4.16" + "sdkVersion": "1.4.17" } \ No newline at end of file diff --git a/lib/schematic.rb b/lib/schematic.rb index f576285..c8ad50b 100644 --- a/lib/schematic.rb +++ b/lib/schematic.rb @@ -142,6 +142,12 @@ require_relative "schematic/billing/types/list_billing_products_response" require_relative "schematic/billing/types/count_billing_products_params" require_relative "schematic/billing/types/count_billing_products_response" +require_relative "schematic/billing/types/list_company_billing_profiles_params" +require_relative "schematic/types/billing_collection_method" +require_relative "schematic/types/proration_behavior" +require_relative "schematic/types/company_billing_profile_response_data" +require_relative "schematic/billing/types/list_company_billing_profiles_response" +require_relative "schematic/billing/types/update_company_billing_profile_response" require_relative "schematic/types/billing_subscription_trial_end_setting" require_relative "schematic/types/billing_subscription_response_data" require_relative "schematic/billing/types/upsert_billing_subscription_response" @@ -210,6 +216,16 @@ require_relative "schematic/credits/types/delete_billing_plan_credit_grant_response" require_relative "schematic/credits/types/count_billing_plan_credit_grants_params" require_relative "schematic/credits/types/count_billing_plan_credit_grants_response" +require_relative "schematic/types/credit_spend_policy_scope" +require_relative "schematic/credits/types/list_credit_spend_policies_params" +require_relative "schematic/types/credit_spend_policy_response_data" +require_relative "schematic/credits/types/list_credit_spend_policies_response" +require_relative "schematic/credits/types/create_credit_spend_policy_response" +require_relative "schematic/credits/types/get_credit_spend_policy_response" +require_relative "schematic/credits/types/update_credit_spend_policy_response" +require_relative "schematic/credits/types/delete_credit_spend_policy_response" +require_relative "schematic/credits/types/count_credit_spend_policies_params" +require_relative "schematic/credits/types/count_credit_spend_policies_response" require_relative "schematic/types/credit_event_type" require_relative "schematic/credits/types/list_credit_event_ledger_params" require_relative "schematic/types/billing_credit_ledger_response_data" @@ -249,6 +265,8 @@ require_relative "schematic/types/flag_type" require_relative "schematic/types/metric_period" require_relative "schematic/types/metric_period_month_reset" +require_relative "schematic/types/plan_version_status" +require_relative "schematic/types/rule_condition_plan_version_response_data" require_relative "schematic/types/rule_condition_detail_response_data" require_relative "schematic/types/rule_condition_group_detail_response_data" require_relative "schematic/types/rule_type" @@ -264,7 +282,6 @@ require_relative "schematic/types/warning_tier_response_data" require_relative "schematic/types/plan_entitlement_response_data" require_relative "schematic/types/plan_price_cadence" -require_relative "schematic/types/plan_version_status" require_relative "schematic/types/plan_version_response_data" require_relative "schematic/types/plan_group_plan_detail_response_data" require_relative "schematic/types/catalog_configuration_response_data" @@ -532,7 +549,6 @@ require_relative "schematic/types/company_plan_detail_response_data" require_relative "schematic/types/compatible_plans" require_relative "schematic/types/component_capabilities" -require_relative "schematic/types/proration_behavior" require_relative "schematic/types/component_checkout_settings" require_relative "schematic/types/component_display_settings" require_relative "schematic/types/credit_transfer_view" @@ -572,6 +588,10 @@ require_relative "schematic/events/types/list_events_response" require_relative "schematic/events/types/create_event_response" require_relative "schematic/events/types/get_event_response" +require_relative "schematic/types/otlp_environment_settings_response_data" +require_relative "schematic/events/types/get_otlp_environment_settings_response" +require_relative "schematic/events/types/upsert_otlp_environment_settings_response" +require_relative "schematic/events/types/delete_otlp_environment_settings_response" require_relative "schematic/types/segment_status_resp" require_relative "schematic/events/types/get_segment_integration_status_response" require_relative "schematic/features/types/list_features_params" @@ -645,8 +665,18 @@ require_relative "schematic/integrationsapi/types/start_data_import_response" require_relative "schematic/types/integrations_data_set_response_data" require_relative "schematic/integrationsapi/types/load_sample_data_set_response" +require_relative "schematic/types/stripe_sandbox_claim_link" +require_relative "schematic/integrationsapi/types/get_stripe_sandbox_claim_link_response" +require_relative "schematic/types/claimed_stripe_sandbox_keys_response_data" +require_relative "schematic/integrationsapi/types/get_stripe_sandbox_keys_response" +require_relative "schematic/integrationsapi/types/claim_stripe_sandbox_keys_response" require_relative "schematic/integrationsapi/types/assume_stripe_installed_response" require_relative "schematic/integrationsapi/types/install_stripe_response" +require_relative "schematic/types/stripe_sandbox_keys_response_data" +require_relative "schematic/types/stripe_sandbox_install_response_data" +require_relative "schematic/integrationsapi/types/install_stripe_claimable_sandbox_response" +require_relative "schematic/types/stripe_sandbox_countries_response_data" +require_relative "schematic/integrationsapi/types/list_stripe_sandbox_countries_response" require_relative "schematic/integrationsapi/types/uninstall_integration_response" require_relative "schematic/licenses/types/list_licenses_params" require_relative "schematic/types/license_response_data" @@ -729,7 +759,6 @@ require_relative "schematic/webhooks/types/count_webhooks_params" require_relative "schematic/webhooks/types/count_webhooks_response" require_relative "schematic/types/api_error" -require_relative "schematic/types/billing_collection_method" require_relative "schematic/types/billing_product_pricing" require_relative "schematic/types/billing_subscription_discount" require_relative "schematic/types/capture_raw_event" @@ -887,6 +916,8 @@ require_relative "schematic/billing/types/create_billing_product_request_body" require_relative "schematic/billing/types/list_billing_products_request" require_relative "schematic/billing/types/count_billing_products_request" +require_relative "schematic/billing/types/list_company_billing_profiles_request" +require_relative "schematic/billing/types/update_company_billing_profile_request_body" require_relative "schematic/billing/types/create_billing_subscription_request_body" require_relative "schematic/credits/client" require_relative "schematic/credits/types/list_billing_credits_request" @@ -909,6 +940,10 @@ require_relative "schematic/credits/types/list_billing_plan_credit_grants_request" require_relative "schematic/credits/types/delete_billing_plan_credit_grant_request" require_relative "schematic/credits/types/count_billing_plan_credit_grants_request" +require_relative "schematic/credits/types/list_credit_spend_policies_request" +require_relative "schematic/credits/types/create_credit_spend_policy_request_body" +require_relative "schematic/credits/types/update_credit_spend_policy_request_body" +require_relative "schematic/credits/types/count_credit_spend_policies_request" require_relative "schematic/credits/types/list_credit_event_ledger_request" require_relative "schematic/credits/types/count_credit_event_ledger_request" require_relative "schematic/catalogs/client" @@ -1001,6 +1036,7 @@ require_relative "schematic/events/types/create_event_batch_request_body" require_relative "schematic/events/types/get_event_summaries_request" require_relative "schematic/events/types/list_events_request" +require_relative "schematic/events/types/upsert_otlp_environment_settings_request_body" require_relative "schematic/features/client" require_relative "schematic/features/types/list_features_request" require_relative "schematic/features/types/create_feature_request_body" @@ -1020,6 +1056,8 @@ require_relative "schematic/integrationsapi/client" require_relative "schematic/integrationsapi/types/list_integrations_request" require_relative "schematic/integrationsapi/types/start_data_import_request_body" +require_relative "schematic/integrationsapi/types/claim_stripe_sandbox_keys_request_body" +require_relative "schematic/integrationsapi/types/install_stripe_sandbox_request_body" require_relative "schematic/licenses/client" require_relative "schematic/licenses/types/list_licenses_request" require_relative "schematic/licenses/types/count_licenses_request" diff --git a/lib/schematic/accounts/types/update_onboarding_state_request_body.rb b/lib/schematic/accounts/types/update_onboarding_state_request_body.rb index 4c6c11a..bd89860 100644 --- a/lib/schematic/accounts/types/update_onboarding_state_request_body.rb +++ b/lib/schematic/accounts/types/update_onboarding_state_request_body.rb @@ -4,6 +4,8 @@ module Schematic module Accounts module Types class UpdateOnboardingStateRequestBody < Internal::Types::Model + field :country, -> { String }, optional: true, nullable: false + field :dismissed, -> { Internal::Types::Boolean }, optional: true, nullable: false field :path, -> { Schematic::Types::OnboardingPath }, optional: true, nullable: false diff --git a/lib/schematic/billing/client.rb b/lib/schematic/billing/client.rb index fe33483..82d6537 100644 --- a/lib/schematic/billing/client.rb +++ b/lib/schematic/billing/client.rb @@ -1164,6 +1164,102 @@ def count_billing_products(request_options: {}, **params) end end + # @param request_options [Hash] + # @param params [Hash] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # @option params [String, nil] :company_id + # @option params [Boolean, nil] :is_default + # @option params [Schematic::Types::BillingProviderType, nil] :provider_type + # @option params [Integer, nil] :limit + # @option params [Integer, nil] :offset + # + # @example + # client.billing.list_company_billing_profiles( + # company_id: "company_id", + # is_default: true, + # provider_type: "metronome", + # limit: 1000000, + # offset: 1000000 + # ) + # + # @return [Schematic::Billing::Types::ListCompanyBillingProfilesResponse] + def list_company_billing_profiles(request_options: {}, **params) + params = Schematic::Internal::Types::Utils.normalize_keys(params) + query_params = {} + query_params["company_id"] = params[:company_id] if params.key?(:company_id) + query_params["is_default"] = params[:is_default] if params.key?(:is_default) + query_params["provider_type"] = params[:provider_type] if params.key?(:provider_type) + query_params["limit"] = params[:limit] if params.key?(:limit) + query_params["offset"] = params[:offset] if params.key?(:offset) + + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "GET", + path: "billing/profiles", + query: query_params, + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Billing::Types::ListCompanyBillingProfilesResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + + # @param request_options [Hash] + # @param params [Schematic::Billing::Types::UpdateCompanyBillingProfileRequestBody] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # @option params [String] :billing_profile_id + # + # @example + # client.billing.update_company_billing_profile( + # billing_profile_id: "billing_profile_id", + # collection_method: "charge_automatically" + # ) + # + # @return [Schematic::Billing::Types::UpdateCompanyBillingProfileResponse] + def update_company_billing_profile(request_options: {}, **params) + params = Schematic::Internal::Types::Utils.normalize_keys(params) + request_data = Schematic::Billing::Types::UpdateCompanyBillingProfileRequestBody.new(params).to_h + non_body_param_names = %w[billing_profile_id] + body = request_data.except(*non_body_param_names) + + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "PUT", + path: "billing/profiles/#{URI.encode_uri_component(params[:billing_profile_id].to_s)}", + body: body, + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Billing::Types::UpdateCompanyBillingProfileResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + # @param request_options [Hash] # @param params [Schematic::Billing::Types::CreateBillingSubscriptionRequestBody] # @option request_options [String] :base_url diff --git a/lib/schematic/billing/types/list_company_billing_profiles_params.rb b/lib/schematic/billing/types/list_company_billing_profiles_params.rb new file mode 100644 index 0000000..90cbc34 --- /dev/null +++ b/lib/schematic/billing/types/list_company_billing_profiles_params.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Schematic + module Billing + module Types + # Input parameters + class ListCompanyBillingProfilesParams < Internal::Types::Model + field :company_id, -> { String }, optional: true, nullable: false + + field :is_default, -> { Internal::Types::Boolean }, optional: true, nullable: false + + field :limit, -> { Integer }, optional: true, nullable: false + + field :offset, -> { Integer }, optional: true, nullable: false + + field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false + end + end + end +end diff --git a/lib/schematic/billing/types/list_company_billing_profiles_request.rb b/lib/schematic/billing/types/list_company_billing_profiles_request.rb new file mode 100644 index 0000000..4062be4 --- /dev/null +++ b/lib/schematic/billing/types/list_company_billing_profiles_request.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Schematic + module Billing + module Types + class ListCompanyBillingProfilesRequest < Internal::Types::Model + field :company_id, -> { String }, optional: true, nullable: false + + field :is_default, -> { Internal::Types::Boolean }, optional: true, nullable: false + + field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false + + field :limit, -> { Integer }, optional: true, nullable: false + + field :offset, -> { Integer }, optional: true, nullable: false + end + end + end +end diff --git a/lib/schematic/billing/types/list_company_billing_profiles_response.rb b/lib/schematic/billing/types/list_company_billing_profiles_response.rb new file mode 100644 index 0000000..566a967 --- /dev/null +++ b/lib/schematic/billing/types/list_company_billing_profiles_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Billing + module Types + class ListCompanyBillingProfilesResponse < Internal::Types::Model + field :data, -> { Internal::Types::Array[Schematic::Types::CompanyBillingProfileResponseData] }, optional: false, nullable: false + + field :params, -> { Schematic::Billing::Types::ListCompanyBillingProfilesParams }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/billing/types/update_company_billing_profile_request_body.rb b/lib/schematic/billing/types/update_company_billing_profile_request_body.rb new file mode 100644 index 0000000..1a0309a --- /dev/null +++ b/lib/schematic/billing/types/update_company_billing_profile_request_body.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Schematic + module Billing + module Types + class UpdateCompanyBillingProfileRequestBody < Internal::Types::Model + field :billing_profile_id, -> { String }, optional: false, nullable: false + + field :collection_method, -> { Schematic::Types::BillingCollectionMethod }, optional: false, nullable: false + + field :days_until_due, -> { Integer }, optional: true, nullable: false + + field :is_default, -> { Internal::Types::Boolean }, optional: true, nullable: false + + field :name, -> { String }, optional: true, nullable: false + + field :payment_method_id, -> { String }, optional: true, nullable: false + + field :proration_behavior, -> { Schematic::Types::ProrationBehavior }, optional: true, nullable: false + end + end + end +end diff --git a/lib/schematic/billing/types/update_company_billing_profile_response.rb b/lib/schematic/billing/types/update_company_billing_profile_response.rb new file mode 100644 index 0000000..482fae0 --- /dev/null +++ b/lib/schematic/billing/types/update_company_billing_profile_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Billing + module Types + class UpdateCompanyBillingProfileResponse < Internal::Types::Model + field :data, -> { Schematic::Types::CompanyBillingProfileResponseData }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/client.rb b/lib/schematic/client.rb index 920659f..8d16b24 100644 --- a/lib/schematic/client.rb +++ b/lib/schematic/client.rb @@ -42,7 +42,7 @@ def initialize(api_key:, base_url: nil, max_retries: 2) @raw_client = Schematic::Internal::Http::RawClient.new( base_url: base_url || Schematic::Environment::DEFAULT, headers: { - "User-Agent" => "schematichq/1.4.16", + "User-Agent" => "schematichq/1.4.17", "X-Fern-Language" => "Ruby", "X-Schematic-Api-Key" => api_key.to_s }, diff --git a/lib/schematic/credits/client.rb b/lib/schematic/credits/client.rb index 0b65bc6..b87b3b6 100644 --- a/lib/schematic/credits/client.rb +++ b/lib/schematic/credits/client.rb @@ -1266,6 +1266,272 @@ def count_billing_plan_credit_grants(request_options: {}, **params) end end + # @param request_options [Hash] + # @param params [Hash] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # @option params [String, nil] :billing_credit_id + # @option params [String, nil] :company_id + # @option params [Schematic::Types::CreditSpendPolicyScope, nil] :scope_type + # @option params [String, nil] :user_id + # @option params [String, nil] :user_ids + # @option params [Integer, nil] :limit + # @option params [Integer, nil] :offset + # + # @example + # client.credits.list_credit_spend_policies( + # billing_credit_id: "billing_credit_id", + # company_id: "company_id", + # scope_type: "company", + # user_id: "user_id", + # user_ids: ["user_ids"], + # limit: 1000000, + # offset: 1000000 + # ) + # + # @return [Schematic::Credits::Types::ListCreditSpendPoliciesResponse] + def list_credit_spend_policies(request_options: {}, **params) + params = Schematic::Internal::Types::Utils.normalize_keys(params) + query_params = {} + query_params["billing_credit_id"] = params[:billing_credit_id] if params.key?(:billing_credit_id) + query_params["company_id"] = params[:company_id] if params.key?(:company_id) + query_params["scope_type"] = params[:scope_type] if params.key?(:scope_type) + query_params["user_id"] = params[:user_id] if params.key?(:user_id) + query_params["user_ids"] = params[:user_ids] if params.key?(:user_ids) + query_params["limit"] = params[:limit] if params.key?(:limit) + query_params["offset"] = params[:offset] if params.key?(:offset) + + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "GET", + path: "billing/credits/spend-policies", + query: query_params, + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Credits::Types::ListCreditSpendPoliciesResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + + # @param request_options [Hash] + # @param params [Schematic::Credits::Types::CreateCreditSpendPolicyRequestBody] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # + # @example + # client.credits.create_credit_spend_policy( + # billing_credit_id: "billing_credit_id", + # max_per_draw: 1.1 + # ) + # + # @return [Schematic::Credits::Types::CreateCreditSpendPolicyResponse] + def create_credit_spend_policy(request_options: {}, **params) + params = Schematic::Internal::Types::Utils.normalize_keys(params) + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "POST", + path: "billing/credits/spend-policies", + body: Schematic::Credits::Types::CreateCreditSpendPolicyRequestBody.new(params).to_h, + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Credits::Types::CreateCreditSpendPolicyResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + + # @param request_options [Hash] + # @param params [Hash] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # @option params [String] :spend_policy_id + # + # @example + # client.credits.get_credit_spend_policy(spend_policy_id: "spend_policy_id") + # + # @return [Schematic::Credits::Types::GetCreditSpendPolicyResponse] + def get_credit_spend_policy(request_options: {}, **params) + params = Schematic::Internal::Types::Utils.normalize_keys(params) + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "GET", + path: "billing/credits/spend-policies/#{URI.encode_uri_component(params[:spend_policy_id].to_s)}", + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Credits::Types::GetCreditSpendPolicyResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + + # @param request_options [Hash] + # @param params [Schematic::Credits::Types::UpdateCreditSpendPolicyRequestBody] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # @option params [String] :spend_policy_id + # + # @example + # client.credits.update_credit_spend_policy(spend_policy_id: "spend_policy_id") + # + # @return [Schematic::Credits::Types::UpdateCreditSpendPolicyResponse] + def update_credit_spend_policy(request_options: {}, **params) + params = Schematic::Internal::Types::Utils.normalize_keys(params) + request_data = Schematic::Credits::Types::UpdateCreditSpendPolicyRequestBody.new(params).to_h + non_body_param_names = %w[spend_policy_id] + body = request_data.except(*non_body_param_names) + + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "PUT", + path: "billing/credits/spend-policies/#{URI.encode_uri_component(params[:spend_policy_id].to_s)}", + body: body, + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Credits::Types::UpdateCreditSpendPolicyResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + + # @param request_options [Hash] + # @param params [Hash] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # @option params [String] :spend_policy_id + # + # @example + # client.credits.delete_credit_spend_policy(spend_policy_id: "spend_policy_id") + # + # @return [Schematic::Credits::Types::DeleteCreditSpendPolicyResponse] + def delete_credit_spend_policy(request_options: {}, **params) + params = Schematic::Internal::Types::Utils.normalize_keys(params) + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "DELETE", + path: "billing/credits/spend-policies/#{URI.encode_uri_component(params[:spend_policy_id].to_s)}", + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Credits::Types::DeleteCreditSpendPolicyResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + + # @param request_options [Hash] + # @param params [Hash] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # @option params [String, nil] :billing_credit_id + # @option params [String, nil] :company_id + # @option params [Schematic::Types::CreditSpendPolicyScope, nil] :scope_type + # @option params [String, nil] :user_id + # @option params [String, nil] :user_ids + # @option params [Integer, nil] :limit + # @option params [Integer, nil] :offset + # + # @example + # client.credits.count_credit_spend_policies( + # billing_credit_id: "billing_credit_id", + # company_id: "company_id", + # scope_type: "company", + # user_id: "user_id", + # user_ids: ["user_ids"], + # limit: 1000000, + # offset: 1000000 + # ) + # + # @return [Schematic::Credits::Types::CountCreditSpendPoliciesResponse] + def count_credit_spend_policies(request_options: {}, **params) + params = Schematic::Internal::Types::Utils.normalize_keys(params) + query_params = {} + query_params["billing_credit_id"] = params[:billing_credit_id] if params.key?(:billing_credit_id) + query_params["company_id"] = params[:company_id] if params.key?(:company_id) + query_params["scope_type"] = params[:scope_type] if params.key?(:scope_type) + query_params["user_id"] = params[:user_id] if params.key?(:user_id) + query_params["user_ids"] = params[:user_ids] if params.key?(:user_ids) + query_params["limit"] = params[:limit] if params.key?(:limit) + query_params["offset"] = params[:offset] if params.key?(:offset) + + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "GET", + path: "billing/credits/spend-policies/count", + query: query_params, + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Credits::Types::CountCreditSpendPoliciesResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + # @param request_options [Hash] # @param params [Hash] # @option request_options [String] :base_url diff --git a/lib/schematic/credits/types/count_credit_spend_policies_params.rb b/lib/schematic/credits/types/count_credit_spend_policies_params.rb new file mode 100644 index 0000000..12e0de9 --- /dev/null +++ b/lib/schematic/credits/types/count_credit_spend_policies_params.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Schematic + module Credits + module Types + # Input parameters + class CountCreditSpendPoliciesParams < Internal::Types::Model + field :billing_credit_id, -> { String }, optional: true, nullable: false + + field :company_id, -> { String }, optional: true, nullable: false + + field :limit, -> { Integer }, optional: true, nullable: false + + field :offset, -> { Integer }, optional: true, nullable: false + + field :scope_type, -> { Schematic::Types::CreditSpendPolicyScope }, optional: true, nullable: false + + field :user_id, -> { String }, optional: true, nullable: false + + field :user_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false + end + end + end +end diff --git a/lib/schematic/credits/types/count_credit_spend_policies_request.rb b/lib/schematic/credits/types/count_credit_spend_policies_request.rb new file mode 100644 index 0000000..ff45e67 --- /dev/null +++ b/lib/schematic/credits/types/count_credit_spend_policies_request.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Schematic + module Credits + module Types + class CountCreditSpendPoliciesRequest < Internal::Types::Model + field :billing_credit_id, -> { String }, optional: true, nullable: false + + field :company_id, -> { String }, optional: true, nullable: false + + field :scope_type, -> { Schematic::Types::CreditSpendPolicyScope }, optional: true, nullable: false + + field :user_id, -> { String }, optional: true, nullable: false + + field :user_ids, -> { String }, optional: true, nullable: false + + field :limit, -> { Integer }, optional: true, nullable: false + + field :offset, -> { Integer }, optional: true, nullable: false + end + end + end +end diff --git a/lib/schematic/credits/types/count_credit_spend_policies_response.rb b/lib/schematic/credits/types/count_credit_spend_policies_response.rb new file mode 100644 index 0000000..b6e57aa --- /dev/null +++ b/lib/schematic/credits/types/count_credit_spend_policies_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Credits + module Types + class CountCreditSpendPoliciesResponse < Internal::Types::Model + field :data, -> { Schematic::Types::CountResponse }, optional: false, nullable: false + + field :params, -> { Schematic::Credits::Types::CountCreditSpendPoliciesParams }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/credits/types/create_credit_spend_policy_request_body.rb b/lib/schematic/credits/types/create_credit_spend_policy_request_body.rb new file mode 100644 index 0000000..a8733f7 --- /dev/null +++ b/lib/schematic/credits/types/create_credit_spend_policy_request_body.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Schematic + module Credits + module Types + class CreateCreditSpendPolicyRequestBody < Internal::Types::Model + field :billing_credit_id, -> { String }, optional: false, nullable: false + + field :company_id, -> { String }, optional: true, nullable: false + + field :label, -> { String }, optional: true, nullable: false + + field :max_per_draw, -> { Integer }, optional: false, nullable: false + + field :user_id, -> { String }, optional: true, nullable: false + end + end + end +end diff --git a/lib/schematic/credits/types/create_credit_spend_policy_response.rb b/lib/schematic/credits/types/create_credit_spend_policy_response.rb new file mode 100644 index 0000000..f242941 --- /dev/null +++ b/lib/schematic/credits/types/create_credit_spend_policy_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Credits + module Types + class CreateCreditSpendPolicyResponse < Internal::Types::Model + field :data, -> { Schematic::Types::CreditSpendPolicyResponseData }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/credits/types/delete_credit_spend_policy_response.rb b/lib/schematic/credits/types/delete_credit_spend_policy_response.rb new file mode 100644 index 0000000..c2ef64e --- /dev/null +++ b/lib/schematic/credits/types/delete_credit_spend_policy_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Credits + module Types + class DeleteCreditSpendPolicyResponse < Internal::Types::Model + field :data, -> { Schematic::Types::DeleteResponse }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/credits/types/get_credit_spend_policy_response.rb b/lib/schematic/credits/types/get_credit_spend_policy_response.rb new file mode 100644 index 0000000..0e7b6e0 --- /dev/null +++ b/lib/schematic/credits/types/get_credit_spend_policy_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Credits + module Types + class GetCreditSpendPolicyResponse < Internal::Types::Model + field :data, -> { Schematic::Types::CreditSpendPolicyResponseData }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/credits/types/list_credit_spend_policies_params.rb b/lib/schematic/credits/types/list_credit_spend_policies_params.rb new file mode 100644 index 0000000..3429d00 --- /dev/null +++ b/lib/schematic/credits/types/list_credit_spend_policies_params.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Schematic + module Credits + module Types + # Input parameters + class ListCreditSpendPoliciesParams < Internal::Types::Model + field :billing_credit_id, -> { String }, optional: true, nullable: false + + field :company_id, -> { String }, optional: true, nullable: false + + field :limit, -> { Integer }, optional: true, nullable: false + + field :offset, -> { Integer }, optional: true, nullable: false + + field :scope_type, -> { Schematic::Types::CreditSpendPolicyScope }, optional: true, nullable: false + + field :user_id, -> { String }, optional: true, nullable: false + + field :user_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false + end + end + end +end diff --git a/lib/schematic/credits/types/list_credit_spend_policies_request.rb b/lib/schematic/credits/types/list_credit_spend_policies_request.rb new file mode 100644 index 0000000..00da835 --- /dev/null +++ b/lib/schematic/credits/types/list_credit_spend_policies_request.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Schematic + module Credits + module Types + class ListCreditSpendPoliciesRequest < Internal::Types::Model + field :billing_credit_id, -> { String }, optional: true, nullable: false + + field :company_id, -> { String }, optional: true, nullable: false + + field :scope_type, -> { Schematic::Types::CreditSpendPolicyScope }, optional: true, nullable: false + + field :user_id, -> { String }, optional: true, nullable: false + + field :user_ids, -> { String }, optional: true, nullable: false + + field :limit, -> { Integer }, optional: true, nullable: false + + field :offset, -> { Integer }, optional: true, nullable: false + end + end + end +end diff --git a/lib/schematic/credits/types/list_credit_spend_policies_response.rb b/lib/schematic/credits/types/list_credit_spend_policies_response.rb new file mode 100644 index 0000000..9cab229 --- /dev/null +++ b/lib/schematic/credits/types/list_credit_spend_policies_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Credits + module Types + class ListCreditSpendPoliciesResponse < Internal::Types::Model + field :data, -> { Internal::Types::Array[Schematic::Types::CreditSpendPolicyResponseData] }, optional: false, nullable: false + + field :params, -> { Schematic::Credits::Types::ListCreditSpendPoliciesParams }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/credits/types/update_credit_spend_policy_request_body.rb b/lib/schematic/credits/types/update_credit_spend_policy_request_body.rb new file mode 100644 index 0000000..e618a25 --- /dev/null +++ b/lib/schematic/credits/types/update_credit_spend_policy_request_body.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Schematic + module Credits + module Types + class UpdateCreditSpendPolicyRequestBody < Internal::Types::Model + field :spend_policy_id, -> { String }, optional: false, nullable: false + + field :label, -> { String }, optional: true, nullable: false + + field :max_per_draw, -> { Integer }, optional: true, nullable: false + end + end + end +end diff --git a/lib/schematic/credits/types/update_credit_spend_policy_response.rb b/lib/schematic/credits/types/update_credit_spend_policy_response.rb new file mode 100644 index 0000000..9c83c48 --- /dev/null +++ b/lib/schematic/credits/types/update_credit_spend_policy_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Credits + module Types + class UpdateCreditSpendPolicyResponse < Internal::Types::Model + field :data, -> { Schematic::Types::CreditSpendPolicyResponseData }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/events/client.rb b/lib/schematic/events/client.rb index 14375bb..81e2557 100644 --- a/lib/schematic/events/client.rb +++ b/lib/schematic/events/client.rb @@ -229,6 +229,107 @@ def get_event(request_options: {}, **params) end end + # @param request_options [Hash] + # @param _params [Hash] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # + # @example + # client.events.get_otlp_environment_settings + # + # @return [Schematic::Events::Types::GetOtlpEnvironmentSettingsResponse] + def get_otlp_environment_settings(request_options: {}, **_params) + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "GET", + path: "otlp/settings", + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Events::Types::GetOtlpEnvironmentSettingsResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + + # @param request_options [Hash] + # @param params [Schematic::Events::Types::UpsertOtlpEnvironmentSettingsRequestBody] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # + # @example + # client.events.upsert_otlp_environment_settings(tool_events_enabled: true) + # + # @return [Schematic::Events::Types::UpsertOtlpEnvironmentSettingsResponse] + def upsert_otlp_environment_settings(request_options: {}, **params) + params = Schematic::Internal::Types::Utils.normalize_keys(params) + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "POST", + path: "otlp/settings", + body: Schematic::Events::Types::UpsertOtlpEnvironmentSettingsRequestBody.new(params).to_h, + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Events::Types::UpsertOtlpEnvironmentSettingsResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + + # @param request_options [Hash] + # @param _params [Hash] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # + # @example + # client.events.delete_otlp_environment_settings + # + # @return [Schematic::Events::Types::DeleteOtlpEnvironmentSettingsResponse] + def delete_otlp_environment_settings(request_options: {}, **_params) + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "DELETE", + path: "otlp/settings", + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Events::Types::DeleteOtlpEnvironmentSettingsResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + # @param request_options [Hash] # @param _params [Hash] # @option request_options [String] :base_url diff --git a/lib/schematic/events/types/delete_otlp_environment_settings_response.rb b/lib/schematic/events/types/delete_otlp_environment_settings_response.rb new file mode 100644 index 0000000..0807ad0 --- /dev/null +++ b/lib/schematic/events/types/delete_otlp_environment_settings_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Events + module Types + class DeleteOtlpEnvironmentSettingsResponse < Internal::Types::Model + field :data, -> { Schematic::Types::DeleteResponse }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/events/types/get_otlp_environment_settings_response.rb b/lib/schematic/events/types/get_otlp_environment_settings_response.rb new file mode 100644 index 0000000..bd60105 --- /dev/null +++ b/lib/schematic/events/types/get_otlp_environment_settings_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Events + module Types + class GetOtlpEnvironmentSettingsResponse < Internal::Types::Model + field :data, -> { Schematic::Types::OtlpEnvironmentSettingsResponseData }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/events/types/upsert_otlp_environment_settings_request_body.rb b/lib/schematic/events/types/upsert_otlp_environment_settings_request_body.rb new file mode 100644 index 0000000..d1ef8dd --- /dev/null +++ b/lib/schematic/events/types/upsert_otlp_environment_settings_request_body.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Schematic + module Events + module Types + class UpsertOtlpEnvironmentSettingsRequestBody < Internal::Types::Model + field :company_attribute, -> { String }, optional: true, nullable: false + + field :company_key, -> { String }, optional: true, nullable: false + + field :tool_events_enabled, -> { Internal::Types::Boolean }, optional: false, nullable: false + + field :user_attribute, -> { String }, optional: true, nullable: false + + field :user_key, -> { String }, optional: true, nullable: false + end + end + end +end diff --git a/lib/schematic/events/types/upsert_otlp_environment_settings_response.rb b/lib/schematic/events/types/upsert_otlp_environment_settings_response.rb new file mode 100644 index 0000000..d2ab4e0 --- /dev/null +++ b/lib/schematic/events/types/upsert_otlp_environment_settings_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Events + module Types + class UpsertOtlpEnvironmentSettingsResponse < Internal::Types::Model + field :data, -> { Schematic::Types::OtlpEnvironmentSettingsResponseData }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/integrationsapi/client.rb b/lib/schematic/integrationsapi/client.rb index 037dbfc..fd27754 100644 --- a/lib/schematic/integrationsapi/client.rb +++ b/lib/schematic/integrationsapi/client.rb @@ -242,6 +242,107 @@ def load_sample_data_set(request_options: {}, **_params) end end + # @param request_options [Hash] + # @param _params [Hash] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # + # @example + # client.integrationsapi.get_stripe_sandbox_claim_link + # + # @return [Schematic::Integrationsapi::Types::GetStripeSandboxClaimLinkResponse] + def get_stripe_sandbox_claim_link(request_options: {}, **_params) + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "GET", + path: "integrations/stripe/sandbox/claim-link", + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Integrationsapi::Types::GetStripeSandboxClaimLinkResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + + # @param request_options [Hash] + # @param _params [Hash] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # + # @example + # client.integrationsapi.get_stripe_sandbox_keys + # + # @return [Schematic::Integrationsapi::Types::GetStripeSandboxKeysResponse] + def get_stripe_sandbox_keys(request_options: {}, **_params) + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "GET", + path: "integrations/stripe/sandbox/keys", + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Integrationsapi::Types::GetStripeSandboxKeysResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + + # @param request_options [Hash] + # @param params [Schematic::Integrationsapi::Types::ClaimStripeSandboxKeysRequestBody] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # + # @example + # client.integrationsapi.claim_stripe_sandbox_keys(token: "token") + # + # @return [Schematic::Integrationsapi::Types::ClaimStripeSandboxKeysResponse] + def claim_stripe_sandbox_keys(request_options: {}, **params) + params = Schematic::Internal::Types::Utils.normalize_keys(params) + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "POST", + path: "integrations/stripe/sandbox/keys/claim", + body: Schematic::Integrationsapi::Types::ClaimStripeSandboxKeysRequestBody.new(params).to_h, + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Integrationsapi::Types::ClaimStripeSandboxKeysResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + # @param request_options [Hash] # @param params [Schematic::Types::InstallIntegrationRequestBody] # @option request_options [String] :base_url @@ -312,6 +413,74 @@ def install_stripe(request_options: {}, **params) end end + # @param request_options [Hash] + # @param params [Schematic::Integrationsapi::Types::InstallStripeSandboxRequestBody] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # + # @example + # client.integrationsapi.install_stripe_claimable_sandbox(email: "email") + # + # @return [Schematic::Integrationsapi::Types::InstallStripeClaimableSandboxResponse] + def install_stripe_claimable_sandbox(request_options: {}, **params) + params = Schematic::Internal::Types::Utils.normalize_keys(params) + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "POST", + path: "integrations/stripe/v2/sandbox", + body: Schematic::Integrationsapi::Types::InstallStripeSandboxRequestBody.new(params).to_h, + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Integrationsapi::Types::InstallStripeClaimableSandboxResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + + # @param request_options [Hash] + # @param _params [Hash] + # @option request_options [String] :base_url + # @option request_options [Hash{String => Object}] :additional_headers + # @option request_options [Hash{String => Object}] :additional_query_parameters + # @option request_options [Hash{String => Object}] :additional_body_parameters + # @option request_options [Integer] :timeout_in_seconds + # + # @example + # client.integrationsapi.list_stripe_sandbox_countries + # + # @return [Schematic::Integrationsapi::Types::ListStripeSandboxCountriesResponse] + def list_stripe_sandbox_countries(request_options: {}, **_params) + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "GET", + path: "integrations/stripe/v2/sandbox-countries", + request_options: request_options + ) + begin + response = @client.send(request) + rescue Net::HTTPRequestTimeout + raise Schematic::Errors::TimeoutError + end + code = response.code.to_i + if code.between?(200, 299) + Schematic::Integrationsapi::Types::ListStripeSandboxCountriesResponse.load(response.body) + else + error_class = Schematic::Errors::ResponseError.subclass_for_code(code) + raise error_class.new(response.body, code: code) + end + end + # @param request_options [Hash] # @param params [Hash] # @option request_options [String] :base_url diff --git a/lib/schematic/integrationsapi/types/claim_stripe_sandbox_keys_request_body.rb b/lib/schematic/integrationsapi/types/claim_stripe_sandbox_keys_request_body.rb new file mode 100644 index 0000000..1315d47 --- /dev/null +++ b/lib/schematic/integrationsapi/types/claim_stripe_sandbox_keys_request_body.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Schematic + module Integrationsapi + module Types + class ClaimStripeSandboxKeysRequestBody < Internal::Types::Model + field :token, -> { String }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/integrationsapi/types/claim_stripe_sandbox_keys_response.rb b/lib/schematic/integrationsapi/types/claim_stripe_sandbox_keys_response.rb new file mode 100644 index 0000000..8e10e3c --- /dev/null +++ b/lib/schematic/integrationsapi/types/claim_stripe_sandbox_keys_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Integrationsapi + module Types + class ClaimStripeSandboxKeysResponse < Internal::Types::Model + field :data, -> { Schematic::Types::ClaimedStripeSandboxKeysResponseData }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/integrationsapi/types/get_stripe_sandbox_claim_link_response.rb b/lib/schematic/integrationsapi/types/get_stripe_sandbox_claim_link_response.rb new file mode 100644 index 0000000..91d42a7 --- /dev/null +++ b/lib/schematic/integrationsapi/types/get_stripe_sandbox_claim_link_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Integrationsapi + module Types + class GetStripeSandboxClaimLinkResponse < Internal::Types::Model + field :data, -> { Schematic::Types::StripeSandboxClaimLink }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/integrationsapi/types/get_stripe_sandbox_keys_response.rb b/lib/schematic/integrationsapi/types/get_stripe_sandbox_keys_response.rb new file mode 100644 index 0000000..81b7c7f --- /dev/null +++ b/lib/schematic/integrationsapi/types/get_stripe_sandbox_keys_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Integrationsapi + module Types + class GetStripeSandboxKeysResponse < Internal::Types::Model + field :data, -> { Schematic::Types::ClaimedStripeSandboxKeysResponseData }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/integrationsapi/types/install_stripe_claimable_sandbox_response.rb b/lib/schematic/integrationsapi/types/install_stripe_claimable_sandbox_response.rb new file mode 100644 index 0000000..9574c5a --- /dev/null +++ b/lib/schematic/integrationsapi/types/install_stripe_claimable_sandbox_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Integrationsapi + module Types + class InstallStripeClaimableSandboxResponse < Internal::Types::Model + field :data, -> { Schematic::Types::StripeSandboxInstallResponseData }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/integrationsapi/types/install_stripe_sandbox_request_body.rb b/lib/schematic/integrationsapi/types/install_stripe_sandbox_request_body.rb new file mode 100644 index 0000000..6f93281 --- /dev/null +++ b/lib/schematic/integrationsapi/types/install_stripe_sandbox_request_body.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Schematic + module Integrationsapi + module Types + class InstallStripeSandboxRequestBody < Internal::Types::Model + field :country, -> { String }, optional: true, nullable: false + + field :email, -> { String }, optional: false, nullable: false + + field :name, -> { String }, optional: true, nullable: false + + field :seed_sample_data, -> { Internal::Types::Boolean }, optional: true, nullable: false + end + end + end +end diff --git a/lib/schematic/integrationsapi/types/list_stripe_sandbox_countries_response.rb b/lib/schematic/integrationsapi/types/list_stripe_sandbox_countries_response.rb new file mode 100644 index 0000000..940f442 --- /dev/null +++ b/lib/schematic/integrationsapi/types/list_stripe_sandbox_countries_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Integrationsapi + module Types + class ListStripeSandboxCountriesResponse < Internal::Types::Model + field :data, -> { Schematic::Types::StripeSandboxCountriesResponseData }, optional: false, nullable: false + + field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/types/claimed_stripe_sandbox_keys_response_data.rb b/lib/schematic/types/claimed_stripe_sandbox_keys_response_data.rb new file mode 100644 index 0000000..59f826c --- /dev/null +++ b/lib/schematic/types/claimed_stripe_sandbox_keys_response_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Types + class ClaimedStripeSandboxKeysResponseData < Internal::Types::Model + field :publishable, -> { String }, optional: false, nullable: false + + field :sandbox_id, -> { String }, optional: false, nullable: false + + field :secret, -> { String }, optional: false, nullable: false + end + end +end diff --git a/lib/schematic/types/company_billing_profile_response_data.rb b/lib/schematic/types/company_billing_profile_response_data.rb new file mode 100644 index 0000000..4333b59 --- /dev/null +++ b/lib/schematic/types/company_billing_profile_response_data.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module Schematic + module Types + class CompanyBillingProfileResponseData < Internal::Types::Model + field :account_id, -> { String }, optional: false, nullable: false + + field :billing_customer_id, -> { String }, optional: true, nullable: false + + field :collection_method, -> { Schematic::Types::BillingCollectionMethod }, optional: false, nullable: false + + field :company_id, -> { String }, optional: false, nullable: false + + field :created_at, -> { String }, optional: false, nullable: false + + field :days_until_due, -> { Integer }, optional: true, nullable: false + + field :environment_id, -> { String }, optional: false, nullable: false + + field :id, -> { String }, optional: false, nullable: false + + field :is_default, -> { Internal::Types::Boolean }, optional: false, nullable: false + + field :name, -> { String }, optional: true, nullable: false + + field :payment_method_id, -> { String }, optional: true, nullable: false + + field :proration_behavior, -> { Schematic::Types::ProrationBehavior }, optional: true, nullable: false + + field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: false, nullable: false + + field :updated_at, -> { String }, optional: false, nullable: false + end + end +end diff --git a/lib/schematic/types/company_detail_response_data.rb b/lib/schematic/types/company_detail_response_data.rb index 2fb56ca..a3aba24 100644 --- a/lib/schematic/types/company_detail_response_data.rb +++ b/lib/schematic/types/company_detail_response_data.rb @@ -7,6 +7,10 @@ class CompanyDetailResponseData < Internal::Types::Model field :billing_credit_balances, -> { Internal::Types::Hash[String, Integer] }, optional: true, nullable: false + field :billing_profile, -> { Schematic::Types::CompanyBillingProfileResponseData }, optional: true, nullable: false + + field :billing_profiles, -> { Internal::Types::Array[Schematic::Types::CompanyBillingProfileResponseData] }, optional: true, nullable: false + field :billing_subscription, -> { Schematic::Types::BillingSubscriptionView }, optional: true, nullable: false field :billing_subscriptions, -> { Internal::Types::Array[Schematic::Types::BillingSubscriptionView] }, optional: false, nullable: false diff --git a/lib/schematic/types/company_override_response_data.rb b/lib/schematic/types/company_override_response_data.rb index b3b722f..1014dc5 100644 --- a/lib/schematic/types/company_override_response_data.rb +++ b/lib/schematic/types/company_override_response_data.rb @@ -35,6 +35,10 @@ class CompanyOverrideResponseData < Internal::Types::Model field :value_bool, -> { Internal::Types::Boolean }, optional: true, nullable: false + field :value_credit, -> { Schematic::Types::BillingCreditResponseData }, optional: true, nullable: false + + field :value_credit_id, -> { String }, optional: true, nullable: false + field :value_numeric, -> { Integer }, optional: true, nullable: false field :value_trait, -> { Schematic::Types::EntityTraitDefinitionResponseData }, optional: true, nullable: false diff --git a/lib/schematic/types/credit_spend_policy_response_data.rb b/lib/schematic/types/credit_spend_policy_response_data.rb new file mode 100644 index 0000000..9c683d3 --- /dev/null +++ b/lib/schematic/types/credit_spend_policy_response_data.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Schematic + module Types + class CreditSpendPolicyResponseData < Internal::Types::Model + field :billing_credit_id, -> { String }, optional: false, nullable: false + + field :company_id, -> { String }, optional: true, nullable: false + + field :created_at, -> { String }, optional: false, nullable: false + + field :id, -> { String }, optional: false, nullable: false + + field :label, -> { String }, optional: true, nullable: false + + field :max_per_draw, -> { Integer }, optional: true, nullable: false + + field :scope_type, -> { Schematic::Types::CreditSpendPolicyScope }, optional: false, nullable: false + + field :updated_at, -> { String }, optional: false, nullable: false + + field :user_id, -> { String }, optional: true, nullable: false + end + end +end diff --git a/lib/schematic/types/credit_spend_policy_scope.rb b/lib/schematic/types/credit_spend_policy_scope.rb new file mode 100644 index 0000000..214e7aa --- /dev/null +++ b/lib/schematic/types/credit_spend_policy_scope.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Types + module CreditSpendPolicyScope + extend Schematic::Internal::Types::Enum + + COMPANY = "company" + USER = "user" + GROUP = "group" + end + end +end diff --git a/lib/schematic/types/event_body_inference.rb b/lib/schematic/types/event_body_inference.rb index bee0c0d..012cd26 100644 --- a/lib/schematic/types/event_body_inference.rb +++ b/lib/schematic/types/event_body_inference.rb @@ -3,6 +3,8 @@ module Schematic module Types class EventBodyInference < Internal::Types::Model + field :cache_creation_input_tokens, -> { Integer }, optional: true, nullable: false + field :cached_input_tokens, -> { Integer }, optional: true, nullable: false field :company, -> { Internal::Types::Hash[String, String] }, optional: false, nullable: false diff --git a/lib/schematic/types/get_onboarding_state_resp.rb b/lib/schematic/types/get_onboarding_state_resp.rb index 63bd7d2..c4565d4 100644 --- a/lib/schematic/types/get_onboarding_state_resp.rb +++ b/lib/schematic/types/get_onboarding_state_resp.rb @@ -5,6 +5,8 @@ module Types class GetOnboardingStateResp < Internal::Types::Model field :agent_connected_at, -> { String }, optional: true, nullable: false + field :country, -> { String }, optional: true, nullable: false + field :dismissed_at, -> { String }, optional: true, nullable: false field :environment_id, -> { String }, optional: true, nullable: false diff --git a/lib/schematic/types/otlp_environment_settings_response_data.rb b/lib/schematic/types/otlp_environment_settings_response_data.rb new file mode 100644 index 0000000..00a81b8 --- /dev/null +++ b/lib/schematic/types/otlp_environment_settings_response_data.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Schematic + module Types + class OtlpEnvironmentSettingsResponseData < Internal::Types::Model + field :company_attribute, -> { String }, optional: true, nullable: false + + field :company_key, -> { String }, optional: true, nullable: false + + field :created_at, -> { String }, optional: false, nullable: false + + field :environment_id, -> { String }, optional: false, nullable: false + + field :tool_events_enabled, -> { Internal::Types::Boolean }, optional: false, nullable: false + + field :updated_at, -> { String }, optional: false, nullable: false + + field :user_attribute, -> { String }, optional: true, nullable: false + + field :user_key, -> { String }, optional: true, nullable: false + end + end +end diff --git a/lib/schematic/types/rule_condition_detail_response_data.rb b/lib/schematic/types/rule_condition_detail_response_data.rb index 53011b2..96d865e 100644 --- a/lib/schematic/types/rule_condition_detail_response_data.rb +++ b/lib/schematic/types/rule_condition_detail_response_data.rb @@ -29,6 +29,8 @@ class RuleConditionDetailResponseData < Internal::Types::Model field :operator, -> { Schematic::Types::ComparableOperator }, optional: false, nullable: false + field :plan_versions, -> { Internal::Types::Array[Schematic::Types::RuleConditionPlanVersionResponseData] }, optional: true, nullable: false + field :resource_ids, -> { Internal::Types::Array[String] }, optional: false, nullable: false field :resources, -> { Internal::Types::Array[Schematic::Types::PreviewObjectResponseData] }, optional: false, nullable: false diff --git a/lib/schematic/types/rule_condition_plan_version_response_data.rb b/lib/schematic/types/rule_condition_plan_version_response_data.rb new file mode 100644 index 0000000..0648da8 --- /dev/null +++ b/lib/schematic/types/rule_condition_plan_version_response_data.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Schematic + module Types + class RuleConditionPlanVersionResponseData < Internal::Types::Model + field :id, -> { String }, optional: false, nullable: false + + field :name, -> { String }, optional: false, nullable: false + + field :status, -> { Schematic::Types::PlanVersionStatus }, optional: false, nullable: false + + field :version, -> { Integer }, optional: false, nullable: false + end + end +end diff --git a/lib/schematic/types/stripe_integration_config.rb b/lib/schematic/types/stripe_integration_config.rb index bfb9079..b57eb7b 100644 --- a/lib/schematic/types/stripe_integration_config.rb +++ b/lib/schematic/types/stripe_integration_config.rb @@ -7,6 +7,12 @@ class StripeIntegrationConfig < Internal::Types::Model field :account_name, -> { String }, optional: true, nullable: false + field :claimable_sandbox_expires_at, -> { String }, optional: true, nullable: false + + field :claimable_sandbox_id, -> { String }, optional: true, nullable: false + + field :claimable_sandbox_status, -> { String }, optional: true, nullable: false + field :company_update_only, -> { Internal::Types::Boolean }, optional: true, nullable: false field :is_sandbox, -> { Internal::Types::Boolean }, optional: false, nullable: false diff --git a/lib/schematic/types/stripe_sandbox_claim_link.rb b/lib/schematic/types/stripe_sandbox_claim_link.rb new file mode 100644 index 0000000..f0cdbea --- /dev/null +++ b/lib/schematic/types/stripe_sandbox_claim_link.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Schematic + module Types + class StripeSandboxClaimLink < Internal::Types::Model + field :claim_url, -> { String }, optional: false, nullable: false + + field :expires_at, -> { String }, optional: true, nullable: false + + field :sandbox_id, -> { String }, optional: false, nullable: false + + field :status, -> { String }, optional: false, nullable: false + end + end +end diff --git a/lib/schematic/types/stripe_sandbox_countries_response_data.rb b/lib/schematic/types/stripe_sandbox_countries_response_data.rb new file mode 100644 index 0000000..7d6c020 --- /dev/null +++ b/lib/schematic/types/stripe_sandbox_countries_response_data.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Schematic + module Types + class StripeSandboxCountriesResponseData < Internal::Types::Model + field :countries, -> { Internal::Types::Array[String] }, optional: false, nullable: false + end + end +end diff --git a/lib/schematic/types/stripe_sandbox_install_response_data.rb b/lib/schematic/types/stripe_sandbox_install_response_data.rb new file mode 100644 index 0000000..3babbb5 --- /dev/null +++ b/lib/schematic/types/stripe_sandbox_install_response_data.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Schematic + module Types + class StripeSandboxInstallResponseData < Internal::Types::Model + field :api_keys, -> { Schematic::Types::StripeSandboxKeysResponseData }, optional: true, nullable: false + + field :claim_url, -> { String }, optional: false, nullable: false + + field :claim_url_expires_at, -> { String }, optional: true, nullable: false + + field :expires_at, -> { String }, optional: true, nullable: false + + field :install, -> { Schematic::Types::IntegrationInstallResponseData }, optional: false, nullable: false + + field :sandbox_id, -> { String }, optional: false, nullable: false + + field :stripe_account_id, -> { String }, optional: false, nullable: false + end + end +end diff --git a/lib/schematic/types/stripe_sandbox_keys_response_data.rb b/lib/schematic/types/stripe_sandbox_keys_response_data.rb new file mode 100644 index 0000000..82b36df --- /dev/null +++ b/lib/schematic/types/stripe_sandbox_keys_response_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Schematic + module Types + class StripeSandboxKeysResponseData < Internal::Types::Model + field :mcp, -> { String }, optional: false, nullable: false + + field :publishable, -> { String }, optional: false, nullable: false + + field :secret, -> { String }, optional: false, nullable: false + end + end +end diff --git a/lib/schematic/version.rb b/lib/schematic/version.rb index c0c2844..cf1ddf3 100644 --- a/lib/schematic/version.rb +++ b/lib/schematic/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Schematic - VERSION = "1.4.16" + VERSION = "1.4.17" end diff --git a/reference.md b/reference.md index d9fa855..f41e181 100644 --- a/reference.md +++ b/reference.md @@ -1273,6 +1273,14 @@ client.accounts.update_onboarding_state
+**country:** `String` + +
+
+ +
+
+ **dismissed:** `Internal::Types::Boolean`
@@ -3799,6 +3807,191 @@ client.billing.count_billing_products(
+ + + + +
client.billing.list_company_billing_profiles() -> Schematic::Billing::Types::ListCompanyBillingProfilesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.billing.list_company_billing_profiles( + company_id: "company_id", + is_default: true, + provider_type: "metronome", + limit: 1000000, + offset: 1000000 +) +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**company_id:** `String` + +
+
+ +
+
+ +**is_default:** `Internal::Types::Boolean` + +
+
+ +
+
+ +**provider_type:** `Schematic::Types::BillingProviderType` + +
+
+ +
+
+ +**limit:** `Integer` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Integer` — Page offset (default 0) + +
+
+ +
+
+ +**request_options:** `Schematic::Billing::RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.billing.update_company_billing_profile(billing_profile_id:, request) -> Schematic::Billing::Types::UpdateCompanyBillingProfileResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.billing.update_company_billing_profile( + billing_profile_id: "billing_profile_id", + collection_method: "charge_automatically" +) +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**billing_profile_id:** `String` — billing_profile_id + +
+
+ +
+
+ +**collection_method:** `Schematic::Types::BillingCollectionMethod` + +
+
+ +
+
+ +**days_until_due:** `Integer` + +
+
+ +
+
+ +**is_default:** `Internal::Types::Boolean` + +
+
+ +
+
+ +**name:** `String` + +
+
+ +
+
+ +**payment_method_id:** `String` + +
+
+ +
+
+ +**proration_behavior:** `Schematic::Types::ProrationBehavior` + +
+
+ +
+
+ +**request_options:** `Schematic::Billing::RequestOptions` + +
+
+
+
+ +
@@ -6369,7 +6562,7 @@ client.credits.count_billing_plan_credit_grants( -
client.credits.list_credit_event_ledger() -> Schematic::Credits::Types::ListCreditEventLedgerResponse +
client.credits.list_credit_spend_policies() -> Schematic::Credits::Types::ListCreditSpendPoliciesResponse
@@ -6382,13 +6575,12 @@ client.credits.count_billing_plan_credit_grants(
```ruby -client.credits.list_credit_event_ledger( +client.credits.list_credit_spend_policies( billing_credit_id: "billing_credit_id", company_id: "company_id", - end_time: "end_time", - event_type: "grant", - feature_id: "feature_id", - start_time: "start_time", + scope_type: "company", + user_id: "user_id", + user_ids: ["user_ids"], limit: 1000000, offset: 1000000 ) @@ -6422,15 +6614,7 @@ client.credits.list_credit_event_ledger(
-**end_time:** `String` - -
-
- -
-
- -**event_type:** `Schematic::Types::CreditEventType` +**scope_type:** `Schematic::Types::CreditSpendPolicyScope`
@@ -6438,7 +6622,7 @@ client.credits.list_credit_event_ledger(
-**feature_id:** `String` +**user_id:** `String`
@@ -6446,7 +6630,7 @@ client.credits.list_credit_event_ledger(
-**start_time:** `String` +**user_ids:** `String`
@@ -6482,7 +6666,7 @@ client.credits.list_credit_event_ledger(
-
client.credits.count_credit_event_ledger() -> Schematic::Credits::Types::CountCreditEventLedgerResponse +
client.credits.create_credit_spend_policy(request) -> Schematic::Credits::Types::CreateCreditSpendPolicyResponse
@@ -6495,15 +6679,9 @@ client.credits.list_credit_event_ledger(
```ruby -client.credits.count_credit_event_ledger( +client.credits.create_credit_spend_policy( billing_credit_id: "billing_credit_id", - company_id: "company_id", - end_time: "end_time", - event_type: "grant", - feature_id: "feature_id", - start_time: "start_time", - limit: 1000000, - offset: 1000000 + max_per_draw: 1.1 ) ```
@@ -6527,7 +6705,7 @@ client.credits.count_credit_event_ledger(
-**company_id:** `String` +**company_id:** `String` — The company the cap applies to. Set exactly one of company_id and user_id.
@@ -6535,7 +6713,7 @@ client.credits.count_credit_event_ledger(
-**end_time:** `String` +**label:** `String`
@@ -6543,7 +6721,7 @@ client.credits.count_credit_event_ledger(
-**event_type:** `Schematic::Types::CreditEventType` +**max_per_draw:** `Integer` — The largest number of credits a single draw may spend.
@@ -6551,7 +6729,7 @@ client.credits.count_credit_event_ledger(
-**feature_id:** `String` +**user_id:** `String` — The user the cap applies to. Set exactly one of company_id and user_id.
@@ -6559,23 +6737,47 @@ client.credits.count_credit_event_ledger(
-**start_time:** `String` +**request_options:** `Schematic::Credits::RequestOptions`
+ +
+ + + + +
+
client.credits.get_credit_spend_policy(spend_policy_id:) -> Schematic::Credits::Types::GetCreditSpendPolicyResponse
-**limit:** `Integer` — Page limit (default 100) - +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.credits.get_credit_spend_policy(spend_policy_id: "spend_policy_id") +```
+
+
+ +#### ⚙️ Parameters
-**offset:** `Integer` — Page offset (default 0) +
+
+ +**spend_policy_id:** `String` — spend_policy_id
@@ -6595,8 +6797,7 @@ client.credits.count_credit_event_ledger(
-## catalogs -
client.catalogs.list_catalogs() -> Schematic::Catalogs::Types::ListCatalogsResponse +
client.credits.update_credit_spend_policy(spend_policy_id:, request) -> Schematic::Credits::Types::UpdateCreditSpendPolicyResponse
@@ -6609,12 +6810,7 @@ client.credits.count_credit_event_ledger(
```ruby -client.catalogs.list_catalogs( - is_default: true, - q: "q", - limit: 1000000, - offset: 1000000 -) +client.credits.update_credit_spend_policy(spend_policy_id: "spend_policy_id") ```
@@ -6629,7 +6825,7 @@ client.catalogs.list_catalogs(
-**is_default:** `Internal::Types::Boolean` +**spend_policy_id:** `String` — spend_policy_id
@@ -6637,7 +6833,7 @@ client.catalogs.list_catalogs(
-**q:** `String` — Search by catalog name +**label:** `String`
@@ -6645,7 +6841,7 @@ client.catalogs.list_catalogs(
-**limit:** `Integer` — Page limit (default 100) +**max_per_draw:** `Integer`
@@ -6653,7 +6849,455 @@ client.catalogs.list_catalogs(
-**offset:** `Integer` — Page offset (default 0) +**request_options:** `Schematic::Credits::RequestOptions` + +
+
+ + + + + + +
+ +
client.credits.delete_credit_spend_policy(spend_policy_id:) -> Schematic::Credits::Types::DeleteCreditSpendPolicyResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.credits.delete_credit_spend_policy(spend_policy_id: "spend_policy_id") +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**spend_policy_id:** `String` — spend_policy_id + +
+
+ +
+
+ +**request_options:** `Schematic::Credits::RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.credits.count_credit_spend_policies() -> Schematic::Credits::Types::CountCreditSpendPoliciesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.credits.count_credit_spend_policies( + billing_credit_id: "billing_credit_id", + company_id: "company_id", + scope_type: "company", + user_id: "user_id", + user_ids: ["user_ids"], + limit: 1000000, + offset: 1000000 +) +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**billing_credit_id:** `String` + +
+
+ +
+
+ +**company_id:** `String` + +
+
+ +
+
+ +**scope_type:** `Schematic::Types::CreditSpendPolicyScope` + +
+
+ +
+
+ +**user_id:** `String` + +
+
+ +
+
+ +**user_ids:** `String` + +
+
+ +
+
+ +**limit:** `Integer` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Integer` — Page offset (default 0) + +
+
+ +
+
+ +**request_options:** `Schematic::Credits::RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.credits.list_credit_event_ledger() -> Schematic::Credits::Types::ListCreditEventLedgerResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.credits.list_credit_event_ledger( + billing_credit_id: "billing_credit_id", + company_id: "company_id", + end_time: "end_time", + event_type: "grant", + feature_id: "feature_id", + start_time: "start_time", + limit: 1000000, + offset: 1000000 +) +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**billing_credit_id:** `String` + +
+
+ +
+
+ +**company_id:** `String` + +
+
+ +
+
+ +**end_time:** `String` + +
+
+ +
+
+ +**event_type:** `Schematic::Types::CreditEventType` + +
+
+ +
+
+ +**feature_id:** `String` + +
+
+ +
+
+ +**start_time:** `String` + +
+
+ +
+
+ +**limit:** `Integer` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Integer` — Page offset (default 0) + +
+
+ +
+
+ +**request_options:** `Schematic::Credits::RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.credits.count_credit_event_ledger() -> Schematic::Credits::Types::CountCreditEventLedgerResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.credits.count_credit_event_ledger( + billing_credit_id: "billing_credit_id", + company_id: "company_id", + end_time: "end_time", + event_type: "grant", + feature_id: "feature_id", + start_time: "start_time", + limit: 1000000, + offset: 1000000 +) +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**billing_credit_id:** `String` + +
+
+ +
+
+ +**company_id:** `String` + +
+
+ +
+
+ +**end_time:** `String` + +
+
+ +
+
+ +**event_type:** `Schematic::Types::CreditEventType` + +
+
+ +
+
+ +**feature_id:** `String` + +
+
+ +
+
+ +**start_time:** `String` + +
+
+ +
+
+ +**limit:** `Integer` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Integer` — Page offset (default 0) + +
+
+ +
+
+ +**request_options:** `Schematic::Credits::RequestOptions` + +
+
+
+
+ + +
+
+
+ +## catalogs +
client.catalogs.list_catalogs() -> Schematic::Catalogs::Types::ListCatalogsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.catalogs.list_catalogs( + is_default: true, + q: "q", + limit: 1000000, + offset: 1000000 +) +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**is_default:** `Internal::Types::Boolean` + +
+
+ +
+
+ +**q:** `String` — Search by catalog name + +
+
+ +
+
+ +**limit:** `Integer` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Integer` — Page offset (default 0)
@@ -17011,23 +17655,191 @@ client.events.list_events(
-```ruby -client.events.create_event(event_type: "flag_check") -``` -
-
+```ruby +client.events.create_event(event_type: "flag_check") +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic::Types::CreateEventRequestBody` + +
+
+ +
+
+ +**request_options:** `Schematic::Events::RequestOptions` + +
+
+
+
+ + + + +
+ +
client.events.get_event(event_id:) -> Schematic::Events::Types::GetEventResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.events.get_event(event_id: "event_id") +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**event_id:** `String` — event_id + +
+
+ +
+
+ +**request_options:** `Schematic::Events::RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.events.get_otlp_environment_settings() -> Schematic::Events::Types::GetOtlpEnvironmentSettingsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.events.get_otlp_environment_settings +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `Schematic::Events::RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.events.upsert_otlp_environment_settings(request) -> Schematic::Events::Types::UpsertOtlpEnvironmentSettingsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.events.upsert_otlp_environment_settings(tool_events_enabled: true) +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**company_attribute:** `String` + +
+
+ +
+
+ +**company_key:** `String` + +
+
+ +
+
+ +**tool_events_enabled:** `Internal::Types::Boolean` +
-#### ⚙️ Parameters -
+**user_attribute:** `String` + +
+
+
-**request:** `Schematic::Types::CreateEventRequestBody` +**user_key:** `String`
@@ -17047,7 +17859,7 @@ client.events.create_event(event_type: "flag_check")
-
client.events.get_event(event_id:) -> Schematic::Events::Types::GetEventResponse +
client.events.delete_otlp_environment_settings() -> Schematic::Events::Types::DeleteOtlpEnvironmentSettingsResponse
@@ -17060,7 +17872,7 @@ client.events.create_event(event_type: "flag_check")
```ruby -client.events.get_event(event_id: "event_id") +client.events.delete_otlp_environment_settings ```
@@ -17075,14 +17887,6 @@ client.events.get_event(event_id: "event_id")
-**event_id:** `String` — event_id - -
-
- -
-
- **request_options:** `Schematic::Events::RequestOptions`
@@ -19232,6 +20036,134 @@ client.integrationsapi.load_sample_data_set
+ + +
+ +
client.integrationsapi.get_stripe_sandbox_claim_link() -> Schematic::Integrationsapi::Types::GetStripeSandboxClaimLinkResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.integrationsapi.get_stripe_sandbox_claim_link +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `Schematic::Integrationsapi::RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.get_stripe_sandbox_keys() -> Schematic::Integrationsapi::Types::GetStripeSandboxKeysResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.integrationsapi.get_stripe_sandbox_keys +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `Schematic::Integrationsapi::RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.claim_stripe_sandbox_keys(request) -> Schematic::Integrationsapi::Types::ClaimStripeSandboxKeysResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.integrationsapi.claim_stripe_sandbox_keys(token: "token") +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**token:** `String` + +
+
+ +
+
+ +**request_options:** `Schematic::Integrationsapi::RequestOptions` + +
+
+
+
+ +
@@ -19328,6 +20260,118 @@ client.integrationsapi.install_stripe(type: "clerk") + + +
+ +
client.integrationsapi.install_stripe_claimable_sandbox(request) -> Schematic::Integrationsapi::Types::InstallStripeClaimableSandboxResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.integrationsapi.install_stripe_claimable_sandbox(email: "email") +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**country:** `String` + +
+
+ +
+
+ +**email:** `String` + +
+
+ +
+
+ +**name:** `String` + +
+
+ +
+
+ +**seed_sample_data:** `Internal::Types::Boolean` + +
+
+ +
+
+ +**request_options:** `Schematic::Integrationsapi::RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.list_stripe_sandbox_countries() -> Schematic::Integrationsapi::Types::ListStripeSandboxCountriesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.integrationsapi.list_stripe_sandbox_countries +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `Schematic::Integrationsapi::RequestOptions` + +
+
+
+
+ +
diff --git a/test/rules_engine_clock_test.rb b/test/rules_engine_clock_test.rb deleted file mode 100644 index 8711b5e..0000000 --- a/test/rules_engine_clock_test.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -require_relative "test_helper" -require "minitest/autorun" - -# Regression for SCHY-471. -# -# A company-override entitlement rule whose metric condition uses a -# calendar/billing metric period drives the engine into the metric-period-reset -# code path, which needs a wall clock. On the raw wasm32-unknown-unknown build -# that path used to trap (+wasm unreachable+); the flag then wrongly fell back to -# its default value for a company that is legitimately entitled. The host now -# injects the current time via +setCurrentTimeMillis+ so this evaluates cleanly. -class RulesEngineClockTest < Minitest::Test - def setup - @engine = Schematic::RulesEngine.new - @engine.initialize! - # The wasm binary is fetched via scripts/download-wasm.sh and may be absent - # (or the wasmtime gem missing) in some environments — skip rather than fail. - skip "WASM rules engine unavailable (wasm binary or wasmtime gem missing)" unless @engine.initialized? - end - - def flag - { - "id" => "flag1", "key" => "mcp-access", "account_id" => "acc_1", - "environment_id" => "env_1", "default_value" => false, "rules" => [] - } - end - - # Usage 40 < allocation 100, so the override grants the feature. - def entitled_company - { - "id" => "co_entitled", "account_id" => "acc_1", "environment_id" => "env_1", - "keys" => { "id" => "co_entitled" }, - "metrics" => [{ - "account_id" => "acc_1", "environment_id" => "env_1", "company_id" => "co_entitled", - "event_subtype" => "api-calls", "period" => "current_month", - "month_reset" => "billing_cycle", "value" => 40, "created_at" => "2023-01-01T00:00:00Z" - }], - "rules" => [{ - "id" => "rule_override", "flag_id" => "flag1", "account_id" => "acc_1", - "environment_id" => "env_1", "name" => "Company Override", - "rule_type" => "company_override", "priority" => 0, "value" => true, - "condition_groups" => [], - "conditions" => [ - { - "id" => "cond_company", "account_id" => "acc_1", "environment_id" => "env_1", - "condition_type" => "company", "operator" => "eq", - "resource_ids" => ["co_entitled"], "trait_value" => "" - }, - { - "id" => "cond_metric", "account_id" => "acc_1", "environment_id" => "env_1", - "condition_type" => "metric", "operator" => "lt", "event_subtype" => "api-calls", - "metric_value" => 100, "metric_period" => "current_month", - "metric_period_month_reset" => "billing_cycle", "trait_value" => "100" - } - ] - }] - } - end - - def test_billing_metric_override_evaluates_without_trapping - result = @engine.check_flag(flag, entitled_company) - - assert result[:value], "company override should grant the flag, not fall back to default false" - assert_match(/override/i, result[:reason].to_s) - end - - def test_billing_metric_override_populates_reset_at - result = @engine.check_flag(flag, entitled_company) - - refute_nil result[:feature_usage_reset_at], - "reset-at should be computed from the injected host time" - end -end From b9286bbc59c678efe416fa94d5931d1d6c2a1d1d Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Sat, 5 Sep 2026 06:36:57 +0000 Subject: [PATCH 2/2] [fern-replay] Applied customizations Patches applied (2): - patch-5da692c2: inject host time into datastream wasm rules engine (SCHY-471) - patch-ee61788c: fix rubocop offenses in clock regression test (SCHY-471) --- .fern/replay.lock | 12 ++++-- test/rules_engine_clock_test.rb | 75 +++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 test/rules_engine_clock_test.rb diff --git a/.fern/replay.lock b/.fern/replay.lock index 0e103c9..547a11a 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -78,14 +78,20 @@ generations: cli_version: unknown generator_versions: fernapi/fern-ruby-sdk: 1.23.2 -current_generation: 67f9937764d88f96352beba4a48e64bd6cd13afb + - commit_sha: d57c23ea04698dbe0f4b64fdf38a7a56aebc3b6e + tree_hash: d882e89d295bd48600db56e21a2a39a6e97e6dae + timestamp: 2026-09-05T06:36:54.355Z + cli_version: unknown + generator_versions: + fernapi/fern-ruby-sdk: 1.24.0 +current_generation: d57c23ea04698dbe0f4b64fdf38a7a56aebc3b6e patches: - id: patch-5da692c2 content_hash: sha256:e652287219a0a709e16112ced444e6472c6fa8bdfe888edf868caaf9769a9472 original_commit: 5da692c20aef08577d900f9a860b5f78a549418e original_message: inject host time into datastream wasm rules engine (SCHY-471) original_author: Christopher Brady - base_generation: 67f9937764d88f96352beba4a48e64bd6cd13afb + base_generation: d57c23ea04698dbe0f4b64fdf38a7a56aebc3b6e files: - test/rules_engine_clock_test.rb patch_content: | @@ -253,7 +259,7 @@ patches: original_commit: ee61788c5a83fce5dd5768b2536391459550d176 original_message: fix rubocop offenses in clock regression test (SCHY-471) original_author: Christopher Brady - base_generation: 67f9937764d88f96352beba4a48e64bd6cd13afb + base_generation: d57c23ea04698dbe0f4b64fdf38a7a56aebc3b6e files: - test/rules_engine_clock_test.rb patch_content: | diff --git a/test/rules_engine_clock_test.rb b/test/rules_engine_clock_test.rb new file mode 100644 index 0000000..8711b5e --- /dev/null +++ b/test/rules_engine_clock_test.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +require_relative "test_helper" +require "minitest/autorun" + +# Regression for SCHY-471. +# +# A company-override entitlement rule whose metric condition uses a +# calendar/billing metric period drives the engine into the metric-period-reset +# code path, which needs a wall clock. On the raw wasm32-unknown-unknown build +# that path used to trap (+wasm unreachable+); the flag then wrongly fell back to +# its default value for a company that is legitimately entitled. The host now +# injects the current time via +setCurrentTimeMillis+ so this evaluates cleanly. +class RulesEngineClockTest < Minitest::Test + def setup + @engine = Schematic::RulesEngine.new + @engine.initialize! + # The wasm binary is fetched via scripts/download-wasm.sh and may be absent + # (or the wasmtime gem missing) in some environments — skip rather than fail. + skip "WASM rules engine unavailable (wasm binary or wasmtime gem missing)" unless @engine.initialized? + end + + def flag + { + "id" => "flag1", "key" => "mcp-access", "account_id" => "acc_1", + "environment_id" => "env_1", "default_value" => false, "rules" => [] + } + end + + # Usage 40 < allocation 100, so the override grants the feature. + def entitled_company + { + "id" => "co_entitled", "account_id" => "acc_1", "environment_id" => "env_1", + "keys" => { "id" => "co_entitled" }, + "metrics" => [{ + "account_id" => "acc_1", "environment_id" => "env_1", "company_id" => "co_entitled", + "event_subtype" => "api-calls", "period" => "current_month", + "month_reset" => "billing_cycle", "value" => 40, "created_at" => "2023-01-01T00:00:00Z" + }], + "rules" => [{ + "id" => "rule_override", "flag_id" => "flag1", "account_id" => "acc_1", + "environment_id" => "env_1", "name" => "Company Override", + "rule_type" => "company_override", "priority" => 0, "value" => true, + "condition_groups" => [], + "conditions" => [ + { + "id" => "cond_company", "account_id" => "acc_1", "environment_id" => "env_1", + "condition_type" => "company", "operator" => "eq", + "resource_ids" => ["co_entitled"], "trait_value" => "" + }, + { + "id" => "cond_metric", "account_id" => "acc_1", "environment_id" => "env_1", + "condition_type" => "metric", "operator" => "lt", "event_subtype" => "api-calls", + "metric_value" => 100, "metric_period" => "current_month", + "metric_period_month_reset" => "billing_cycle", "trait_value" => "100" + } + ] + }] + } + end + + def test_billing_metric_override_evaluates_without_trapping + result = @engine.check_flag(flag, entitled_company) + + assert result[:value], "company override should grant the flag, not fall back to default false" + assert_match(/override/i, result[:reason].to_s) + end + + def test_billing_metric_override_populates_reset_at + result = @engine.check_flag(flag, entitled_company) + + refute_nil result[:feature_usage_reset_at], + "reset-at should be computed from the injected host time" + end +end