Class: Schematic::Credits::Client
- Inherits:
-
Object
- Object
- Schematic::Credits::Client
- Defined in:
- lib/schematic/credits/client.rb
Instance Method Summary collapse
- #acquire_credit_lease(request_options: {}, **params) ⇒ Schematic::Credits::Types::AcquireCreditLeaseResponse
- #count_billing_credits(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountBillingCreditsResponse
- #count_billing_credits_grants(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountBillingCreditsGrantsResponse
- #count_billing_plan_credit_grants(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountBillingPlanCreditGrantsResponse
- #count_company_grants(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountCompanyGrantsResponse
- #count_credit_bundles(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountCreditBundlesResponse
- #count_credit_event_ledger(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountCreditEventLedgerResponse
- #create_billing_credit(request_options: {}, **params) ⇒ Schematic::Credits::Types::CreateBillingCreditResponse
- #create_billing_plan_credit_grant(request_options: {}, **params) ⇒ Schematic::Credits::Types::CreateBillingPlanCreditGrantResponse
- #create_credit_bundle(request_options: {}, **params) ⇒ Schematic::Credits::Types::CreateCreditBundleResponse
- #delete_billing_plan_credit_grant(request_options: {}, **params) ⇒ Schematic::Credits::Types::DeleteBillingPlanCreditGrantResponse
- #delete_credit_bundle(request_options: {}, **params) ⇒ Schematic::Credits::Types::DeleteCreditBundleResponse
- #extend_credit_lease(request_options: {}, **params) ⇒ Schematic::Credits::Types::ExtendCreditLeaseResponse
- #get_credit_bundle(request_options: {}, **params) ⇒ Schematic::Credits::Types::GetCreditBundleResponse
- #get_single_billing_credit(request_options: {}, **params) ⇒ Schematic::Credits::Types::GetSingleBillingCreditResponse
- #get_single_billing_plan_credit_grant(request_options: {}, **params) ⇒ Schematic::Credits::Types::GetSingleBillingPlanCreditGrantResponse
- #grant_billing_credits_to_company(request_options: {}, **params) ⇒ Schematic::Credits::Types::GrantBillingCreditsToCompanyResponse
- #initialize(client:) ⇒ void constructor
- #list_billing_credits(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListBillingCreditsResponse
- #list_billing_plan_credit_grants(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListBillingPlanCreditGrantsResponse
- #list_company_credit_balances(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListCompanyCreditBalancesResponse
- #list_company_grants(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListCompanyGrantsResponse
- #list_credit_bundles(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListCreditBundlesResponse
- #list_credit_event_ledger(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListCreditEventLedgerResponse
- #list_grants_for_credit(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListGrantsForCreditResponse
- #release_credit_lease(request_options: {}, **params) ⇒ Schematic::Credits::Types::ReleaseCreditLeaseResponse
- #soft_delete_billing_credit(request_options: {}, **params) ⇒ Schematic::Credits::Types::SoftDeleteBillingCreditResponse
- #update_billing_credit(request_options: {}, **params) ⇒ Schematic::Credits::Types::UpdateBillingCreditResponse
- #update_billing_plan_credit_grant(request_options: {}, **params) ⇒ Schematic::Credits::Types::UpdateBillingPlanCreditGrantResponse
- #update_credit_bundle_details(request_options: {}, **params) ⇒ Schematic::Credits::Types::UpdateCreditBundleDetailsResponse
- #zero_out_grant(request_options: {}, **params) ⇒ Schematic::Credits::Types::ZeroOutGrantResponse
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/schematic/credits/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#acquire_credit_lease(request_options: {}, **params) ⇒ Schematic::Credits::Types::AcquireCreditLeaseResponse
873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 |
# File 'lib/schematic/credits/client.rb', line 873 def acquire_credit_lease(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "billing/credits/lease", body: Schematic::Credits::Types::AcquireCreditLeaseRequestBody.new(params).to_h, 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::Credits::Types::AcquireCreditLeaseResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_billing_credits(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountBillingCreditsResponse
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 |
# File 'lib/schematic/credits/client.rb', line 542 def count_billing_credits(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["ids"] = params[:ids] if params.key?(:ids) query_params["name"] = params[:name] if params.key?(:name) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/count", query: query_params, 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::Credits::Types::CountBillingCreditsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_billing_credits_grants(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountBillingCreditsGrantsResponse
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 |
# File 'lib/schematic/credits/client.rb', line 778 def count_billing_credits_grants(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["credit_id"] = params[:credit_id] if params.key?(:credit_id) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/grants/count", query: query_params, 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::Credits::Types::CountBillingCreditsGrantsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_billing_plan_credit_grants(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountBillingPlanCreditGrantsResponse
1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 |
# File 'lib/schematic/credits/client.rb', line 1236 def count_billing_plan_credit_grants(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["credit_id"] = params[:credit_id] if params.key?(:credit_id) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id) query_params["plan_ids"] = params[:plan_ids] if params.key?(:plan_ids) query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id) query_params["plan_version_ids"] = params[:plan_version_ids] if params.key?(:plan_version_ids) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/plan-grants/count", query: query_params, 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::Credits::Types::CountBillingPlanCreditGrantsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_company_grants(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountCompanyGrantsResponse
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 |
# File 'lib/schematic/credits/client.rb', line 674 def count_company_grants(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["company_id"] = params[:company_id] if params.key?(:company_id) query_params["order"] = params[:order] if params.key?(:order) query_params["dir"] = params[:dir] if params.key?(:dir) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/grants/company/count", query: query_params, 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::Credits::Types::CountCompanyGrantsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_credit_bundles(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountCreditBundlesResponse
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
# File 'lib/schematic/credits/client.rb', line 490 def count_credit_bundles(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["ids"] = params[:ids] if params.key?(:ids) query_params["credit_id"] = params[:credit_id] if params.key?(:credit_id) query_params["status"] = params[:status] if params.key?(:status) query_params["bundle_type"] = params[:bundle_type] if params.key?(:bundle_type) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/bundles/count", query: query_params, 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::Credits::Types::CountCreditBundlesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_credit_event_ledger(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountCreditEventLedgerResponse
1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 |
# File 'lib/schematic/credits/client.rb', line 1360 def count_credit_event_ledger(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["billing_credit_id"] = params[:billing_credit_id] if params.key?(:billing_credit_id) query_params["company_id"] = params[:company_id] if params.key?(:company_id) query_params["end_time"] = params[:end_time] if params.key?(:end_time) query_params["event_type"] = params[:event_type] if params.key?(:event_type) query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id) query_params["start_time"] = params[:start_time] if params.key?(:start_time) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/billing/credits/ledger/count", query: query_params, 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::Credits::Types::CountCreditEventLedgerResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_billing_credit(request_options: {}, **params) ⇒ Schematic::Credits::Types::CreateBillingCreditResponse
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/schematic/credits/client.rb', line 79 def create_billing_credit(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "billing/credits", body: Schematic::Credits::Types::CreateBillingCreditRequestBody.new(params).to_h, 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::Credits::Types::CreateBillingCreditResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_billing_plan_credit_grant(request_options: {}, **params) ⇒ Schematic::Credits::Types::CreateBillingPlanCreditGrantResponse
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 |
# File 'lib/schematic/credits/client.rb', line 1063 def create_billing_plan_credit_grant(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "billing/credits/plan-grants", body: Schematic::Types::CreateBillingPlanCreditGrantRequestBody.new(params).to_h, 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::Credits::Types::CreateBillingPlanCreditGrantResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_credit_bundle(request_options: {}, **params) ⇒ Schematic::Credits::Types::CreateCreditBundleResponse
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/schematic/credits/client.rb', line 328 def create_credit_bundle(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "billing/credits/bundles", body: Schematic::Credits::Types::CreateCreditBundleRequestBody.new(params).to_h, 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::Credits::Types::CreateCreditBundleResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_billing_plan_credit_grant(request_options: {}, **params) ⇒ Schematic::Credits::Types::DeleteBillingPlanCreditGrantResponse
1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 |
# File 'lib/schematic/credits/client.rb', line 1181 def delete_billing_plan_credit_grant(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["apply_to_existing"] = params[:apply_to_existing] if params.key?(:apply_to_existing) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "billing/credits/plan-grants/#{URI.encode_uri_component(params[:plan_grant_id].to_s)}", query: query_params, 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::Credits::Types::DeleteBillingPlanCreditGrantResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_credit_bundle(request_options: {}, **params) ⇒ Schematic::Credits::Types::DeleteCreditBundleResponse
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/schematic/credits/client.rb', line 443 def delete_credit_bundle(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "billing/credits/bundles/#{URI.encode_uri_component(params[:bundle_id].to_s)}", 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::Credits::Types::DeleteCreditBundleResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#extend_credit_lease(request_options: {}, **params) ⇒ Schematic::Credits::Types::ExtendCreditLeaseResponse
912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 |
# File 'lib/schematic/credits/client.rb', line 912 def extend_credit_lease(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request_data = Schematic::Credits::Types::ExtendCreditLeaseRequestBody.new(params).to_h non_body_param_names = %w[lease_id] body = request_data.except(*non_body_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "billing/credits/lease/#{URI.encode_uri_component(params[:lease_id].to_s)}/extend", body: body, 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::Credits::Types::ExtendCreditLeaseResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_credit_bundle(request_options: {}, **params) ⇒ Schematic::Credits::Types::GetCreditBundleResponse
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/schematic/credits/client.rb', line 364 def get_credit_bundle(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/bundles/#{URI.encode_uri_component(params[:bundle_id].to_s)}", 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::Credits::Types::GetCreditBundleResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_single_billing_credit(request_options: {}, **params) ⇒ Schematic::Credits::Types::GetSingleBillingCreditResponse
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/schematic/credits/client.rb', line 115 def get_single_billing_credit(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/#{URI.encode_uri_component(params[:credit_id].to_s)}", 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::Credits::Types::GetSingleBillingCreditResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_single_billing_plan_credit_grant(request_options: {}, **params) ⇒ Schematic::Credits::Types::GetSingleBillingPlanCreditGrantResponse
1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 |
# File 'lib/schematic/credits/client.rb', line 1099 def get_single_billing_plan_credit_grant(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/plan-grants/#{URI.encode_uri_component(params[:plan_grant_id].to_s)}", 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::Credits::Types::GetSingleBillingPlanCreditGrantResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#grant_billing_credits_to_company(request_options: {}, **params) ⇒ Schematic::Credits::Types::GrantBillingCreditsToCompanyResponse
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 |
# File 'lib/schematic/credits/client.rb', line 628 def grant_billing_credits_to_company(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "billing/credits/grants/company", body: Schematic::Credits::Types::CreateCompanyCreditGrant.new(params).to_h, 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::Credits::Types::GrantBillingCreditsToCompanyResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_billing_credits(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListBillingCreditsResponse
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/schematic/credits/client.rb', line 34 def list_billing_credits(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["ids"] = params[:ids] if params.key?(:ids) query_params["name"] = params[:name] if params.key?(:name) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits", query: query_params, 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::Credits::Types::ListBillingCreditsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_billing_plan_credit_grants(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListBillingPlanCreditGrantsResponse
1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 |
# File 'lib/schematic/credits/client.rb', line 1012 def list_billing_plan_credit_grants(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["credit_id"] = params[:credit_id] if params.key?(:credit_id) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id) query_params["plan_ids"] = params[:plan_ids] if params.key?(:plan_ids) query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id) query_params["plan_version_ids"] = params[:plan_version_ids] if params.key?(:plan_version_ids) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/plan-grants", query: query_params, 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::Credits::Types::ListBillingPlanCreditGrantsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_company_credit_balances(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListCompanyCreditBalancesResponse
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/schematic/credits/client.rb', line 229 def list_company_credit_balances(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["company_id"] = params[:company_id] if params.key?(:company_id) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/balance", query: query_params, 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::Credits::Types::ListCompanyCreditBalancesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_company_grants(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListCompanyGrantsResponse
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 |
# File 'lib/schematic/credits/client.rb', line 727 def list_company_grants(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["company_id"] = params[:company_id] if params.key?(:company_id) query_params["order"] = params[:order] if params.key?(:order) query_params["dir"] = params[:dir] if params.key?(:dir) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/grants/company/list", query: query_params, 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::Credits::Types::ListCompanyGrantsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_credit_bundles(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListCreditBundlesResponse
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/schematic/credits/client.rb', line 280 def list_credit_bundles(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["ids"] = params[:ids] if params.key?(:ids) query_params["credit_id"] = params[:credit_id] if params.key?(:credit_id) query_params["status"] = params[:status] if params.key?(:status) query_params["bundle_type"] = params[:bundle_type] if params.key?(:bundle_type) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/bundles", query: query_params, 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::Credits::Types::ListCreditBundlesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_credit_event_ledger(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListCreditEventLedgerResponse
1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 |
# File 'lib/schematic/credits/client.rb', line 1298 def list_credit_event_ledger(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["billing_credit_id"] = params[:billing_credit_id] if params.key?(:billing_credit_id) query_params["company_id"] = params[:company_id] if params.key?(:company_id) query_params["end_time"] = params[:end_time] if params.key?(:end_time) query_params["event_type"] = params[:event_type] if params.key?(:event_type) query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id) query_params["start_time"] = params[:start_time] if params.key?(:start_time) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "v2/billing/credits/ledger", query: query_params, 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::Credits::Types::ListCreditEventLedgerResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_grants_for_credit(request_options: {}, **params) ⇒ Schematic::Credits::Types::ListGrantsForCreditResponse
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 |
# File 'lib/schematic/credits/client.rb', line 828 def list_grants_for_credit(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["credit_id"] = params[:credit_id] if params.key?(:credit_id) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "billing/credits/grants/list", query: query_params, 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::Credits::Types::ListGrantsForCreditResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#release_credit_lease(request_options: {}, **params) ⇒ Schematic::Credits::Types::ReleaseCreditLeaseResponse
957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 |
# File 'lib/schematic/credits/client.rb', line 957 def release_credit_lease(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[lease_id] body_params = params.except(*path_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "billing/credits/lease/#{URI.encode_uri_component(params[:lease_id].to_s)}/release", body: body_params, 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::Credits::Types::ReleaseCreditLeaseResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#soft_delete_billing_credit(request_options: {}, **params) ⇒ Schematic::Credits::Types::SoftDeleteBillingCreditResponse
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/schematic/credits/client.rb', line 194 def soft_delete_billing_credit(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "billing/credits/#{URI.encode_uri_component(params[:credit_id].to_s)}", 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::Credits::Types::SoftDeleteBillingCreditResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update_billing_credit(request_options: {}, **params) ⇒ Schematic::Credits::Types::UpdateBillingCreditResponse
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/schematic/credits/client.rb', line 154 def update_billing_credit(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request_data = Schematic::Credits::Types::UpdateBillingCreditRequestBody.new(params).to_h non_body_param_names = %w[credit_id] body = request_data.except(*non_body_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "billing/credits/#{URI.encode_uri_component(params[:credit_id].to_s)}", body: body, 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::Credits::Types::UpdateBillingCreditResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update_billing_plan_credit_grant(request_options: {}, **params) ⇒ Schematic::Credits::Types::UpdateBillingPlanCreditGrantResponse
1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 |
# File 'lib/schematic/credits/client.rb', line 1138 def update_billing_plan_credit_grant(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[plan_grant_id] body_params = params.except(*path_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "billing/credits/plan-grants/#{URI.encode_uri_component(params[:plan_grant_id].to_s)}", body: Schematic::Types::UpdateBillingPlanCreditGrantRequestBody.new(body_params).to_h, 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::Credits::Types::UpdateBillingPlanCreditGrantResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update_credit_bundle_details(request_options: {}, **params) ⇒ Schematic::Credits::Types::UpdateCreditBundleDetailsResponse
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'lib/schematic/credits/client.rb', line 403 def update_credit_bundle_details(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request_data = Schematic::Credits::Types::UpdateCreditBundleDetailsRequestBody.new(params).to_h non_body_param_names = %w[bundle_id] body = request_data.except(*non_body_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "billing/credits/bundles/#{URI.encode_uri_component(params[:bundle_id].to_s)}", body: body, 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::Credits::Types::UpdateCreditBundleDetailsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#zero_out_grant(request_options: {}, **params) ⇒ Schematic::Credits::Types::ZeroOutGrantResponse
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 |
# File 'lib/schematic/credits/client.rb', line 584 def zero_out_grant(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request_data = Schematic::Credits::Types::ZeroOutGrantRequestBody.new(params).to_h non_body_param_names = %w[grant_id] body = request_data.except(*non_body_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "billing/credits/grants/#{URI.encode_uri_component(params[:grant_id].to_s)}/zero-out", body: body, 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::Credits::Types::ZeroOutGrantResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |