Class: Schematic::Billing::Client
- Inherits:
-
Object
- Object
- Schematic::Billing::Client
- Defined in:
- lib/schematic/billing/client.rb
Instance Method Summary collapse
- #count_billing_products(request_options: {}, **params) ⇒ Schematic::Billing::Types::CountBillingProductsResponse
- #count_customers(request_options: {}, **params) ⇒ Schematic::Billing::Types::CountCustomersResponse
- #delete_billing_product(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeleteBillingProductResponse
- #delete_product_price(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeleteProductPriceResponse
- #initialize(client:) ⇒ void constructor
- #list_billing_prices(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListBillingPricesResponse
- #list_billing_product_prices(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListBillingProductPricesResponse
- #list_billing_products(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListBillingProductsResponse
- #list_coupons(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListCouponsResponse
- #list_customers_with_subscriptions(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListCustomersWithSubscriptionsResponse
- #list_invoices(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListInvoicesResponse
- #list_meters(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListMetersResponse
- #list_payment_methods(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListPaymentMethodsResponse
- #upsert_billing_coupon(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertBillingCouponResponse
- #upsert_billing_customer(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertBillingCustomerResponse
- #upsert_billing_meter(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertBillingMeterResponse
- #upsert_billing_price(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertBillingPriceResponse
- #upsert_billing_product(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertBillingProductResponse
- #upsert_billing_subscription(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertBillingSubscriptionResponse
- #upsert_invoice(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertInvoiceResponse
- #upsert_payment_method(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertPaymentMethodResponse
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/schematic/billing/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#count_billing_products(request_options: {}, **params) ⇒ Schematic::Billing::Types::CountBillingProductsResponse
790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 |
# File 'lib/schematic/billing/client.rb', line 790 def count_billing_products(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[ids is_active name price_usage_type provider_type q with_one_time_charges with_prices_only with_zero_price without_linked_to_plan limit offset] query_params = {} query_params["ids"] = params[:ids] if params.key?(:ids) query_params["is_active"] = params[:is_active] if params.key?(:is_active) query_params["name"] = params[:name] if params.key?(:name) query_params["price_usage_type"] = params[:price_usage_type] if params.key?(:price_usage_type) query_params["provider_type"] = params[:provider_type] if params.key?(:provider_type) query_params["q"] = params[:q] if params.key?(:q) query_params["with_one_time_charges"] = params[:with_one_time_charges] if params.key?(:with_one_time_charges) query_params["with_prices_only"] = params[:with_prices_only] if params.key?(:with_prices_only) query_params["with_zero_price"] = params[:with_zero_price] if params.key?(:with_zero_price) query_params["without_linked_to_plan"] = params[:without_linked_to_plan] if params.key?(:without_linked_to_plan) 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/products/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::Billing::Types::CountBillingProductsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_customers(request_options: {}, **params) ⇒ Schematic::Billing::Types::CountCustomersResponse
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/schematic/billing/client.rb', line 184 def count_customers(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_ids name provider_type q limit offset] query_params = {} query_params["company_ids"] = params[:company_ids] if params.key?(:company_ids) query_params["name"] = params[:name] if params.key?(:name) query_params["provider_type"] = params[:provider_type] if params.key?(:provider_type) 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: "billing/customers/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::Billing::Types::CountCustomersResponse.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_product(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeleteBillingProductResponse
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
# File 'lib/schematic/billing/client.rb', line 555 def delete_billing_product(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/product/#{URI.encode_uri_component(params[:billing_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::Billing::Types::DeleteBillingProductResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_product_price(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeleteProductPriceResponse
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 |
# File 'lib/schematic/billing/client.rb', line 655 def delete_product_price(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/product/prices/#{URI.encode_uri_component(params[:billing_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::Billing::Types::DeleteProductPriceResponse.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_prices(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListBillingPricesResponse
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 500 501 502 503 504 505 506 507 508 509 510 511 |
# File 'lib/schematic/billing/client.rb', line 470 def list_billing_prices(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[currency for_initial_plan for_trial_expiry_plan ids interval is_active price product_id product_ids provider_type q tiers_mode usage_type with_meter limit offset] query_params = {} query_params["currency"] = params[:currency] if params.key?(:currency) 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["ids"] = params[:ids] if params.key?(:ids) query_params["interval"] = params[:interval] if params.key?(:interval) query_params["is_active"] = params[:is_active] if params.key?(:is_active) query_params["price"] = params[:price] if params.key?(:price) query_params["product_id"] = params[:product_id] if params.key?(:product_id) query_params["product_ids"] = params[:product_ids] if params.key?(:product_ids) query_params["provider_type"] = params[:provider_type] if params.key?(:provider_type) query_params["q"] = params[:q] if params.key?(:q) query_params["tiers_mode"] = params[:tiers_mode] if params.key?(:tiers_mode) query_params["usage_type"] = params[:usage_type] if params.key?(:usage_type) query_params["with_meter"] = params[:with_meter] if params.key?(:with_meter) 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/price", 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::Billing::Types::ListBillingPricesResponse.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_prices(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListBillingProductPricesResponse
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 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 |
# File 'lib/schematic/billing/client.rb', line 602 def list_billing_product_prices(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[currency for_initial_plan for_trial_expiry_plan ids interval is_active price product_id product_ids provider_type q tiers_mode usage_type with_meter limit offset] query_params = {} query_params["currency"] = params[:currency] if params.key?(:currency) 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["ids"] = params[:ids] if params.key?(:ids) query_params["interval"] = params[:interval] if params.key?(:interval) query_params["is_active"] = params[:is_active] if params.key?(:is_active) query_params["price"] = params[:price] if params.key?(:price) query_params["product_id"] = params[:product_id] if params.key?(:product_id) query_params["product_ids"] = params[:product_ids] if params.key?(:product_ids) query_params["provider_type"] = params[:provider_type] if params.key?(:provider_type) query_params["q"] = params[:q] if params.key?(:q) query_params["tiers_mode"] = params[:tiers_mode] if params.key?(:tiers_mode) query_params["usage_type"] = params[:usage_type] if params.key?(:usage_type) query_params["with_meter"] = params[:with_meter] if params.key?(:with_meter) 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/product/prices", 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::Billing::Types::ListBillingProductPricesResponse.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_products(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListBillingProductsResponse
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 758 759 760 761 762 763 764 765 766 767 |
# File 'lib/schematic/billing/client.rb', line 730 def list_billing_products(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[ids is_active name price_usage_type provider_type q with_one_time_charges with_prices_only with_zero_price without_linked_to_plan limit offset] query_params = {} query_params["ids"] = params[:ids] if params.key?(:ids) query_params["is_active"] = params[:is_active] if params.key?(:is_active) query_params["name"] = params[:name] if params.key?(:name) query_params["price_usage_type"] = params[:price_usage_type] if params.key?(:price_usage_type) query_params["provider_type"] = params[:provider_type] if params.key?(:provider_type) query_params["q"] = params[:q] if params.key?(:q) query_params["with_one_time_charges"] = params[:with_one_time_charges] if params.key?(:with_one_time_charges) query_params["with_prices_only"] = params[:with_prices_only] if params.key?(:with_prices_only) query_params["with_zero_price"] = params[:with_zero_price] if params.key?(:with_zero_price) query_params["without_linked_to_plan"] = params[:without_linked_to_plan] if params.key?(:without_linked_to_plan) 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/products", 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::Billing::Types::ListBillingProductsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_coupons(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListCouponsResponse
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/billing/client.rb', line 26 def list_coupons(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[is_active q limit offset] query_params = {} query_params["is_active"] = params[:is_active] if params.key?(:is_active) 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: "billing/coupons", 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::Billing::Types::ListCouponsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_customers_with_subscriptions(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListCustomersWithSubscriptionsResponse
136 137 138 139 140 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 167 |
# File 'lib/schematic/billing/client.rb', line 136 def list_customers_with_subscriptions(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_ids name provider_type q limit offset] query_params = {} query_params["company_ids"] = params[:company_ids] if params.key?(:company_ids) query_params["name"] = params[:name] if params.key?(:name) query_params["provider_type"] = params[:provider_type] if params.key?(:provider_type) 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: "billing/customers", 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::Billing::Types::ListCustomersWithSubscriptionsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_invoices(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListInvoicesResponse
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 |
# File 'lib/schematic/billing/client.rb', line 231 def list_invoices(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id customer_external_id subscription_external_id limit offset] query_params = {} query_params["company_id"] = params[:company_id] if params.key?(:company_id) query_params["customer_external_id"] = params[:customer_external_id] if params.key?(:customer_external_id) query_params["subscription_external_id"] = params[:subscription_external_id] if params.key?(:subscription_external_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/invoices", 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::Billing::Types::ListInvoicesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_meters(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListMetersResponse
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/schematic/billing/client.rb', line 307 def list_meters(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[display_name limit offset] query_params = {} query_params["display_name"] = params[:display_name] if params.key?(:display_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/meter", 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::Billing::Types::ListMetersResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_payment_methods(request_options: {}, **params) ⇒ Schematic::Billing::Types::ListPaymentMethodsResponse
382 383 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 409 410 411 |
# File 'lib/schematic/billing/client.rb', line 382 def list_payment_methods(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id customer_external_id limit offset] query_params = {} query_params["company_id"] = params[:company_id] if params.key?(:company_id) query_params["customer_external_id"] = params[:customer_external_id] if params.key?(:customer_external_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/payment-methods", 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::Billing::Types::ListPaymentMethodsResponse.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_coupon(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertBillingCouponResponse
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/billing/client.rb', line 66 def upsert_billing_coupon(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/coupons", body: Schematic::Billing::Types::CreateCouponRequestBody.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::Billing::Types::UpsertBillingCouponResponse.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_customer(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertBillingCustomerResponse
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/schematic/billing/client.rb', line 98 def upsert_billing_customer(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/customer/upsert", body: Schematic::Billing::Types::CreateBillingCustomerRequestBody.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::Billing::Types::UpsertBillingCustomerResponse.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_meter(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertBillingMeterResponse
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/schematic/billing/client.rb', line 346 def upsert_billing_meter(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/meter/upsert", body: Schematic::Billing::Types::CreateMeterRequestBody.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::Billing::Types::UpsertBillingMeterResponse.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_price(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertBillingPriceResponse
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
# File 'lib/schematic/billing/client.rb', line 522 def upsert_billing_price(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/price/upsert", body: Schematic::Billing::Types::CreateBillingPriceRequestBody.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::Billing::Types::UpsertBillingPriceResponse.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(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertBillingProductResponse
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 |
# File 'lib/schematic/billing/client.rb', line 686 def upsert_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: "billing/product/upsert", body: Schematic::Billing::Types::CreateBillingProductRequestBody.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::Billing::Types::UpsertBillingProductResponse.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_subscription(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertBillingSubscriptionResponse
838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 |
# File 'lib/schematic/billing/client.rb', line 838 def upsert_billing_subscription(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/subscription/upsert", body: Schematic::Billing::Types::CreateBillingSubscriptionRequestBody.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::Billing::Types::UpsertBillingSubscriptionResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#upsert_invoice(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertInvoiceResponse
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/schematic/billing/client.rb', line 272 def upsert_invoice(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/invoices", body: Schematic::Billing::Types::CreateInvoiceRequestBody.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::Billing::Types::UpsertInvoiceResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#upsert_payment_method(request_options: {}, **params) ⇒ Schematic::Billing::Types::UpsertPaymentMethodResponse
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/schematic/billing/client.rb', line 422 def upsert_payment_method(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/payment-methods", body: Schematic::Billing::Types::CreatePaymentMethodRequestBody.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::Billing::Types::UpsertPaymentMethodResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |