schematichq 1.4.5 → 1.4.6
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 +4 -4
- data/.fern/metadata.json +2 -2
- data/.fern/replay.lock +20 -495
- data/WASM_VERSION +1 -1
- data/lib/schematic/billing/client.rb +102 -2
- data/lib/schematic/billing/types/delete_billing_coupon_response.rb +12 -0
- data/lib/schematic/billing/types/delete_billing_customer_response.rb +12 -0
- data/lib/schematic/billing/types/delete_billing_invoice_response.rb +12 -0
- data/lib/schematic/billing/types/list_billing_prices_params.rb +1 -0
- data/lib/schematic/billing/types/list_billing_prices_request.rb +1 -0
- data/lib/schematic/billing/types/list_billing_product_prices_params.rb +1 -0
- data/lib/schematic/billing/types/list_billing_product_prices_request.rb +1 -0
- data/lib/schematic/client.rb +1 -1
- data/lib/schematic/datastream/merge.rb +3 -4
- data/lib/schematic/types/account_member_permission.rb +0 -1
- data/lib/schematic/types/check_flags_response_data.rb +1 -0
- data/lib/schematic/types/company_credit_balance.rb +11 -0
- data/lib/schematic/types/company_subscription_response_data.rb +1 -0
- data/lib/schematic/types/feature_entitlement.rb +2 -0
- data/lib/schematic/types/rulesengine_feature_entitlement.rb +2 -0
- data/lib/schematic/types/test_webhook_response_data.rb +10 -0
- data/lib/schematic/version.rb +1 -1
- data/lib/schematic/wasm/rulesengine.wasm +0 -0
- data/lib/schematic/webhooks/client.rb +37 -0
- data/lib/schematic/webhooks/types/send_test_webhook_action_response.rb +12 -0
- data/lib/schematic/webhooks/types/test_webhook_request_body.rb +12 -0
- data/lib/schematic.rb +7 -0
- data/reference.md +221 -0
- 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
|
data/lib/schematic/client.rb
CHANGED
|
@@ -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.
|
|
13
|
+
"User-Agent" => "schematichq/1.4.6",
|
|
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
|
|
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
|
-
#
|
|
156
|
-
#
|
|
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)
|
|
@@ -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
|
|
@@ -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
|
data/lib/schematic/version.rb
CHANGED
|
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"
|
|
@@ -500,6 +503,7 @@ require_relative "schematic/types/rules_detail_response_data"
|
|
|
500
503
|
require_relative "schematic/features/types/update_flag_rules_response"
|
|
501
504
|
require_relative "schematic/types/check_flag_response_data"
|
|
502
505
|
require_relative "schematic/features/types/check_flag_response"
|
|
506
|
+
require_relative "schematic/types/company_credit_balance"
|
|
503
507
|
require_relative "schematic/types/trial_status"
|
|
504
508
|
require_relative "schematic/types/datastream_company_plan"
|
|
505
509
|
require_relative "schematic/types/check_flags_response_data"
|
|
@@ -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"
|