Class: Schematic::Credits::Client
- Inherits:
-
Object
- Object
- Schematic::Credits::Client
- Defined in:
- lib/schematic/credits/client.rb
Instance Method Summary collapse
- #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
- #count_credit_ledger(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountCreditLedgerResponse
- #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
- #get_credit_bundle(request_options: {}, **params) ⇒ Schematic::Credits::Types::GetCreditBundleResponse
- #get_enriched_credit_ledger(request_options: {}, **params) ⇒ Schematic::Credits::Types::GetEnrichedCreditLedgerResponse
- #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
- #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
#count_billing_credits(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountBillingCreditsResponse
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 |
# File 'lib/schematic/credits/client.rb', line 470 def count_billing_credits(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[ids name limit offset] 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) params.except(*query_param_names) 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
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 703 704 |
# File 'lib/schematic/credits/client.rb', line 675 def count_billing_credits_grants(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[credit_id ids limit offset] 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) params.except(*query_param_names) 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
1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 |
# File 'lib/schematic/credits/client.rb', line 1056 def count_billing_plan_credit_grants(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[credit_id ids plan_id plan_ids plan_version_id limit offset] 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["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) 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
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 610 611 612 613 614 |
# File 'lib/schematic/credits/client.rb', line 584 def count_company_grants(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id order dir limit offset] 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) params.except(*query_param_names) 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
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
# File 'lib/schematic/credits/client.rb', line 424 def count_credit_bundles(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[ids credit_id status bundle_type limit offset] 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) params.except(*query_param_names) 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
1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 |
# File 'lib/schematic/credits/client.rb', line 1159 def count_credit_event_ledger(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[billing_credit_id company_id end_time event_type feature_id start_time limit offset] 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) params.except(*query_param_names) 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 |
#count_credit_ledger(request_options: {}, **params) ⇒ Schematic::Credits::Types::CountCreditLedgerResponse
819 820 821 822 823 824 825 826 827 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 |
# File 'lib/schematic/credits/client.rb', line 819 def count_credit_ledger(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id billing_credit_id feature_id period start_time end_time limit offset] query_params = {} query_params["company_id"] = params[:company_id] if params.key?(:company_id) query_params["billing_credit_id"] = params[:billing_credit_id] if params.key?(:billing_credit_id) query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id) query_params["period"] = params[:period] if params.key?(:period) query_params["start_time"] = params[:start_time] if params.key?(:start_time) query_params["end_time"] = params[:end_time] if params.key?(:end_time) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "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::CountCreditLedgerResponse.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
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/schematic/credits/client.rb', line 66 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
913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 |
# File 'lib/schematic/credits/client.rb', line 913 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
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/schematic/credits/client.rb', line 285 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
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 |
# File 'lib/schematic/credits/client.rb', line 1012 def delete_billing_plan_credit_grant(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[apply_to_existing] query_params = {} query_params["apply_to_existing"] = params[:apply_to_existing] if params.key?(:apply_to_existing) params = params.except(*query_param_names) 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
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
# File 'lib/schematic/credits/client.rb', line 387 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 |
#get_credit_bundle(request_options: {}, **params) ⇒ Schematic::Credits::Types::GetCreditBundleResponse
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/schematic/credits/client.rb', line 318 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_enriched_credit_ledger(request_options: {}, **params) ⇒ Schematic::Credits::Types::GetEnrichedCreditLedgerResponse
767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 |
# File 'lib/schematic/credits/client.rb', line 767 def get_enriched_credit_ledger(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id billing_credit_id feature_id period start_time end_time limit offset] query_params = {} query_params["company_id"] = params[:company_id] if params.key?(:company_id) query_params["billing_credit_id"] = params[:billing_credit_id] if params.key?(:billing_credit_id) query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id) query_params["period"] = params[:period] if params.key?(:period) query_params["start_time"] = params[:start_time] if params.key?(:start_time) query_params["end_time"] = params[:end_time] if params.key?(:end_time) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "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::GetEnrichedCreditLedgerResponse.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
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/schematic/credits/client.rb', line 99 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
946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 |
# File 'lib/schematic/credits/client.rb', line 946 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
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 |
# File 'lib/schematic/credits/client.rb', line 547 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
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/schematic/credits/client.rb', line 26 def list_billing_credits(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[ids name limit offset] 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) params.except(*query_param_names) 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
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 |
# File 'lib/schematic/credits/client.rb', line 870 def list_billing_plan_credit_grants(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[credit_id ids plan_id plan_ids plan_version_id limit offset] 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["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) 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
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/schematic/credits/client.rb', line 200 def list_company_credit_balances(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id] query_params = {} query_params["company_id"] = params[:company_id] if params.key?(:company_id) params.except(*query_param_names) 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
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 |
# File 'lib/schematic/credits/client.rb', line 630 def list_company_grants(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id order dir limit offset] 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) params.except(*query_param_names) 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
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/schematic/credits/client.rb', line 243 def list_credit_bundles(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[ids credit_id status bundle_type limit offset] 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) params.except(*query_param_names) 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
1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 |
# File 'lib/schematic/credits/client.rb', line 1107 def list_credit_event_ledger(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[billing_credit_id company_id end_time event_type feature_id start_time limit offset] 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) params.except(*query_param_names) 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
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 |
# File 'lib/schematic/credits/client.rb', line 719 def list_grants_for_credit(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[credit_id ids limit offset] 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) params.except(*query_param_names) 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 |
#soft_delete_billing_credit(request_options: {}, **params) ⇒ Schematic::Credits::Types::SoftDeleteBillingCreditResponse
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/schematic/credits/client.rb', line 168 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
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/schematic/credits/client.rb', line 131 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 = ["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
978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 |
# File 'lib/schematic/credits/client.rb', line 978 def update_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: "PUT", path: "billing/credits/plan-grants/#{URI.encode_uri_component(params[:plan_grant_id].to_s)}", body: Schematic::Types::UpdateBillingPlanCreditGrantRequestBody.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::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
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/schematic/credits/client.rb', line 350 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 = ["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
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
# File 'lib/schematic/credits/client.rb', line 511 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 = ["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 |