schematichq 1.4.16 → 1.4.17
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 +4 -4
- data/.fern/replay.lock +9 -3
- data/WASM_VERSION +1 -1
- data/lib/schematic/accounts/types/update_onboarding_state_request_body.rb +2 -0
- data/lib/schematic/billing/client.rb +96 -0
- data/lib/schematic/billing/types/list_company_billing_profiles_params.rb +20 -0
- data/lib/schematic/billing/types/list_company_billing_profiles_request.rb +19 -0
- data/lib/schematic/billing/types/list_company_billing_profiles_response.rb +13 -0
- data/lib/schematic/billing/types/update_company_billing_profile_request_body.rb +23 -0
- data/lib/schematic/billing/types/update_company_billing_profile_response.rb +13 -0
- data/lib/schematic/client.rb +1 -1
- data/lib/schematic/credits/client.rb +266 -0
- data/lib/schematic/credits/types/count_credit_spend_policies_params.rb +24 -0
- data/lib/schematic/credits/types/count_credit_spend_policies_request.rb +23 -0
- data/lib/schematic/credits/types/count_credit_spend_policies_response.rb +13 -0
- data/lib/schematic/credits/types/create_credit_spend_policy_request_body.rb +19 -0
- data/lib/schematic/credits/types/create_credit_spend_policy_response.rb +13 -0
- data/lib/schematic/credits/types/delete_credit_spend_policy_response.rb +13 -0
- data/lib/schematic/credits/types/get_credit_spend_policy_response.rb +13 -0
- data/lib/schematic/credits/types/list_credit_spend_policies_params.rb +24 -0
- data/lib/schematic/credits/types/list_credit_spend_policies_request.rb +23 -0
- data/lib/schematic/credits/types/list_credit_spend_policies_response.rb +13 -0
- data/lib/schematic/credits/types/update_credit_spend_policy_request_body.rb +15 -0
- data/lib/schematic/credits/types/update_credit_spend_policy_response.rb +13 -0
- data/lib/schematic/datastream/resource_cache.rb +2 -4
- data/lib/schematic/events/client.rb +101 -0
- data/lib/schematic/events/types/delete_otlp_environment_settings_response.rb +13 -0
- data/lib/schematic/events/types/get_otlp_environment_settings_response.rb +13 -0
- data/lib/schematic/events/types/upsert_otlp_environment_settings_request_body.rb +19 -0
- data/lib/schematic/events/types/upsert_otlp_environment_settings_response.rb +13 -0
- data/lib/schematic/integrationsapi/client.rb +169 -0
- data/lib/schematic/integrationsapi/types/claim_stripe_sandbox_keys_request_body.rb +11 -0
- data/lib/schematic/integrationsapi/types/claim_stripe_sandbox_keys_response.rb +13 -0
- data/lib/schematic/integrationsapi/types/get_stripe_sandbox_claim_link_response.rb +13 -0
- data/lib/schematic/integrationsapi/types/get_stripe_sandbox_keys_response.rb +13 -0
- data/lib/schematic/integrationsapi/types/install_stripe_claimable_sandbox_response.rb +13 -0
- data/lib/schematic/integrationsapi/types/install_stripe_sandbox_request_body.rb +17 -0
- data/lib/schematic/integrationsapi/types/list_stripe_sandbox_countries_response.rb +13 -0
- data/lib/schematic/schematic_client.rb +11 -2
- data/lib/schematic/types/claimed_stripe_sandbox_keys_response_data.rb +13 -0
- data/lib/schematic/types/company_billing_profile_response_data.rb +35 -0
- data/lib/schematic/types/company_detail_response_data.rb +4 -0
- data/lib/schematic/types/company_override_response_data.rb +4 -0
- data/lib/schematic/types/credit_spend_policy_response_data.rb +25 -0
- data/lib/schematic/types/credit_spend_policy_scope.rb +13 -0
- data/lib/schematic/types/event_body_inference.rb +2 -0
- data/lib/schematic/types/get_onboarding_state_resp.rb +2 -0
- data/lib/schematic/types/otlp_environment_settings_response_data.rb +23 -0
- data/lib/schematic/types/rule_condition_detail_response_data.rb +2 -0
- data/lib/schematic/types/rule_condition_plan_version_response_data.rb +15 -0
- data/lib/schematic/types/stripe_integration_config.rb +6 -0
- data/lib/schematic/types/stripe_sandbox_claim_link.rb +15 -0
- data/lib/schematic/types/stripe_sandbox_countries_response_data.rb +9 -0
- data/lib/schematic/types/stripe_sandbox_install_response_data.rb +21 -0
- data/lib/schematic/types/stripe_sandbox_keys_response_data.rb +13 -0
- data/lib/schematic/version.rb +1 -1
- data/lib/schematic/wasm/rulesengine.wasm +0 -0
- data/lib/schematic.rb +41 -3
- data/reference.md +1108 -64
- data/testapp/app.rb +5 -1
- metadata +40 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec00574afecedfe21546aa5e1881fbba6e0c4c308503fcd0ffaa5770be83830a
|
|
4
|
+
data.tar.gz: fcfeb1feba843c69814311bbf25d5987aaee0abcd7c0b6f57725d6cdb6aad606
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a8054ded9284e483552fd743da2237cca4a97b28558d656b9014d0a2a8f87430d14d48647449e891566bc617736751ee4419288c75211162e5cac32861c7717
|
|
7
|
+
data.tar.gz: 5320a797e92c4707ee497ab2f56467b22f3a827ac8b111906a5d24cbca65635e5f914ba6e3347670e0657cc53f8328cecbcf9ee214d94fb2fa9f553027e52591
|
data/.fern/metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"cliVersion": "5.50.0",
|
|
3
3
|
"generatorName": "fernapi/fern-ruby-sdk",
|
|
4
|
-
"generatorVersion": "1.
|
|
4
|
+
"generatorVersion": "1.24.0",
|
|
5
5
|
"generatorConfig": {
|
|
6
6
|
"module": "SchematicHQ",
|
|
7
7
|
"rubocopVariableNumberStyle": "disabled",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"webrick": ">= 1.0"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"originGitCommit": "
|
|
16
|
+
"originGitCommit": "31f498c0a9babdc0eec5ae88e1212a254b2f2561",
|
|
17
17
|
"originGitCommitIsDirty": false,
|
|
18
18
|
"invokedBy": "ci",
|
|
19
|
-
"requestedVersion": "1.4.
|
|
19
|
+
"requestedVersion": "1.4.17",
|
|
20
20
|
"ciProvider": "github",
|
|
21
|
-
"sdkVersion": "1.4.
|
|
21
|
+
"sdkVersion": "1.4.17"
|
|
22
22
|
}
|
data/.fern/replay.lock
CHANGED
|
@@ -78,14 +78,20 @@ generations:
|
|
|
78
78
|
cli_version: unknown
|
|
79
79
|
generator_versions:
|
|
80
80
|
fernapi/fern-ruby-sdk: 1.23.2
|
|
81
|
-
|
|
81
|
+
- commit_sha: d57c23ea04698dbe0f4b64fdf38a7a56aebc3b6e
|
|
82
|
+
tree_hash: d882e89d295bd48600db56e21a2a39a6e97e6dae
|
|
83
|
+
timestamp: 2026-09-05T06:36:54.355Z
|
|
84
|
+
cli_version: unknown
|
|
85
|
+
generator_versions:
|
|
86
|
+
fernapi/fern-ruby-sdk: 1.24.0
|
|
87
|
+
current_generation: d57c23ea04698dbe0f4b64fdf38a7a56aebc3b6e
|
|
82
88
|
patches:
|
|
83
89
|
- id: patch-5da692c2
|
|
84
90
|
content_hash: sha256:e652287219a0a709e16112ced444e6472c6fa8bdfe888edf868caaf9769a9472
|
|
85
91
|
original_commit: 5da692c20aef08577d900f9a860b5f78a549418e
|
|
86
92
|
original_message: inject host time into datastream wasm rules engine (SCHY-471)
|
|
87
93
|
original_author: Christopher Brady <chris@schematichq.com>
|
|
88
|
-
base_generation:
|
|
94
|
+
base_generation: d57c23ea04698dbe0f4b64fdf38a7a56aebc3b6e
|
|
89
95
|
files:
|
|
90
96
|
- test/rules_engine_clock_test.rb
|
|
91
97
|
patch_content: |
|
|
@@ -253,7 +259,7 @@ patches:
|
|
|
253
259
|
original_commit: ee61788c5a83fce5dd5768b2536391459550d176
|
|
254
260
|
original_message: fix rubocop offenses in clock regression test (SCHY-471)
|
|
255
261
|
original_author: Christopher Brady <chris@schematichq.com>
|
|
256
|
-
base_generation:
|
|
262
|
+
base_generation: d57c23ea04698dbe0f4b64fdf38a7a56aebc3b6e
|
|
257
263
|
files:
|
|
258
264
|
- test/rules_engine_clock_test.rb
|
|
259
265
|
patch_content: |
|
data/WASM_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.7.
|
|
1
|
+
0.7.3
|
|
@@ -4,6 +4,8 @@ module Schematic
|
|
|
4
4
|
module Accounts
|
|
5
5
|
module Types
|
|
6
6
|
class UpdateOnboardingStateRequestBody < Internal::Types::Model
|
|
7
|
+
field :country, -> { String }, optional: true, nullable: false
|
|
8
|
+
|
|
7
9
|
field :dismissed, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
8
10
|
|
|
9
11
|
field :path, -> { Schematic::Types::OnboardingPath }, optional: true, nullable: false
|
|
@@ -1164,6 +1164,102 @@ module Schematic
|
|
|
1164
1164
|
end
|
|
1165
1165
|
end
|
|
1166
1166
|
|
|
1167
|
+
# @param request_options [Hash]
|
|
1168
|
+
# @param params [Hash]
|
|
1169
|
+
# @option request_options [String] :base_url
|
|
1170
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1171
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1172
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1173
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1174
|
+
# @option params [String, nil] :company_id
|
|
1175
|
+
# @option params [Boolean, nil] :is_default
|
|
1176
|
+
# @option params [Schematic::Types::BillingProviderType, nil] :provider_type
|
|
1177
|
+
# @option params [Integer, nil] :limit
|
|
1178
|
+
# @option params [Integer, nil] :offset
|
|
1179
|
+
#
|
|
1180
|
+
# @example
|
|
1181
|
+
# client.billing.list_company_billing_profiles(
|
|
1182
|
+
# company_id: "company_id",
|
|
1183
|
+
# is_default: true,
|
|
1184
|
+
# provider_type: "metronome",
|
|
1185
|
+
# limit: 1000000,
|
|
1186
|
+
# offset: 1000000
|
|
1187
|
+
# )
|
|
1188
|
+
#
|
|
1189
|
+
# @return [Schematic::Billing::Types::ListCompanyBillingProfilesResponse]
|
|
1190
|
+
def list_company_billing_profiles(request_options: {}, **params)
|
|
1191
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1192
|
+
query_params = {}
|
|
1193
|
+
query_params["company_id"] = params[:company_id] if params.key?(:company_id)
|
|
1194
|
+
query_params["is_default"] = params[:is_default] if params.key?(:is_default)
|
|
1195
|
+
query_params["provider_type"] = params[:provider_type] if params.key?(:provider_type)
|
|
1196
|
+
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
1197
|
+
query_params["offset"] = params[:offset] if params.key?(:offset)
|
|
1198
|
+
|
|
1199
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1200
|
+
base_url: request_options[:base_url],
|
|
1201
|
+
method: "GET",
|
|
1202
|
+
path: "billing/profiles",
|
|
1203
|
+
query: query_params,
|
|
1204
|
+
request_options: request_options
|
|
1205
|
+
)
|
|
1206
|
+
begin
|
|
1207
|
+
response = @client.send(request)
|
|
1208
|
+
rescue Net::HTTPRequestTimeout
|
|
1209
|
+
raise Schematic::Errors::TimeoutError
|
|
1210
|
+
end
|
|
1211
|
+
code = response.code.to_i
|
|
1212
|
+
if code.between?(200, 299)
|
|
1213
|
+
Schematic::Billing::Types::ListCompanyBillingProfilesResponse.load(response.body)
|
|
1214
|
+
else
|
|
1215
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1216
|
+
raise error_class.new(response.body, code: code)
|
|
1217
|
+
end
|
|
1218
|
+
end
|
|
1219
|
+
|
|
1220
|
+
# @param request_options [Hash]
|
|
1221
|
+
# @param params [Schematic::Billing::Types::UpdateCompanyBillingProfileRequestBody]
|
|
1222
|
+
# @option request_options [String] :base_url
|
|
1223
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1224
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1225
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1226
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1227
|
+
# @option params [String] :billing_profile_id
|
|
1228
|
+
#
|
|
1229
|
+
# @example
|
|
1230
|
+
# client.billing.update_company_billing_profile(
|
|
1231
|
+
# billing_profile_id: "billing_profile_id",
|
|
1232
|
+
# collection_method: "charge_automatically"
|
|
1233
|
+
# )
|
|
1234
|
+
#
|
|
1235
|
+
# @return [Schematic::Billing::Types::UpdateCompanyBillingProfileResponse]
|
|
1236
|
+
def update_company_billing_profile(request_options: {}, **params)
|
|
1237
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1238
|
+
request_data = Schematic::Billing::Types::UpdateCompanyBillingProfileRequestBody.new(params).to_h
|
|
1239
|
+
non_body_param_names = %w[billing_profile_id]
|
|
1240
|
+
body = request_data.except(*non_body_param_names)
|
|
1241
|
+
|
|
1242
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1243
|
+
base_url: request_options[:base_url],
|
|
1244
|
+
method: "PUT",
|
|
1245
|
+
path: "billing/profiles/#{URI.encode_uri_component(params[:billing_profile_id].to_s)}",
|
|
1246
|
+
body: body,
|
|
1247
|
+
request_options: request_options
|
|
1248
|
+
)
|
|
1249
|
+
begin
|
|
1250
|
+
response = @client.send(request)
|
|
1251
|
+
rescue Net::HTTPRequestTimeout
|
|
1252
|
+
raise Schematic::Errors::TimeoutError
|
|
1253
|
+
end
|
|
1254
|
+
code = response.code.to_i
|
|
1255
|
+
if code.between?(200, 299)
|
|
1256
|
+
Schematic::Billing::Types::UpdateCompanyBillingProfileResponse.load(response.body)
|
|
1257
|
+
else
|
|
1258
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1259
|
+
raise error_class.new(response.body, code: code)
|
|
1260
|
+
end
|
|
1261
|
+
end
|
|
1262
|
+
|
|
1167
1263
|
# @param request_options [Hash]
|
|
1168
1264
|
# @param params [Schematic::Billing::Types::CreateBillingSubscriptionRequestBody]
|
|
1169
1265
|
# @option request_options [String] :base_url
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
# Input parameters
|
|
7
|
+
class ListCompanyBillingProfilesParams < Internal::Types::Model
|
|
8
|
+
field :company_id, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :is_default, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :limit, -> { Integer }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :offset, -> { Integer }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class ListCompanyBillingProfilesRequest < Internal::Types::Model
|
|
7
|
+
field :company_id, -> { String }, optional: true, nullable: false
|
|
8
|
+
|
|
9
|
+
field :is_default, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :limit, -> { Integer }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :offset, -> { Integer }, optional: true, nullable: false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class ListCompanyBillingProfilesResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Internal::Types::Array[Schematic::Types::CompanyBillingProfileResponseData] }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :params, -> { Schematic::Billing::Types::ListCompanyBillingProfilesParams }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class UpdateCompanyBillingProfileRequestBody < Internal::Types::Model
|
|
7
|
+
field :billing_profile_id, -> { String }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :collection_method, -> { Schematic::Types::BillingCollectionMethod }, optional: false, nullable: false
|
|
10
|
+
|
|
11
|
+
field :days_until_due, -> { Integer }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :is_default, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :name, -> { String }, optional: true, nullable: false
|
|
16
|
+
|
|
17
|
+
field :payment_method_id, -> { String }, optional: true, nullable: false
|
|
18
|
+
|
|
19
|
+
field :proration_behavior, -> { Schematic::Types::ProrationBehavior }, optional: true, nullable: false
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class UpdateCompanyBillingProfileResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::CompanyBillingProfileResponseData }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/schematic/client.rb
CHANGED
|
@@ -42,7 +42,7 @@ module Schematic
|
|
|
42
42
|
@raw_client = Schematic::Internal::Http::RawClient.new(
|
|
43
43
|
base_url: base_url || Schematic::Environment::DEFAULT,
|
|
44
44
|
headers: {
|
|
45
|
-
"User-Agent" => "schematichq/1.4.
|
|
45
|
+
"User-Agent" => "schematichq/1.4.17",
|
|
46
46
|
"X-Fern-Language" => "Ruby",
|
|
47
47
|
"X-Schematic-Api-Key" => api_key.to_s
|
|
48
48
|
},
|
|
@@ -1266,6 +1266,272 @@ module Schematic
|
|
|
1266
1266
|
end
|
|
1267
1267
|
end
|
|
1268
1268
|
|
|
1269
|
+
# @param request_options [Hash]
|
|
1270
|
+
# @param params [Hash]
|
|
1271
|
+
# @option request_options [String] :base_url
|
|
1272
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1273
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1274
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1275
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1276
|
+
# @option params [String, nil] :billing_credit_id
|
|
1277
|
+
# @option params [String, nil] :company_id
|
|
1278
|
+
# @option params [Schematic::Types::CreditSpendPolicyScope, nil] :scope_type
|
|
1279
|
+
# @option params [String, nil] :user_id
|
|
1280
|
+
# @option params [String, nil] :user_ids
|
|
1281
|
+
# @option params [Integer, nil] :limit
|
|
1282
|
+
# @option params [Integer, nil] :offset
|
|
1283
|
+
#
|
|
1284
|
+
# @example
|
|
1285
|
+
# client.credits.list_credit_spend_policies(
|
|
1286
|
+
# billing_credit_id: "billing_credit_id",
|
|
1287
|
+
# company_id: "company_id",
|
|
1288
|
+
# scope_type: "company",
|
|
1289
|
+
# user_id: "user_id",
|
|
1290
|
+
# user_ids: ["user_ids"],
|
|
1291
|
+
# limit: 1000000,
|
|
1292
|
+
# offset: 1000000
|
|
1293
|
+
# )
|
|
1294
|
+
#
|
|
1295
|
+
# @return [Schematic::Credits::Types::ListCreditSpendPoliciesResponse]
|
|
1296
|
+
def list_credit_spend_policies(request_options: {}, **params)
|
|
1297
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1298
|
+
query_params = {}
|
|
1299
|
+
query_params["billing_credit_id"] = params[:billing_credit_id] if params.key?(:billing_credit_id)
|
|
1300
|
+
query_params["company_id"] = params[:company_id] if params.key?(:company_id)
|
|
1301
|
+
query_params["scope_type"] = params[:scope_type] if params.key?(:scope_type)
|
|
1302
|
+
query_params["user_id"] = params[:user_id] if params.key?(:user_id)
|
|
1303
|
+
query_params["user_ids"] = params[:user_ids] if params.key?(:user_ids)
|
|
1304
|
+
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
1305
|
+
query_params["offset"] = params[:offset] if params.key?(:offset)
|
|
1306
|
+
|
|
1307
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1308
|
+
base_url: request_options[:base_url],
|
|
1309
|
+
method: "GET",
|
|
1310
|
+
path: "billing/credits/spend-policies",
|
|
1311
|
+
query: query_params,
|
|
1312
|
+
request_options: request_options
|
|
1313
|
+
)
|
|
1314
|
+
begin
|
|
1315
|
+
response = @client.send(request)
|
|
1316
|
+
rescue Net::HTTPRequestTimeout
|
|
1317
|
+
raise Schematic::Errors::TimeoutError
|
|
1318
|
+
end
|
|
1319
|
+
code = response.code.to_i
|
|
1320
|
+
if code.between?(200, 299)
|
|
1321
|
+
Schematic::Credits::Types::ListCreditSpendPoliciesResponse.load(response.body)
|
|
1322
|
+
else
|
|
1323
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1324
|
+
raise error_class.new(response.body, code: code)
|
|
1325
|
+
end
|
|
1326
|
+
end
|
|
1327
|
+
|
|
1328
|
+
# @param request_options [Hash]
|
|
1329
|
+
# @param params [Schematic::Credits::Types::CreateCreditSpendPolicyRequestBody]
|
|
1330
|
+
# @option request_options [String] :base_url
|
|
1331
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1332
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1333
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1334
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1335
|
+
#
|
|
1336
|
+
# @example
|
|
1337
|
+
# client.credits.create_credit_spend_policy(
|
|
1338
|
+
# billing_credit_id: "billing_credit_id",
|
|
1339
|
+
# max_per_draw: 1.1
|
|
1340
|
+
# )
|
|
1341
|
+
#
|
|
1342
|
+
# @return [Schematic::Credits::Types::CreateCreditSpendPolicyResponse]
|
|
1343
|
+
def create_credit_spend_policy(request_options: {}, **params)
|
|
1344
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1345
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1346
|
+
base_url: request_options[:base_url],
|
|
1347
|
+
method: "POST",
|
|
1348
|
+
path: "billing/credits/spend-policies",
|
|
1349
|
+
body: Schematic::Credits::Types::CreateCreditSpendPolicyRequestBody.new(params).to_h,
|
|
1350
|
+
request_options: request_options
|
|
1351
|
+
)
|
|
1352
|
+
begin
|
|
1353
|
+
response = @client.send(request)
|
|
1354
|
+
rescue Net::HTTPRequestTimeout
|
|
1355
|
+
raise Schematic::Errors::TimeoutError
|
|
1356
|
+
end
|
|
1357
|
+
code = response.code.to_i
|
|
1358
|
+
if code.between?(200, 299)
|
|
1359
|
+
Schematic::Credits::Types::CreateCreditSpendPolicyResponse.load(response.body)
|
|
1360
|
+
else
|
|
1361
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1362
|
+
raise error_class.new(response.body, code: code)
|
|
1363
|
+
end
|
|
1364
|
+
end
|
|
1365
|
+
|
|
1366
|
+
# @param request_options [Hash]
|
|
1367
|
+
# @param params [Hash]
|
|
1368
|
+
# @option request_options [String] :base_url
|
|
1369
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1370
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1371
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1372
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1373
|
+
# @option params [String] :spend_policy_id
|
|
1374
|
+
#
|
|
1375
|
+
# @example
|
|
1376
|
+
# client.credits.get_credit_spend_policy(spend_policy_id: "spend_policy_id")
|
|
1377
|
+
#
|
|
1378
|
+
# @return [Schematic::Credits::Types::GetCreditSpendPolicyResponse]
|
|
1379
|
+
def get_credit_spend_policy(request_options: {}, **params)
|
|
1380
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1381
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1382
|
+
base_url: request_options[:base_url],
|
|
1383
|
+
method: "GET",
|
|
1384
|
+
path: "billing/credits/spend-policies/#{URI.encode_uri_component(params[:spend_policy_id].to_s)}",
|
|
1385
|
+
request_options: request_options
|
|
1386
|
+
)
|
|
1387
|
+
begin
|
|
1388
|
+
response = @client.send(request)
|
|
1389
|
+
rescue Net::HTTPRequestTimeout
|
|
1390
|
+
raise Schematic::Errors::TimeoutError
|
|
1391
|
+
end
|
|
1392
|
+
code = response.code.to_i
|
|
1393
|
+
if code.between?(200, 299)
|
|
1394
|
+
Schematic::Credits::Types::GetCreditSpendPolicyResponse.load(response.body)
|
|
1395
|
+
else
|
|
1396
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1397
|
+
raise error_class.new(response.body, code: code)
|
|
1398
|
+
end
|
|
1399
|
+
end
|
|
1400
|
+
|
|
1401
|
+
# @param request_options [Hash]
|
|
1402
|
+
# @param params [Schematic::Credits::Types::UpdateCreditSpendPolicyRequestBody]
|
|
1403
|
+
# @option request_options [String] :base_url
|
|
1404
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1405
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1406
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1407
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1408
|
+
# @option params [String] :spend_policy_id
|
|
1409
|
+
#
|
|
1410
|
+
# @example
|
|
1411
|
+
# client.credits.update_credit_spend_policy(spend_policy_id: "spend_policy_id")
|
|
1412
|
+
#
|
|
1413
|
+
# @return [Schematic::Credits::Types::UpdateCreditSpendPolicyResponse]
|
|
1414
|
+
def update_credit_spend_policy(request_options: {}, **params)
|
|
1415
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1416
|
+
request_data = Schematic::Credits::Types::UpdateCreditSpendPolicyRequestBody.new(params).to_h
|
|
1417
|
+
non_body_param_names = %w[spend_policy_id]
|
|
1418
|
+
body = request_data.except(*non_body_param_names)
|
|
1419
|
+
|
|
1420
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1421
|
+
base_url: request_options[:base_url],
|
|
1422
|
+
method: "PUT",
|
|
1423
|
+
path: "billing/credits/spend-policies/#{URI.encode_uri_component(params[:spend_policy_id].to_s)}",
|
|
1424
|
+
body: body,
|
|
1425
|
+
request_options: request_options
|
|
1426
|
+
)
|
|
1427
|
+
begin
|
|
1428
|
+
response = @client.send(request)
|
|
1429
|
+
rescue Net::HTTPRequestTimeout
|
|
1430
|
+
raise Schematic::Errors::TimeoutError
|
|
1431
|
+
end
|
|
1432
|
+
code = response.code.to_i
|
|
1433
|
+
if code.between?(200, 299)
|
|
1434
|
+
Schematic::Credits::Types::UpdateCreditSpendPolicyResponse.load(response.body)
|
|
1435
|
+
else
|
|
1436
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1437
|
+
raise error_class.new(response.body, code: code)
|
|
1438
|
+
end
|
|
1439
|
+
end
|
|
1440
|
+
|
|
1441
|
+
# @param request_options [Hash]
|
|
1442
|
+
# @param params [Hash]
|
|
1443
|
+
# @option request_options [String] :base_url
|
|
1444
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1445
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1446
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1447
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1448
|
+
# @option params [String] :spend_policy_id
|
|
1449
|
+
#
|
|
1450
|
+
# @example
|
|
1451
|
+
# client.credits.delete_credit_spend_policy(spend_policy_id: "spend_policy_id")
|
|
1452
|
+
#
|
|
1453
|
+
# @return [Schematic::Credits::Types::DeleteCreditSpendPolicyResponse]
|
|
1454
|
+
def delete_credit_spend_policy(request_options: {}, **params)
|
|
1455
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1456
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1457
|
+
base_url: request_options[:base_url],
|
|
1458
|
+
method: "DELETE",
|
|
1459
|
+
path: "billing/credits/spend-policies/#{URI.encode_uri_component(params[:spend_policy_id].to_s)}",
|
|
1460
|
+
request_options: request_options
|
|
1461
|
+
)
|
|
1462
|
+
begin
|
|
1463
|
+
response = @client.send(request)
|
|
1464
|
+
rescue Net::HTTPRequestTimeout
|
|
1465
|
+
raise Schematic::Errors::TimeoutError
|
|
1466
|
+
end
|
|
1467
|
+
code = response.code.to_i
|
|
1468
|
+
if code.between?(200, 299)
|
|
1469
|
+
Schematic::Credits::Types::DeleteCreditSpendPolicyResponse.load(response.body)
|
|
1470
|
+
else
|
|
1471
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1472
|
+
raise error_class.new(response.body, code: code)
|
|
1473
|
+
end
|
|
1474
|
+
end
|
|
1475
|
+
|
|
1476
|
+
# @param request_options [Hash]
|
|
1477
|
+
# @param params [Hash]
|
|
1478
|
+
# @option request_options [String] :base_url
|
|
1479
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1480
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1481
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1482
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1483
|
+
# @option params [String, nil] :billing_credit_id
|
|
1484
|
+
# @option params [String, nil] :company_id
|
|
1485
|
+
# @option params [Schematic::Types::CreditSpendPolicyScope, nil] :scope_type
|
|
1486
|
+
# @option params [String, nil] :user_id
|
|
1487
|
+
# @option params [String, nil] :user_ids
|
|
1488
|
+
# @option params [Integer, nil] :limit
|
|
1489
|
+
# @option params [Integer, nil] :offset
|
|
1490
|
+
#
|
|
1491
|
+
# @example
|
|
1492
|
+
# client.credits.count_credit_spend_policies(
|
|
1493
|
+
# billing_credit_id: "billing_credit_id",
|
|
1494
|
+
# company_id: "company_id",
|
|
1495
|
+
# scope_type: "company",
|
|
1496
|
+
# user_id: "user_id",
|
|
1497
|
+
# user_ids: ["user_ids"],
|
|
1498
|
+
# limit: 1000000,
|
|
1499
|
+
# offset: 1000000
|
|
1500
|
+
# )
|
|
1501
|
+
#
|
|
1502
|
+
# @return [Schematic::Credits::Types::CountCreditSpendPoliciesResponse]
|
|
1503
|
+
def count_credit_spend_policies(request_options: {}, **params)
|
|
1504
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1505
|
+
query_params = {}
|
|
1506
|
+
query_params["billing_credit_id"] = params[:billing_credit_id] if params.key?(:billing_credit_id)
|
|
1507
|
+
query_params["company_id"] = params[:company_id] if params.key?(:company_id)
|
|
1508
|
+
query_params["scope_type"] = params[:scope_type] if params.key?(:scope_type)
|
|
1509
|
+
query_params["user_id"] = params[:user_id] if params.key?(:user_id)
|
|
1510
|
+
query_params["user_ids"] = params[:user_ids] if params.key?(:user_ids)
|
|
1511
|
+
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
1512
|
+
query_params["offset"] = params[:offset] if params.key?(:offset)
|
|
1513
|
+
|
|
1514
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1515
|
+
base_url: request_options[:base_url],
|
|
1516
|
+
method: "GET",
|
|
1517
|
+
path: "billing/credits/spend-policies/count",
|
|
1518
|
+
query: query_params,
|
|
1519
|
+
request_options: request_options
|
|
1520
|
+
)
|
|
1521
|
+
begin
|
|
1522
|
+
response = @client.send(request)
|
|
1523
|
+
rescue Net::HTTPRequestTimeout
|
|
1524
|
+
raise Schematic::Errors::TimeoutError
|
|
1525
|
+
end
|
|
1526
|
+
code = response.code.to_i
|
|
1527
|
+
if code.between?(200, 299)
|
|
1528
|
+
Schematic::Credits::Types::CountCreditSpendPoliciesResponse.load(response.body)
|
|
1529
|
+
else
|
|
1530
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1531
|
+
raise error_class.new(response.body, code: code)
|
|
1532
|
+
end
|
|
1533
|
+
end
|
|
1534
|
+
|
|
1269
1535
|
# @param request_options [Hash]
|
|
1270
1536
|
# @param params [Hash]
|
|
1271
1537
|
# @option request_options [String] :base_url
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Credits
|
|
5
|
+
module Types
|
|
6
|
+
# Input parameters
|
|
7
|
+
class CountCreditSpendPoliciesParams < Internal::Types::Model
|
|
8
|
+
field :billing_credit_id, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :company_id, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :limit, -> { Integer }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :offset, -> { Integer }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :scope_type, -> { Schematic::Types::CreditSpendPolicyScope }, optional: true, nullable: false
|
|
17
|
+
|
|
18
|
+
field :user_id, -> { String }, optional: true, nullable: false
|
|
19
|
+
|
|
20
|
+
field :user_ids, -> { Internal::Types::Array[String] }, optional: true, nullable: false
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Credits
|
|
5
|
+
module Types
|
|
6
|
+
class CountCreditSpendPoliciesRequest < Internal::Types::Model
|
|
7
|
+
field :billing_credit_id, -> { String }, optional: true, nullable: false
|
|
8
|
+
|
|
9
|
+
field :company_id, -> { String }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :scope_type, -> { Schematic::Types::CreditSpendPolicyScope }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :user_id, -> { String }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :user_ids, -> { String }, optional: true, nullable: false
|
|
16
|
+
|
|
17
|
+
field :limit, -> { Integer }, optional: true, nullable: false
|
|
18
|
+
|
|
19
|
+
field :offset, -> { Integer }, optional: true, nullable: false
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Credits
|
|
5
|
+
module Types
|
|
6
|
+
class CountCreditSpendPoliciesResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::CountResponse }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :params, -> { Schematic::Credits::Types::CountCreditSpendPoliciesParams }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Credits
|
|
5
|
+
module Types
|
|
6
|
+
class CreateCreditSpendPolicyRequestBody < Internal::Types::Model
|
|
7
|
+
field :billing_credit_id, -> { String }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :company_id, -> { String }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :label, -> { String }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :max_per_draw, -> { Integer }, optional: false, nullable: false
|
|
14
|
+
|
|
15
|
+
field :user_id, -> { String }, optional: true, nullable: false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Credits
|
|
5
|
+
module Types
|
|
6
|
+
class CreateCreditSpendPolicyResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::CreditSpendPolicyResponseData }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|