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_coupon(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeleteBillingCouponResponse
- #delete_billing_customer(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeleteBillingCustomerResponse
- #delete_billing_invoice(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeleteBillingInvoiceResponse
- #delete_billing_product(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeleteBillingProductResponse
- #delete_payment_method_by_external_id(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeletePaymentMethodByExternalIdResponse
- #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
925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 |
# File 'lib/schematic/billing/client.rb', line 925 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 recurring_charges_only 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["recurring_charges_only"] = params[:recurring_charges_only] if params.key?(:recurring_charges_only) 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
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 275 276 277 278 279 |
# File 'lib/schematic/billing/client.rb', line 248 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_coupon(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeleteBillingCouponResponse
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 99 def delete_billing_coupon(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/coupons/#{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::DeleteBillingCouponResponse.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_customer(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeleteBillingCustomerResponse
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/schematic/billing/client.rb', line 131 def delete_billing_customer(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/customer/#{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::DeleteBillingCustomerResponse.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_invoice(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeleteBillingInvoiceResponse
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'lib/schematic/billing/client.rb', line 369 def delete_billing_invoice(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/invoices/#{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::DeleteBillingInvoiceResponse.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
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 |
# File 'lib/schematic/billing/client.rb', line 685 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_payment_method_by_external_id(request_options: {}, **params) ⇒ Schematic::Billing::Types::DeletePaymentMethodByExternalIdResponse
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 |
# File 'lib/schematic/billing/client.rb', line 551 def delete_payment_method_by_external_id(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/payment-methods/#{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::DeletePaymentMethodByExternalIdResponse.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
787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 |
# File 'lib/schematic/billing/client.rb', line 787 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
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 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
# File 'lib/schematic/billing/client.rb', line 599 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 plan_version_id 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["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id) 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
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 768 769 770 771 772 773 774 775 |
# File 'lib/schematic/billing/client.rb', line 733 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 plan_version_id 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["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id) 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
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 889 890 891 892 893 894 895 896 897 898 899 900 901 |
# File 'lib/schematic/billing/client.rb', line 863 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 recurring_charges_only 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["recurring_charges_only"] = params[:recurring_charges_only] if params.key?(:recurring_charges_only) 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
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 227 228 229 230 231 |
# File 'lib/schematic/billing/client.rb', line 200 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
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 |
# File 'lib/schematic/billing/client.rb', line 295 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
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/schematic/billing/client.rb', line 403 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
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 |
# File 'lib/schematic/billing/client.rb', line 478 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
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/schematic/billing/client.rb', line 162 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
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/schematic/billing/client.rb', line 442 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
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 |
# File 'lib/schematic/billing/client.rb', line 652 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
818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 |
# File 'lib/schematic/billing/client.rb', line 818 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
974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 |
# File 'lib/schematic/billing/client.rb', line 974 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
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/schematic/billing/client.rb', line 336 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
518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
# File 'lib/schematic/billing/client.rb', line 518 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 |