schematichq 1.4.5 → 1.4.7

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.fern/metadata.json +2 -2
  3. data/.fern/replay.lock +20 -495
  4. data/WASM_VERSION +1 -1
  5. data/lib/schematic/billing/client.rb +102 -2
  6. data/lib/schematic/billing/types/delete_billing_coupon_response.rb +12 -0
  7. data/lib/schematic/billing/types/delete_billing_customer_response.rb +12 -0
  8. data/lib/schematic/billing/types/delete_billing_invoice_response.rb +12 -0
  9. data/lib/schematic/billing/types/list_billing_prices_params.rb +1 -0
  10. data/lib/schematic/billing/types/list_billing_prices_request.rb +1 -0
  11. data/lib/schematic/billing/types/list_billing_product_prices_params.rb +1 -0
  12. data/lib/schematic/billing/types/list_billing_product_prices_request.rb +1 -0
  13. data/lib/schematic/checkout/types/checkout_data_request_body.rb +1 -0
  14. data/lib/schematic/client.rb +1 -1
  15. data/lib/schematic/datastream/merge.rb +3 -4
  16. data/lib/schematic/plans/types/publish_plan_version_request_body.rb +1 -0
  17. data/lib/schematic/types/account_member_permission.rb +0 -1
  18. data/lib/schematic/types/check_flags_response_data.rb +1 -0
  19. data/lib/schematic/types/company_credit_balance.rb +11 -0
  20. data/lib/schematic/types/company_subscription_response_data.rb +1 -0
  21. data/lib/schematic/types/feature_entitlement.rb +2 -0
  22. data/lib/schematic/types/plan_change_response_data.rb +1 -0
  23. data/lib/schematic/types/rules_engine_schema_version.rb +1 -1
  24. data/lib/schematic/types/rulesengine_feature_entitlement.rb +2 -0
  25. data/lib/schematic/types/test_webhook_response_data.rb +10 -0
  26. data/lib/schematic/version.rb +1 -1
  27. data/lib/schematic/wasm/rulesengine.wasm +0 -0
  28. data/lib/schematic/webhooks/client.rb +37 -0
  29. data/lib/schematic/webhooks/types/send_test_webhook_action_response.rb +12 -0
  30. data/lib/schematic/webhooks/types/test_webhook_request_body.rb +12 -0
  31. data/lib/schematic.rb +8 -1
  32. data/reference.md +237 -0
  33. metadata +9 -2
@@ -86,6 +86,70 @@ module Schematic
86
86
  end
87
87
  end
88
88
 
89
+ # @param request_options [Hash]
90
+ # @param params [Hash]
91
+ # @option request_options [String] :base_url
92
+ # @option request_options [Hash{String => Object}] :additional_headers
93
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
94
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
95
+ # @option request_options [Integer] :timeout_in_seconds
96
+ # @option params [String] :billing_id
97
+ #
98
+ # @return [Schematic::Billing::Types::DeleteBillingCouponResponse]
99
+ def delete_billing_coupon(request_options: {}, **params)
100
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
101
+ request = Schematic::Internal::JSON::Request.new(
102
+ base_url: request_options[:base_url],
103
+ method: "DELETE",
104
+ path: "billing/coupons/#{URI.encode_uri_component(params[:billing_id].to_s)}",
105
+ request_options: request_options
106
+ )
107
+ begin
108
+ response = @client.send(request)
109
+ rescue Net::HTTPRequestTimeout
110
+ raise Schematic::Errors::TimeoutError
111
+ end
112
+ code = response.code.to_i
113
+ if code.between?(200, 299)
114
+ Schematic::Billing::Types::DeleteBillingCouponResponse.load(response.body)
115
+ else
116
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
117
+ raise error_class.new(response.body, code: code)
118
+ end
119
+ end
120
+
121
+ # @param request_options [Hash]
122
+ # @param params [Hash]
123
+ # @option request_options [String] :base_url
124
+ # @option request_options [Hash{String => Object}] :additional_headers
125
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
126
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
127
+ # @option request_options [Integer] :timeout_in_seconds
128
+ # @option params [String] :billing_id
129
+ #
130
+ # @return [Schematic::Billing::Types::DeleteBillingCustomerResponse]
131
+ def delete_billing_customer(request_options: {}, **params)
132
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
133
+ request = Schematic::Internal::JSON::Request.new(
134
+ base_url: request_options[:base_url],
135
+ method: "DELETE",
136
+ path: "billing/customer/#{URI.encode_uri_component(params[:billing_id].to_s)}",
137
+ request_options: request_options
138
+ )
139
+ begin
140
+ response = @client.send(request)
141
+ rescue Net::HTTPRequestTimeout
142
+ raise Schematic::Errors::TimeoutError
143
+ end
144
+ code = response.code.to_i
145
+ if code.between?(200, 299)
146
+ Schematic::Billing::Types::DeleteBillingCustomerResponse.load(response.body)
147
+ else
148
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
149
+ raise error_class.new(response.body, code: code)
150
+ end
151
+ end
152
+
89
153
  # @param request_options [Hash]
90
154
  # @param params [Schematic::Billing::Types::CreateBillingCustomerRequestBody]
91
155
  # @option request_options [String] :base_url
@@ -292,6 +356,38 @@ module Schematic
292
356
  end
293
357
  end
294
358
 
359
+ # @param request_options [Hash]
360
+ # @param params [Hash]
361
+ # @option request_options [String] :base_url
362
+ # @option request_options [Hash{String => Object}] :additional_headers
363
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
364
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
365
+ # @option request_options [Integer] :timeout_in_seconds
366
+ # @option params [String] :billing_id
367
+ #
368
+ # @return [Schematic::Billing::Types::DeleteBillingInvoiceResponse]
369
+ def delete_billing_invoice(request_options: {}, **params)
370
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
371
+ request = Schematic::Internal::JSON::Request.new(
372
+ base_url: request_options[:base_url],
373
+ method: "DELETE",
374
+ path: "billing/invoices/#{URI.encode_uri_component(params[:billing_id].to_s)}",
375
+ request_options: request_options
376
+ )
377
+ begin
378
+ response = @client.send(request)
379
+ rescue Net::HTTPRequestTimeout
380
+ raise Schematic::Errors::TimeoutError
381
+ end
382
+ code = response.code.to_i
383
+ if code.between?(200, 299)
384
+ Schematic::Billing::Types::DeleteBillingInvoiceResponse.load(response.body)
385
+ else
386
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
387
+ raise error_class.new(response.body, code: code)
388
+ end
389
+ end
390
+
295
391
  # @param request_options [Hash]
296
392
  # @param params [Hash]
297
393
  # @option request_options [String] :base_url
@@ -487,6 +583,7 @@ module Schematic
487
583
  # @option params [String, nil] :ids
488
584
  # @option params [String, nil] :interval
489
585
  # @option params [Boolean, nil] :is_active
586
+ # @option params [String, nil] :plan_version_id
490
587
  # @option params [Integer, nil] :price
491
588
  # @option params [String, nil] :product_id
492
589
  # @option params [String, nil] :product_ids
@@ -501,7 +598,7 @@ module Schematic
501
598
  # @return [Schematic::Billing::Types::ListBillingPricesResponse]
502
599
  def list_billing_prices(request_options: {}, **params)
503
600
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
504
- query_param_names = %i[currency for_initial_plan for_trial_expiry_plan ids interval is_active price product_id product_ids provider_type q tiers_mode usage_type with_meter limit offset]
601
+ query_param_names = %i[currency for_initial_plan for_trial_expiry_plan ids interval is_active plan_version_id price product_id product_ids provider_type q tiers_mode usage_type with_meter limit offset]
505
602
  query_params = {}
506
603
  query_params["currency"] = params[:currency] if params.key?(:currency)
507
604
  query_params["for_initial_plan"] = params[:for_initial_plan] if params.key?(:for_initial_plan)
@@ -509,6 +606,7 @@ module Schematic
509
606
  query_params["ids"] = params[:ids] if params.key?(:ids)
510
607
  query_params["interval"] = params[:interval] if params.key?(:interval)
511
608
  query_params["is_active"] = params[:is_active] if params.key?(:is_active)
609
+ query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
512
610
  query_params["price"] = params[:price] if params.key?(:price)
513
611
  query_params["product_id"] = params[:product_id] if params.key?(:product_id)
514
612
  query_params["product_ids"] = params[:product_ids] if params.key?(:product_ids)
@@ -619,6 +717,7 @@ module Schematic
619
717
  # @option params [String, nil] :ids
620
718
  # @option params [String, nil] :interval
621
719
  # @option params [Boolean, nil] :is_active
720
+ # @option params [String, nil] :plan_version_id
622
721
  # @option params [Integer, nil] :price
623
722
  # @option params [String, nil] :product_id
624
723
  # @option params [String, nil] :product_ids
@@ -633,7 +732,7 @@ module Schematic
633
732
  # @return [Schematic::Billing::Types::ListBillingProductPricesResponse]
634
733
  def list_billing_product_prices(request_options: {}, **params)
635
734
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
636
- query_param_names = %i[currency for_initial_plan for_trial_expiry_plan ids interval is_active price product_id product_ids provider_type q tiers_mode usage_type with_meter limit offset]
735
+ query_param_names = %i[currency for_initial_plan for_trial_expiry_plan ids interval is_active plan_version_id price product_id product_ids provider_type q tiers_mode usage_type with_meter limit offset]
637
736
  query_params = {}
638
737
  query_params["currency"] = params[:currency] if params.key?(:currency)
639
738
  query_params["for_initial_plan"] = params[:for_initial_plan] if params.key?(:for_initial_plan)
@@ -641,6 +740,7 @@ module Schematic
641
740
  query_params["ids"] = params[:ids] if params.key?(:ids)
642
741
  query_params["interval"] = params[:interval] if params.key?(:interval)
643
742
  query_params["is_active"] = params[:is_active] if params.key?(:is_active)
743
+ query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
644
744
  query_params["price"] = params[:price] if params.key?(:price)
645
745
  query_params["product_id"] = params[:product_id] if params.key?(:product_id)
646
746
  query_params["product_ids"] = params[:product_ids] if params.key?(:product_ids)
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class DeleteBillingCouponResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::DeleteResponse }, optional: false, nullable: false
8
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class DeleteBillingCustomerResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::DeleteResponse }, optional: false, nullable: false
8
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class DeleteBillingInvoiceResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::DeleteResponse }, optional: false, nullable: false
8
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -13,6 +13,7 @@ module Schematic
13
13
  field :is_active, -> { Internal::Types::Boolean }, optional: true, nullable: false
14
14
  field :limit, -> { Integer }, optional: true, nullable: false
15
15
  field :offset, -> { Integer }, optional: true, nullable: false
16
+ field :plan_version_id, -> { String }, optional: true, nullable: false
16
17
  field :price, -> { Integer }, optional: true, nullable: false
17
18
  field :product_id, -> { String }, optional: true, nullable: false
18
19
  field :product_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false
@@ -10,6 +10,7 @@ module Schematic
10
10
  field :ids, -> { String }, optional: true, nullable: false
11
11
  field :interval, -> { String }, optional: true, nullable: false
12
12
  field :is_active, -> { Internal::Types::Boolean }, optional: true, nullable: false
13
+ field :plan_version_id, -> { String }, optional: true, nullable: false
13
14
  field :price, -> { Integer }, optional: true, nullable: false
14
15
  field :product_id, -> { String }, optional: true, nullable: false
15
16
  field :product_ids, -> { String }, optional: true, nullable: false
@@ -13,6 +13,7 @@ module Schematic
13
13
  field :is_active, -> { Internal::Types::Boolean }, optional: true, nullable: false
14
14
  field :limit, -> { Integer }, optional: true, nullable: false
15
15
  field :offset, -> { Integer }, optional: true, nullable: false
16
+ field :plan_version_id, -> { String }, optional: true, nullable: false
16
17
  field :price, -> { Integer }, optional: true, nullable: false
17
18
  field :product_id, -> { String }, optional: true, nullable: false
18
19
  field :product_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false
@@ -10,6 +10,7 @@ module Schematic
10
10
  field :ids, -> { String }, optional: true, nullable: false
11
11
  field :interval, -> { String }, optional: true, nullable: false
12
12
  field :is_active, -> { Internal::Types::Boolean }, optional: true, nullable: false
13
+ field :plan_version_id, -> { String }, optional: true, nullable: false
13
14
  field :price, -> { Integer }, optional: true, nullable: false
14
15
  field :product_id, -> { String }, optional: true, nullable: false
15
16
  field :product_ids, -> { String }, optional: true, nullable: false
@@ -5,6 +5,7 @@ module Schematic
5
5
  module Types
6
6
  class CheckoutDataRequestBody < Internal::Types::Model
7
7
  field :company_id, -> { String }, optional: false, nullable: false
8
+ field :currency, -> { String }, optional: true, nullable: false
8
9
  field :selected_plan_id, -> { String }, optional: true, nullable: false
9
10
  end
10
11
  end
@@ -10,7 +10,7 @@ module Schematic
10
10
  @raw_client = Schematic::Internal::Http::RawClient.new(
11
11
  base_url: base_url || Schematic::Environment::DEFAULT,
12
12
  headers: {
13
- "User-Agent" => "schematichq/1.4.5",
13
+ "User-Agent" => "schematichq/1.4.7",
14
14
  "X-Fern-Language" => "Ruby",
15
15
  "X-Schematic-Api-Key" => api_key.to_s
16
16
  }
@@ -46,7 +46,7 @@ module Schematic
46
46
  end
47
47
  end
48
48
 
49
- if (updated_balances&.any? || metrics_updated) && !entitlements_in_partial
49
+ if (updated_balances || metrics_updated) && !entitlements_in_partial
50
50
  result[:entitlements] = sync_entitlements(
51
51
  result[:entitlements], result[:metrics], updated_balances, metrics_updated
52
52
  )
@@ -152,9 +152,8 @@ module Schematic
152
152
  end
153
153
  end
154
154
 
155
- # The partial's credit_balances may be keyed by string or symbol depending
156
- # on how the message was parsed, while an entitlement's credit_id is a
157
- # string value, so check both key forms.
155
+ # credit_balances keys may be symbols (deep_copy symbolizes) while an
156
+ # entitlement's credit_id is always a string, so check both forms.
158
157
  def fetch_balance(balances, credit_id)
159
158
  return [true, balances[credit_id]] if balances.key?(credit_id)
160
159
  return [true, balances[credit_id.to_sym]] if balances.key?(credit_id.to_sym)
@@ -6,6 +6,7 @@ module Schematic
6
6
  class PublishPlanVersionRequestBody < Internal::Types::Model
7
7
  field :plan_id, -> { String }, optional: false, nullable: false
8
8
  field :activation_strategy, -> { Schematic::Types::CustomPlanActivationStrategy }, optional: true, nullable: false
9
+ field :coupon_external_id, -> { String }, optional: true, nullable: false
9
10
  field :customer_email, -> { String }, optional: true, nullable: false
10
11
  field :days_until_due, -> { Integer }, optional: true, nullable: false
11
12
  field :excluded_company_ids, -> { Internal::Types::Array[String] }, optional: false, nullable: false
@@ -5,7 +5,6 @@ module Schematic
5
5
  module AccountMemberPermission
6
6
  extend Schematic::Internal::Types::Enum
7
7
 
8
- BILLING_CREDITS_EDIT = "billing_credits_edit"
9
8
  COMPANIES_EDIT = "companies_edit"
10
9
  COMPANY_USERS_EDIT = "company_users_edit"
11
10
  COMPONENTS_EDIT = "components_edit"
@@ -3,6 +3,7 @@
3
3
  module Schematic
4
4
  module Types
5
5
  class CheckFlagsResponseData < Internal::Types::Model
6
+ field :credit_balances, -> { Internal::Types::Hash[String, Schematic::Types::CompanyCreditBalance] }, optional: true, nullable: false
6
7
  field :flags, -> { Internal::Types::Array[Schematic::Types::CheckFlagResponseData] }, optional: false, nullable: false
7
8
  field :plan, -> { Schematic::Types::DatastreamCompanyPlan }, optional: true, nullable: false
8
9
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Types
5
+ class CompanyCreditBalance < Internal::Types::Model
6
+ field :remaining, -> { Integer }, optional: false, nullable: false
7
+ field :reserved, -> { Integer }, optional: false, nullable: false
8
+ field :settled, -> { Integer }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
@@ -10,6 +10,7 @@ module Schematic
10
10
  field :discounts, -> { Internal::Types::Array[Schematic::Types::BillingSubscriptionDiscountView] }, optional: false, nullable: false
11
11
  field :expired_at, -> { String }, optional: true, nullable: false
12
12
  field :interval, -> { String }, optional: false, nullable: false
13
+ field :is_initial, -> { Internal::Types::Boolean }, optional: false, nullable: false
13
14
  field :latest_invoice, -> { Schematic::Types::InvoiceResponseData }, optional: true, nullable: false
14
15
  field :payment_method, -> { Schematic::Types::PaymentMethodResponseData }, optional: true, nullable: false
15
16
  field :products, -> { Internal::Types::Array[Schematic::Types::BillingProductForSubscriptionResponseData] }, optional: false, nullable: false
@@ -4,6 +4,7 @@ module Schematic
4
4
  module Types
5
5
  class FeatureEntitlement < Internal::Types::Model
6
6
  field :allocation, -> { Integer }, optional: true, nullable: false
7
+ field :consumption_rate, -> { Integer }, optional: true, nullable: false
7
8
  field :credit_id, -> { String }, optional: true, nullable: false
8
9
  field :credit_remaining, -> { Integer }, optional: true, nullable: false
9
10
  field :credit_reserved, -> { Integer }, optional: true, nullable: false
@@ -11,6 +12,7 @@ module Schematic
11
12
  field :credit_total, -> { Integer }, optional: true, nullable: false
12
13
  field :credit_used, -> { Integer }, optional: true, nullable: false
13
14
  field :event_name, -> { String }, optional: true, nullable: false
15
+ field :event_subtype, -> { String }, optional: true, nullable: false
14
16
  field :feature_id, -> { String }, optional: false, nullable: false
15
17
  field :feature_key, -> { String }, optional: false, nullable: false
16
18
  field :metric_period, -> { Schematic::Types::MetricPeriod }, optional: true, nullable: false
@@ -17,6 +17,7 @@ module Schematic
17
17
  field :created_at, -> { String }, optional: false, nullable: false
18
18
  field :environment_id, -> { String }, optional: false, nullable: false
19
19
  field :id, -> { String }, optional: false, nullable: false
20
+ field :integration, -> { Schematic::Types::IntegrationResponseData }, optional: true, nullable: false
20
21
  field :is_version_upgrade, -> { Internal::Types::Boolean }, optional: false, nullable: false
21
22
  field :previous_base_plan, -> { Schematic::Types::PlanSnapshotView }, optional: true, nullable: false
22
23
  field :previous_base_plan_version, -> { Schematic::Types::PlanVersionSnapshotView }, optional: true, nullable: false
@@ -5,7 +5,7 @@ module Schematic
5
5
  module RulesEngineSchemaVersion
6
6
  extend Schematic::Internal::Types::Enum
7
7
 
8
- V_97288_F_60 = "v97288f60"
8
+ V_5_B_3_E_7220 = "v5b3e7220"
9
9
  PLACEHOLDER_FOR_FERN_COMPATIBILITY = "placeholder-for-fern-compatibility"
10
10
  end
11
11
  end
@@ -4,6 +4,7 @@ module Schematic
4
4
  module Types
5
5
  class RulesengineFeatureEntitlement < Internal::Types::Model
6
6
  field :allocation, -> { Integer }, optional: true, nullable: false
7
+ field :consumption_rate, -> { Integer }, optional: true, nullable: false
7
8
  field :credit_id, -> { String }, optional: true, nullable: false
8
9
  field :credit_remaining, -> { Integer }, optional: true, nullable: false
9
10
  field :credit_reserved, -> { Integer }, optional: true, nullable: false
@@ -11,6 +12,7 @@ module Schematic
11
12
  field :credit_total, -> { Integer }, optional: true, nullable: false
12
13
  field :credit_used, -> { Integer }, optional: true, nullable: false
13
14
  field :event_name, -> { String }, optional: true, nullable: false
15
+ field :event_subtype, -> { String }, optional: true, nullable: false
14
16
  field :feature_id, -> { String }, optional: false, nullable: false
15
17
  field :feature_key, -> { String }, optional: false, nullable: false
16
18
  field :metric_period, -> { Schematic::Types::RulesengineMetricPeriod }, optional: true, nullable: false
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Types
5
+ class TestWebhookResponseData < Internal::Types::Model
6
+ field :response_code, -> { Integer }, optional: false, nullable: false
7
+ field :success, -> { Internal::Types::Boolean }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Schematic
4
- VERSION = "1.4.5"
4
+ VERSION = "1.4.7"
5
5
  end
Binary file
@@ -309,6 +309,43 @@ module Schematic
309
309
  end
310
310
  end
311
311
 
312
+ # @param request_options [Hash]
313
+ # @param params [Schematic::Webhooks::Types::TestWebhookRequestBody]
314
+ # @option request_options [String] :base_url
315
+ # @option request_options [Hash{String => Object}] :additional_headers
316
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
317
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
318
+ # @option request_options [Integer] :timeout_in_seconds
319
+ # @option params [String] :webhook_id
320
+ #
321
+ # @return [Schematic::Webhooks::Types::SendTestWebhookActionResponse]
322
+ def send_test_webhook_action(request_options: {}, **params)
323
+ params = Schematic::Internal::Types::Utils.normalize_keys(params)
324
+ request_data = Schematic::Webhooks::Types::TestWebhookRequestBody.new(params).to_h
325
+ non_body_param_names = ["webhook_id"]
326
+ body = request_data.except(*non_body_param_names)
327
+
328
+ request = Schematic::Internal::JSON::Request.new(
329
+ base_url: request_options[:base_url],
330
+ method: "POST",
331
+ path: "webhooks/#{URI.encode_uri_component(params[:webhook_id].to_s)}/test",
332
+ body: body,
333
+ request_options: request_options
334
+ )
335
+ begin
336
+ response = @client.send(request)
337
+ rescue Net::HTTPRequestTimeout
338
+ raise Schematic::Errors::TimeoutError
339
+ end
340
+ code = response.code.to_i
341
+ if code.between?(200, 299)
342
+ Schematic::Webhooks::Types::SendTestWebhookActionResponse.load(response.body)
343
+ else
344
+ error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
345
+ raise error_class.new(response.body, code: code)
346
+ end
347
+ end
348
+
312
349
  # @param request_options [Hash]
313
350
  # @param params [Hash]
314
351
  # @option request_options [String] :base_url
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Webhooks
5
+ module Types
6
+ class SendTestWebhookActionResponse < Internal::Types::Model
7
+ field :data, -> { Schematic::Types::TestWebhookResponseData }, optional: false, nullable: false
8
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Webhooks
5
+ module Types
6
+ class TestWebhookRequestBody < Internal::Types::Model
7
+ field :webhook_id, -> { String }, optional: false, nullable: false
8
+ field :request_type, -> { Schematic::Types::WebhookRequestType }, optional: false, nullable: false
9
+ end
10
+ end
11
+ end
12
+ end
data/lib/schematic.rb CHANGED
@@ -85,6 +85,8 @@ require_relative "schematic/types/billing_provider_type"
85
85
  require_relative "schematic/types/billing_coupon_response_data"
86
86
  require_relative "schematic/billing/types/list_coupons_response"
87
87
  require_relative "schematic/billing/types/upsert_billing_coupon_response"
88
+ require_relative "schematic/billing/types/delete_billing_coupon_response"
89
+ require_relative "schematic/billing/types/delete_billing_customer_response"
88
90
  require_relative "schematic/types/billing_customer_response_data"
89
91
  require_relative "schematic/billing/types/upsert_billing_customer_response"
90
92
  require_relative "schematic/billing/types/list_customers_with_subscriptions_params"
@@ -98,6 +100,7 @@ require_relative "schematic/types/invoice_status"
98
100
  require_relative "schematic/types/invoice_response_data"
99
101
  require_relative "schematic/billing/types/list_invoices_response"
100
102
  require_relative "schematic/billing/types/upsert_invoice_response"
103
+ require_relative "schematic/billing/types/delete_billing_invoice_response"
101
104
  require_relative "schematic/billing/types/list_meters_params"
102
105
  require_relative "schematic/types/billing_meter_response_data"
103
106
  require_relative "schematic/billing/types/list_meters_response"
@@ -326,6 +329,7 @@ require_relative "schematic/companies/types/get_entity_trait_values_response"
326
329
  require_relative "schematic/types/plan_change_action"
327
330
  require_relative "schematic/types/plan_change_base_plan_action"
328
331
  require_relative "schematic/companies/types/list_plan_changes_params"
332
+ require_relative "schematic/types/integration_response_data"
329
333
  require_relative "schematic/types/plan_change_subscription_action"
330
334
  require_relative "schematic/types/plan_snapshot_view"
331
335
  require_relative "schematic/types/plan_version_snapshot_view"
@@ -500,6 +504,7 @@ require_relative "schematic/types/rules_detail_response_data"
500
504
  require_relative "schematic/features/types/update_flag_rules_response"
501
505
  require_relative "schematic/types/check_flag_response_data"
502
506
  require_relative "schematic/features/types/check_flag_response"
507
+ require_relative "schematic/types/company_credit_balance"
503
508
  require_relative "schematic/types/trial_status"
504
509
  require_relative "schematic/types/datastream_company_plan"
505
510
  require_relative "schematic/types/check_flags_response_data"
@@ -546,7 +551,6 @@ require_relative "schematic/types/integration_webhook_url_response_data"
546
551
  require_relative "schematic/integrationsapi/types/get_integration_webhook_url_response"
547
552
  require_relative "schematic/types/company_matching_criteria"
548
553
  require_relative "schematic/types/integration_install_config"
549
- require_relative "schematic/types/integration_response_data"
550
554
  require_relative "schematic/types/integration_install_response_data"
551
555
  require_relative "schematic/integrationsapi/types/install_integration_response"
552
556
  require_relative "schematic/integrationsapi/types/start_data_import_response"
@@ -621,6 +625,8 @@ require_relative "schematic/webhooks/types/create_webhook_response"
621
625
  require_relative "schematic/webhooks/types/get_webhook_response"
622
626
  require_relative "schematic/webhooks/types/update_webhook_response"
623
627
  require_relative "schematic/webhooks/types/delete_webhook_response"
628
+ require_relative "schematic/types/test_webhook_response_data"
629
+ require_relative "schematic/webhooks/types/send_test_webhook_action_response"
624
630
  require_relative "schematic/webhooks/types/count_webhooks_params"
625
631
  require_relative "schematic/webhooks/types/count_webhooks_response"
626
632
  require_relative "schematic/types/api_error"
@@ -907,5 +913,6 @@ require_relative "schematic/webhooks/types/count_webhook_events_request"
907
913
  require_relative "schematic/webhooks/types/list_webhooks_request"
908
914
  require_relative "schematic/webhooks/types/create_webhook_request_body"
909
915
  require_relative "schematic/webhooks/types/update_webhook_request_body"
916
+ require_relative "schematic/webhooks/types/test_webhook_request_body"
910
917
  require_relative "schematic/webhooks/types/count_webhooks_request"
911
918
  require_relative "schematic/environment"