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
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 |
# File 'lib/schematic/billing/client.rb', line 1129 def count_billing_products(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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) 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
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 328 329 |
# File 'lib/schematic/billing/client.rb', line 300 def count_customers(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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) 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
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/schematic/billing/client.rb', line 120 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
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/schematic/billing/client.rb', line 155 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
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/schematic/billing/client.rb', line 440 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
826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 |
# File 'lib/schematic/billing/client.rb', line 826 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
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 |
# File 'lib/schematic/billing/client.rb', line 651 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
953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 |
# File 'lib/schematic/billing/client.rb', line 953 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
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 758 759 760 761 762 763 |
# File 'lib/schematic/billing/client.rb', line 722 def list_billing_prices(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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["interval_count"] = params[:interval_count] if params.key?(:interval_count) 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) 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
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 |
# File 'lib/schematic/billing/client.rb', line 897 def list_billing_product_prices(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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["interval_count"] = params[:interval_count] if params.key?(:interval_count) 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) 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
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 |
# File 'lib/schematic/billing/client.rb', line 1052 def list_billing_products(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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) 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
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/schematic/billing/client.rb', line 34 def list_coupons(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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) 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
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/schematic/billing/client.rb', line 244 def list_customers_with_subscriptions(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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) 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
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/schematic/billing/client.rb', line 354 def list_invoices(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["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) 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
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 481 def list_meters(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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) 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
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 |
# File 'lib/schematic/billing/client.rb', line 570 def list_payment_methods(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["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) 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
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/schematic/billing/client.rb', line 84 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
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/schematic/billing/client.rb', line 196 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
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/schematic/billing/client.rb', line 526 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
790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 |
# File 'lib/schematic/billing/client.rb', line 790 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
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 |
# File 'lib/schematic/billing/client.rb', line 990 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
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 |
# File 'lib/schematic/billing/client.rb', line 1201 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
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 |
# File 'lib/schematic/billing/client.rb', line 404 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
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 |
# File 'lib/schematic/billing/client.rb', line 615 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 |