schematichq 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.claude/settings.json +16 -0
- data/.claude/skills/pr-review/SKILL.md +129 -0
- data/.fern/metadata.json +18 -0
- data/.fernignore +21 -0
- data/.rubocop.yml +69 -0
- data/CLAUDE.md +45 -0
- data/LICENSE +21 -0
- data/README.md +639 -0
- data/Rakefile +20 -0
- data/WASM_VERSION +1 -0
- data/custom.gemspec.rb +10 -0
- data/lib/schematic/accesstokens/client.rb +46 -0
- data/lib/schematic/accesstokens/types/issue_temporary_access_token_request_body.rb +12 -0
- data/lib/schematic/accesstokens/types/issue_temporary_access_token_response.rb +12 -0
- data/lib/schematic/accounts/client.rb +604 -0
- data/lib/schematic/accounts/types/count_api_keys_params.rb +15 -0
- data/lib/schematic/accounts/types/count_api_keys_request.rb +14 -0
- data/lib/schematic/accounts/types/count_api_keys_response.rb +12 -0
- data/lib/schematic/accounts/types/count_audit_logs_params.rb +18 -0
- data/lib/schematic/accounts/types/count_audit_logs_request.rb +17 -0
- data/lib/schematic/accounts/types/count_audit_logs_response.rb +12 -0
- data/lib/schematic/accounts/types/create_api_key_request_body.rb +14 -0
- data/lib/schematic/accounts/types/create_api_key_response.rb +12 -0
- data/lib/schematic/accounts/types/create_environment_request_body.rb +12 -0
- data/lib/schematic/accounts/types/create_environment_response.rb +12 -0
- data/lib/schematic/accounts/types/delete_api_key_response.rb +12 -0
- data/lib/schematic/accounts/types/delete_environment_response.rb +12 -0
- data/lib/schematic/accounts/types/get_api_key_response.rb +12 -0
- data/lib/schematic/accounts/types/get_audit_log_response.rb +12 -0
- data/lib/schematic/accounts/types/get_environment_response.rb +12 -0
- data/lib/schematic/accounts/types/get_who_am_i_response.rb +12 -0
- data/lib/schematic/accounts/types/list_api_keys_params.rb +15 -0
- data/lib/schematic/accounts/types/list_api_keys_request.rb +14 -0
- data/lib/schematic/accounts/types/list_api_keys_response.rb +12 -0
- data/lib/schematic/accounts/types/list_audit_logs_params.rb +18 -0
- data/lib/schematic/accounts/types/list_audit_logs_request.rb +17 -0
- data/lib/schematic/accounts/types/list_audit_logs_response.rb +12 -0
- data/lib/schematic/accounts/types/list_environments_params.rb +14 -0
- data/lib/schematic/accounts/types/list_environments_request.rb +13 -0
- data/lib/schematic/accounts/types/list_environments_response.rb +12 -0
- data/lib/schematic/accounts/types/quickstart_response.rb +12 -0
- data/lib/schematic/accounts/types/update_api_key_request_body.rb +13 -0
- data/lib/schematic/accounts/types/update_api_key_response.rb +12 -0
- data/lib/schematic/accounts/types/update_environment_request_body.rb +13 -0
- data/lib/schematic/accounts/types/update_environment_response.rb +12 -0
- data/lib/schematic/billing/client.rb +862 -0
- data/lib/schematic/billing/types/count_billing_products_params.rb +23 -0
- data/lib/schematic/billing/types/count_billing_products_request.rb +22 -0
- data/lib/schematic/billing/types/count_billing_products_response.rb +12 -0
- data/lib/schematic/billing/types/count_customers_params.rb +17 -0
- data/lib/schematic/billing/types/count_customers_request.rb +16 -0
- data/lib/schematic/billing/types/count_customers_response.rb +12 -0
- data/lib/schematic/billing/types/create_billing_customer_request_body.rb +17 -0
- data/lib/schematic/billing/types/create_billing_price_request_body.rb +25 -0
- data/lib/schematic/billing/types/create_billing_product_request_body.rb +15 -0
- data/lib/schematic/billing/types/create_billing_subscription_request_body.rb +29 -0
- data/lib/schematic/billing/types/create_coupon_request_body.rb +19 -0
- data/lib/schematic/billing/types/create_invoice_request_body.rb +23 -0
- data/lib/schematic/billing/types/create_meter_request_body.rb +14 -0
- data/lib/schematic/billing/types/create_payment_method_request_body.rb +22 -0
- data/lib/schematic/billing/types/delete_billing_product_response.rb +12 -0
- data/lib/schematic/billing/types/delete_product_price_response.rb +12 -0
- data/lib/schematic/billing/types/list_billing_prices_params.rb +27 -0
- data/lib/schematic/billing/types/list_billing_prices_request.rb +26 -0
- data/lib/schematic/billing/types/list_billing_prices_response.rb +12 -0
- data/lib/schematic/billing/types/list_billing_product_prices_params.rb +27 -0
- data/lib/schematic/billing/types/list_billing_product_prices_request.rb +26 -0
- data/lib/schematic/billing/types/list_billing_product_prices_response.rb +12 -0
- data/lib/schematic/billing/types/list_billing_products_params.rb +23 -0
- data/lib/schematic/billing/types/list_billing_products_request.rb +22 -0
- data/lib/schematic/billing/types/list_billing_products_response.rb +12 -0
- data/lib/schematic/billing/types/list_coupons_params.rb +15 -0
- data/lib/schematic/billing/types/list_coupons_request.rb +14 -0
- data/lib/schematic/billing/types/list_coupons_response.rb +12 -0
- data/lib/schematic/billing/types/list_customers_with_subscriptions_params.rb +17 -0
- data/lib/schematic/billing/types/list_customers_with_subscriptions_request.rb +16 -0
- data/lib/schematic/billing/types/list_customers_with_subscriptions_response.rb +12 -0
- data/lib/schematic/billing/types/list_invoices_params.rb +16 -0
- data/lib/schematic/billing/types/list_invoices_request.rb +15 -0
- data/lib/schematic/billing/types/list_invoices_response.rb +12 -0
- data/lib/schematic/billing/types/list_meters_params.rb +14 -0
- data/lib/schematic/billing/types/list_meters_request.rb +13 -0
- data/lib/schematic/billing/types/list_meters_response.rb +12 -0
- data/lib/schematic/billing/types/list_payment_methods_params.rb +15 -0
- data/lib/schematic/billing/types/list_payment_methods_request.rb +14 -0
- data/lib/schematic/billing/types/list_payment_methods_response.rb +12 -0
- data/lib/schematic/billing/types/upsert_billing_coupon_response.rb +12 -0
- data/lib/schematic/billing/types/upsert_billing_customer_response.rb +12 -0
- data/lib/schematic/billing/types/upsert_billing_meter_response.rb +12 -0
- data/lib/schematic/billing/types/upsert_billing_price_response.rb +12 -0
- data/lib/schematic/billing/types/upsert_billing_product_response.rb +12 -0
- data/lib/schematic/billing/types/upsert_billing_subscription_response.rb +12 -0
- data/lib/schematic/billing/types/upsert_invoice_response.rb +12 -0
- data/lib/schematic/billing/types/upsert_payment_method_response.rb +12 -0
- data/lib/schematic/cache.rb +133 -0
- data/lib/schematic/checkout/client.rb +243 -0
- data/lib/schematic/checkout/types/cancel_subscription_request.rb +13 -0
- data/lib/schematic/checkout/types/cancel_subscription_response.rb +12 -0
- data/lib/schematic/checkout/types/checkout_data_request_body.rb +12 -0
- data/lib/schematic/checkout/types/checkout_internal_response.rb +12 -0
- data/lib/schematic/checkout/types/get_checkout_data_response.rb +12 -0
- data/lib/schematic/checkout/types/manage_plan_response.rb +12 -0
- data/lib/schematic/checkout/types/preview_checkout_internal_response.rb +12 -0
- data/lib/schematic/checkout/types/preview_manage_plan_response.rb +12 -0
- data/lib/schematic/checkout/types/update_customer_subscription_trial_end_response.rb +12 -0
- data/lib/schematic/checkout/types/update_trial_end_request_body.rb +12 -0
- data/lib/schematic/client.rb +110 -0
- data/lib/schematic/companies/client.rb +1561 -0
- data/lib/schematic/companies/types/count_companies_params.rb +29 -0
- data/lib/schematic/companies/types/count_companies_request.rb +28 -0
- data/lib/schematic/companies/types/count_companies_response.rb +12 -0
- data/lib/schematic/companies/types/count_entity_key_definitions_params.rb +16 -0
- data/lib/schematic/companies/types/count_entity_key_definitions_request.rb +15 -0
- data/lib/schematic/companies/types/count_entity_key_definitions_response.rb +12 -0
- data/lib/schematic/companies/types/count_entity_trait_definitions_params.rb +18 -0
- data/lib/schematic/companies/types/count_entity_trait_definitions_request.rb +17 -0
- data/lib/schematic/companies/types/count_entity_trait_definitions_response.rb +12 -0
- data/lib/schematic/companies/types/count_plan_traits_params.rb +17 -0
- data/lib/schematic/companies/types/count_plan_traits_request.rb +16 -0
- data/lib/schematic/companies/types/count_plan_traits_response.rb +12 -0
- data/lib/schematic/companies/types/count_users_params.rb +17 -0
- data/lib/schematic/companies/types/count_users_request.rb +16 -0
- data/lib/schematic/companies/types/count_users_response.rb +12 -0
- data/lib/schematic/companies/types/create_company_response.rb +12 -0
- data/lib/schematic/companies/types/create_entity_trait_definition_request_body.rb +14 -0
- data/lib/schematic/companies/types/create_plan_trait_request_body.rb +13 -0
- data/lib/schematic/companies/types/create_plan_trait_response.rb +12 -0
- data/lib/schematic/companies/types/create_user_response.rb +12 -0
- data/lib/schematic/companies/types/delete_company_by_keys_response.rb +12 -0
- data/lib/schematic/companies/types/delete_company_membership_response.rb +12 -0
- data/lib/schematic/companies/types/delete_company_params.rb +13 -0
- data/lib/schematic/companies/types/delete_company_request.rb +13 -0
- data/lib/schematic/companies/types/delete_company_response.rb +12 -0
- data/lib/schematic/companies/types/delete_plan_trait_response.rb +12 -0
- data/lib/schematic/companies/types/delete_user_by_keys_response.rb +12 -0
- data/lib/schematic/companies/types/delete_user_response.rb +12 -0
- data/lib/schematic/companies/types/get_active_company_subscription_params.rb +15 -0
- data/lib/schematic/companies/types/get_active_company_subscription_request.rb +14 -0
- data/lib/schematic/companies/types/get_active_company_subscription_response.rb +12 -0
- data/lib/schematic/companies/types/get_company_response.rb +12 -0
- data/lib/schematic/companies/types/get_entity_trait_definition_response.rb +12 -0
- data/lib/schematic/companies/types/get_entity_trait_values_params.rb +15 -0
- data/lib/schematic/companies/types/get_entity_trait_values_request.rb +14 -0
- data/lib/schematic/companies/types/get_entity_trait_values_response.rb +12 -0
- data/lib/schematic/companies/types/get_or_create_company_membership_request_body.rb +12 -0
- data/lib/schematic/companies/types/get_or_create_company_membership_response.rb +12 -0
- data/lib/schematic/companies/types/get_or_create_entity_trait_definition_response.rb +12 -0
- data/lib/schematic/companies/types/get_plan_change_response.rb +12 -0
- data/lib/schematic/companies/types/get_plan_trait_response.rb +12 -0
- data/lib/schematic/companies/types/get_user_response.rb +12 -0
- data/lib/schematic/companies/types/list_companies_params.rb +29 -0
- data/lib/schematic/companies/types/list_companies_request.rb +28 -0
- data/lib/schematic/companies/types/list_companies_response.rb +12 -0
- data/lib/schematic/companies/types/list_company_memberships_params.rb +15 -0
- data/lib/schematic/companies/types/list_company_memberships_request.rb +14 -0
- data/lib/schematic/companies/types/list_company_memberships_response.rb +12 -0
- data/lib/schematic/companies/types/list_entity_key_definitions_params.rb +16 -0
- data/lib/schematic/companies/types/list_entity_key_definitions_request.rb +15 -0
- data/lib/schematic/companies/types/list_entity_key_definitions_response.rb +12 -0
- data/lib/schematic/companies/types/list_entity_trait_definitions_params.rb +18 -0
- data/lib/schematic/companies/types/list_entity_trait_definitions_request.rb +17 -0
- data/lib/schematic/companies/types/list_entity_trait_definitions_response.rb +12 -0
- data/lib/schematic/companies/types/list_plan_changes_params.rb +18 -0
- data/lib/schematic/companies/types/list_plan_changes_request.rb +17 -0
- data/lib/schematic/companies/types/list_plan_changes_response.rb +12 -0
- data/lib/schematic/companies/types/list_plan_traits_params.rb +17 -0
- data/lib/schematic/companies/types/list_plan_traits_request.rb +16 -0
- data/lib/schematic/companies/types/list_plan_traits_response.rb +12 -0
- data/lib/schematic/companies/types/list_users_params.rb +17 -0
- data/lib/schematic/companies/types/list_users_request.rb +16 -0
- data/lib/schematic/companies/types/list_users_response.rb +12 -0
- data/lib/schematic/companies/types/lookup_company_params.rb +12 -0
- data/lib/schematic/companies/types/lookup_company_request.rb +11 -0
- data/lib/schematic/companies/types/lookup_company_response.rb +12 -0
- data/lib/schematic/companies/types/lookup_user_params.rb +12 -0
- data/lib/schematic/companies/types/lookup_user_request.rb +11 -0
- data/lib/schematic/companies/types/lookup_user_response.rb +12 -0
- data/lib/schematic/companies/types/update_entity_trait_definition_request_body.rb +13 -0
- data/lib/schematic/companies/types/update_entity_trait_definition_response.rb +12 -0
- data/lib/schematic/companies/types/update_plan_trait_bulk_request_body.rb +13 -0
- data/lib/schematic/companies/types/update_plan_trait_request_body.rb +13 -0
- data/lib/schematic/companies/types/update_plan_trait_response.rb +12 -0
- data/lib/schematic/companies/types/update_plan_traits_bulk_response.rb +12 -0
- data/lib/schematic/companies/types/upsert_company_response.rb +12 -0
- data/lib/schematic/companies/types/upsert_company_trait_response.rb +12 -0
- data/lib/schematic/companies/types/upsert_user_response.rb +12 -0
- data/lib/schematic/companies/types/upsert_user_trait_response.rb +12 -0
- data/lib/schematic/components/client.rb +271 -0
- data/lib/schematic/components/types/count_components_params.rb +14 -0
- data/lib/schematic/components/types/count_components_request.rb +13 -0
- data/lib/schematic/components/types/count_components_response.rb +12 -0
- data/lib/schematic/components/types/create_component_request_body.rb +13 -0
- data/lib/schematic/components/types/create_component_response.rb +12 -0
- data/lib/schematic/components/types/delete_component_response.rb +12 -0
- data/lib/schematic/components/types/get_component_response.rb +12 -0
- data/lib/schematic/components/types/list_components_params.rb +14 -0
- data/lib/schematic/components/types/list_components_request.rb +13 -0
- data/lib/schematic/components/types/list_components_response.rb +12 -0
- data/lib/schematic/components/types/preview_component_data_params.rb +13 -0
- data/lib/schematic/components/types/preview_component_data_request.rb +12 -0
- data/lib/schematic/components/types/preview_component_data_response.rb +12 -0
- data/lib/schematic/components/types/update_component_request_body.rb +15 -0
- data/lib/schematic/components/types/update_component_response.rb +12 -0
- data/lib/schematic/componentspublic/client.rb +45 -0
- data/lib/schematic/componentspublic/types/get_public_plans_response.rb +12 -0
- data/lib/schematic/credits/client.rb +1157 -0
- data/lib/schematic/credits/types/count_billing_credits_grants_params.rb +15 -0
- data/lib/schematic/credits/types/count_billing_credits_grants_request.rb +14 -0
- data/lib/schematic/credits/types/count_billing_credits_grants_response.rb +12 -0
- data/lib/schematic/credits/types/count_billing_credits_params.rb +15 -0
- data/lib/schematic/credits/types/count_billing_credits_request.rb +14 -0
- data/lib/schematic/credits/types/count_billing_credits_response.rb +12 -0
- data/lib/schematic/credits/types/count_billing_plan_credit_grants_params.rb +18 -0
- data/lib/schematic/credits/types/count_billing_plan_credit_grants_request.rb +17 -0
- data/lib/schematic/credits/types/count_billing_plan_credit_grants_response.rb +12 -0
- data/lib/schematic/credits/types/count_company_grants_params.rb +16 -0
- data/lib/schematic/credits/types/count_company_grants_request.rb +15 -0
- data/lib/schematic/credits/types/count_company_grants_response.rb +12 -0
- data/lib/schematic/credits/types/count_credit_bundles_params.rb +17 -0
- data/lib/schematic/credits/types/count_credit_bundles_request.rb +16 -0
- data/lib/schematic/credits/types/count_credit_bundles_response.rb +12 -0
- data/lib/schematic/credits/types/count_credit_event_ledger_params.rb +19 -0
- data/lib/schematic/credits/types/count_credit_event_ledger_request.rb +18 -0
- data/lib/schematic/credits/types/count_credit_event_ledger_response.rb +12 -0
- data/lib/schematic/credits/types/count_credit_ledger_params.rb +19 -0
- data/lib/schematic/credits/types/count_credit_ledger_request.rb +18 -0
- data/lib/schematic/credits/types/count_credit_ledger_response.rb +12 -0
- data/lib/schematic/credits/types/create_billing_credit_request_body.rb +23 -0
- data/lib/schematic/credits/types/create_billing_credit_response.rb +12 -0
- data/lib/schematic/credits/types/create_billing_plan_credit_grant_response.rb +12 -0
- data/lib/schematic/credits/types/create_company_credit_grant.rb +22 -0
- data/lib/schematic/credits/types/create_credit_bundle_request_body.rb +22 -0
- data/lib/schematic/credits/types/create_credit_bundle_response.rb +12 -0
- data/lib/schematic/credits/types/delete_billing_plan_credit_grant_params.rb +12 -0
- data/lib/schematic/credits/types/delete_billing_plan_credit_grant_request.rb +12 -0
- data/lib/schematic/credits/types/delete_billing_plan_credit_grant_response.rb +12 -0
- data/lib/schematic/credits/types/delete_credit_bundle_response.rb +12 -0
- data/lib/schematic/credits/types/get_credit_bundle_response.rb +12 -0
- data/lib/schematic/credits/types/get_enriched_credit_ledger_params.rb +19 -0
- data/lib/schematic/credits/types/get_enriched_credit_ledger_request.rb +18 -0
- data/lib/schematic/credits/types/get_enriched_credit_ledger_response.rb +12 -0
- data/lib/schematic/credits/types/get_single_billing_credit_response.rb +12 -0
- data/lib/schematic/credits/types/get_single_billing_plan_credit_grant_response.rb +12 -0
- data/lib/schematic/credits/types/grant_billing_credits_to_company_response.rb +12 -0
- data/lib/schematic/credits/types/list_billing_credits_params.rb +15 -0
- data/lib/schematic/credits/types/list_billing_credits_request.rb +14 -0
- data/lib/schematic/credits/types/list_billing_credits_response.rb +12 -0
- data/lib/schematic/credits/types/list_billing_plan_credit_grants_params.rb +18 -0
- data/lib/schematic/credits/types/list_billing_plan_credit_grants_request.rb +17 -0
- data/lib/schematic/credits/types/list_billing_plan_credit_grants_response.rb +12 -0
- data/lib/schematic/credits/types/list_company_grants_params.rb +16 -0
- data/lib/schematic/credits/types/list_company_grants_request.rb +15 -0
- data/lib/schematic/credits/types/list_company_grants_response.rb +12 -0
- data/lib/schematic/credits/types/list_credit_bundles_params.rb +17 -0
- data/lib/schematic/credits/types/list_credit_bundles_request.rb +16 -0
- data/lib/schematic/credits/types/list_credit_bundles_response.rb +12 -0
- data/lib/schematic/credits/types/list_credit_event_ledger_params.rb +19 -0
- data/lib/schematic/credits/types/list_credit_event_ledger_request.rb +18 -0
- data/lib/schematic/credits/types/list_credit_event_ledger_response.rb +12 -0
- data/lib/schematic/credits/types/list_grants_for_credit_params.rb +15 -0
- data/lib/schematic/credits/types/list_grants_for_credit_request.rb +14 -0
- data/lib/schematic/credits/types/list_grants_for_credit_response.rb +12 -0
- data/lib/schematic/credits/types/soft_delete_billing_credit_response.rb +12 -0
- data/lib/schematic/credits/types/update_billing_credit_request_body.rb +23 -0
- data/lib/schematic/credits/types/update_billing_credit_response.rb +12 -0
- data/lib/schematic/credits/types/update_billing_plan_credit_grant_response.rb +12 -0
- data/lib/schematic/credits/types/update_credit_bundle_details_request_body.rb +20 -0
- data/lib/schematic/credits/types/update_credit_bundle_details_response.rb +12 -0
- data/lib/schematic/credits/types/zero_out_grant_request_body.rb +12 -0
- data/lib/schematic/credits/types/zero_out_grant_response.rb +12 -0
- data/lib/schematic/dataexports/client.rb +76 -0
- data/lib/schematic/dataexports/types/create_data_export_request_body.rb +13 -0
- data/lib/schematic/dataexports/types/create_data_export_response.rb +12 -0
- data/lib/schematic/datastream/client.rb +508 -0
- data/lib/schematic/datastream/merge.rb +95 -0
- data/lib/schematic/datastream/resource_cache.rb +76 -0
- data/lib/schematic/datastream/websocket_client.rb +315 -0
- data/lib/schematic/entitlements/client.rb +900 -0
- data/lib/schematic/entitlements/types/count_company_overrides_params.rb +20 -0
- data/lib/schematic/entitlements/types/count_company_overrides_request.rb +19 -0
- data/lib/schematic/entitlements/types/count_company_overrides_response.rb +12 -0
- data/lib/schematic/entitlements/types/count_feature_companies_params.rb +15 -0
- data/lib/schematic/entitlements/types/count_feature_companies_request.rb +14 -0
- data/lib/schematic/entitlements/types/count_feature_companies_response.rb +12 -0
- data/lib/schematic/entitlements/types/count_feature_usage_params.rb +19 -0
- data/lib/schematic/entitlements/types/count_feature_usage_request.rb +18 -0
- data/lib/schematic/entitlements/types/count_feature_usage_response.rb +12 -0
- data/lib/schematic/entitlements/types/count_feature_users_params.rb +15 -0
- data/lib/schematic/entitlements/types/count_feature_users_request.rb +14 -0
- data/lib/schematic/entitlements/types/count_feature_users_response.rb +12 -0
- data/lib/schematic/entitlements/types/count_plan_entitlements_params.rb +22 -0
- data/lib/schematic/entitlements/types/count_plan_entitlements_request.rb +21 -0
- data/lib/schematic/entitlements/types/count_plan_entitlements_response.rb +12 -0
- data/lib/schematic/entitlements/types/create_company_override_request_body.rb +22 -0
- data/lib/schematic/entitlements/types/create_company_override_request_body_metric_period.rb +16 -0
- data/lib/schematic/entitlements/types/create_company_override_request_body_metric_period_month_reset.rb +14 -0
- data/lib/schematic/entitlements/types/create_company_override_response.rb +12 -0
- data/lib/schematic/entitlements/types/create_plan_entitlement_request_body.rb +38 -0
- data/lib/schematic/entitlements/types/create_plan_entitlement_request_body_metric_period.rb +16 -0
- data/lib/schematic/entitlements/types/create_plan_entitlement_request_body_metric_period_month_reset.rb +14 -0
- data/lib/schematic/entitlements/types/create_plan_entitlement_response.rb +12 -0
- data/lib/schematic/entitlements/types/delete_company_override_response.rb +12 -0
- data/lib/schematic/entitlements/types/delete_plan_entitlement_response.rb +12 -0
- data/lib/schematic/entitlements/types/duplicate_plan_entitlements_request_body.rb +12 -0
- data/lib/schematic/entitlements/types/duplicate_plan_entitlements_response.rb +12 -0
- data/lib/schematic/entitlements/types/get_company_override_response.rb +12 -0
- data/lib/schematic/entitlements/types/get_feature_usage_by_company_params.rb +12 -0
- data/lib/schematic/entitlements/types/get_feature_usage_by_company_request.rb +11 -0
- data/lib/schematic/entitlements/types/get_feature_usage_by_company_response.rb +12 -0
- data/lib/schematic/entitlements/types/get_feature_usage_time_series_params.rb +16 -0
- data/lib/schematic/entitlements/types/get_feature_usage_time_series_request.rb +15 -0
- data/lib/schematic/entitlements/types/get_feature_usage_time_series_response.rb +12 -0
- data/lib/schematic/entitlements/types/get_plan_entitlement_response.rb +12 -0
- data/lib/schematic/entitlements/types/list_company_overrides_params.rb +20 -0
- data/lib/schematic/entitlements/types/list_company_overrides_request.rb +19 -0
- data/lib/schematic/entitlements/types/list_company_overrides_response.rb +12 -0
- data/lib/schematic/entitlements/types/list_feature_companies_params.rb +15 -0
- data/lib/schematic/entitlements/types/list_feature_companies_request.rb +14 -0
- data/lib/schematic/entitlements/types/list_feature_companies_response.rb +12 -0
- data/lib/schematic/entitlements/types/list_feature_usage_params.rb +19 -0
- data/lib/schematic/entitlements/types/list_feature_usage_request.rb +18 -0
- data/lib/schematic/entitlements/types/list_feature_usage_response.rb +12 -0
- data/lib/schematic/entitlements/types/list_feature_users_params.rb +15 -0
- data/lib/schematic/entitlements/types/list_feature_users_request.rb +14 -0
- data/lib/schematic/entitlements/types/list_feature_users_response.rb +12 -0
- data/lib/schematic/entitlements/types/list_plan_entitlements_params.rb +22 -0
- data/lib/schematic/entitlements/types/list_plan_entitlements_request.rb +21 -0
- data/lib/schematic/entitlements/types/list_plan_entitlements_response.rb +12 -0
- data/lib/schematic/entitlements/types/update_company_override_request_body.rb +21 -0
- data/lib/schematic/entitlements/types/update_company_override_request_body_metric_period.rb +16 -0
- data/lib/schematic/entitlements/types/update_company_override_request_body_metric_period_month_reset.rb +14 -0
- data/lib/schematic/entitlements/types/update_company_override_response.rb +12 -0
- data/lib/schematic/entitlements/types/update_plan_entitlement_request_body.rb +36 -0
- data/lib/schematic/entitlements/types/update_plan_entitlement_request_body_metric_period.rb +16 -0
- data/lib/schematic/entitlements/types/update_plan_entitlement_request_body_metric_period_month_reset.rb +14 -0
- data/lib/schematic/entitlements/types/update_plan_entitlement_response.rb +12 -0
- data/lib/schematic/environment.rb +7 -0
- data/lib/schematic/errors/api_error.rb +8 -0
- data/lib/schematic/errors/client_error.rb +17 -0
- data/lib/schematic/errors/redirect_error.rb +8 -0
- data/lib/schematic/errors/response_error.rb +42 -0
- data/lib/schematic/errors/server_error.rb +11 -0
- data/lib/schematic/errors/timeout_error.rb +8 -0
- data/lib/schematic/event_buffer.rb +180 -0
- data/lib/schematic/events/client.rb +235 -0
- data/lib/schematic/events/types/create_event_batch_request_body.rb +11 -0
- data/lib/schematic/events/types/create_event_batch_response.rb +12 -0
- data/lib/schematic/events/types/create_event_response.rb +12 -0
- data/lib/schematic/events/types/get_event_response.rb +12 -0
- data/lib/schematic/events/types/get_event_summaries_params.rb +15 -0
- data/lib/schematic/events/types/get_event_summaries_request.rb +14 -0
- data/lib/schematic/events/types/get_event_summaries_response.rb +12 -0
- data/lib/schematic/events/types/get_segment_integration_status_response.rb +12 -0
- data/lib/schematic/events/types/list_events_params.rb +18 -0
- data/lib/schematic/events/types/list_events_request.rb +17 -0
- data/lib/schematic/events/types/list_events_response.rb +12 -0
- data/lib/schematic/features/client.rb +610 -0
- data/lib/schematic/features/types/check_flag_response.rb +12 -0
- data/lib/schematic/features/types/check_flags_bulk_request_body.rb +11 -0
- data/lib/schematic/features/types/check_flags_bulk_response.rb +12 -0
- data/lib/schematic/features/types/check_flags_response.rb +12 -0
- data/lib/schematic/features/types/count_features_params.rb +20 -0
- data/lib/schematic/features/types/count_features_request.rb +19 -0
- data/lib/schematic/features/types/count_features_response.rb +12 -0
- data/lib/schematic/features/types/count_flags_params.rb +16 -0
- data/lib/schematic/features/types/count_flags_request.rb +15 -0
- data/lib/schematic/features/types/count_flags_response.rb +12 -0
- data/lib/schematic/features/types/create_feature_request_body.rb +21 -0
- data/lib/schematic/features/types/create_feature_response.rb +12 -0
- data/lib/schematic/features/types/create_flag_response.rb +12 -0
- data/lib/schematic/features/types/delete_feature_response.rb +12 -0
- data/lib/schematic/features/types/delete_flag_response.rb +12 -0
- data/lib/schematic/features/types/get_feature_response.rb +12 -0
- data/lib/schematic/features/types/get_flag_response.rb +12 -0
- data/lib/schematic/features/types/list_features_params.rb +20 -0
- data/lib/schematic/features/types/list_features_request.rb +19 -0
- data/lib/schematic/features/types/list_features_response.rb +12 -0
- data/lib/schematic/features/types/list_flags_params.rb +16 -0
- data/lib/schematic/features/types/list_flags_request.rb +15 -0
- data/lib/schematic/features/types/list_flags_response.rb +12 -0
- data/lib/schematic/features/types/update_feature_request_body.rb +22 -0
- data/lib/schematic/features/types/update_feature_response.rb +12 -0
- data/lib/schematic/features/types/update_flag_response.rb +12 -0
- data/lib/schematic/features/types/update_flag_rules_request_body.rb +12 -0
- data/lib/schematic/features/types/update_flag_rules_response.rb +12 -0
- data/lib/schematic/internal/errors/constraint_error.rb +10 -0
- data/lib/schematic/internal/errors/type_error.rb +10 -0
- data/lib/schematic/internal/http/base_request.rb +51 -0
- data/lib/schematic/internal/http/raw_client.rb +214 -0
- data/lib/schematic/internal/iterators/cursor_item_iterator.rb +28 -0
- data/lib/schematic/internal/iterators/cursor_page_iterator.rb +51 -0
- data/lib/schematic/internal/iterators/item_iterator.rb +59 -0
- data/lib/schematic/internal/iterators/offset_item_iterator.rb +30 -0
- data/lib/schematic/internal/iterators/offset_page_iterator.rb +83 -0
- data/lib/schematic/internal/json/request.rb +41 -0
- data/lib/schematic/internal/json/serializable.rb +25 -0
- data/lib/schematic/internal/multipart/multipart_encoder.rb +141 -0
- data/lib/schematic/internal/multipart/multipart_form_data.rb +78 -0
- data/lib/schematic/internal/multipart/multipart_form_data_part.rb +51 -0
- data/lib/schematic/internal/multipart/multipart_request.rb +40 -0
- data/lib/schematic/internal/types/array.rb +47 -0
- data/lib/schematic/internal/types/boolean.rb +34 -0
- data/lib/schematic/internal/types/enum.rb +56 -0
- data/lib/schematic/internal/types/hash.rb +36 -0
- data/lib/schematic/internal/types/model/field.rb +38 -0
- data/lib/schematic/internal/types/model.rb +208 -0
- data/lib/schematic/internal/types/type.rb +35 -0
- data/lib/schematic/internal/types/union.rb +161 -0
- data/lib/schematic/internal/types/unknown.rb +15 -0
- data/lib/schematic/internal/types/utils.rb +116 -0
- data/lib/schematic/logger.rb +62 -0
- data/lib/schematic/planbundle/client.rb +83 -0
- data/lib/schematic/planbundle/types/create_plan_bundle_request_body.rb +15 -0
- data/lib/schematic/planbundle/types/create_plan_bundle_response.rb +12 -0
- data/lib/schematic/planbundle/types/update_plan_bundle_request_body.rb +17 -0
- data/lib/schematic/planbundle/types/update_plan_bundle_response.rb +12 -0
- data/lib/schematic/plangroups/client.rb +121 -0
- data/lib/schematic/plangroups/types/create_plan_group_request_body.rb +42 -0
- data/lib/schematic/plangroups/types/create_plan_group_response.rb +12 -0
- data/lib/schematic/plangroups/types/get_plan_group_params.rb +12 -0
- data/lib/schematic/plangroups/types/get_plan_group_request.rb +11 -0
- data/lib/schematic/plangroups/types/get_plan_group_response.rb +12 -0
- data/lib/schematic/plangroups/types/update_plan_group_request_body.rb +43 -0
- data/lib/schematic/plangroups/types/update_plan_group_response.rb +12 -0
- data/lib/schematic/planmigrations/client.rb +226 -0
- data/lib/schematic/planmigrations/types/count_company_migrations_params.rb +16 -0
- data/lib/schematic/planmigrations/types/count_company_migrations_request.rb +15 -0
- data/lib/schematic/planmigrations/types/count_company_migrations_response.rb +12 -0
- data/lib/schematic/planmigrations/types/count_migrations_params.rb +15 -0
- data/lib/schematic/planmigrations/types/count_migrations_request.rb +14 -0
- data/lib/schematic/planmigrations/types/count_migrations_response.rb +12 -0
- data/lib/schematic/planmigrations/types/get_migration_response.rb +12 -0
- data/lib/schematic/planmigrations/types/list_company_migrations_params.rb +16 -0
- data/lib/schematic/planmigrations/types/list_company_migrations_request.rb +15 -0
- data/lib/schematic/planmigrations/types/list_company_migrations_response.rb +12 -0
- data/lib/schematic/planmigrations/types/list_migrations_params.rb +15 -0
- data/lib/schematic/planmigrations/types/list_migrations_request.rb +14 -0
- data/lib/schematic/planmigrations/types/list_migrations_response.rb +12 -0
- data/lib/schematic/plans/client.rb +460 -0
- data/lib/schematic/plans/types/count_plans_params.rb +24 -0
- data/lib/schematic/plans/types/count_plans_request.rb +23 -0
- data/lib/schematic/plans/types/count_plans_response.rb +12 -0
- data/lib/schematic/plans/types/create_plan_response.rb +12 -0
- data/lib/schematic/plans/types/delete_plan_response.rb +12 -0
- data/lib/schematic/plans/types/delete_plan_version_params.rb +12 -0
- data/lib/schematic/plans/types/delete_plan_version_request.rb +12 -0
- data/lib/schematic/plans/types/delete_plan_version_response.rb +12 -0
- data/lib/schematic/plans/types/get_plan_params.rb +12 -0
- data/lib/schematic/plans/types/get_plan_request.rb +12 -0
- data/lib/schematic/plans/types/get_plan_response.rb +12 -0
- data/lib/schematic/plans/types/list_plan_issues_params.rb +13 -0
- data/lib/schematic/plans/types/list_plan_issues_request.rb +12 -0
- data/lib/schematic/plans/types/list_plan_issues_response.rb +12 -0
- data/lib/schematic/plans/types/list_plans_params.rb +24 -0
- data/lib/schematic/plans/types/list_plans_request.rb +23 -0
- data/lib/schematic/plans/types/list_plans_response.rb +12 -0
- data/lib/schematic/plans/types/publish_plan_version_request_body.rb +13 -0
- data/lib/schematic/plans/types/publish_plan_version_response.rb +12 -0
- data/lib/schematic/plans/types/update_company_plans_request_body.rb +13 -0
- data/lib/schematic/plans/types/update_company_plans_response.rb +12 -0
- data/lib/schematic/plans/types/update_plan_response.rb +12 -0
- data/lib/schematic/plans/types/upsert_billing_product_plan_response.rb +12 -0
- data/lib/schematic/redis_cache.rb +94 -0
- data/lib/schematic/rules_engine.rb +145 -0
- data/lib/schematic/scheduledcheckout/client.rb +159 -0
- data/lib/schematic/scheduledcheckout/types/create_scheduled_checkout_request.rb +14 -0
- data/lib/schematic/scheduledcheckout/types/create_scheduled_checkout_response.rb +12 -0
- data/lib/schematic/scheduledcheckout/types/get_scheduled_checkout_response.rb +12 -0
- data/lib/schematic/scheduledcheckout/types/list_scheduled_checkouts_params.rb +15 -0
- data/lib/schematic/scheduledcheckout/types/list_scheduled_checkouts_request.rb +14 -0
- data/lib/schematic/scheduledcheckout/types/list_scheduled_checkouts_response.rb +12 -0
- data/lib/schematic/scheduledcheckout/types/update_scheduled_checkout_request.rb +13 -0
- data/lib/schematic/scheduledcheckout/types/update_scheduled_checkout_response.rb +12 -0
- data/lib/schematic/schematic_client.rb +552 -0
- data/lib/schematic/types/actor_type.rb +15 -0
- data/lib/schematic/types/api_error.rb +9 -0
- data/lib/schematic/types/api_key_create_response_data.rb +18 -0
- data/lib/schematic/types/api_key_response_data.rb +17 -0
- data/lib/schematic/types/api_key_scope.rb +14 -0
- data/lib/schematic/types/audit_log_list_response_data.rb +23 -0
- data/lib/schematic/types/audit_log_response_data.rb +26 -0
- data/lib/schematic/types/billing_coupon_response_data.rb +25 -0
- data/lib/schematic/types/billing_credit_bundle_response_data.rb +29 -0
- data/lib/schematic/types/billing_credit_bundle_status.rb +12 -0
- data/lib/schematic/types/billing_credit_bundle_type.rb +23 -0
- data/lib/schematic/types/billing_credit_bundle_view.rb +28 -0
- data/lib/schematic/types/billing_credit_burn_strategy.rb +14 -0
- data/lib/schematic/types/billing_credit_expiry_type.rb +15 -0
- data/lib/schematic/types/billing_credit_expiry_unit.rb +12 -0
- data/lib/schematic/types/billing_credit_grant_reason.rb +15 -0
- data/lib/schematic/types/billing_credit_grant_response_data.rb +32 -0
- data/lib/schematic/types/billing_credit_grant_zeroed_out_reason.rb +14 -0
- data/lib/schematic/types/billing_credit_ledger_response_data.rb +14 -0
- data/lib/schematic/types/billing_credit_response_data.rb +24 -0
- data/lib/schematic/types/billing_credit_rollover_policy.rb +13 -0
- data/lib/schematic/types/billing_credit_view.rb +27 -0
- data/lib/schematic/types/billing_customer_response_data.rb +16 -0
- data/lib/schematic/types/billing_customer_subscription.rb +14 -0
- data/lib/schematic/types/billing_customer_with_subscriptions_response_data.rb +17 -0
- data/lib/schematic/types/billing_meter_response_data.rb +14 -0
- data/lib/schematic/types/billing_plan_credit_grant_reset_cadence.rb +14 -0
- data/lib/schematic/types/billing_plan_credit_grant_reset_start.rb +12 -0
- data/lib/schematic/types/billing_plan_credit_grant_reset_type.rb +12 -0
- data/lib/schematic/types/billing_plan_credit_grant_response_data.rb +34 -0
- data/lib/schematic/types/billing_price_response_data.rb +16 -0
- data/lib/schematic/types/billing_price_scheme.rb +12 -0
- data/lib/schematic/types/billing_price_usage_type.rb +12 -0
- data/lib/schematic/types/billing_price_view.rb +30 -0
- data/lib/schematic/types/billing_product_detail_response_data.rb +23 -0
- data/lib/schematic/types/billing_product_for_subscription_response_data.rb +30 -0
- data/lib/schematic/types/billing_product_plan_response_data.rb +19 -0
- data/lib/schematic/types/billing_product_price_interval.rb +14 -0
- data/lib/schematic/types/billing_product_price_response_data.rb +24 -0
- data/lib/schematic/types/billing_product_price_tier_response_data.rb +12 -0
- data/lib/schematic/types/billing_product_pricing.rb +20 -0
- data/lib/schematic/types/billing_product_response_data.rb +21 -0
- data/lib/schematic/types/billing_provider_type.rb +12 -0
- data/lib/schematic/types/billing_subscription_discount.rb +15 -0
- data/lib/schematic/types/billing_subscription_discount_view.rb +22 -0
- data/lib/schematic/types/billing_subscription_response_data.rb +28 -0
- data/lib/schematic/types/billing_subscription_trial_end_setting.rb +12 -0
- data/lib/schematic/types/billing_subscription_view.rb +32 -0
- data/lib/schematic/types/billing_tiers_mode.rb +12 -0
- data/lib/schematic/types/capture_raw_event.rb +13 -0
- data/lib/schematic/types/capture_raw_event_batch.rb +9 -0
- data/lib/schematic/types/change_subscription_internal_request_body.rb +18 -0
- data/lib/schematic/types/change_subscription_request_body.rb +17 -0
- data/lib/schematic/types/charge_type.rb +13 -0
- data/lib/schematic/types/check_flag_request_body.rb +10 -0
- data/lib/schematic/types/check_flag_response_data.rb +23 -0
- data/lib/schematic/types/check_flags_bulk_response_data.rb +9 -0
- data/lib/schematic/types/check_flags_response_data.rb +10 -0
- data/lib/schematic/types/checkout_data_response_data.rb +18 -0
- data/lib/schematic/types/checkout_settings_response_data.rb +11 -0
- data/lib/schematic/types/checkout_subscription.rb +30 -0
- data/lib/schematic/types/company_detail_response_data.rb +31 -0
- data/lib/schematic/types/company_event_period_metrics_response_data.rb +19 -0
- data/lib/schematic/types/company_ledger_response_data.rb +11 -0
- data/lib/schematic/types/company_membership_detail_response_data.rb +14 -0
- data/lib/schematic/types/company_membership_response_data.rb +13 -0
- data/lib/schematic/types/company_override_note_response_data.rb +14 -0
- data/lib/schematic/types/company_override_response_data.rb +28 -0
- data/lib/schematic/types/company_plan_detail_response_data.rb +43 -0
- data/lib/schematic/types/company_plan_invalid_reason.rb +12 -0
- data/lib/schematic/types/company_plan_with_billing_sub_view.rb +19 -0
- data/lib/schematic/types/company_response_data.rb +15 -0
- data/lib/schematic/types/company_subscription_response_data.rb +22 -0
- data/lib/schematic/types/compatible_plans.rb +10 -0
- data/lib/schematic/types/compatible_plans_response_data.rb +10 -0
- data/lib/schematic/types/component_capabilities.rb +10 -0
- data/lib/schematic/types/component_checkout_settings.rb +12 -0
- data/lib/schematic/types/component_display_settings.rb +14 -0
- data/lib/schematic/types/component_entity_type.rb +12 -0
- data/lib/schematic/types/component_hydrate_response_data.rb +34 -0
- data/lib/schematic/types/component_preview_response_data.rb +35 -0
- data/lib/schematic/types/component_response_data.rb +15 -0
- data/lib/schematic/types/component_settings_response_data.rb +14 -0
- data/lib/schematic/types/component_state.rb +12 -0
- data/lib/schematic/types/condition.rb +23 -0
- data/lib/schematic/types/condition_condition_type.rb +19 -0
- data/lib/schematic/types/condition_group.rb +9 -0
- data/lib/schematic/types/condition_group_response_data.rb +15 -0
- data/lib/schematic/types/condition_group_view.rb +16 -0
- data/lib/schematic/types/condition_metric_period.rb +14 -0
- data/lib/schematic/types/condition_metric_period_month_reset.rb +12 -0
- data/lib/schematic/types/condition_operator.rb +18 -0
- data/lib/schematic/types/condition_response_data.rb +32 -0
- data/lib/schematic/types/condition_view.rb +39 -0
- data/lib/schematic/types/count_response.rb +9 -0
- data/lib/schematic/types/coupon_request_body.rb +16 -0
- data/lib/schematic/types/create_billing_plan_credit_grant_request_body.rb +26 -0
- data/lib/schematic/types/create_billing_price_tier_request_body.rb +14 -0
- data/lib/schematic/types/create_entitlement_in_bundle_request_body.rb +36 -0
- data/lib/schematic/types/create_entitlement_in_bundle_request_body_metric_period.rb +14 -0
- data/lib/schematic/types/create_entitlement_in_bundle_request_body_metric_period_month_reset.rb +12 -0
- data/lib/schematic/types/create_entitlement_req_common.rb +17 -0
- data/lib/schematic/types/create_entitlement_req_common_metric_period.rb +14 -0
- data/lib/schematic/types/create_entitlement_req_common_metric_period_month_reset.rb +12 -0
- data/lib/schematic/types/create_event_request_body.rb +11 -0
- data/lib/schematic/types/create_flag_request_body.rb +15 -0
- data/lib/schematic/types/create_or_update_condition_group_request_body.rb +11 -0
- data/lib/schematic/types/create_or_update_condition_request_body.rb +21 -0
- data/lib/schematic/types/create_or_update_condition_request_body_condition_type.rb +17 -0
- data/lib/schematic/types/create_or_update_condition_request_body_metric_period.rb +14 -0
- data/lib/schematic/types/create_or_update_condition_request_body_metric_period_month_reset.rb +12 -0
- data/lib/schematic/types/create_or_update_condition_request_body_operator.rb +18 -0
- data/lib/schematic/types/create_or_update_flag_request_body.rb +16 -0
- data/lib/schematic/types/create_or_update_rule_request_body.rb +15 -0
- data/lib/schematic/types/create_or_update_rule_request_body_rule_type.rb +15 -0
- data/lib/schematic/types/create_plan_request_body.rb +12 -0
- data/lib/schematic/types/create_price_tier_request_body.rb +12 -0
- data/lib/schematic/types/credit_auto_topup_amount_type.rb +23 -0
- data/lib/schematic/types/credit_bundle_currency_price.rb +10 -0
- data/lib/schematic/types/credit_bundle_currency_price_request_body.rb +11 -0
- data/lib/schematic/types/credit_bundle_currency_price_response_data.rb +10 -0
- data/lib/schematic/types/credit_bundle_purchase_response_data.rb +11 -0
- data/lib/schematic/types/credit_company_grant_view.rb +40 -0
- data/lib/schematic/types/credit_currency_price_request_body.rb +11 -0
- data/lib/schematic/types/credit_currency_price_response_data.rb +10 -0
- data/lib/schematic/types/credit_event_ledger_response_data.rb +39 -0
- data/lib/schematic/types/credit_event_type.rb +14 -0
- data/lib/schematic/types/credit_grant_detail.rb +12 -0
- data/lib/schematic/types/credit_grant_expiry_request_body.rb +14 -0
- data/lib/schematic/types/credit_grant_sort_order.rb +14 -0
- data/lib/schematic/types/credit_ledger_enriched_entry_response_data.rb +30 -0
- data/lib/schematic/types/credit_ledger_period.rb +14 -0
- data/lib/schematic/types/credit_transfer_response_data.rb +14 -0
- data/lib/schematic/types/credit_transfer_view.rb +14 -0
- data/lib/schematic/types/credit_trigger_config.rb +9 -0
- data/lib/schematic/types/credit_usage.rb +17 -0
- data/lib/schematic/types/credit_usage_aggregation.rb +12 -0
- data/lib/schematic/types/credits_auto_topup_company_summary.rb +10 -0
- data/lib/schematic/types/credits_auto_topup_credit_summary.rb +10 -0
- data/lib/schematic/types/credits_auto_topup_hard_failure.rb +12 -0
- data/lib/schematic/types/credits_auto_topup_retry_failure.rb +13 -0
- data/lib/schematic/types/currency_price_request_body.rb +15 -0
- data/lib/schematic/types/custom_plan_config.rb +11 -0
- data/lib/schematic/types/custom_plan_view_config_response_data.rb +11 -0
- data/lib/schematic/types/data_event_payload.rb +12 -0
- data/lib/schematic/types/data_export_output_file_type.rb +23 -0
- data/lib/schematic/types/data_export_response_data.rb +17 -0
- data/lib/schematic/types/data_export_status.rb +13 -0
- data/lib/schematic/types/data_export_type.rb +23 -0
- data/lib/schematic/types/datastream_company_plan.rb +11 -0
- data/lib/schematic/types/delete_billing_plan_credit_grant_request_body.rb +9 -0
- data/lib/schematic/types/delete_response.rb +9 -0
- data/lib/schematic/types/duplicate_plan_entitlements_response_response_data.rb +10 -0
- data/lib/schematic/types/entitlement_currency_prices_response_data.rb +11 -0
- data/lib/schematic/types/entitlement_price_behavior.rb +15 -0
- data/lib/schematic/types/entitlement_trigger_config.rb +9 -0
- data/lib/schematic/types/entitlement_type.rb +13 -0
- data/lib/schematic/types/entitlement_value_type.rb +16 -0
- data/lib/schematic/types/entitlements_in_plan.rb +10 -0
- data/lib/schematic/types/entity_key_definition_response_data.rb +13 -0
- data/lib/schematic/types/entity_key_detail_response_data.rb +18 -0
- data/lib/schematic/types/entity_key_response_data.rb +17 -0
- data/lib/schematic/types/entity_trait_definition_response_data.rb +15 -0
- data/lib/schematic/types/entity_trait_detail_response_data.rb +15 -0
- data/lib/schematic/types/entity_trait_response_data.rb +14 -0
- data/lib/schematic/types/entity_trait_value.rb +10 -0
- data/lib/schematic/types/entity_type.rb +12 -0
- data/lib/schematic/types/environment_detail_response_data.rb +14 -0
- data/lib/schematic/types/environment_response_data.rb +13 -0
- data/lib/schematic/types/environment_type.rb +13 -0
- data/lib/schematic/types/event_body.rb +13 -0
- data/lib/schematic/types/event_body_flag_check.rb +18 -0
- data/lib/schematic/types/event_body_identify.rb +12 -0
- data/lib/schematic/types/event_body_identify_company.rb +12 -0
- data/lib/schematic/types/event_body_track.rb +13 -0
- data/lib/schematic/types/event_detail_response_data.rb +30 -0
- data/lib/schematic/types/event_response_data.rb +27 -0
- data/lib/schematic/types/event_status.rb +15 -0
- data/lib/schematic/types/event_summary_response_data.rb +14 -0
- data/lib/schematic/types/event_type.rb +13 -0
- data/lib/schematic/types/feature_company_response_data.rb +44 -0
- data/lib/schematic/types/feature_company_user_response_data.rb +21 -0
- data/lib/schematic/types/feature_detail_response_data.rb +25 -0
- data/lib/schematic/types/feature_entitlement.rb +22 -0
- data/lib/schematic/types/feature_entitlement_metric_period.rb +14 -0
- data/lib/schematic/types/feature_entitlement_month_reset.rb +12 -0
- data/lib/schematic/types/feature_ledger_response_data.rb +12 -0
- data/lib/schematic/types/feature_lifecycle_phase.rb +19 -0
- data/lib/schematic/types/feature_response_data.rb +21 -0
- data/lib/schematic/types/feature_type.rb +13 -0
- data/lib/schematic/types/feature_usage_detail_response_data.rb +9 -0
- data/lib/schematic/types/feature_usage_legacy_response_data.rb +14 -0
- data/lib/schematic/types/feature_usage_response_data.rb +42 -0
- data/lib/schematic/types/feature_usage_time_series_response_data.rb +13 -0
- data/lib/schematic/types/feature_view.rb +26 -0
- data/lib/schematic/types/flag_detail_response_data.rb +21 -0
- data/lib/schematic/types/flag_response_data.rb +18 -0
- data/lib/schematic/types/flag_type.rb +23 -0
- data/lib/schematic/types/flag_view.rb +22 -0
- data/lib/schematic/types/generic_preview_object.rb +12 -0
- data/lib/schematic/types/invoice_request_body.rb +20 -0
- data/lib/schematic/types/invoice_response_data.rb +27 -0
- data/lib/schematic/types/invoice_status.rb +15 -0
- data/lib/schematic/types/issue_temporary_access_token_response_data.rb +16 -0
- data/lib/schematic/types/keys_request_body.rb +9 -0
- data/lib/schematic/types/limit_time_series_point_response_data.rb +14 -0
- data/lib/schematic/types/manage_plan_preview_response_response_data.rb +9 -0
- data/lib/schematic/types/manage_plan_request.rb +21 -0
- data/lib/schematic/types/manage_plan_response_response_data.rb +10 -0
- data/lib/schematic/types/meter_request_body.rb +11 -0
- data/lib/schematic/types/ordered_plans_in_group.rb +10 -0
- data/lib/schematic/types/payment_method_request_body.rb +19 -0
- data/lib/schematic/types/payment_method_response_data.rb +26 -0
- data/lib/schematic/types/plan_bundle_action.rb +13 -0
- data/lib/schematic/types/plan_bundle_credit_grant_request_body.rb +13 -0
- data/lib/schematic/types/plan_bundle_entitlement_request_body.rb +11 -0
- data/lib/schematic/types/plan_bundle_response_data.rb +13 -0
- data/lib/schematic/types/plan_change_action.rb +21 -0
- data/lib/schematic/types/plan_change_base_plan_action.rb +14 -0
- data/lib/schematic/types/plan_change_response_data.rb +30 -0
- data/lib/schematic/types/plan_change_subscription_action.rb +17 -0
- data/lib/schematic/types/plan_controlled_by_type.rb +12 -0
- data/lib/schematic/types/plan_credit_grant_view.rb +35 -0
- data/lib/schematic/types/plan_currency_price_request_body.rb +12 -0
- data/lib/schematic/types/plan_currency_prices_response_data.rb +12 -0
- data/lib/schematic/types/plan_detail_response_data.rb +33 -0
- data/lib/schematic/types/plan_entitlement_response_data.rb +34 -0
- data/lib/schematic/types/plan_entitlements_order.rb +10 -0
- data/lib/schematic/types/plan_group_bundle_order.rb +9 -0
- data/lib/schematic/types/plan_group_detail_response_data.rb +45 -0
- data/lib/schematic/types/plan_group_plan_detail_response_data.rb +37 -0
- data/lib/schematic/types/plan_group_plan_entitlements_order.rb +10 -0
- data/lib/schematic/types/plan_group_response_data.rb +36 -0
- data/lib/schematic/types/plan_issue_response_data.rb +12 -0
- data/lib/schematic/types/plan_response_data.rb +16 -0
- data/lib/schematic/types/plan_selection.rb +11 -0
- data/lib/schematic/types/plan_snapshot_view.rb +13 -0
- data/lib/schematic/types/plan_trait_response_data.rb +17 -0
- data/lib/schematic/types/plan_type.rb +12 -0
- data/lib/schematic/types/plan_version_company_migration_response_data.rb +19 -0
- data/lib/schematic/types/plan_version_company_migration_status.rb +15 -0
- data/lib/schematic/types/plan_version_migration_response_data.rb +23 -0
- data/lib/schematic/types/plan_version_migration_status.rb +14 -0
- data/lib/schematic/types/plan_version_migration_strategy.rb +12 -0
- data/lib/schematic/types/plan_version_response_data.rb +19 -0
- data/lib/schematic/types/plan_version_snapshot_view.rb +11 -0
- data/lib/schematic/types/plan_version_status.rb +13 -0
- data/lib/schematic/types/plan_view_public_response_data.rb +38 -0
- data/lib/schematic/types/preview_object.rb +12 -0
- data/lib/schematic/types/preview_object_response_data.rb +12 -0
- data/lib/schematic/types/preview_subscription_change_response_data.rb +21 -0
- data/lib/schematic/types/preview_subscription_finance_response_data.rb +21 -0
- data/lib/schematic/types/preview_subscription_upcoming_invoice_line_items.rb +13 -0
- data/lib/schematic/types/proration_behavior.rb +12 -0
- data/lib/schematic/types/public_plans_response_data.rb +17 -0
- data/lib/schematic/types/quickstart_resp.rb +9 -0
- data/lib/schematic/types/raw_event_batch_response_data.rb +9 -0
- data/lib/schematic/types/raw_event_response_data.rb +13 -0
- data/lib/schematic/types/rule.rb +18 -0
- data/lib/schematic/types/rule_condition_detail_response_data.rb +29 -0
- data/lib/schematic/types/rule_condition_group_detail_response_data.rb +15 -0
- data/lib/schematic/types/rule_condition_group_response_data.rb +14 -0
- data/lib/schematic/types/rule_condition_response_data.rb +26 -0
- data/lib/schematic/types/rule_detail_response_data.rb +19 -0
- data/lib/schematic/types/rule_response_data.rb +17 -0
- data/lib/schematic/types/rule_rule_type.rb +17 -0
- data/lib/schematic/types/rule_view.rb +20 -0
- data/lib/schematic/types/rules_detail_response_data.rb +10 -0
- data/lib/schematic/types/rules_engine_schema_version.rb +12 -0
- data/lib/schematic/types/rulesengine_check_flag_result.rb +23 -0
- data/lib/schematic/types/rulesengine_check_flag_result_feature_usage_period.rb +14 -0
- data/lib/schematic/types/rulesengine_check_flag_result_rule_type.rb +17 -0
- data/lib/schematic/types/rulesengine_company.rb +22 -0
- data/lib/schematic/types/rulesengine_company_metric.rb +17 -0
- data/lib/schematic/types/rulesengine_company_metric_month_reset.rb +12 -0
- data/lib/schematic/types/rulesengine_company_metric_period.rb +14 -0
- data/lib/schematic/types/rulesengine_condition.rb +23 -0
- data/lib/schematic/types/rulesengine_condition_condition_type.rb +19 -0
- data/lib/schematic/types/rulesengine_condition_group.rb +9 -0
- data/lib/schematic/types/rulesengine_condition_metric_period.rb +14 -0
- data/lib/schematic/types/rulesengine_condition_metric_period_month_reset.rb +12 -0
- data/lib/schematic/types/rulesengine_condition_operator.rb +18 -0
- data/lib/schematic/types/rulesengine_entitlement_value_type.rb +16 -0
- data/lib/schematic/types/rulesengine_entity_type.rb +12 -0
- data/lib/schematic/types/rulesengine_feature_entitlement.rb +22 -0
- data/lib/schematic/types/rulesengine_feature_entitlement_metric_period.rb +14 -0
- data/lib/schematic/types/rulesengine_feature_entitlement_month_reset.rb +12 -0
- data/lib/schematic/types/rulesengine_flag.rb +14 -0
- data/lib/schematic/types/rulesengine_rule.rb +18 -0
- data/lib/schematic/types/rulesengine_rule_rule_type.rb +17 -0
- data/lib/schematic/types/rulesengine_subscription.rb +11 -0
- data/lib/schematic/types/rulesengine_trait.rb +10 -0
- data/lib/schematic/types/rulesengine_trait_definition.rb +11 -0
- data/lib/schematic/types/rulesengine_trait_definition_comparable_type.rb +14 -0
- data/lib/schematic/types/rulesengine_user.rb +14 -0
- data/lib/schematic/types/scheduled_checkout_response_data.rb +22 -0
- data/lib/schematic/types/scheduled_checkout_status.rb +15 -0
- data/lib/schematic/types/scheduled_downgrade_config_behavior.rb +12 -0
- data/lib/schematic/types/scheduled_downgrade_response_data.rb +19 -0
- data/lib/schematic/types/segment_status_resp.rb +11 -0
- data/lib/schematic/types/skipped_entitlement_error_response_data.rb +9 -0
- data/lib/schematic/types/skipped_entitlement_response_data.rb +12 -0
- data/lib/schematic/types/sort_direction.rb +12 -0
- data/lib/schematic/types/stripe_embed_info.rb +12 -0
- data/lib/schematic/types/subscription_status.rb +19 -0
- data/lib/schematic/types/subscription_trait_update.rb +15 -0
- data/lib/schematic/types/subscription_type.rb +14 -0
- data/lib/schematic/types/temporary_access_token_resource_type.rb +23 -0
- data/lib/schematic/types/temporary_access_token_response_data.rb +15 -0
- data/lib/schematic/types/time_series_granularity.rb +14 -0
- data/lib/schematic/types/trait_definition.rb +11 -0
- data/lib/schematic/types/trait_definition_comparable_type.rb +14 -0
- data/lib/schematic/types/trait_type.rb +16 -0
- data/lib/schematic/types/update_add_on_request_body.rb +10 -0
- data/lib/schematic/types/update_billing_plan_credit_grant_request_body.rb +23 -0
- data/lib/schematic/types/update_credit_bundle_request_body.rb +10 -0
- data/lib/schematic/types/update_entitlement_req_common.rb +16 -0
- data/lib/schematic/types/update_entitlement_req_common_metric_period.rb +14 -0
- data/lib/schematic/types/update_entitlement_req_common_metric_period_month_reset.rb +12 -0
- data/lib/schematic/types/update_pay_in_advance_request_body.rb +10 -0
- data/lib/schematic/types/update_plan_request_body.rb +11 -0
- data/lib/schematic/types/update_plan_trait_trait_request_body.rb +10 -0
- data/lib/schematic/types/update_rule_request_body.rb +13 -0
- data/lib/schematic/types/upsert_billing_product_request_body.rb +20 -0
- data/lib/schematic/types/upsert_company_request_body.rb +15 -0
- data/lib/schematic/types/upsert_trait_request_body.rb +13 -0
- data/lib/schematic/types/upsert_user_request_body.rb +18 -0
- data/lib/schematic/types/upsert_user_sub_request_body.rb +16 -0
- data/lib/schematic/types/usage_based_entitlement_request_body.rb +25 -0
- data/lib/schematic/types/usage_based_entitlement_response_data.rb +20 -0
- data/lib/schematic/types/usage_time_series_point_response_data.rb +12 -0
- data/lib/schematic/types/user_detail_response_data.rb +18 -0
- data/lib/schematic/types/user_response_data.rb +14 -0
- data/lib/schematic/types/web_feature_usage_webhook_output.rb +15 -0
- data/lib/schematic/types/web_scheduled_downgrade_webhook_output.rb +15 -0
- data/lib/schematic/types/webhook_event_detail_response_data.rb +18 -0
- data/lib/schematic/types/webhook_event_response_data.rb +17 -0
- data/lib/schematic/types/webhook_event_status.rb +13 -0
- data/lib/schematic/types/webhook_request_type.rb +49 -0
- data/lib/schematic/types/webhook_response_data.rb +18 -0
- data/lib/schematic/types/webhook_status.rb +12 -0
- data/lib/schematic/types/who_am_i_response_data.rb +17 -0
- data/lib/schematic/version.rb +5 -0
- data/lib/schematic/wasm/rulesengine.wasm +0 -0
- data/lib/schematic/webhook_verification.rb +83 -0
- data/lib/schematic/webhooks/client.rb +355 -0
- data/lib/schematic/webhooks/types/count_webhook_events_params.rb +16 -0
- data/lib/schematic/webhooks/types/count_webhook_events_request.rb +15 -0
- data/lib/schematic/webhooks/types/count_webhook_events_response.rb +12 -0
- data/lib/schematic/webhooks/types/count_webhooks_params.rb +14 -0
- data/lib/schematic/webhooks/types/count_webhooks_request.rb +13 -0
- data/lib/schematic/webhooks/types/count_webhooks_response.rb +12 -0
- data/lib/schematic/webhooks/types/create_webhook_request_body.rb +15 -0
- data/lib/schematic/webhooks/types/create_webhook_response.rb +12 -0
- data/lib/schematic/webhooks/types/delete_webhook_response.rb +12 -0
- data/lib/schematic/webhooks/types/get_webhook_event_response.rb +12 -0
- data/lib/schematic/webhooks/types/get_webhook_response.rb +12 -0
- data/lib/schematic/webhooks/types/list_webhook_events_params.rb +16 -0
- data/lib/schematic/webhooks/types/list_webhook_events_request.rb +15 -0
- data/lib/schematic/webhooks/types/list_webhook_events_response.rb +12 -0
- data/lib/schematic/webhooks/types/list_webhooks_params.rb +14 -0
- data/lib/schematic/webhooks/types/list_webhooks_request.rb +13 -0
- data/lib/schematic/webhooks/types/list_webhooks_response.rb +12 -0
- data/lib/schematic/webhooks/types/update_webhook_request_body.rb +17 -0
- data/lib/schematic/webhooks/types/update_webhook_response.rb +12 -0
- data/lib/schematic.rb +821 -0
- data/lib/schematichq.rb +17 -0
- data/reference.md +16668 -0
- data/scripts/download-wasm.sh +82 -0
- data/scripts/webhook_test_server.rb +55 -0
- data/testapp/Gemfile +6 -0
- data/testapp/app.rb +307 -0
- metadata +917 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# Downloads the rules engine WASM binary from the schematic-api GitHub Release.
|
|
5
|
+
# Reads the pinned version from WASM_VERSION at the repo root.
|
|
6
|
+
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
8
|
+
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
9
|
+
WASM_DIR="$REPO_ROOT/lib/schematic/wasm"
|
|
10
|
+
VERSION_FILE="$REPO_ROOT/WASM_VERSION"
|
|
11
|
+
TARGET_FILE="$WASM_DIR/rulesengine.wasm"
|
|
12
|
+
|
|
13
|
+
GITHUB_REPO="SchematicHQ/schematic-api"
|
|
14
|
+
|
|
15
|
+
if [ ! -f "$VERSION_FILE" ]; then
|
|
16
|
+
echo "ERROR: WASM_VERSION file not found at $VERSION_FILE"
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
VERSION=$(tr -d '[:space:]' < "$VERSION_FILE")
|
|
21
|
+
TAG="rulesengine/v${VERSION}"
|
|
22
|
+
|
|
23
|
+
# Skip download if binary already exists and version matches
|
|
24
|
+
if [ -f "$TARGET_FILE" ] && [ -f "$WASM_DIR/.wasm_version" ]; then
|
|
25
|
+
CURRENT=$(tr -d '[:space:]' < "$WASM_DIR/.wasm_version")
|
|
26
|
+
if [ "$CURRENT" = "$VERSION" ]; then
|
|
27
|
+
echo "WASM binary already at version $VERSION, skipping download."
|
|
28
|
+
exit 0
|
|
29
|
+
fi
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Ruby uses the same raw WASM binary as Python/C# (no wasm-bindgen).
|
|
33
|
+
# Try Ruby-specific asset first, fall back to Python asset (identical binary).
|
|
34
|
+
ASSET_NAME="rulesengine-wasm-ruby-v${VERSION}.tar.gz"
|
|
35
|
+
FALLBACK_ASSET_NAME="rulesengine-wasm-python-v${VERSION}.tar.gz"
|
|
36
|
+
|
|
37
|
+
echo "Downloading rules engine WASM v${VERSION}..."
|
|
38
|
+
mkdir -p "$WASM_DIR"
|
|
39
|
+
|
|
40
|
+
TMPDIR=$(mktemp -d)
|
|
41
|
+
trap 'rm -rf "$TMPDIR"' EXIT
|
|
42
|
+
|
|
43
|
+
DOWNLOADED=false
|
|
44
|
+
|
|
45
|
+
if gh release download "$TAG" \
|
|
46
|
+
-R "$GITHUB_REPO" \
|
|
47
|
+
-p "$ASSET_NAME" \
|
|
48
|
+
-D "$TMPDIR" 2>/dev/null; then
|
|
49
|
+
DOWNLOADED=true
|
|
50
|
+
elif gh release download "$TAG" \
|
|
51
|
+
-R "$GITHUB_REPO" \
|
|
52
|
+
-p "$FALLBACK_ASSET_NAME" \
|
|
53
|
+
-D "$TMPDIR" 2>/dev/null; then
|
|
54
|
+
ASSET_NAME="$FALLBACK_ASSET_NAME"
|
|
55
|
+
DOWNLOADED=true
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
if [ "$DOWNLOADED" = false ]; then
|
|
59
|
+
echo "ERROR: Failed to download WASM binary"
|
|
60
|
+
echo "Tag: $TAG"
|
|
61
|
+
echo "Tried: rulesengine-wasm-ruby-v${VERSION}.tar.gz"
|
|
62
|
+
echo "Tried: rulesengine-wasm-python-v${VERSION}.tar.gz"
|
|
63
|
+
echo ""
|
|
64
|
+
echo "Ensure a release exists at:"
|
|
65
|
+
echo " https://github.com/${GITHUB_REPO}/releases/tag/${TAG}"
|
|
66
|
+
echo ""
|
|
67
|
+
echo "Ensure the GitHub CLI is authenticated: gh auth status"
|
|
68
|
+
exit 1
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
tar -xzf "$TMPDIR/$ASSET_NAME" -C "$TMPDIR"
|
|
72
|
+
|
|
73
|
+
if [ ! -f "$TMPDIR/rulesengine.wasm" ]; then
|
|
74
|
+
echo "ERROR: rulesengine.wasm not found in release archive"
|
|
75
|
+
ls -la "$TMPDIR"
|
|
76
|
+
exit 1
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
cp "$TMPDIR/rulesengine.wasm" "$TARGET_FILE"
|
|
80
|
+
echo "$VERSION" > "$WASM_DIR/.wasm_version"
|
|
81
|
+
|
|
82
|
+
echo "Downloaded rules engine WASM v${VERSION} to $TARGET_FILE"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "webrick"
|
|
5
|
+
require "json"
|
|
6
|
+
require_relative "../lib/schematic/webhook_verification"
|
|
7
|
+
|
|
8
|
+
secret = ENV["SCHEMATIC_WEBHOOK_SECRET"] || ARGV[0]
|
|
9
|
+
port = (ENV["PORT"] || "8080").to_i
|
|
10
|
+
|
|
11
|
+
unless secret
|
|
12
|
+
puts "Usage: ruby webhook_test_server.rb <webhook_secret>"
|
|
13
|
+
puts " or set SCHEMATIC_WEBHOOK_SECRET environment variable"
|
|
14
|
+
exit 1
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
server = WEBrick::HTTPServer.new(Port: port)
|
|
18
|
+
|
|
19
|
+
server.mount_proc "/webhook" do |req, res|
|
|
20
|
+
puts "\n--- Incoming Webhook ---"
|
|
21
|
+
puts "Method: #{req.request_method}"
|
|
22
|
+
puts "Headers:"
|
|
23
|
+
req.header.each { |k, v| puts " #{k}: #{v.join(", ")}" }
|
|
24
|
+
|
|
25
|
+
body = req.body || ""
|
|
26
|
+
signature = req.header["x-schematic-webhook-signature"]&.first
|
|
27
|
+
timestamp = req.header["x-schematic-webhook-timestamp"]&.first
|
|
28
|
+
|
|
29
|
+
begin
|
|
30
|
+
Schematic::Webhooks.verify_signature(body, signature, timestamp, secret)
|
|
31
|
+
puts "\nSignature: VALID"
|
|
32
|
+
|
|
33
|
+
begin
|
|
34
|
+
parsed = JSON.pretty_generate(JSON.parse(body))
|
|
35
|
+
puts "Payload:\n#{parsed}"
|
|
36
|
+
rescue JSON::ParserError
|
|
37
|
+
puts "Payload (raw): #{body}"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
res.status = 200
|
|
41
|
+
res.content_type = "application/json"
|
|
42
|
+
res.body = JSON.generate({ status: "ok" })
|
|
43
|
+
rescue Schematic::Webhooks::WebhookSignatureError => e
|
|
44
|
+
puts "\nSignature: INVALID (#{e.message})"
|
|
45
|
+
res.status = 401
|
|
46
|
+
res.content_type = "application/json"
|
|
47
|
+
res.body = JSON.generate({ error: e.message })
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
trap("INT") { server.shutdown }
|
|
52
|
+
|
|
53
|
+
puts "Webhook test server listening on port #{port}"
|
|
54
|
+
puts "POST webhooks to http://localhost:#{port}/webhook"
|
|
55
|
+
server.start
|
data/testapp/Gemfile
ADDED
data/testapp/app.rb
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
##
|
|
5
|
+
# SDK E2E Test App for schematic-ruby.
|
|
6
|
+
#
|
|
7
|
+
# A lightweight HTTP server implementing the standard test app contract
|
|
8
|
+
# defined in the SDK spec. The E2E harness (SchematicHQ/actions/sdk-e2e)
|
|
9
|
+
# calls POST /configure after startup to pass an env-scoped API key,
|
|
10
|
+
# then runs assertions against the other endpoints.
|
|
11
|
+
#
|
|
12
|
+
# SDK source is controlled by SDK_SOURCE env var:
|
|
13
|
+
# - "local" (default): loads from ../lib
|
|
14
|
+
# - "published": requires the 'schematichq' gem from RubyGems
|
|
15
|
+
#
|
|
16
|
+
# Usage:
|
|
17
|
+
# # Local build (default)
|
|
18
|
+
# ruby testapp/app.rb
|
|
19
|
+
#
|
|
20
|
+
# # Published version
|
|
21
|
+
# cd testapp && bundle install
|
|
22
|
+
# SDK_SOURCE=published ruby app.rb
|
|
23
|
+
|
|
24
|
+
require "webrick"
|
|
25
|
+
require "json"
|
|
26
|
+
require "socket"
|
|
27
|
+
require "redis"
|
|
28
|
+
|
|
29
|
+
# --- SDK Loading ---
|
|
30
|
+
|
|
31
|
+
$LOAD_PATH.unshift(File.join(__dir__, "..", "lib")) unless ENV["SDK_SOURCE"] == "published"
|
|
32
|
+
require "schematichq"
|
|
33
|
+
|
|
34
|
+
# --- Constants ---
|
|
35
|
+
|
|
36
|
+
PORT = Integer(ENV["PORT"] || "8080")
|
|
37
|
+
CACHE_TTL = 2.0 # Short TTL for E2E -- tests sleep past this to verify cache expiration
|
|
38
|
+
CACHE_TTL_MS = (CACHE_TTL * 1000).to_i
|
|
39
|
+
|
|
40
|
+
# --- State ---
|
|
41
|
+
|
|
42
|
+
module AppState
|
|
43
|
+
class << self
|
|
44
|
+
attr_accessor :client, :current_config, :cache_providers
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
self.client = nil
|
|
48
|
+
self.current_config = {}
|
|
49
|
+
self.cache_providers = nil
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# --- Helpers ---
|
|
53
|
+
|
|
54
|
+
def parse_json(request)
|
|
55
|
+
body = request.body
|
|
56
|
+
return {} if body.nil? || body.empty?
|
|
57
|
+
|
|
58
|
+
JSON.parse(body)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def json_response(response, status, body)
|
|
62
|
+
response.status = status
|
|
63
|
+
response["Content-Type"] = "application/json"
|
|
64
|
+
response.body = JSON.generate(body)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# --- Route handlers ---
|
|
68
|
+
|
|
69
|
+
def handle_health(_request, response)
|
|
70
|
+
cfg = AppState.current_config
|
|
71
|
+
json_response(response, 200,
|
|
72
|
+
"status" => AppState.client ? "configured" : "waiting",
|
|
73
|
+
"config" => {
|
|
74
|
+
"offline" => cfg["offline"] || false,
|
|
75
|
+
"useDataStream" => cfg["useDataStream"] || false,
|
|
76
|
+
"hasFlagDefaults" => cfg["flagDefaults"].is_a?(Hash) && !cfg["flagDefaults"].empty?,
|
|
77
|
+
"cacheTtlMs" => CACHE_TTL_MS
|
|
78
|
+
})
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def handle_configure(request, response)
|
|
82
|
+
config = parse_json(request)
|
|
83
|
+
|
|
84
|
+
# Close existing client if any
|
|
85
|
+
begin
|
|
86
|
+
AppState.client&.close
|
|
87
|
+
rescue StandardError
|
|
88
|
+
# ignore close errors
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
opts = {
|
|
92
|
+
api_key: config["apiKey"]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
# Build Redis client if needed (shared between cache and DataStream/replicator)
|
|
96
|
+
redis_client = config["redisUrl"] ? Redis.new(url: config["redisUrl"]) : nil
|
|
97
|
+
|
|
98
|
+
# Cache provider: explicit Redis, disabled, or SDK defaults
|
|
99
|
+
cache_providers = if redis_client
|
|
100
|
+
[Schematic::RedisCacheProvider.new(client: redis_client, ttl: CACHE_TTL)]
|
|
101
|
+
elsif config["noCache"]
|
|
102
|
+
[]
|
|
103
|
+
else
|
|
104
|
+
[Schematic::LocalCache.new(ttl: CACHE_TTL)]
|
|
105
|
+
end
|
|
106
|
+
opts[:cache_providers] = cache_providers
|
|
107
|
+
AppState.cache_providers = cache_providers
|
|
108
|
+
|
|
109
|
+
opts[:base_url] = config["baseUrl"] if config["baseUrl"]
|
|
110
|
+
opts[:event_capture_base_url] = config["eventCaptureBaseUrl"] if config["eventCaptureBaseUrl"]
|
|
111
|
+
opts[:flag_defaults] = config["flagDefaults"] if config["flagDefaults"]
|
|
112
|
+
opts[:offline] = true if config["offline"]
|
|
113
|
+
|
|
114
|
+
if config["useDataStream"]
|
|
115
|
+
opts[:use_data_stream] = true
|
|
116
|
+
|
|
117
|
+
datastream_opts = { cache_ttl: CACHE_TTL }
|
|
118
|
+
datastream_opts[:redis_client] = redis_client if redis_client
|
|
119
|
+
|
|
120
|
+
if config["replicatorUrl"]
|
|
121
|
+
datastream_opts[:replicator_mode] = true
|
|
122
|
+
datastream_opts[:replicator_health_url] = "#{config["replicatorUrl"]}/ready"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
opts[:datastream_options] = datastream_opts
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
opts[:log_level] = :debug
|
|
129
|
+
AppState.client = Schematic::SchematicClient.new(**opts)
|
|
130
|
+
AppState.current_config = config
|
|
131
|
+
|
|
132
|
+
json_response(response, 200, "success" => true, "cacheTtlMs" => CACHE_TTL_MS)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def handle_check_flag(request, response)
|
|
136
|
+
unless AppState.client
|
|
137
|
+
json_response(response, 503, "error" => "not configured")
|
|
138
|
+
return
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
body = parse_json(request)
|
|
142
|
+
|
|
143
|
+
begin
|
|
144
|
+
value = AppState.client.check_flag(body["flagKey"], company: body["company"], user: body["user"])
|
|
145
|
+
json_response(response, 200, "value" => value)
|
|
146
|
+
rescue StandardError => e
|
|
147
|
+
json_response(response, 200, "value" => false, "error" => e.message)
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def handle_check_flag_with_entitlement(request, response)
|
|
152
|
+
unless AppState.client
|
|
153
|
+
json_response(response, 503, "error" => "not configured")
|
|
154
|
+
return
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
body = parse_json(request)
|
|
158
|
+
|
|
159
|
+
begin
|
|
160
|
+
resp = AppState.client.check_flag_with_entitlement(body["flagKey"], company: body["company"], user: body["user"])
|
|
161
|
+
json_response(response, 200, resp.to_h.transform_keys(&:to_s))
|
|
162
|
+
rescue StandardError => e
|
|
163
|
+
json_response(response, 200, "value" => false, "error" => e.message)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def handle_identify(request, response)
|
|
168
|
+
unless AppState.client
|
|
169
|
+
json_response(response, 503, "error" => "not configured")
|
|
170
|
+
return
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
body = parse_json(request)
|
|
174
|
+
|
|
175
|
+
# Translate E2E contract to Ruby SDK's identify body:
|
|
176
|
+
# E2E: { "company": {k:v}, "user": {k:v}, "keys": {k:v} }
|
|
177
|
+
# SDK: { keys: {k:v}, company: { keys: {k:v} } }
|
|
178
|
+
identify_body = { keys: body["keys"] || body["user"] || {} }
|
|
179
|
+
identify_body[:company] = { keys: body["company"] } if body["company"]
|
|
180
|
+
|
|
181
|
+
begin
|
|
182
|
+
AppState.client.identify(identify_body)
|
|
183
|
+
json_response(response, 200, "success" => true)
|
|
184
|
+
rescue StandardError => e
|
|
185
|
+
json_response(response, 200, "success" => false, "error" => e.message)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def handle_track(request, response)
|
|
190
|
+
unless AppState.client
|
|
191
|
+
json_response(response, 503, "error" => "not configured")
|
|
192
|
+
return
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
body = parse_json(request)
|
|
196
|
+
|
|
197
|
+
track_body = { event: body["event"] }
|
|
198
|
+
track_body[:company] = body["company"] if body["company"]
|
|
199
|
+
track_body[:user] = body["user"] if body["user"]
|
|
200
|
+
track_body[:traits] = body["traits"] if body["traits"]
|
|
201
|
+
track_body[:quantity] = body["quantity"] unless body["quantity"].nil?
|
|
202
|
+
|
|
203
|
+
begin
|
|
204
|
+
AppState.client.track(track_body)
|
|
205
|
+
json_response(response, 200, "success" => true)
|
|
206
|
+
rescue StandardError => e
|
|
207
|
+
json_response(response, 200, "success" => false, "error" => e.message)
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def handle_set_flag_default(request, response)
|
|
212
|
+
unless AppState.client
|
|
213
|
+
json_response(response, 503, "error" => "not configured")
|
|
214
|
+
return
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
body = parse_json(request)
|
|
218
|
+
|
|
219
|
+
begin
|
|
220
|
+
AppState.client.set_flag_default(body["flagKey"], body["value"])
|
|
221
|
+
json_response(response, 200, "success" => true)
|
|
222
|
+
rescue StandardError => e
|
|
223
|
+
json_response(response, 200, "success" => false, "error" => e.message)
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
def handle_config(_request, response)
|
|
228
|
+
cfg = AppState.current_config
|
|
229
|
+
json_response(response, 200,
|
|
230
|
+
"apiKey" => cfg["apiKey"] ? "#{cfg["apiKey"][0..6]}..." : nil,
|
|
231
|
+
"offline" => cfg["offline"] || false,
|
|
232
|
+
"useDataStream" => cfg["useDataStream"] || false,
|
|
233
|
+
"flagDefaults" => cfg["flagDefaults"] || {},
|
|
234
|
+
"cacheTtlMs" => CACHE_TTL_MS,
|
|
235
|
+
"configured" => !AppState.client.nil?)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# --- Port finder ---
|
|
239
|
+
|
|
240
|
+
def find_available_port(start_port)
|
|
241
|
+
port = start_port
|
|
242
|
+
loop do
|
|
243
|
+
server = TCPServer.new("0.0.0.0", port)
|
|
244
|
+
server.close
|
|
245
|
+
return port
|
|
246
|
+
rescue Errno::EADDRINUSE
|
|
247
|
+
warn "Port #{port} in use, trying #{port + 1}..."
|
|
248
|
+
port += 1
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# --- Server ---
|
|
253
|
+
|
|
254
|
+
port = find_available_port(PORT)
|
|
255
|
+
|
|
256
|
+
server = WEBrick::HTTPServer.new(
|
|
257
|
+
Port: port,
|
|
258
|
+
Logger: WEBrick::Log.new($stderr, WEBrick::Log::INFO),
|
|
259
|
+
AccessLog: [[File.open(File::NULL, "w"), WEBrick::AccessLog::COMMON_LOG_FORMAT]]
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
server.mount_proc("/health") { |req, res| handle_health(req, res) }
|
|
263
|
+
|
|
264
|
+
server.mount_proc "/configure" do |req, res|
|
|
265
|
+
req.request_method == "POST" ? handle_configure(req, res) : json_response(res, 405, "error" => "method not allowed")
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
server.mount_proc "/check-flag" do |req, res|
|
|
269
|
+
req.request_method == "POST" ? handle_check_flag(req, res) : json_response(res, 405, "error" => "method not allowed")
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
server.mount_proc "/check-flag-with-entitlement" do |req, res|
|
|
273
|
+
req.request_method == "POST" ? handle_check_flag_with_entitlement(req, res) : json_response(res, 405, "error" => "method not allowed")
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
server.mount_proc "/identify" do |req, res|
|
|
277
|
+
req.request_method == "POST" ? handle_identify(req, res) : json_response(res, 405, "error" => "method not allowed")
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
server.mount_proc "/track" do |req, res|
|
|
281
|
+
req.request_method == "POST" ? handle_track(req, res) : json_response(res, 405, "error" => "method not allowed")
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
server.mount_proc "/set-flag-default" do |req, res|
|
|
285
|
+
req.request_method == "POST" ? handle_set_flag_default(req, res) : json_response(res, 405, "error" => "method not allowed")
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
server.mount_proc("/config") { |req, res| handle_config(req, res) }
|
|
289
|
+
|
|
290
|
+
$stdout.puts "SDK E2E test app listening on http://localhost:#{port}"
|
|
291
|
+
$stdout.puts "Waiting for POST /configure to initialize SchematicClient..."
|
|
292
|
+
$stdout.flush
|
|
293
|
+
|
|
294
|
+
# Graceful shutdown
|
|
295
|
+
shutdown = proc do
|
|
296
|
+
warn "\nShutting down..."
|
|
297
|
+
AppState.client&.close
|
|
298
|
+
rescue StandardError
|
|
299
|
+
nil
|
|
300
|
+
ensure
|
|
301
|
+
server.shutdown
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
trap("INT", &shutdown)
|
|
305
|
+
trap("TERM", &shutdown)
|
|
306
|
+
|
|
307
|
+
server.start
|