Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"webrick": ">= 1.0"
}
},
"originGitCommit": "4fd82021eff164a6f2484d4504850c46fe8f4a95",
"originGitCommit": "a0658700ca9b3d362ce6594c0740c41d9286e429",
"sdkVersion": "1.4.1"
}
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ GEM
reline (0.6.3)
io-console (~> 0.5)
rexml (3.4.4)
rubocop (1.86.1)
rubocop (1.86.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
Expand Down
15 changes: 9 additions & 6 deletions lib/schematic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@
require_relative "schematic/types/stripe_embed_info"
require_relative "schematic/types/component_preview_response_data"
require_relative "schematic/components/types/preview_component_data_response"
require_relative "schematic/types/plan_bundle_response_data"
require_relative "schematic/planbundle/types/create_custom_plan_bundle_response"
require_relative "schematic/planbundle/types/create_plan_bundle_response"
require_relative "schematic/planbundle/types/update_plan_bundle_response"
require_relative "schematic/types/data_export_output_file_type"
require_relative "schematic/types/data_export_status"
require_relative "schematic/types/data_export_type"
Expand Down Expand Up @@ -535,9 +539,6 @@
require_relative "schematic/types/integrations_data_set_response_data"
require_relative "schematic/integrationsapi/types/load_sample_data_set_v_2_response"
require_relative "schematic/integrationsapi/types/uninstall_integration_response"
require_relative "schematic/types/plan_bundle_response_data"
require_relative "schematic/planbundle/types/create_plan_bundle_response"
require_relative "schematic/planbundle/types/update_plan_bundle_response"
require_relative "schematic/plangroups/types/get_plan_group_params"
require_relative "schematic/types/checkout_settings_response_data"
require_relative "schematic/types/component_settings_response_data"
Expand Down Expand Up @@ -624,6 +625,7 @@
require_relative "schematic/types/credit_auto_topup_amount_type"
require_relative "schematic/types/create_billing_plan_credit_grant_request_body"
require_relative "schematic/types/create_billing_price_tier_request_body"
require_relative "schematic/types/create_custom_plan_bundle_plan_request_body"
require_relative "schematic/types/create_price_tier_request_body"
require_relative "schematic/types/currency_price_request_body"
require_relative "schematic/types/create_entitlement_in_bundle_request_body"
Expand Down Expand Up @@ -827,6 +829,10 @@
require_relative "schematic/components/types/update_component_request_body"
require_relative "schematic/components/types/count_components_request"
require_relative "schematic/components/types/preview_component_data_request"
require_relative "schematic/planbundle/client"
require_relative "schematic/planbundle/types/create_custom_plan_bundle_request_body"
require_relative "schematic/planbundle/types/create_plan_bundle_request_body"
require_relative "schematic/planbundle/types/update_plan_bundle_request_body"
require_relative "schematic/dataexports/client"
require_relative "schematic/dataexports/types/create_data_export_request_body"
require_relative "schematic/events/client"
Expand All @@ -852,9 +858,6 @@
require_relative "schematic/integrationsapi/client"
require_relative "schematic/integrationsapi/types/list_integrations_request"
require_relative "schematic/integrationsapi/types/start_data_import_request_body"
require_relative "schematic/planbundle/client"
require_relative "schematic/planbundle/types/create_plan_bundle_request_body"
require_relative "schematic/planbundle/types/update_plan_bundle_request_body"
require_relative "schematic/plangroups/client"
require_relative "schematic/plangroups/types/get_plan_group_request"
require_relative "schematic/plangroups/types/create_plan_group_request_body"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class CreateBillingPriceRequestBody < Internal::Types::Model
field :currency, -> { String }, optional: false, nullable: false
field :external_account_id, -> { String }, optional: false, nullable: false
field :interval, -> { String }, optional: false, nullable: false
field :interval_count, -> { Integer }, optional: true, nullable: false
field :is_active, -> { Internal::Types::Boolean }, optional: false, nullable: false
field :meter_id, -> { String }, optional: true, nullable: false
field :nickname, -> { String }, optional: true, nullable: false
Expand Down
10 changes: 5 additions & 5 deletions lib/schematic/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def components
@components ||= Schematic::Components::Client.new(client: @raw_client)
end

# @return [Schematic::Planbundle::Client]
def planbundle
@planbundle ||= Schematic::Planbundle::Client.new(client: @raw_client)
end

# @return [Schematic::Dataexports::Client]
def dataexports
@dataexports ||= Schematic::Dataexports::Client.new(client: @raw_client)
Expand All @@ -82,11 +87,6 @@ def integrationsapi
@integrationsapi ||= Schematic::Integrationsapi::Client.new(client: @raw_client)
end

# @return [Schematic::Planbundle::Client]
def planbundle
@planbundle ||= Schematic::Planbundle::Client.new(client: @raw_client)
end

# @return [Schematic::Plangroups::Client]
def plangroups
@plangroups ||= Schematic::Plangroups::Client.new(client: @raw_client)
Expand Down
8 changes: 6 additions & 2 deletions lib/schematic/entitlements/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def count_feature_companies(request_options: {}, **params)
# @option params [Hash[String, String], nil] :company_keys
# @option params [String, nil] :feature_ids
# @option params [Boolean, nil] :include_usage_aggregation
# @option params [Schematic::Types::BillingProviderType, nil] :managed_by
# @option params [String, nil] :q
# @option params [Boolean, nil] :without_negative_entitlements
# @option params [Integer, nil] :limit
Expand All @@ -358,12 +359,13 @@ def count_feature_companies(request_options: {}, **params)
# @return [Schematic::Entitlements::Types::ListFeatureUsageResponse]
def list_feature_usage(request_options: {}, **params)
params = Schematic::Internal::Types::Utils.normalize_keys(params)
query_param_names = %i[company_id company_keys feature_ids include_usage_aggregation q without_negative_entitlements limit offset]
query_param_names = %i[company_id company_keys feature_ids include_usage_aggregation managed_by q without_negative_entitlements limit offset]
query_params = {}
query_params["company_id"] = params[:company_id] if params.key?(:company_id)
query_params["company_keys"] = params[:company_keys] if params.key?(:company_keys)
query_params["feature_ids"] = params[:feature_ids] if params.key?(:feature_ids)
query_params["include_usage_aggregation"] = params[:include_usage_aggregation] if params.key?(:include_usage_aggregation)
query_params["managed_by"] = params[:managed_by] if params.key?(:managed_by)
query_params["q"] = params[:q] if params.key?(:q)
query_params["without_negative_entitlements"] = params[:without_negative_entitlements] if params.key?(:without_negative_entitlements)
query_params["limit"] = params[:limit] if params.key?(:limit)
Expand Down Expand Up @@ -448,6 +450,7 @@ def get_feature_usage_time_series(request_options: {}, **params)
# @option params [Hash[String, String], nil] :company_keys
# @option params [String, nil] :feature_ids
# @option params [Boolean, nil] :include_usage_aggregation
# @option params [Schematic::Types::BillingProviderType, nil] :managed_by
# @option params [String, nil] :q
# @option params [Boolean, nil] :without_negative_entitlements
# @option params [Integer, nil] :limit
Expand All @@ -456,12 +459,13 @@ def get_feature_usage_time_series(request_options: {}, **params)
# @return [Schematic::Entitlements::Types::CountFeatureUsageResponse]
def count_feature_usage(request_options: {}, **params)
params = Schematic::Internal::Types::Utils.normalize_keys(params)
query_param_names = %i[company_id company_keys feature_ids include_usage_aggregation q without_negative_entitlements limit offset]
query_param_names = %i[company_id company_keys feature_ids include_usage_aggregation managed_by q without_negative_entitlements limit offset]
query_params = {}
query_params["company_id"] = params[:company_id] if params.key?(:company_id)
query_params["company_keys"] = params[:company_keys] if params.key?(:company_keys)
query_params["feature_ids"] = params[:feature_ids] if params.key?(:feature_ids)
query_params["include_usage_aggregation"] = params[:include_usage_aggregation] if params.key?(:include_usage_aggregation)
query_params["managed_by"] = params[:managed_by] if params.key?(:managed_by)
query_params["q"] = params[:q] if params.key?(:q)
query_params["without_negative_entitlements"] = params[:without_negative_entitlements] if params.key?(:without_negative_entitlements)
query_params["limit"] = params[:limit] if params.key?(:limit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class CountFeatureUsageParams < Internal::Types::Model
field :feature_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false
field :include_usage_aggregation, -> { Internal::Types::Boolean }, optional: true, nullable: false
field :limit, -> { Integer }, optional: true, nullable: false
field :managed_by, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
field :offset, -> { Integer }, optional: true, nullable: false
field :q, -> { String }, optional: true, nullable: false
field :without_negative_entitlements, -> { Internal::Types::Boolean }, optional: true, nullable: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class CountFeatureUsageRequest < Internal::Types::Model
field :company_keys, -> { Internal::Types::Hash[String, String] }, optional: true, nullable: false
field :feature_ids, -> { String }, optional: true, nullable: false
field :include_usage_aggregation, -> { Internal::Types::Boolean }, optional: true, nullable: false
field :managed_by, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
field :q, -> { String }, optional: true, nullable: false
field :without_negative_entitlements, -> { Internal::Types::Boolean }, optional: true, nullable: false
field :limit, -> { Integer }, optional: true, nullable: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class CreateBillingLinkedPlanEntitlementRequestBody < Internal::Types::Model
field :plan_version_id, -> { String }, optional: true, nullable: false
field :price_behavior, -> { Schematic::Types::EntitlementPriceBehavior }, optional: true, nullable: false
field :price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
field :quarterly_metered_price_id, -> { String }, optional: true, nullable: false
field :quarterly_price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
field :quarterly_unit_price, -> { Integer }, optional: true, nullable: false
field :quarterly_unit_price_decimal, -> { String }, optional: true, nullable: false
field :soft_limit, -> { Integer }, optional: true, nullable: false
field :tier_mode, -> { Schematic::Types::BillingTiersMode }, optional: true, nullable: false
field :value_bool, -> { Internal::Types::Boolean }, optional: true, nullable: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ class CreatePlanEntitlementRequestBody < Internal::Types::Model
field :plan_version_id, -> { String }, optional: true, nullable: false
field :price_behavior, -> { Schematic::Types::EntitlementPriceBehavior }, optional: true, nullable: false
field :price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
field :quarterly_metered_price_id, -> { String }, optional: true, nullable: false
field :quarterly_price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
field :quarterly_unit_price, -> { Integer }, optional: true, nullable: false
field :quarterly_unit_price_decimal, -> { String }, optional: true, nullable: false
field :soft_limit, -> { Integer }, optional: true, nullable: false
field :tier_mode, -> { Schematic::Types::BillingTiersMode }, optional: true, nullable: false
field :value_bool, -> { Internal::Types::Boolean }, optional: true, nullable: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ListFeatureUsageParams < Internal::Types::Model
field :feature_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false
field :include_usage_aggregation, -> { Internal::Types::Boolean }, optional: true, nullable: false
field :limit, -> { Integer }, optional: true, nullable: false
field :managed_by, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
field :offset, -> { Integer }, optional: true, nullable: false
field :q, -> { String }, optional: true, nullable: false
field :without_negative_entitlements, -> { Internal::Types::Boolean }, optional: true, nullable: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ListFeatureUsageRequest < Internal::Types::Model
field :company_keys, -> { Internal::Types::Hash[String, String] }, optional: true, nullable: false
field :feature_ids, -> { String }, optional: true, nullable: false
field :include_usage_aggregation, -> { Internal::Types::Boolean }, optional: true, nullable: false
field :managed_by, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
field :q, -> { String }, optional: true, nullable: false
field :without_negative_entitlements, -> { Internal::Types::Boolean }, optional: true, nullable: false
field :limit, -> { Integer }, optional: true, nullable: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class UpdatePlanEntitlementRequestBody < Internal::Types::Model
field :overage_billing_product_id, -> { String }, optional: true, nullable: false
field :price_behavior, -> { Schematic::Types::EntitlementPriceBehavior }, optional: true, nullable: false
field :price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
field :quarterly_metered_price_id, -> { String }, optional: true, nullable: false
field :quarterly_price_tiers, -> { Internal::Types::Array[Schematic::Types::CreatePriceTierRequestBody] }, optional: true, nullable: false
field :quarterly_unit_price, -> { Integer }, optional: true, nullable: false
field :quarterly_unit_price_decimal, -> { String }, optional: true, nullable: false
field :soft_limit, -> { Integer }, optional: true, nullable: false
field :tier_mode, -> { Schematic::Types::BillingTiersMode }, optional: true, nullable: false
field :value_bool, -> { Internal::Types::Boolean }, optional: true, nullable: false
Expand Down
32 changes: 32 additions & 0 deletions lib/schematic/planbundle/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,38 @@ def initialize(client:)
@client = client
end

# @param request_options [Hash]
# @param params [Schematic::Planbundle::Types::CreateCustomPlanBundleRequestBody]
# @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
#
# @return [Schematic::Planbundle::Types::CreateCustomPlanBundleResponse]
def create_custom_plan_bundle(request_options: {}, **params)
params = Schematic::Internal::Types::Utils.normalize_keys(params)
request = Schematic::Internal::JSON::Request.new(
base_url: request_options[:base_url],
method: "POST",
path: "custom-plan-bundles",
body: Schematic::Planbundle::Types::CreateCustomPlanBundleRequestBody.new(params).to_h,
request_options: request_options
)
begin
response = @client.send(request)
rescue Net::HTTPRequestTimeout
raise Schematic::Errors::TimeoutError
end
code = response.code.to_i
if code.between?(200, 299)
Schematic::Planbundle::Types::CreateCustomPlanBundleResponse.load(response.body)
else
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
raise error_class.new(response.body, code: code)
end
end

# @param request_options [Hash]
# @param params [Schematic::Planbundle::Types::CreatePlanBundleRequestBody]
# @option request_options [String] :base_url
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Schematic
module Planbundle
module Types
class CreateCustomPlanBundleRequestBody < Internal::Types::Model
field :billing_product, -> { Schematic::Types::UpsertBillingProductRequestBody }, optional: true, nullable: false
field :entitlements, -> { Internal::Types::Array[Schematic::Types::PlanBundleEntitlementRequestBody] }, optional: false, nullable: false
field :plan, -> { Schematic::Types::CreateCustomPlanBundlePlanRequestBody }, optional: true, nullable: false
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module Schematic
module Planbundle
module Types
class CreateCustomPlanBundleResponse < Internal::Types::Model
field :data, -> { Schematic::Types::PlanBundleResponseData }, optional: false, nullable: false
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
end
end
end
end
1 change: 1 addition & 0 deletions lib/schematic/types/billing_price_response_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class BillingPriceResponseData < Internal::Types::Model
field :external_price_id, -> { String }, optional: false, nullable: false
field :id, -> { String }, optional: false, nullable: false
field :interval, -> { Schematic::Types::BillingProductPriceInterval }, optional: false, nullable: false
field :interval_count, -> { Integer }, optional: false, nullable: false
field :nickname, -> { String }, optional: true, nullable: false
field :price, -> { Integer }, optional: false, nullable: false
field :price_decimal, -> { String }, optional: true, nullable: false
Expand Down
1 change: 1 addition & 0 deletions lib/schematic/types/billing_price_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class BillingPriceView < Internal::Types::Model
field :currency, -> { String }, optional: false, nullable: false
field :id, -> { String }, optional: false, nullable: false
field :interval, -> { Schematic::Types::BillingProductPriceInterval }, optional: false, nullable: false
field :interval_count, -> { Integer }, optional: false, nullable: false
field :is_active, -> { Internal::Types::Boolean }, optional: false, nullable: false
field :meter_event_name, -> { String }, optional: true, nullable: false
field :meter_event_payload_key, -> { String }, optional: true, nullable: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class BillingProductForSubscriptionResponseData < Internal::Types::Model
field :external_id, -> { String }, optional: false, nullable: false
field :id, -> { String }, optional: false, nullable: false
field :interval, -> { String }, optional: false, nullable: false
field :interval_count, -> { Integer }, optional: true, nullable: false
field :meter_id, -> { String }, optional: true, nullable: false
field :name, -> { String }, optional: false, nullable: false
field :package_size, -> { Integer }, optional: false, nullable: false
Expand Down
Loading