From 978d72611279b55eea819fff774fd96b58dcc6b4 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 10 Aug 2026 10:29:01 +0000 Subject: [PATCH 1/2] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-ruby-sdk: 1.1.13 --- .fern/metadata.json | 4 +- Gemfile.lock | 20 +-- lib/schematic.rb | 9 ++ lib/schematic/client.rb | 2 +- lib/schematic/companies/client.rb | 76 +++++++++++ .../types/count_entity_keys_params.rb | 15 +++ .../types/count_entity_keys_request.rb | 14 ++ .../types/count_entity_keys_response.rb | 12 ++ .../delete_entity_key_definition_response.rb | 12 ++ lib/schematic/types/billing_credit_view.rb | 2 +- .../billing_product_record_response_data.rb | 17 +++ .../company_feature_usage_export_metadata.rb | 5 +- ...ge_export_metadata_sort_order_direction.rb | 12 ++ ...ge_export_metadata_visible_columns_item.rb | 14 ++ lib/schematic/types/data_export_metadata.rb | 1 + lib/schematic/types/data_export_type.rb | 1 + lib/schematic/types/event_export_metadata.rb | 16 +++ .../event_export_metadata_event_types_item.rb | 14 ++ lib/schematic/types/feature_view.rb | 2 +- .../types/test_webhook_response_data.rb | 1 + lib/schematic/version.rb | 2 +- reference.md | 125 ++++++++++++++++++ test/rules_engine_clock_test.rb | 75 ----------- 23 files changed, 359 insertions(+), 92 deletions(-) create mode 100644 lib/schematic/companies/types/count_entity_keys_params.rb create mode 100644 lib/schematic/companies/types/count_entity_keys_request.rb create mode 100644 lib/schematic/companies/types/count_entity_keys_response.rb create mode 100644 lib/schematic/companies/types/delete_entity_key_definition_response.rb create mode 100644 lib/schematic/types/billing_product_record_response_data.rb create mode 100644 lib/schematic/types/company_feature_usage_export_metadata_sort_order_direction.rb create mode 100644 lib/schematic/types/company_feature_usage_export_metadata_visible_columns_item.rb create mode 100644 lib/schematic/types/event_export_metadata.rb create mode 100644 lib/schematic/types/event_export_metadata_event_types_item.rb delete mode 100644 test/rules_engine_clock_test.rb diff --git a/.fern/metadata.json b/.fern/metadata.json index 168e99f..d45d34c 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -13,6 +13,6 @@ "webrick": ">= 1.0" } }, - "originGitCommit": "a9fc73b97dcfa602bff97a7d41d980a55c9c9030", - "sdkVersion": "1.4.12" + "originGitCommit": "8cfe954dda14329fc30a4f80b915db0acf608382", + "sdkVersion": "1.4.13" } \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index fed6652..3415e26 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - schematichq (1.4.12) + schematichq (1.4.13) wasmtime (>= 19.0) websocket (>= 1.2) @@ -17,7 +17,7 @@ GEM bigdecimal rexml hashdiff (1.2.1) - io-console (0.8.2) + io-console (0.9.2) json (2.21.2) language_server-protocol (3.17.0.6) lint_roller (1.1.0) @@ -39,10 +39,10 @@ GEM rainbow (3.1.1) rake (13.4.2) regexp_parser (2.12.0) - reline (0.6.3) + reline (0.7.0) io-console (~> 0.5) rexml (3.4.4) - rubocop (1.88.2) + rubocop (1.89.0) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -64,12 +64,12 @@ GEM unicode-display_width (3.2.0) unicode-emoji (~> 4.1) unicode-emoji (4.2.0) - wasmtime (46.0.0-aarch64-linux) - wasmtime (46.0.0-aarch64-linux-musl) - wasmtime (46.0.0-arm64-darwin) - wasmtime (46.0.0-x86_64-darwin) - wasmtime (46.0.0-x86_64-linux) - wasmtime (46.0.0-x86_64-linux-musl) + wasmtime (47.0.3-aarch64-linux) + wasmtime (47.0.3-aarch64-linux-musl) + wasmtime (47.0.3-arm64-darwin) + wasmtime (47.0.3-x86_64-darwin) + wasmtime (47.0.3-x86_64-linux) + wasmtime (47.0.3-x86_64-linux-musl) webmock (3.26.2) addressable (>= 2.8.0) crack (>= 0.3.2) diff --git a/lib/schematic.rb b/lib/schematic.rb index 147e8eb..9b3b251 100644 --- a/lib/schematic.rb +++ b/lib/schematic.rb @@ -269,6 +269,7 @@ require_relative "schematic/types/checkout_subscription" require_relative "schematic/checkout/types/checkout_internal_response" require_relative "schematic/types/billing_credit_ledger_authority" +require_relative "schematic/types/billing_product_record_response_data" require_relative "schematic/types/credit_currency_price" require_relative "schematic/types/billing_credit_view" require_relative "schematic/types/billing_product_for_subscription_response_data" @@ -355,8 +356,11 @@ require_relative "schematic/companies/types/upsert_company_trait_response" require_relative "schematic/companies/types/list_entity_key_definitions_params" require_relative "schematic/companies/types/list_entity_key_definitions_response" +require_relative "schematic/companies/types/delete_entity_key_definition_response" require_relative "schematic/companies/types/count_entity_key_definitions_params" require_relative "schematic/companies/types/count_entity_key_definitions_response" +require_relative "schematic/companies/types/count_entity_keys_params" +require_relative "schematic/companies/types/count_entity_keys_response" require_relative "schematic/companies/types/list_entity_trait_definitions_params" require_relative "schematic/companies/types/list_entity_trait_definitions_response" require_relative "schematic/companies/types/get_or_create_entity_trait_definition_response" @@ -521,7 +525,11 @@ require_relative "schematic/types/data_export_type" require_relative "schematic/dataexports/types/list_data_exports_params" require_relative "schematic/types/audit_log_export_metadata" +require_relative "schematic/types/company_feature_usage_export_metadata_sort_order_direction" +require_relative "schematic/types/company_feature_usage_export_metadata_visible_columns_item" require_relative "schematic/types/company_feature_usage_export_metadata" +require_relative "schematic/types/event_export_metadata_event_types_item" +require_relative "schematic/types/event_export_metadata" require_relative "schematic/types/data_export_metadata" require_relative "schematic/types/data_export_output_file_type" require_relative "schematic/types/data_export_response_data" @@ -895,6 +903,7 @@ require_relative "schematic/companies/types/get_active_company_subscription_request" require_relative "schematic/companies/types/list_entity_key_definitions_request" require_relative "schematic/companies/types/count_entity_key_definitions_request" +require_relative "schematic/companies/types/count_entity_keys_request" require_relative "schematic/companies/types/list_entity_trait_definitions_request" require_relative "schematic/companies/types/create_entity_trait_definition_request_body" require_relative "schematic/companies/types/update_entity_trait_definition_request_body" diff --git a/lib/schematic/client.rb b/lib/schematic/client.rb index 6ebf58b..3f6f11c 100644 --- a/lib/schematic/client.rb +++ b/lib/schematic/client.rb @@ -10,7 +10,7 @@ def initialize(api_key:, base_url: nil) @raw_client = Schematic::Internal::Http::RawClient.new( base_url: base_url || Schematic::Environment::DEFAULT, headers: { - "User-Agent" => "schematichq/1.4.12", + "User-Agent" => "schematichq/1.4.13", "X-Fern-Language" => "Ruby", "X-Schematic-Api-Key" => api_key.to_s } diff --git a/lib/schematic/companies/client.rb b/lib/schematic/companies/client.rb index 897c049..3263dc5 100644 --- a/lib/schematic/companies/client.rb +++ b/lib/schematic/companies/client.rb @@ -681,6 +681,38 @@ def list_entity_key_definitions(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] :entity_key_definition_id + # + # @return [Schematic::Companies::Types::DeleteEntityKeyDefinitionResponse] + def delete_entity_key_definition(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: "entity-key-definitions/#{URI.encode_uri_component(params[:entity_key_definition_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::Companies::Types::DeleteEntityKeyDefinitionResponse.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 @@ -727,6 +759,50 @@ def count_entity_key_definitions(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] :definition_id + # @option params [Schematic::Types::EntityType, nil] :entity_type + # @option params [Integer, nil] :limit + # @option params [Integer, nil] :offset + # + # @return [Schematic::Companies::Types::CountEntityKeysResponse] + def count_entity_keys(request_options: {}, **params) + params = Schematic::Internal::Types::Utils.normalize_keys(params) + query_param_names = %i[definition_id entity_type limit offset] + query_params = {} + query_params["definition_id"] = params[:definition_id] if params.key?(:definition_id) + query_params["entity_type"] = params[:entity_type] if params.key?(:entity_type) + query_params["limit"] = params[:limit] if params.key?(:limit) + query_params["offset"] = params[:offset] if params.key?(:offset) + params.except(*query_param_names) + + request = Schematic::Internal::JSON::Request.new( + base_url: request_options[:base_url], + method: "GET", + path: "entity-keys/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::Companies::Types::CountEntityKeysResponse.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/companies/types/count_entity_keys_params.rb b/lib/schematic/companies/types/count_entity_keys_params.rb new file mode 100644 index 0000000..faeff7a --- /dev/null +++ b/lib/schematic/companies/types/count_entity_keys_params.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Schematic + module Companies + module Types + # Input parameters + class CountEntityKeysParams < Internal::Types::Model + field :definition_id, -> { String }, optional: true, nullable: false + field :entity_type, -> { Schematic::Types::EntityType }, 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/companies/types/count_entity_keys_request.rb b/lib/schematic/companies/types/count_entity_keys_request.rb new file mode 100644 index 0000000..a64bb04 --- /dev/null +++ b/lib/schematic/companies/types/count_entity_keys_request.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Schematic + module Companies + module Types + class CountEntityKeysRequest < Internal::Types::Model + field :definition_id, -> { String }, optional: true, nullable: false + field :entity_type, -> { Schematic::Types::EntityType }, 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/companies/types/count_entity_keys_response.rb b/lib/schematic/companies/types/count_entity_keys_response.rb new file mode 100644 index 0000000..90d69d0 --- /dev/null +++ b/lib/schematic/companies/types/count_entity_keys_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Schematic + module Companies + module Types + class CountEntityKeysResponse < Internal::Types::Model + field :data, -> { Schematic::Types::CountResponse }, optional: false, nullable: false + field :params, -> { Schematic::Companies::Types::CountEntityKeysParams }, optional: false, nullable: false + end + end + end +end diff --git a/lib/schematic/companies/types/delete_entity_key_definition_response.rb b/lib/schematic/companies/types/delete_entity_key_definition_response.rb new file mode 100644 index 0000000..22e8ae5 --- /dev/null +++ b/lib/schematic/companies/types/delete_entity_key_definition_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Schematic + module Companies + module Types + class DeleteEntityKeyDefinitionResponse < 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/types/billing_credit_view.rb b/lib/schematic/types/billing_credit_view.rb index 2f13501..3132d78 100644 --- a/lib/schematic/types/billing_credit_view.rb +++ b/lib/schematic/types/billing_credit_view.rb @@ -21,7 +21,7 @@ class BillingCreditView < Internal::Types::Model field :price, -> { Schematic::Types::BillingPriceView }, optional: true, nullable: false field :price_per_unit, -> { Integer }, optional: true, nullable: false field :price_per_unit_decimal, -> { String }, optional: true, nullable: false - field :product, -> { Schematic::Types::BillingProductResponseData }, optional: true, nullable: false + field :product, -> { Schematic::Types::BillingProductRecordResponseData }, optional: true, nullable: false field :singular_name, -> { String }, optional: true, nullable: false field :updated_at, -> { String }, optional: false, nullable: false end diff --git a/lib/schematic/types/billing_product_record_response_data.rb b/lib/schematic/types/billing_product_record_response_data.rb new file mode 100644 index 0000000..9b53e82 --- /dev/null +++ b/lib/schematic/types/billing_product_record_response_data.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Schematic + module Types + class BillingProductRecordResponseData < Internal::Types::Model + field :account_id, -> { String }, optional: false, nullable: false + field :created_at, -> { String }, optional: false, nullable: false + field :environment_id, -> { String }, optional: false, nullable: false + field :external_id, -> { String }, optional: false, nullable: false + field :id, -> { String }, optional: false, nullable: false + field :is_active, -> { Internal::Types::Boolean }, optional: false, nullable: false + field :name, -> { String }, optional: false, 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_feature_usage_export_metadata.rb b/lib/schematic/types/company_feature_usage_export_metadata.rb index 6a1b78e..c91e77c 100644 --- a/lib/schematic/types/company_feature_usage_export_metadata.rb +++ b/lib/schematic/types/company_feature_usage_export_metadata.rb @@ -5,7 +5,7 @@ module Types class CompanyFeatureUsageExportMetadata < Internal::Types::Model field :company_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false field :credit_type_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false - field :feature_ids, -> { Internal::Types::Array[String] }, optional: false, nullable: false + field :feature_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false field :has_scheduled_downgrade, -> { Internal::Types::Boolean }, optional: true, nullable: false field :monetized_subscriptions, -> { Internal::Types::Boolean }, optional: true, nullable: false field :notification_email_recipient_email_addresses, -> { Internal::Types::Array[String] }, optional: true, nullable: false @@ -13,8 +13,11 @@ class CompanyFeatureUsageExportMetadata < Internal::Types::Model field :plan_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false field :plan_version_id, -> { String }, optional: true, nullable: false field :q, -> { String }, optional: true, nullable: false + field :sort_order_column, -> { String }, optional: true, nullable: false + field :sort_order_direction, -> { Schematic::Types::CompanyFeatureUsageExportMetadataSortOrderDirection }, optional: true, nullable: false field :subscription_statuses, -> { Internal::Types::Array[String] }, optional: true, nullable: false field :subscription_types, -> { Internal::Types::Array[String] }, optional: true, nullable: false + field :visible_columns, -> { Internal::Types::Array[Schematic::Types::CompanyFeatureUsageExportMetadataVisibleColumnsItem] }, optional: true, nullable: false field :with_entitlement_for, -> { String }, optional: true, nullable: false field :with_subscription, -> { Internal::Types::Boolean }, optional: true, nullable: false field :without_feature_override_for, -> { String }, optional: true, nullable: false diff --git a/lib/schematic/types/company_feature_usage_export_metadata_sort_order_direction.rb b/lib/schematic/types/company_feature_usage_export_metadata_sort_order_direction.rb new file mode 100644 index 0000000..13253c7 --- /dev/null +++ b/lib/schematic/types/company_feature_usage_export_metadata_sort_order_direction.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Schematic + module Types + module CompanyFeatureUsageExportMetadataSortOrderDirection + extend Schematic::Internal::Types::Enum + + ASC = "asc" + DESC = "desc" + end + end +end diff --git a/lib/schematic/types/company_feature_usage_export_metadata_visible_columns_item.rb b/lib/schematic/types/company_feature_usage_export_metadata_visible_columns_item.rb new file mode 100644 index 0000000..b7b6e33 --- /dev/null +++ b/lib/schematic/types/company_feature_usage_export_metadata_visible_columns_item.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Schematic + module Types + module CompanyFeatureUsageExportMetadataVisibleColumnsItem + extend Schematic::Internal::Types::Enum + + PLAN = "plan" + SUBSCRIPTION = "subscription" + USERS = "users" + LAST_SEEN_AT = "last_seen_at" + end + end +end diff --git a/lib/schematic/types/data_export_metadata.rb b/lib/schematic/types/data_export_metadata.rb index 4fe6d11..399b8a4 100644 --- a/lib/schematic/types/data_export_metadata.rb +++ b/lib/schematic/types/data_export_metadata.rb @@ -9,6 +9,7 @@ class DataExportMetadata < Internal::Types::Model member -> { Schematic::Types::AuditLogExportMetadata }, key: "AUDIT_LOG" member -> { Schematic::Types::CompanyFeatureUsageExportMetadata }, key: "COMPANY_FEATURE_USAGE" + member -> { Schematic::Types::EventExportMetadata }, key: "EVENT" end end end diff --git a/lib/schematic/types/data_export_type.rb b/lib/schematic/types/data_export_type.rb index c1c7dd4..bd8f4cf 100644 --- a/lib/schematic/types/data_export_type.rb +++ b/lib/schematic/types/data_export_type.rb @@ -7,6 +7,7 @@ module DataExportType AUDIT_LOG = "audit-log" COMPANY_FEATURE_USAGE = "company-feature-usage" + EVENT = "event" end end end diff --git a/lib/schematic/types/event_export_metadata.rb b/lib/schematic/types/event_export_metadata.rb new file mode 100644 index 0000000..0511cda --- /dev/null +++ b/lib/schematic/types/event_export_metadata.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Schematic + module Types + class EventExportMetadata < Internal::Types::Model + field :company_id, -> { String }, optional: true, nullable: false + field :end_time, -> { String }, optional: true, nullable: false + field :event_subtype, -> { String }, optional: true, nullable: false + field :event_types, -> { Internal::Types::Array[Schematic::Types::EventExportMetadataEventTypesItem] }, optional: true, nullable: false + field :flag_id, -> { String }, optional: true, nullable: false + field :notification_email_recipient_email_addresses, -> { Internal::Types::Array[String] }, optional: true, nullable: false + field :start_time, -> { String }, optional: true, nullable: false + field :user_id, -> { String }, optional: true, nullable: false + end + end +end diff --git a/lib/schematic/types/event_export_metadata_event_types_item.rb b/lib/schematic/types/event_export_metadata_event_types_item.rb new file mode 100644 index 0000000..bef940d --- /dev/null +++ b/lib/schematic/types/event_export_metadata_event_types_item.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Schematic + module Types + module EventExportMetadataEventTypesItem + extend Schematic::Internal::Types::Enum + + FLAG_CHECK = "flag_check" + IDENTIFY = "identify" + INFERENCE = "inference" + TRACK = "track" + end + end +end diff --git a/lib/schematic/types/feature_view.rb b/lib/schematic/types/feature_view.rb index b658b8a..51833e9 100644 --- a/lib/schematic/types/feature_view.rb +++ b/lib/schematic/types/feature_view.rb @@ -5,7 +5,7 @@ module Types class FeatureView < Internal::Types::Model field :account_id, -> { String }, optional: false, nullable: false field :billing_linked_resource, -> { Schematic::Types::BillingLinkedResourceResponseData }, optional: true, nullable: false - field :billing_product, -> { Schematic::Types::BillingProductResponseData }, optional: true, nullable: false + field :billing_product, -> { Schematic::Types::BillingProductRecordResponseData }, optional: true, nullable: false field :created_at, -> { String }, optional: false, nullable: false field :description, -> { String }, optional: false, nullable: false field :event_subtype, -> { String }, optional: true, nullable: false diff --git a/lib/schematic/types/test_webhook_response_data.rb b/lib/schematic/types/test_webhook_response_data.rb index ce5f51d..027d5e7 100644 --- a/lib/schematic/types/test_webhook_response_data.rb +++ b/lib/schematic/types/test_webhook_response_data.rb @@ -3,6 +3,7 @@ module Schematic module Types class TestWebhookResponseData < Internal::Types::Model + field :failure_reason, -> { String }, optional: true, nullable: false field :response_code, -> { Integer }, optional: false, nullable: false field :success, -> { Internal::Types::Boolean }, optional: false, nullable: false end diff --git a/lib/schematic/version.rb b/lib/schematic/version.rb index f625f9e..9db4f09 100644 --- a/lib/schematic/version.rb +++ b/lib/schematic/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Schematic - VERSION = "1.4.12" + VERSION = "1.4.13" end diff --git a/reference.md b/reference.md index d387a29..e1a987e 100644 --- a/reference.md +++ b/reference.md @@ -9177,6 +9177,54 @@ client.companies.list_entity_key_definitions( + + + + +
client.companies.delete_entity_key_definition(entity_key_definition_id) -> Schematic::Companies::Types::DeleteEntityKeyDefinitionResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.companies.delete_entity_key_definition(entity_key_definition_id: "entity_key_definition_id") +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**entity_key_definition_id:** `String` — entity_key_definition_id + +
+
+ +
+
+ +**request_options:** `Schematic::Companies::RequestOptions` + +
+
+
+
+ +
@@ -9263,6 +9311,83 @@ client.companies.count_entity_key_definitions( + + + + +
client.companies.count_entity_keys() -> Schematic::Companies::Types::CountEntityKeysResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```ruby +client.companies.count_entity_keys( + definition_id: "definition_id", + entity_type: "company", + limit: 1000000, + offset: 1000000 +) +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**definition_id:** `String` + +
+
+ +
+
+ +**entity_type:** `Schematic::Types::EntityType` + +
+
+ +
+
+ +**limit:** `Integer` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Integer` — Page offset (default 0) + +
+
+ +
+
+ +**request_options:** `Schematic::Companies::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 52b9c9b14e2490beef483edd73a505e06c13c589 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 10 Aug 2026 10:29:01 +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 dfc8ec1..42a5f7f 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -54,14 +54,20 @@ generations: cli_version: unknown generator_versions: fernapi/fern-ruby-sdk: 1.1.13 -current_generation: 4c98e0c88a5af9323ad047925ea28dec7a8bf762 + - commit_sha: 08bb53f51fc9cf2cc4e0b0b303167d8d1e6fbf0e + tree_hash: 4d178b386600e95e5e5d3a0e8eca8f586421d8ec + timestamp: 2026-08-10T10:28:58.021Z + cli_version: unknown + generator_versions: + fernapi/fern-ruby-sdk: 1.1.13 +current_generation: 08bb53f51fc9cf2cc4e0b0b303167d8d1e6fbf0e 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: 4c98e0c88a5af9323ad047925ea28dec7a8bf762 + base_generation: 08bb53f51fc9cf2cc4e0b0b303167d8d1e6fbf0e files: - test/rules_engine_clock_test.rb patch_content: | @@ -229,7 +235,7 @@ patches: original_commit: ee61788c5a83fce5dd5768b2536391459550d176 original_message: fix rubocop offenses in clock regression test (SCHY-471) original_author: Christopher Brady - base_generation: 4c98e0c88a5af9323ad047925ea28dec7a8bf762 + base_generation: 08bb53f51fc9cf2cc4e0b0b303167d8d1e6fbf0e 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