Class: Schematic::Plans::Client
- Inherits:
-
Object
- Object
- Schematic::Plans::Client
- Defined in:
- lib/schematic/plans/client.rb
Instance Method Summary collapse
- #count_billing_product_match_companies(request_options: {}, **params) ⇒ Schematic::Plans::Types::CountBillingProductMatchCompaniesResponse
- #count_plans(request_options: {}, **params) ⇒ Schematic::Plans::Types::CountPlansResponse
- #create_custom_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::CreateCustomPlanResponse
- #create_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::CreatePlanResponse
- #delete_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::DeletePlanResponse
- #delete_plan_version(request_options: {}, **params) ⇒ Schematic::Plans::Types::DeletePlanVersionResponse
- #get_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::GetPlanResponse
- #initialize(client:) ⇒ void constructor
- #list_billing_product_match_companies(request_options: {}, **params) ⇒ Schematic::Plans::Types::ListBillingProductMatchCompaniesResponse
- #list_custom_plan_billings(request_options: {}, **params) ⇒ Schematic::Plans::Types::ListCustomPlanBillingsResponse
- #list_plan_issues(request_options: {}, **params) ⇒ Schematic::Plans::Types::ListPlanIssuesResponse
- #list_plans(request_options: {}, **params) ⇒ Schematic::Plans::Types::ListPlansResponse
- #mark_custom_plan_billing_paid(request_options: {}, **params) ⇒ Schematic::Plans::Types::MarkCustomPlanBillingPaidResponse
- #publish_plan_version(request_options: {}, **params) ⇒ Schematic::Plans::Types::PublishPlanVersionResponse
- #retry_custom_plan_billing(request_options: {}, **params) ⇒ Schematic::Plans::Types::RetryCustomPlanBillingResponse
- #update_company_plans(request_options: {}, **params) ⇒ Schematic::Plans::Types::UpdateCompanyPlansResponse
- #update_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::UpdatePlanResponse
- #upsert_billing_product_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::UpsertBillingProductPlanResponse
- #upsert_plan_for_billing_product(request_options: {}, **params) ⇒ Schematic::Plans::Types::UpsertPlanForBillingProductResponse
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/schematic/plans/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#count_billing_product_match_companies(request_options: {}, **params) ⇒ Schematic::Plans::Types::CountBillingProductMatchCompaniesResponse
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 |
# File 'lib/schematic/plans/client.rb', line 641 def count_billing_product_match_companies(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id) query_params["q"] = params[:q] if params.key?(:q) 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: "plans/billing-product-match-companies/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::Plans::Types::CountBillingProductMatchCompaniesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_plans(request_options: {}, **params) ⇒ Schematic::Plans::Types::CountPlansResponse
717 718 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 749 750 751 752 753 754 755 756 757 |
# File 'lib/schematic/plans/client.rb', line 717 def count_plans(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["company_scoped_only"] = params[:company_scoped_only] if params.key?(:company_scoped_only) query_params["exclude_company_scoped"] = params[:exclude_company_scoped] if params.key?(:exclude_company_scoped) query_params["for_fallback_plan"] = params[:for_fallback_plan] if params.key?(:for_fallback_plan) query_params["for_initial_plan"] = params[:for_initial_plan] if params.key?(:for_initial_plan) query_params["for_trial_expiry_plan"] = params[:for_trial_expiry_plan] if params.key?(:for_trial_expiry_plan) query_params["has_product_id"] = params[:has_product_id] if params.key?(:has_product_id) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["include_draft_versions"] = params[:include_draft_versions] if params.key?(:include_draft_versions) query_params["plan_type"] = params[:plan_type] if params.key?(:plan_type) query_params["q"] = params[:q] if params.key?(:q) query_params["scoped_to_company_id"] = params[:scoped_to_company_id] if params.key?(:scoped_to_company_id) query_params["with_entitlements"] = params[:with_entitlements] if params.key?(:with_entitlements) query_params["without_entitlement_for"] = params[:without_entitlement_for] if params.key?(:without_entitlement_for) query_params["without_paid_product_id"] = params[:without_paid_product_id] if params.key?(:without_paid_product_id) 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: "plans/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::Plans::Types::CountPlansResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_custom_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::CreateCustomPlanResponse
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/schematic/plans/client.rb', line 217 def create_custom_plan(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "custom-plans", body: Schematic::Plans::Types::CreateCustomPlanRequestBody.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::Plans::Types::CreateCustomPlanResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::CreatePlanResponse
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/schematic/plans/client.rb', line 344 def create_plan(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "plans", body: Schematic::Types::CreatePlanRequestBody.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::Plans::Types::CreatePlanResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::DeletePlanResponse
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/schematic/plans/client.rb', line 465 def delete_plan(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "plans/#{URI.encode_uri_component(params[:plan_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::Plans::Types::DeletePlanResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_plan_version(request_options: {}, **params) ⇒ Schematic::Plans::Types::DeletePlanVersionResponse
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 |
# File 'lib/schematic/plans/client.rb', line 820 def delete_plan_version(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["promote_archived_version"] = params[:promote_archived_version] if params.key?(:promote_archived_version) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "plans/version/#{URI.encode_uri_component(params[:plan_version_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::Plans::Types::DeletePlanVersionResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::GetPlanResponse
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'lib/schematic/plans/client.rb', line 384 def get_plan(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "plans/#{URI.encode_uri_component(params[:plan_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::Plans::Types::GetPlanResponse.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_product_match_companies(request_options: {}, **params) ⇒ Schematic::Plans::Types::ListBillingProductMatchCompaniesResponse
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 |
# File 'lib/schematic/plans/client.rb', line 591 def list_billing_product_match_companies(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id) query_params["q"] = params[:q] if params.key?(:q) 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: "plans/billing-product-match-companies", 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::Plans::Types::ListBillingProductMatchCompaniesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_custom_plan_billings(request_options: {}, **params) ⇒ Schematic::Plans::Types::ListCustomPlanBillingsResponse
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/schematic/plans/client.rb', line 83 def list_custom_plan_billings(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["plan_id"] = params[:plan_id] if params.key?(:plan_id) query_params["plan_billing_source"] = params[:plan_billing_source] if params.key?(:plan_billing_source) query_params["status"] = params[:status] if params.key?(:status) query_params["statuses"] = params[:statuses] if params.key?(:statuses) 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: "custom-plan-billings", 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::Plans::Types::ListCustomPlanBillingsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_plan_issues(request_options: {}, **params) ⇒ Schematic::Plans::Types::ListPlanIssuesResponse
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 801 |
# File 'lib/schematic/plans/client.rb', line 776 def list_plan_issues(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id) query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "plans/issues", 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::Plans::Types::ListPlanIssuesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_plans(request_options: {}, **params) ⇒ Schematic::Plans::Types::ListPlansResponse
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
# File 'lib/schematic/plans/client.rb', line 287 def list_plans(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["company_scoped_only"] = params[:company_scoped_only] if params.key?(:company_scoped_only) query_params["exclude_company_scoped"] = params[:exclude_company_scoped] if params.key?(:exclude_company_scoped) query_params["for_fallback_plan"] = params[:for_fallback_plan] if params.key?(:for_fallback_plan) query_params["for_initial_plan"] = params[:for_initial_plan] if params.key?(:for_initial_plan) query_params["for_trial_expiry_plan"] = params[:for_trial_expiry_plan] if params.key?(:for_trial_expiry_plan) query_params["has_product_id"] = params[:has_product_id] if params.key?(:has_product_id) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["include_draft_versions"] = params[:include_draft_versions] if params.key?(:include_draft_versions) query_params["plan_type"] = params[:plan_type] if params.key?(:plan_type) query_params["q"] = params[:q] if params.key?(:q) query_params["scoped_to_company_id"] = params[:scoped_to_company_id] if params.key?(:scoped_to_company_id) query_params["with_entitlements"] = params[:with_entitlements] if params.key?(:with_entitlements) query_params["without_entitlement_for"] = params[:without_entitlement_for] if params.key?(:without_entitlement_for) query_params["without_paid_product_id"] = params[:without_paid_product_id] if params.key?(:without_paid_product_id) 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: "plans", 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::Plans::Types::ListPlansResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#mark_custom_plan_billing_paid(request_options: {}, **params) ⇒ Schematic::Plans::Types::MarkCustomPlanBillingPaidResponse
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/schematic/plans/client.rb', line 133 def mark_custom_plan_billing_paid(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[custom_plan_billing_id] body_params = params.except(*path_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "custom-plan-billings/#{URI.encode_uri_component(params[:custom_plan_billing_id].to_s)}/mark-paid", 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::Plans::Types::MarkCustomPlanBillingPaidResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#publish_plan_version(request_options: {}, **params) ⇒ Schematic::Plans::Types::PublishPlanVersionResponse
863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 |
# File 'lib/schematic/plans/client.rb', line 863 def publish_plan_version(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request_data = Schematic::Plans::Types::PublishPlanVersionRequestBody.new(params).to_h non_body_param_names = %w[plan_version_id] body = request_data.except(*non_body_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "plans/version/#{URI.encode_uri_component(params[:plan_version_id].to_s)}/publish", 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::Plans::Types::PublishPlanVersionResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#retry_custom_plan_billing(request_options: {}, **params) ⇒ Schematic::Plans::Types::RetryCustomPlanBillingResponse
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/schematic/plans/client.rb', line 175 def retry_custom_plan_billing(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request_data = Schematic::Plans::Types::RetryCustomPlanBillingRequestBody.new(params).to_h non_body_param_names = %w[custom_plan_billing_id] body = request_data.except(*non_body_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "custom-plan-billings/#{URI.encode_uri_component(params[:custom_plan_billing_id].to_s)}/retry", 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::Plans::Types::RetryCustomPlanBillingResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update_company_plans(request_options: {}, **params) ⇒ Schematic::Plans::Types::UpdateCompanyPlansResponse
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 |
# File 'lib/schematic/plans/client.rb', line 29 def update_company_plans(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request_data = Schematic::Plans::Types::UpdateCompanyPlansRequestBody.new(params).to_h non_body_param_names = %w[company_id] body = request_data.except(*non_body_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "company-plans/#{URI.encode_uri_component(params[:company_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::Plans::Types::UpdateCompanyPlansResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::UpdatePlanResponse
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 |
# File 'lib/schematic/plans/client.rb', line 426 def update_plan(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[plan_id] body_params = params.except(*path_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "plans/#{URI.encode_uri_component(params[:plan_id].to_s)}", body: Schematic::Types::UpdatePlanRequestBody.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::Plans::Types::UpdatePlanResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#upsert_billing_product_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::UpsertBillingProductPlanResponse
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 |
# File 'lib/schematic/plans/client.rb', line 504 def upsert_billing_product_plan(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[plan_id] body_params = params.except(*path_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "plans/#{URI.encode_uri_component(params[:plan_id].to_s)}/billing_products", body: Schematic::Types::UpsertBillingProductRequestBody.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::Plans::Types::UpsertBillingProductPlanResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#upsert_plan_for_billing_product(request_options: {}, **params) ⇒ Schematic::Plans::Types::UpsertPlanForBillingProductResponse
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/plans/client.rb', line 547 def upsert_plan_for_billing_product(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "plans/billing-linked", body: Schematic::Plans::Types::CreateBillingLinkedPlanRequestBody.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::Plans::Types::UpsertPlanForBillingProductResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |