From 7ba616966a4d02a4d5687963ecd795eb5352b748 Mon Sep 17 00:00:00 2001 From: maxio-sdk Date: Tue, 9 Sep 2025 14:56:54 +0000 Subject: [PATCH] Automated commit message --- README.md | 94 ++++++++++--------- advanced_billing.gemspec | 8 +- doc/auth/basic-authentication.md | 5 +- doc/client.md | 6 +- doc/controllers/component-price-points.md | 9 +- doc/controllers/components.md | 4 +- doc/controllers/customers.md | 39 +++++++- doc/controllers/payment-profiles.md | 10 +- doc/controllers/product-price-points.md | 5 +- doc/controllers/subscription-components.md | 12 +-- doc/controllers/subscriptions.md | 18 ++-- doc/controllers/webhooks.md | 41 ++------ ...eate-usage-subscription-id-or-reference.md | 14 +++ ...ages-input-subscription-id-or-reference.md | 14 +++ doc/proxy-settings.md | 31 ++++++ lib/advanced_billing.rb | 1 + lib/advanced_billing/client.rb | 6 +- lib/advanced_billing/configuration.rb | 14 ++- .../controllers/base_controller.rb | 2 +- .../component_price_points_controller.rb | 3 +- .../controllers/components_controller.rb | 5 +- .../controllers/customers_controller.rb | 4 +- .../payment_profiles_controller.rb | 21 ++--- .../subscription_components_controller.rb | 40 +++++--- .../controllers/subscriptions_controller.rb | 43 +++++---- .../controllers/webhooks_controller.rb | 71 +++++--------- lib/advanced_billing/http/proxy_settings.rb | 13 +++ .../utilities/union_type_lookup.rb | 14 +++ 28 files changed, 330 insertions(+), 217 deletions(-) create mode 100644 doc/models/containers/create-usage-subscription-id-or-reference.md create mode 100644 doc/models/containers/list-usages-input-subscription-id-or-reference.md create mode 100644 doc/proxy-settings.md create mode 100644 lib/advanced_billing/http/proxy_settings.rb diff --git a/README.md b/README.md index ac4004e5..1ec9d1b6 100644 --- a/README.md +++ b/README.md @@ -29,20 +29,20 @@ curl -u :x -H Accept:application/json -H Content-Type:application/json Install the gem from the command line: ```bash -gem install maxio-advanced-billing-sdk -v 7.0.0 +gem install maxio-advanced-billing-sdk -v 7.0.1 ``` Or add the gem to your Gemfile and run `bundle`: ```ruby -gem 'maxio-advanced-billing-sdk', '7.0.0' +gem 'maxio-advanced-billing-sdk', '7.0.1' ``` -For additional gem details, see the [RubyGems page for the maxio-advanced-billing-sdk gem](https://rubygems.org/gems/maxio-advanced-billing-sdk/versions/7.0.0). +For additional gem details, see the [RubyGems page for the maxio-advanced-billing-sdk gem](https://rubygems.org/gems/maxio-advanced-billing-sdk/versions/7.0.1). ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/client.md) The following parameters are configurable for the API Client: @@ -59,12 +59,16 @@ The following parameters are configurable for the API Client: | retry_statuses | `Array` | A list of HTTP statuses to retry.
**Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** | | retry_methods | `Array` | A list of HTTP methods to retry.
**Default: %i[get put]** | | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. | -| basic_auth_credentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/auth/basic-authentication.md) | The credential object for Basic Authentication | +| proxy_settings | [`ProxySettings`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. | +| basic_auth_credentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/auth/basic-authentication.md) | The credential object for Basic Authentication | The API client can be initialized as follows: ```ruby -client = AdvancedBilling::Client.new( +require 'advanced_billing' +include AdvancedBilling + +client = Client.new( basic_auth_credentials: BasicAuthCredentials.new( username: 'BasicAuthUserName', password: 'BasicAuthPassword' @@ -89,52 +93,56 @@ The SDK can be configured to use a different environment for making API calls. A This API uses the following authentication schemes. -* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/auth/basic-authentication.md) +* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/auth/basic-authentication.md) ## List of APIs -* [API Exports](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/api-exports.md) -* [Advance Invoice](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/advance-invoice.md) -* [Billing Portal](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/billing-portal.md) -* [Component Price Points](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/component-price-points.md) -* [Custom Fields](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/custom-fields.md) -* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/events-based-billing-segments.md) -* [Payment Profiles](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/payment-profiles.md) -* [Product Families](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/product-families.md) -* [Product Price Points](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/product-price-points.md) -* [Proforma Invoices](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/proforma-invoices.md) -* [Reason Codes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/reason-codes.md) -* [Referral Codes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/referral-codes.md) -* [Sales Commissions](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/sales-commissions.md) -* [Subscription Components](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/subscription-components.md) -* [Subscription Groups](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/subscription-groups.md) -* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/subscription-group-invoice-account.md) -* [Subscription Group Status](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/subscription-group-status.md) -* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/subscription-invoice-account.md) -* [Subscription Notes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/subscription-notes.md) -* [Subscription Products](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/subscription-products.md) -* [Subscription Status](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/subscription-status.md) -* [Coupons](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/coupons.md) -* [Components](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/components.md) -* [Customers](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/customers.md) -* [Events](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/events.md) -* [Insights](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/insights.md) -* [Invoices](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/invoices.md) -* [Offers](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/offers.md) -* [Products](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/products.md) -* [Sites](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/sites.md) -* [Subscriptions](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/subscriptions.md) -* [Webhooks](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/controllers/webhooks.md) +* [API Exports](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/api-exports.md) +* [Advance Invoice](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/advance-invoice.md) +* [Billing Portal](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/billing-portal.md) +* [Component Price Points](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/component-price-points.md) +* [Custom Fields](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/custom-fields.md) +* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/events-based-billing-segments.md) +* [Payment Profiles](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/payment-profiles.md) +* [Product Families](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/product-families.md) +* [Product Price Points](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/product-price-points.md) +* [Proforma Invoices](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/proforma-invoices.md) +* [Reason Codes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/reason-codes.md) +* [Referral Codes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/referral-codes.md) +* [Sales Commissions](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/sales-commissions.md) +* [Subscription Components](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-components.md) +* [Subscription Groups](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-groups.md) +* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-group-invoice-account.md) +* [Subscription Group Status](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-group-status.md) +* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-invoice-account.md) +* [Subscription Notes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-notes.md) +* [Subscription Products](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-products.md) +* [Subscription Status](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-status.md) +* [Coupons](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/coupons.md) +* [Components](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/components.md) +* [Customers](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/customers.md) +* [Events](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/events.md) +* [Insights](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/insights.md) +* [Invoices](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/invoices.md) +* [Offers](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/offers.md) +* [Products](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/products.md) +* [Sites](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/sites.md) +* [Subscriptions](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscriptions.md) +* [Webhooks](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/webhooks.md) ## SDK Infrastructure +### Configuration + +* [ProxySettings](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/proxy-settings.md) + ### HTTP -* [HttpResponse](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/http-response.md) -* [HttpRequest](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/http-request.md) +* [HttpResponse](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/http-response.md) +* [HttpRequest](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/http-request.md) ### Utilities -* [ApiHelper](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/api-helper.md) -* [DateTimeHelper](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.0/doc/date-time-helper.md) +* [ApiHelper](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/api-helper.md) +* [DateTimeHelper](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/date-time-helper.md) diff --git a/advanced_billing.gemspec b/advanced_billing.gemspec index a055bd27..44aa570d 100644 --- a/advanced_billing.gemspec +++ b/advanced_billing.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'maxio-advanced-billing-sdk' - s.version = '7.0.0' + s.version = '7.0.1' s.summary = 'SDK for Maxio Advanced Billing' s.description = "Ultimate billing and pricing flexibility for B2B SaaS.\nMaxio integrates directly into your product, so you can seamlessly manage your product catalog, bill customers, and collect payments." s.authors = ['Maxio SDK'] @@ -10,9 +10,9 @@ Gem::Specification.new do |s| s.metadata = { } - s.add_dependency('apimatic_core_interfaces', '~> 0.2.1') - s.add_dependency('apimatic_core', '~> 0.3.17') - s.add_dependency('apimatic_faraday_client_adapter', '~> 0.1.4') + s.add_dependency('apimatic_core_interfaces', '~> 0.2.2') + s.add_dependency('apimatic_core', '~> 0.3.19') + s.add_dependency('apimatic_faraday_client_adapter', '~> 0.1.6') s.required_ruby_version = ['>= 2.6'] s.files = Dir['{bin,lib,man,test,spec}/**/*', 'README*', 'LICENSE*'] s.require_paths = ['lib'] diff --git a/doc/auth/basic-authentication.md b/doc/auth/basic-authentication.md index 3d5aa14c..3f57fbfa 100644 --- a/doc/auth/basic-authentication.md +++ b/doc/auth/basic-authentication.md @@ -23,7 +23,10 @@ Documentation for accessing and setting credentials for BasicAuth. You must provide credentials in the client as shown in the following code snippet. ```ruby -client = AdvancedBilling::Client.new( +require 'advanced_billing' +include AdvancedBilling + +client = Client.new( basic_auth_credentials: BasicAuthCredentials.new( username: 'BasicAuthUserName', password: 'BasicAuthPassword' diff --git a/doc/client.md b/doc/client.md index 41e28344..f7613683 100644 --- a/doc/client.md +++ b/doc/client.md @@ -16,12 +16,16 @@ The following parameters are configurable for the API Client: | retry_statuses | `Array` | A list of HTTP statuses to retry.
**Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** | | retry_methods | `Array` | A list of HTTP methods to retry.
**Default: %i[get put]** | | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. | +| proxy_settings | [`ProxySettings`](../doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. | | basic_auth_credentials | [`BasicAuthCredentials`](auth/basic-authentication.md) | The credential object for Basic Authentication | The API client can be initialized as follows: ```ruby -client = AdvancedBilling::Client.new( +require 'advanced_billing' +include AdvancedBilling + +client = Client.new( basic_auth_credentials: BasicAuthCredentials.new( username: 'BasicAuthUserName', password: 'BasicAuthPassword' diff --git a/doc/controllers/component-price-points.md b/doc/controllers/component-price-points.md index 1b106973..120011ed 100644 --- a/doc/controllers/component-price-points.md +++ b/doc/controllers/component-price-points.md @@ -97,7 +97,7 @@ puts result # Create Component Price Point -This endpoint can be used to create a new price point for an existing component. +Creates a price point for an existing component. ```ruby def create_component_price_point(component_id, @@ -133,7 +133,7 @@ body = CreateComponentPricePointRequest.new( Price.new( starting_quantity: '101', unit_price: '4.00', - ending_quantity: nil + ending_quantity: '200' ) ], handle: 'wholesale-handle', @@ -186,10 +186,11 @@ def list_component_price_points(options = {}) ## Example Usage ```ruby -Liquid error: Value cannot be null. (Parameter 'key')collect = { +collect = { 'component_id' => 222, 'page' => 2, - 'per_page' => 50 + 'per_page' => 50, + 'filter_type' => Liquid error: Value cannot be null. (Parameter 'key') } result = component_price_points_controller.list_component_price_points(collect) diff --git a/doc/controllers/components.md b/doc/controllers/components.md index e0a37269..43fd96f7 100644 --- a/doc/controllers/components.md +++ b/doc/controllers/components.md @@ -646,9 +646,9 @@ puts result # Read Component -This request will return information regarding a component from a specific product family. +Returns information regarding a component from a specific product family. -You may read the component by either the component's id or handle. When using the handle, it must be prefixed with `handle:`. +You can read the component by either the component's id or handle. When using the handle, it must be prefixed with `handle:`. ```ruby def read_component(product_family_id, diff --git a/doc/controllers/customers.md b/doc/controllers/customers.md index 1d0e3347..4c1f1f8a 100644 --- a/doc/controllers/customers.md +++ b/doc/controllers/customers.md @@ -268,7 +268,7 @@ puts result # Read Customer -This method allows to retrieve the Customer properties by Advanced Billing-generated Customer ID. +Retrieves the Customer properties by Advanced Billing-generated Customer ID. ```ruby def read_customer(id) @@ -293,6 +293,43 @@ result = customers_controller.read_customer(id) puts result ``` +## Example Response *(as JSON)* + +```json +{ + "customer": { + "first_name": "Jane", + "last_name": "Doe", + "email": "jane@example.com", + "cc_emails": "joe@example.com", + "organization": "ABC, Inc.", + "reference": "1234567890", + "id": 88833369, + "created_at": "2025-05-08T11:39:18-04:00", + "updated_at": "2025-05-08T11:39:18-04:00", + "address": "123 Main Street", + "address_2": "Unit 10", + "city": "Anytown", + "state": "MA", + "state_name": "Massachusetts", + "zip": "02120", + "country": "US", + "country_name": "United States", + "phone": "555-555-1212", + "verified": false, + "portal_customer_created_at": null, + "portal_invite_last_sent_at": null, + "portal_invite_last_accepted_at": null, + "tax_exempt": false, + "vat_number": null, + "parent_id": null, + "locale": "es-MX", + "salesforce_id": null, + "default_auto_renewal_profile_id": null + } +} +``` + # Update Customer diff --git a/doc/controllers/payment-profiles.md b/doc/controllers/payment-profiles.md index 0547ed6f..4a163dfd 100644 --- a/doc/controllers/payment-profiles.md +++ b/doc/controllers/payment-profiles.md @@ -96,9 +96,9 @@ For more information on GoCardless, please view the following resources: + [Full documentation on GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoCardless) -+ [Using Chargify.js with GoCardless - minimal example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#minimal-example-with-direct-debit-gocardless-gateway) ++ [Using Chargify.js with GoCardless - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQZKCER8CFK40MR6XJ) -+ [Using Chargify.js with GoCardless - full example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#full-example-with-direct-debit-gocardless-gateway) ++ [Using Chargify.js with GoCardless - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV) ### GoCardless with Local Bank Details @@ -170,9 +170,9 @@ For more information on Stripe SEPA Direct Debit, please view the following reso + [Full documentation on Stripe SEPA Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) -+ [Using Chargify.js with Stripe Direct Debit - minimal example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#minimal-example-with-sepa-or-becs-direct-debit-stripe-gateway) ++ [Using Chargify.js with Stripe Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) -+ [Using Chargify.js with Stripe Direct Debit - full example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#full-example-with-sepa-direct-debit-stripe-gateway) ++ [Using Chargify.js with Stripe Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QRECQQ4ECS3ZA55GY7) ### Stripe SEPA Direct Debit Payment Profiles @@ -1024,7 +1024,7 @@ One Time Tokens aka Advanced Billing Tokens house the credit card or ACH (Author You can use One Time Tokens while creating a subscription or payment profile instead of passing all bank account or credit card data directly to a given API endpoint. -To obtain a One Time Token you have to use [Chargify.js](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDI0-overview). +To obtain a One Time Token you have to use [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0). ```ruby def read_one_time_token(chargify_token) diff --git a/doc/controllers/product-price-points.md b/doc/controllers/product-price-points.md index 217ae5da..ffc1a45c 100644 --- a/doc/controllers/product-price-points.md +++ b/doc/controllers/product-price-points.md @@ -133,10 +133,11 @@ def list_product_price_points(options = {}) ## Example Usage ```ruby -Liquid error: Value cannot be null. (Parameter 'key')collect = { +collect = { 'product_id' => 124, 'page' => 2, - 'per_page' => 10 + 'per_page' => 10, + 'filter_type' => Liquid error: Value cannot be null. (Parameter 'key') } result = product_price_points_controller.list_product_price_points(collect) diff --git a/doc/controllers/subscription-components.md b/doc/controllers/subscription-components.md index 3aca637a..db2bc3bc 100644 --- a/doc/controllers/subscription-components.md +++ b/doc/controllers/subscription-components.md @@ -1082,7 +1082,7 @@ Q. Is it possible to record metered usage for more than one component at a time? A. No. Usage should be reported as one API call per component on a single subscription. For example, to record that a subscriber has sent both an SMS Message and an Email, send an API call for each. ```ruby -def create_usage(subscription_id, +def create_usage(subscription_id_or_reference, component_id, body: nil) ``` @@ -1091,7 +1091,7 @@ def create_usage(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id_or_reference` | Integer \| String | Template, Required | This is a container for one-of cases. | | `component_id` | Integer \| String | Template, Required | This is a container for one-of cases. | | `body` | [`CreateUsageRequest`](../../doc/models/create-usage-request.md) | Body, Optional | - | @@ -1102,7 +1102,7 @@ def create_usage(subscription_id, ## Example Usage ```ruby -subscription_id = 222 +subscription_id_or_reference = 234 component_id = 144 @@ -1115,7 +1115,7 @@ body = CreateUsageRequest.new( ) result = subscription_components_controller.create_usage( - subscription_id, + subscription_id_or_reference, component_id, body: body ) @@ -1172,7 +1172,7 @@ def list_usages(options = {}) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id_or_reference` | Integer \| String | Template, Required | This is a container for one-of cases. | | `component_id` | Integer \| String | Template, Required | This is a container for one-of cases. | | `since_id` | `Integer` | Query, Optional | Returns usages with an id greater than or equal to the one specified | | `max_id` | `Integer` | Query, Optional | Returns usages with an id less than or equal to the one specified | @@ -1189,7 +1189,7 @@ def list_usages(options = {}) ```ruby collect = { - 'subscription_id' => 222, + 'subscription_id_or_reference' => 234, 'component_id' => 144, 'page' => 2, 'per_page' => 50 diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md index e6bdd3c2..6c9abfe4 100644 --- a/doc/controllers/subscriptions.md +++ b/doc/controllers/subscriptions.md @@ -117,7 +117,7 @@ Custom prices and price points can exist in harmony on a subscription. ## Subscription with Chargify.js token -The `chargify_token` can be obtained using [Chargify.js](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDI0-overview). The token represents payment profile attributes that were provided by the customer in their browser and stored at the payment gateway. +The `chargify_token` can be obtained using [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0). The token represents payment profile attributes that were provided by the customer in their browser and stored at the payment gateway. The `payment_type` attribute may either be `credit_card` or `bank_account`, depending on the type of payment method being added. If a bank account is being passed, the payment attributes should be changed to `bank_account_attributes`. @@ -248,9 +248,9 @@ For more information on GoCardless, please view the following two resources: + [Full documentation on GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoCardless) -+ [Using Chargify.js with GoCardless - minimal example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#minimal-example-with-direct-debit-gocardless-gateway) ++ [Using Chargify.js with GoCardless - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQZKCER8CFK40MR6XJ) -+ [Using Chargify.js with GoCardless - full example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#full-example-with-direct-debit-gocardless-gateway) ++ [Using Chargify.js with GoCardless - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV) ```json { @@ -310,9 +310,9 @@ For more information on Stripe Direct Debit, please view the following two resou + [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) -+ [Using Chargify.js with Stripe SEPA or BECS Direct Debit - minimal example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#minimal-example-with-sepa-or-becs-direct-debit-stripe-gateway) ++ [Using Chargify.js with Stripe SEPA or BECS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) -+ [Using Chargify.js with Stripe SEPA Direct Debit - full example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#full-example-with-sepa-direct-debit-stripe-gateway) ++ [Using Chargify.js with Stripe SEPA Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV) ```json { @@ -340,9 +340,9 @@ For more information on Stripe Direct Debit, please view the following two resou + [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) -+ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](page:development-tools/chargify-js/examples#minimal-example-with-sepa-becs-or-bacs-direct-debit-stripe-gateway) ++ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) -+ [Using Chargify.js with Stripe BECS Direct Debit - full example](page:development-tools/chargify-js/examples#full-example-with-becs-direct-debit-stripe-gateway) ++ [Using Chargify.js with Stripe BECS Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QRX4B1TYZKZD8ZND6D) ```json { @@ -371,9 +371,9 @@ For more information on Stripe Direct Debit, please view the following two resou + [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) -+ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](page:development-tools/chargify-js/examples#minimal-example-with-sepa-becs-or-bacs-direct-debit-stripe-gateway) ++ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) -+ [Using Chargify.js with Stripe BACS Direct Debit - full example](page:development-tools/chargify-js/examples#full-example-with-bacs-direct-debit-stripe-gateway) ++ [Using Chargify.js with Stripe BACS Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR7PA1DJ3XE9MD05FM) ```json { diff --git a/doc/controllers/webhooks.md b/doc/controllers/webhooks.md index 96c73fc3..d728e3d0 100644 --- a/doc/controllers/webhooks.md +++ b/doc/controllers/webhooks.md @@ -20,20 +20,7 @@ webhooks_controller = client.webhooks # List Webhooks -## Webhooks Intro - -The Webhooks API allows you to view a list of all webhooks and to selectively resend individual or groups of webhooks. Webhooks will be sent on endpoints specified by you. Endpoints can be added via API or Web UI. There is also an option to enable / disable webhooks via API request. - -We recommend that you review Advanced Billing's webhook documentation located in our help site. The following resources will help guide you on how to use webhooks in Advanced Billing, in addition to these webhook endpoints: - -+ [Adding/editing new webhooks](https://maxio.zendesk.com/hc/en-us/articles/24286723085197-Webhooks#configure-webhook-url) -+ [Webhooks introduction and delivery information](https://maxio.zendesk.com/hc/en-us/articles/24266143173901-Webhooks-Overview) -+ [Main webhook reference](https://maxio.zendesk.com/hc/en-us/articles/24266136649869-Webhooks-Reference) -+ [Available webhooks and payloads](https://maxio.zendesk.com/hc/en-us/articles/24266136649869-Webhooks-Reference#events) - -## List Webhooks for a Site - -This method allows you to fetch data about webhooks. You can pass query parameters if you want to filter webhooks. +Allows you to view a list of webhooks. You can pass query parameters if you want to filter webhooks. See the [Webhooks](page:introduction/webhooks/webhooks) documentation for more information. ```ruby def list_webhooks(options = {}) @@ -109,7 +96,7 @@ puts result # Enable Webhooks -This method allows you to enable webhooks via API for your site +Allows you to enable webhooks for your site ```ruby def enable_webhooks(body: nil) @@ -147,9 +134,7 @@ puts result # Replay Webhooks -Posting to the replay endpoint does not immediately resend the webhooks. They are added to a queue and will be sent as soon as possible, depending on available system resources. - -You may submit an array of up to 1000 webhook IDs to replay in the request. +Replays webhooks. Posting to this endpoint does not immediately resend the webhooks. They are added to a queue and sent as soon as possible, depending on available system resources. You can submit an array of up to 1000 webhook IDs in the replay request. ```ruby def replay_webhooks(body: nil) @@ -190,10 +175,8 @@ puts result # Create Endpoint -The Chargify API allows you to create an endpoint and assign a list of webhooks subscriptions (events) to it. - -You can check available events here. -[Event keys](https://maxio.zendesk.com/hc/en-us/articles/24266136649869-Webhooks-Reference#events) +Creates an endpoint and assigns a list of webhooks subscriptions (events) to it. +See the [Webhooks Reference](page:introduction/webhooks/webhooks-reference#events) page for available events. ```ruby def create_endpoint(body: nil) @@ -252,7 +235,7 @@ puts result # List Endpoints -This method returns created endpoints for site. +Returns created endpoints for a site. ```ruby def list_endpoints @@ -300,15 +283,11 @@ puts result # Update Endpoint -You can update an Endpoint via the API with a PUT request to the resource endpoint. - -You can change the `url` of your endpoint which consumes webhooks or list of `webhook_subscriptions`. -Check available [Event keys](https://maxio.zendesk.com/hc/en-us/articles/24266136649869-Webhooks-Reference#events). +Updates an Endpoint. You can change the `url` of your endpoint or the list of `webhook_subscriptions` to which you are subscribed. See the [Webhooks Reference](page:introduction/webhooks/webhooks-reference#events) page for available events. -Always send a complete list of events which you want subscribe/watch. -Sending an PUT request for existing endpoint with empty list of `webhook_subscriptions` will end with unsubscribe from all events. +Always send a complete list of events to which you want to subscribe. Sending a PUT request for an existing endpoint with an empty list of `webhook_subscriptions` will unsubscribe all events. -If you want unsubscribe from specific event, just send a list of `webhook_subscriptions` without the specific event key. +If you want unsubscribe from a specific event, send a list of `webhook_subscriptions` without the specific event key. ```ruby def update_endpoint(endpoint_id, @@ -333,7 +312,7 @@ endpoint_id = 42 body = CreateOrUpdateEndpointRequest.new( endpoint: CreateOrUpdateEndpoint.new( - url: 'https://yout.site/webhooks/1/json.', + url: 'https://your.site/webhooks/1/json.', webhook_subscriptions: [ WebhookSubscription::PAYMENT_FAILURE, WebhookSubscription::PAYMENT_SUCCESS, diff --git a/doc/models/containers/create-usage-subscription-id-or-reference.md b/doc/models/containers/create-usage-subscription-id-or-reference.md new file mode 100644 index 00000000..5e3897f2 --- /dev/null +++ b/doc/models/containers/create-usage-subscription-id-or-reference.md @@ -0,0 +1,14 @@ + +# Create Usage Subscription Id or Reference + +## Data Type + +`Integer | String` + +## Cases + +| Type | +| --- | +| `Integer` | +| `String` | + diff --git a/doc/models/containers/list-usages-input-subscription-id-or-reference.md b/doc/models/containers/list-usages-input-subscription-id-or-reference.md new file mode 100644 index 00000000..704961c9 --- /dev/null +++ b/doc/models/containers/list-usages-input-subscription-id-or-reference.md @@ -0,0 +1,14 @@ + +# List Usages Input Subscription Id or Reference + +## Data Type + +`Integer | String` + +## Cases + +| Type | +| --- | +| `Integer` | +| `String` | + diff --git a/doc/proxy-settings.md b/doc/proxy-settings.md new file mode 100644 index 00000000..84994d4a --- /dev/null +++ b/doc/proxy-settings.md @@ -0,0 +1,31 @@ + +# ProxySettings + +Represents the proxy server configurations for API calls. + +## Properties + +| Name | Type | Tag | Description | +| --- | --- | --- | --- | +| address | `String` | required | The proxy server URL. | +| port | `Integer` | optional | The port to connect to the proxy server. | +| username | `String` | optional | Username for proxy authentication. | +| password | `String` | optional | Password for proxy authentication. | + +## Usage Example + +```ruby +require 'advanced_billing' +include AdvancedBilling + + +client = AdvancedBilling::Client.new( + proxy_settings: ProxySettings.new( + address: "http://localhost", + port: 8888, + username: 'user', + password: 'pass' + ) +) +``` + diff --git a/lib/advanced_billing.rb b/lib/advanced_billing.rb index bc3dcd64..967403f3 100644 --- a/lib/advanced_billing.rb +++ b/lib/advanced_billing.rb @@ -23,6 +23,7 @@ require_relative 'advanced_billing/http/http_method_enum' require_relative 'advanced_billing/http/http_request' require_relative 'advanced_billing/http/http_response' +require_relative 'advanced_billing/http/proxy_settings' require_relative 'advanced_billing/http/auth/basic_auth' diff --git a/lib/advanced_billing/client.rb b/lib/advanced_billing/client.rb index 1c975b29..4ab9d876 100644 --- a/lib/advanced_billing/client.rb +++ b/lib/advanced_billing/client.rb @@ -205,7 +205,7 @@ def initialize( connection: nil, adapter: :net_http_persistent, timeout: 120, max_retries: 0, retry_interval: 1, backoff_factor: 2, retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], - retry_methods: %i[get put], http_callback: nil, + retry_methods: %i[get put], http_callback: nil, proxy_settings: nil, environment: Environment::US, site: 'subdomain', basic_auth_credentials: nil, config: nil ) @@ -216,8 +216,8 @@ def initialize( backoff_factor: backoff_factor, retry_statuses: retry_statuses, retry_methods: retry_methods, http_callback: http_callback, - environment: environment, site: site, - basic_auth_credentials: basic_auth_credentials + proxy_settings: proxy_settings, environment: environment, + site: site, basic_auth_credentials: basic_auth_credentials ) else config diff --git a/lib/advanced_billing/configuration.rb b/lib/advanced_billing/configuration.rb index bbecf87c..9e165ae4 100644 --- a/lib/advanced_billing/configuration.rb +++ b/lib/advanced_billing/configuration.rb @@ -36,14 +36,15 @@ def initialize( connection: nil, adapter: :net_http_persistent, timeout: 120, max_retries: 0, retry_interval: 1, backoff_factor: 2, retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], - retry_methods: %i[get put], http_callback: nil, + retry_methods: %i[get put], http_callback: nil, proxy_settings: nil, environment: Environment::US, site: 'subdomain', basic_auth_credentials: nil ) super connection: connection, adapter: adapter, timeout: timeout, max_retries: max_retries, retry_interval: retry_interval, backoff_factor: backoff_factor, retry_statuses: retry_statuses, - retry_methods: retry_methods, http_callback: http_callback + retry_methods: retry_methods, http_callback: http_callback, + proxy_settings: proxy_settings # Current API environment @environment = String(environment) @@ -64,7 +65,8 @@ def initialize( def clone_with(connection: nil, adapter: nil, timeout: nil, max_retries: nil, retry_interval: nil, backoff_factor: nil, retry_statuses: nil, retry_methods: nil, http_callback: nil, - environment: nil, site: nil, basic_auth_credentials: nil) + proxy_settings: nil, environment: nil, site: nil, + basic_auth_credentials: nil) connection ||= self.connection adapter ||= self.adapter timeout ||= self.timeout @@ -74,6 +76,7 @@ def clone_with(connection: nil, adapter: nil, timeout: nil, retry_statuses ||= self.retry_statuses retry_methods ||= self.retry_methods http_callback ||= self.http_callback + proxy_settings ||= self.proxy_settings environment ||= self.environment site ||= self.site basic_auth_credentials ||= self.basic_auth_credentials @@ -84,8 +87,9 @@ def clone_with(connection: nil, adapter: nil, timeout: nil, backoff_factor: backoff_factor, retry_statuses: retry_statuses, retry_methods: retry_methods, - http_callback: http_callback, environment: environment, - site: site, + http_callback: http_callback, + proxy_settings: proxy_settings, + environment: environment, site: site, basic_auth_credentials: basic_auth_credentials) end diff --git a/lib/advanced_billing/controllers/base_controller.rb b/lib/advanced_billing/controllers/base_controller.rb index 2c24aa45..7fc8da00 100644 --- a/lib/advanced_billing/controllers/base_controller.rb +++ b/lib/advanced_billing/controllers/base_controller.rb @@ -10,7 +10,7 @@ class BaseController attr_accessor :config, :http_call_back def self.user_agent - 'AB SDK Ruby:7.0.0 on OS {os-info}' + 'AB SDK Ruby:7.0.1 on OS {os-info}' end def self.user_agent_parameters diff --git a/lib/advanced_billing/controllers/component_price_points_controller.rb b/lib/advanced_billing/controllers/component_price_points_controller.rb index 1dfdacd2..febb82c3 100644 --- a/lib/advanced_billing/controllers/component_price_points_controller.rb +++ b/lib/advanced_billing/controllers/component_price_points_controller.rb @@ -40,8 +40,7 @@ def promote_component_price_point_to_default(component_id, .execute end - # This endpoint can be used to create a new price point for an existing - # component. + # Creates a price point for an existing component. # @param [Integer] component_id Required parameter: The Advanced Billing id # of the component # @param [CreateComponentPricePointRequest] body Optional parameter: TODO: diff --git a/lib/advanced_billing/controllers/components_controller.rb b/lib/advanced_billing/controllers/components_controller.rb index bd5a9027..a2d24662 100644 --- a/lib/advanced_billing/controllers/components_controller.rb +++ b/lib/advanced_billing/controllers/components_controller.rb @@ -254,9 +254,8 @@ def find_component(handle) .execute end - # This request will return information regarding a component from a specific - # product family. - # You may read the component by either the component's id or handle. When + # Returns information regarding a component from a specific product family. + # You can read the component by either the component's id or handle. When # using the handle, it must be prefixed with `handle:`. # @param [Integer] product_family_id Required parameter: The Advanced # Billing id of the product family to which the component belongs diff --git a/lib/advanced_billing/controllers/customers_controller.rb b/lib/advanced_billing/controllers/customers_controller.rb index bb97bc79..ff1fb85d 100644 --- a/lib/advanced_billing/controllers/customers_controller.rb +++ b/lib/advanced_billing/controllers/customers_controller.rb @@ -137,8 +137,8 @@ def list_customers(options = {}) .execute end - # This method allows to retrieve the Customer properties by Advanced - # Billing-generated Customer ID. + # Retrieves the Customer properties by Advanced Billing-generated Customer + # ID. # @param [Integer] id Required parameter: The Advanced Billing id of the # customer # @return [CustomerResponse] Response from the API call. diff --git a/lib/advanced_billing/controllers/payment_profiles_controller.rb b/lib/advanced_billing/controllers/payment_profiles_controller.rb index a2eac7f8..250edf83 100644 --- a/lib/advanced_billing/controllers/payment_profiles_controller.rb +++ b/lib/advanced_billing/controllers/payment_profiles_controller.rb @@ -90,11 +90,11 @@ class PaymentProfilesController < BaseController # GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoC # ardless) # + [Using Chargify.js with GoCardless - minimal - # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN - # DIy-examples#minimal-example-with-direct-debit-gocardless-gateway) + # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# + # h_01K0PJ15QQZKCER8CFK40MR6XJ) # + [Using Chargify.js with GoCardless - full - # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN - # DIy-examples#full-example-with-direct-debit-gocardless-gateway) + # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# + # h_01K0PJ15QR09JVHWW0MCA7HVJV) # ### GoCardless with Local Bank Details # Following examples create customer, bank account and mandate in # GoCardless: @@ -165,12 +165,11 @@ class PaymentProfilesController < BaseController # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S # EPA-and-BECS-Direct-Debit) # + [Using Chargify.js with Stripe Direct Debit - minimal - # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN - # DIy-examples#minimal-example-with-sepa-or-becs-direct-debit-stripe-gateway - # ) + # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# + # h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) # + [Using Chargify.js with Stripe Direct Debit - full - # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN - # DIy-examples#full-example-with-sepa-direct-debit-stripe-gateway) + # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# + # h_01K0PJ15QRECQQ4ECS3ZA55GY7) # ### Stripe SEPA Direct Debit Payment Profiles # The following example creates a customer, bank account and mandate in # Stripe: @@ -711,8 +710,8 @@ def change_subscription_group_default_payment_profile(uid, # profile instead of passing all bank account or credit card data directly # to a given API endpoint. # To obtain a One Time Token you have to use - # [Chargify.js](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0 - # NjAzNDI0-overview). + # [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Char + # gify-js-Overview#chargify-js-overview-0-0). # @param [String] chargify_token Required parameter: Advanced Billing # Token # @return [GetOneTimeTokenRequest] Response from the API call. diff --git a/lib/advanced_billing/controllers/subscription_components_controller.rb b/lib/advanced_billing/controllers/subscription_components_controller.rb index ff8f477b..f12612f7 100644 --- a/lib/advanced_billing/controllers/subscription_components_controller.rb +++ b/lib/advanced_billing/controllers/subscription_components_controller.rb @@ -597,24 +597,33 @@ def delete_prepaid_usage_allocation(subscription_id, # A. No. Usage should be reported as one API call per component on a single # subscription. For example, to record that a subscriber has sent both an # SMS Message and an Email, send an API call for each. - # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # @param [Integer | String] subscription_id_or_reference Required parameter: + # Either the Advanced Billing subscription ID (integer) or the subscription + # reference (string). Important: In cases where a numeric string value + # matches both an existing subscription ID and an existing subscription + # reference, the system will prioritize the subscription ID lookup. For + # example, if both subscription ID 123 and subscription reference "123" + # exist, passing "123" will return the subscription with ID 123. # @param [Integer | String] component_id Required parameter: Either the # Advanced Billing id for the component or the component's handle prefixed # by `handle:` # @param [CreateUsageRequest] body Optional parameter: TODO: type # description here # @return [UsageResponse] Response from the API call. - def create_usage(subscription_id, + def create_usage(subscription_id_or_reference, component_id, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, - '/subscriptions/{subscription_id}/components/{component_id}/usages.json', + '/subscriptions/{subscription_id_or_reference}/components/{component_id}/usages.json', Server::PRODUCTION) - .template_param(new_parameter(subscription_id, key: 'subscription_id') + .template_param(new_parameter(subscription_id_or_reference, key: 'subscription_id_or_reference') .is_required(true) - .should_encode(true)) + .should_encode(true) + .validator(proc do |value| + UnionTypeLookUp.get(:CreateUsageSubscriptionIdOrReference) + .validate(value) + end)) .template_param(new_parameter(component_id, key: 'component_id') .is_required(true) .should_encode(true) @@ -653,8 +662,13 @@ def create_usage(subscription_id, # subscription. You can now specify either the component id (integer) or # the component handle prefixed by "handle:" to specify the unique # identifier for the component you are working with. - # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # @param [Integer | String] subscription_id_or_reference Required parameter: + # Either the Advanced Billing subscription ID (integer) or the subscription + # reference (string). Important: In cases where a numeric string value + # matches both an existing subscription ID and an existing subscription + # reference, the system will prioritize the subscription ID lookup. For + # example, if both subscription ID 123 and subscription reference "123" + # exist, passing "123" will return the subscription with ID 123. # @param [Integer | String] component_id Required parameter: Either the # Advanced Billing id for the component or the component's handle prefixed # by `handle:` @@ -683,11 +697,15 @@ def create_usage(subscription_id, def list_usages(options = {}) @api_call .request(new_request_builder(HttpMethodEnum::GET, - '/subscriptions/{subscription_id}/components/{component_id}/usages.json', + '/subscriptions/{subscription_id_or_reference}/components/{component_id}/usages.json', Server::PRODUCTION) - .template_param(new_parameter(options['subscription_id'], key: 'subscription_id') + .template_param(new_parameter(options['subscription_id_or_reference'], key: 'subscription_id_or_reference') .is_required(true) - .should_encode(true)) + .should_encode(true) + .validator(proc do |value| + UnionTypeLookUp.get(:ListUsagesInputSubscriptionIdOrReference) + .validate(value) + end)) .template_param(new_parameter(options['component_id'], key: 'component_id') .is_required(true) .should_encode(true) diff --git a/lib/advanced_billing/controllers/subscriptions_controller.rb b/lib/advanced_billing/controllers/subscriptions_controller.rb index e1d926e6..36985584 100644 --- a/lib/advanced_billing/controllers/subscriptions_controller.rb +++ b/lib/advanced_billing/controllers/subscriptions_controller.rb @@ -137,10 +137,10 @@ class SubscriptionsController < BaseController # # Passing Payment Information # ## Subscription with Chargify.js token # The `chargify_token` can be obtained using - # [Chargify.js](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0 - # NjAzNDI0-overview). The token represents payment profile attributes that - # were provided by the customer in their browser and stored at the payment - # gateway. + # [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Char + # gify-js-Overview#chargify-js-overview-0-0). The token represents payment + # profile attributes that were provided by the customer in their browser and + # stored at the payment gateway. # The `payment_type` attribute may either be `credit_card` or # `bank_account`, depending on the type of payment method being added. If a # bank account is being passed, the payment attributes should be changed to @@ -265,11 +265,11 @@ class SubscriptionsController < BaseController # GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoC # ardless) # + [Using Chargify.js with GoCardless - minimal - # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN - # DIy-examples#minimal-example-with-direct-debit-gocardless-gateway) + # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# + # h_01K0PJ15QQZKCER8CFK40MR6XJ) # + [Using Chargify.js with GoCardless - full - # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN - # DIy-examples#full-example-with-direct-debit-gocardless-gateway) + # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# + # h_01K0PJ15QR09JVHWW0MCA7HVJV) # ```json # { # "subscription": { @@ -327,12 +327,11 @@ class SubscriptionsController < BaseController # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S # EPA-and-BECS-Direct-Debit) # + [Using Chargify.js with Stripe SEPA or BECS Direct Debit - minimal - # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN - # DIy-examples#minimal-example-with-sepa-or-becs-direct-debit-stripe-gateway - # ) + # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# + # h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) # + [Using Chargify.js with Stripe SEPA Direct Debit - full - # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN - # DIy-examples#full-example-with-sepa-direct-debit-stripe-gateway) + # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# + # h_01K0PJ15QR09JVHWW0MCA7HVJV) # ```json # { # "subscription": { @@ -359,11 +358,11 @@ class SubscriptionsController < BaseController # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S # EPA-and-BECS-Direct-Debit) # + [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal - # example](page:development-tools/chargify-js/examples#minimal-example-with- - # sepa-becs-or-bacs-direct-debit-stripe-gateway) + # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# + # h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) # + [Using Chargify.js with Stripe BECS Direct Debit - full - # example](page:development-tools/chargify-js/examples#full-example-with-bec - # s-direct-debit-stripe-gateway) + # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# + # h_01K0PJ15QRX4B1TYZKZD8ZND6D) # ```json # { # "subscription": { @@ -391,11 +390,11 @@ class SubscriptionsController < BaseController # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S # EPA-and-BECS-Direct-Debit) # + [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal - # example](page:development-tools/chargify-js/examples#minimal-example-with- - # sepa-becs-or-bacs-direct-debit-stripe-gateway) + # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# + # h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) # + [Using Chargify.js with Stripe BACS Direct Debit - full - # example](page:development-tools/chargify-js/examples#full-example-with-bac - # s-direct-debit-stripe-gateway) + # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# + # h_01K0PJ15QR7PA1DJ3XE9MD05FM) # ```json # { # "subscription": { @@ -1288,7 +1287,7 @@ def remove_coupon_from_subscription(subscription_id, .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:deserialize_primitive_types)) - .deserialize_into(proc do |response| response.to_s end) + .deserialize_into(proc do |response| response&.to_s end) .is_primitive_response(true) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ diff --git a/lib/advanced_billing/controllers/webhooks_controller.rb b/lib/advanced_billing/controllers/webhooks_controller.rb index 30f85a0f..6bfc885f 100644 --- a/lib/advanced_billing/controllers/webhooks_controller.rb +++ b/lib/advanced_billing/controllers/webhooks_controller.rb @@ -6,30 +6,10 @@ module AdvancedBilling # WebhooksController class WebhooksController < BaseController - # ## Webhooks Intro - # The Webhooks API allows you to view a list of all webhooks and to - # selectively resend individual or groups of webhooks. Webhooks will be sent - # on endpoints specified by you. Endpoints can be added via API or Web UI. - # There is also an option to enable / disable webhooks via API request. - # We recommend that you review Advanced Billing's webhook documentation - # located in our help site. The following resources will help guide you on - # how to use webhooks in Advanced Billing, in addition to these webhook - # endpoints: - # + [Adding/editing new - # webhooks](https://maxio.zendesk.com/hc/en-us/articles/24286723085197-Webho - # oks#configure-webhook-url) - # + [Webhooks introduction and delivery - # information](https://maxio.zendesk.com/hc/en-us/articles/24266143173901-We - # bhooks-Overview) - # + [Main webhook - # reference](https://maxio.zendesk.com/hc/en-us/articles/24266136649869-Webh - # ooks-Reference) - # + [Available webhooks and - # payloads](https://maxio.zendesk.com/hc/en-us/articles/24266136649869-Webho - # oks-Reference#events) - # ## List Webhooks for a Site - # This method allows you to fetch data about webhooks. You can pass query - # parameters if you want to filter webhooks. + # Allows you to view a list of webhooks. You can pass query parameters if + # you want to filter webhooks. See the + # [Webhooks](page:introduction/webhooks/webhooks) documentation for more + # information. # @param [WebhookStatus] status Optional parameter: Webhooks with matching # status would be returned. # @param [String] since_date Optional parameter: Format YYYY-MM-DD. Returns @@ -75,7 +55,7 @@ def list_webhooks(options = {}) .execute end - # This method allows you to enable webhooks via API for your site + # Allows you to enable webhooks for your site # @param [EnableWebhooksRequest] body Optional parameter: TODO: type # description here # @return [EnableWebhooksResponse] Response from the API call. @@ -95,11 +75,10 @@ def enable_webhooks(body: nil) .execute end - # Posting to the replay endpoint does not immediately resend the webhooks. - # They are added to a queue and will be sent as soon as possible, depending - # on available system resources. - # You may submit an array of up to 1000 webhook IDs to replay in the - # request. + # Replays webhooks. Posting to this endpoint does not immediately resend the + # webhooks. They are added to a queue and sent as soon as possible, + # depending on available system resources. You can submit an array of up to + # 1000 webhook IDs in the replay request. # @param [ReplayWebhooksRequest] body Optional parameter: TODO: type # description here # @return [ReplayWebhooksResponse] Response from the API call. @@ -119,12 +98,11 @@ def replay_webhooks(body: nil) .execute end - # The Chargify API allows you to create an endpoint and assign a list of - # webhooks subscriptions (events) to it. - # You can check available events here. - # [Event - # keys](https://maxio.zendesk.com/hc/en-us/articles/24266136649869-Webhooks- - # Reference#events) + # Creates an endpoint and assigns a list of webhooks subscriptions (events) + # to it. + # See the [Webhooks + # Reference](page:introduction/webhooks/webhooks-reference#events) page for + # available events. # @param [CreateOrUpdateEndpointRequest] body Optional parameter: TODO: type # description here # @return [EndpointResponse] Response from the API call. @@ -148,7 +126,7 @@ def create_endpoint(body: nil) .execute end - # This method returns created endpoints for site. + # Returns created endpoints for a site. # @return [Array[Endpoint]] Response from the API call. def list_endpoints @api_call @@ -164,17 +142,14 @@ def list_endpoints .execute end - # You can update an Endpoint via the API with a PUT request to the resource - # endpoint. - # You can change the `url` of your endpoint which consumes webhooks or list - # of `webhook_subscriptions`. - # Check available [Event - # keys](https://maxio.zendesk.com/hc/en-us/articles/24266136649869-Webhooks- - # Reference#events). - # Always send a complete list of events which you want subscribe/watch. - # Sending an PUT request for existing endpoint with empty list of - # `webhook_subscriptions` will end with unsubscribe from all events. - # If you want unsubscribe from specific event, just send a list of + # Updates an Endpoint. You can change the `url` of your endpoint or the list + # of `webhook_subscriptions` to which you are subscribed. See the [Webhooks + # Reference](page:introduction/webhooks/webhooks-reference#events) page for + # available events. + # Always send a complete list of events to which you want to subscribe. + # Sending a PUT request for an existing endpoint with an empty list of + # `webhook_subscriptions` will unsubscribe all events. + # If you want unsubscribe from a specific event, send a list of # `webhook_subscriptions` without the specific event key. # @param [Integer] endpoint_id Required parameter: The Advanced Billing id # for the endpoint that should be updated diff --git a/lib/advanced_billing/http/proxy_settings.rb b/lib/advanced_billing/http/proxy_settings.rb new file mode 100644 index 00000000..aacb4e07 --- /dev/null +++ b/lib/advanced_billing/http/proxy_settings.rb @@ -0,0 +1,13 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + ## + # ProxySettings encapsulates HTTP proxy configuration for Faraday, + # including optional basic authentication. + # + class ProxySettings < CoreLibrary::ProxySettings + end +end diff --git a/lib/advanced_billing/utilities/union_type_lookup.rb b/lib/advanced_billing/utilities/union_type_lookup.rb index 358e78ab..29c2bc4a 100644 --- a/lib/advanced_billing/utilities/union_type_lookup.rb +++ b/lib/advanced_billing/utilities/union_type_lookup.rb @@ -110,6 +110,13 @@ def self.union_types ] ), + :CreateUsageSubscriptionIdOrReference => OneOf.new( + [ + LeafType.new(Integer), + LeafType.new(String) + ] + ), + :CreateUsageComponentId => OneOf.new( [ LeafType.new(Integer), @@ -117,6 +124,13 @@ def self.union_types ] ), + :ListUsagesInputSubscriptionIdOrReference => OneOf.new( + [ + LeafType.new(Integer), + LeafType.new(String) + ] + ), + :ListUsagesInputComponentId => OneOf.new( [ LeafType.new(Integer),