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
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
# File 'lib/schematic/plans/client.rb', line 528 def count_billing_product_match_companies(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[plan_id q limit offset] 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) params.except(*query_param_names) 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
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 615 616 617 618 619 620 621 622 623 624 625 626 627 |
# File 'lib/schematic/plans/client.rb', line 585 def count_plans(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id company_scoped_only exclude_company_scoped for_fallback_plan for_initial_plan for_trial_expiry_plan has_product_id ids include_draft_versions plan_type q scoped_to_company_id with_entitlements without_entitlement_for without_paid_product_id limit offset] 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) params.except(*query_param_names) 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
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/schematic/plans/client.rb', line 177 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
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/schematic/plans/client.rb', line 279 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
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'lib/schematic/plans/client.rb', line 384 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
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 705 706 |
# File 'lib/schematic/plans/client.rb', line 680 def delete_plan_version(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[promote_archived_version] query_params = {} query_params["promote_archived_version"] = params[:promote_archived_version] if params.key?(:promote_archived_version) params = params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "plans/version/#{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::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
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/schematic/plans/client.rb', line 313 def get_plan(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[plan_version_id] query_params = {} query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id) params = params.except(*query_param_names) 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
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
# File 'lib/schematic/plans/client.rb', line 484 def list_billing_product_match_companies(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[plan_id q limit offset] 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) params.except(*query_param_names) 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
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/schematic/plans/client.rb', line 65 def list_custom_plan_billings(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id plan_id status statuses limit offset] 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["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) params.except(*query_param_names) 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
640 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 |
# File 'lib/schematic/plans/client.rb', line 640 def list_plan_issues(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[plan_id plan_version_id] 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) params.except(*query_param_names) 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
226 227 228 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 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/schematic/plans/client.rb', line 226 def list_plans(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id company_scoped_only exclude_company_scoped for_fallback_plan for_initial_plan for_trial_expiry_plan has_product_id ids include_draft_versions plan_type q scoped_to_company_id with_entitlements without_entitlement_for without_paid_product_id limit offset] 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) params.except(*query_param_names) 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
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/schematic/plans/client.rb', line 108 def mark_custom_plan_billing_paid(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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: 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
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 |
# File 'lib/schematic/plans/client.rb', line 718 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 = ["plan_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_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
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/schematic/plans/client.rb', line 141 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 = ["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
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/schematic/plans/client.rb', line 23 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 = ["company_plan_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_plan_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
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/schematic/plans/client.rb', line 351 def update_plan(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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(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
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/schematic/plans/client.rb', line 416 def upsert_billing_product_plan(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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(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
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
# File 'lib/schematic/plans/client.rb', line 448 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 |