diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d126d1d5..d0771f5ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,40 @@ on: - 'stl-preview-base/**' jobs: + build: + timeout-minutes: 10 + name: build + permissions: + contents: read + id-token: write + runs-on: ${{ github.repository == 'stainless-sdks/orb-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: |- + github.repository == 'stainless-sdks/orb-ruby' && + (github.event_name == 'push' || github.event.pull_request.head.repo.fork) + steps: + - uses: actions/checkout@v6 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: false + - run: |- + bundle install + + - name: Get GitHub OIDC Token + if: github.repository == 'stainless-sdks/orb-ruby' + id: github-oidc + uses: actions/github-script@v8 + with: + script: core.setOutput('github_token', await core.getIDToken()); + + - name: Build and upload gem artifacts + if: github.repository == 'stainless-sdks/orb-ruby' + env: + URL: https://pkg.stainless.com/s + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + PACKAGE_NAME: orb + run: ./scripts/utils/upload-artifact.sh lint: timeout-minutes: 10 name: lint diff --git a/.release-please-manifest.json b/.release-please-manifest.json index de0960aba..f94eeca26 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.12.0" + ".": "1.13.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index c80eee48c..2be12a8b5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 139 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-c92fb451e13f157b3735f188acc8d57aa3adfbaac1683645e1ba4f432dd7a4f8.yml -openapi_spec_hash: dbcd87ecfbd3976eb3b99ec6f9fbc606 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-5bb582f84f0b4cf7bef84833fefd48a5f2734dc25805da2028fd8a6f1198da07.yml +openapi_spec_hash: ced0e30dc67faa2414df511819408f12 config_hash: 3279841440b02d4e8303c961d6983492 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6753d58bd..beb041444 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## 1.13.0 (2026-03-03) + +Full Changelog: [v1.12.0...v1.13.0](https://github.com/orbcorp/orb-ruby/compare/v1.12.0...v1.13.0) + +### Features + +* **api:** api update ([c203926](https://github.com/orbcorp/orb-ruby/commit/c203926582b3237293d3078ada79bf3d221071d7)) +* **api:** api update ([fd4f82d](https://github.com/orbcorp/orb-ruby/commit/fd4f82dd2f04f36cd49a7413fdfaa5e1189f22c2)) +* **api:** api update ([a703c63](https://github.com/orbcorp/orb-ruby/commit/a703c638264d4dd7761a3534562f47a86b8da288)) +* **api:** api update ([49c2213](https://github.com/orbcorp/orb-ruby/commit/49c22131d40a8e0e050f894be9ff48d5958301aa)) +* **api:** api update ([357d2d4](https://github.com/orbcorp/orb-ruby/commit/357d2d4e2758c92578d1c7af1e26f1a1779738b0)) + + +### Bug Fixes + +* **client:** serialize query parameters properly ([003ab4e](https://github.com/orbcorp/orb-ruby/commit/003ab4e466176c051711b7e89e1e40be5de6a664)) +* properly mock time in ruby ci tests ([c8c588e](https://github.com/orbcorp/orb-ruby/commit/c8c588eb8bd5383d1875fef102cd7de66d6dff71)) + + +### Chores + +* **ci:** add build step ([b57c8a3](https://github.com/orbcorp/orb-ruby/commit/b57c8a3f52e22c5c67f3842357747437d12f56d7)) +* **docs:** add missing descriptions ([174bbeb](https://github.com/orbcorp/orb-ruby/commit/174bbebe6ed10a5c2c079232299b48b4269e470c)) +* update mock server docs ([4b838cf](https://github.com/orbcorp/orb-ruby/commit/4b838cf2bc89666bea9767ae25e66868d38bbeef)) + ## 1.12.0 (2026-02-12) Full Changelog: [v1.11.2...v1.12.0](https://github.com/orbcorp/orb-ruby/compare/v1.11.2...v1.12.0) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e044532d5..781a0604d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,8 +68,8 @@ $ bundle exec rake Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. -```bash -$ npx prism mock path/to/your/openapi.yml +```sh +$ ./scripts/mock ``` ```bash diff --git a/Gemfile.lock b/Gemfile.lock index 44549717c..913d9e83f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - orb-billing (1.12.0) + orb-billing (1.13.0) cgi connection_pool diff --git a/README.md b/README.md index af62afe56..93f22b730 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "orb-billing", "~> 1.12.0" +gem "orb-billing", "~> 1.13.0" ``` diff --git a/lib/orb/client.rb b/lib/orb/client.rb index d8a61c75d..01283d246 100644 --- a/lib/orb/client.rb +++ b/lib/orb/client.rb @@ -21,42 +21,109 @@ class Client < Orb::Internal::Transport::BaseClient # @return [Orb::Resources::TopLevel] attr_reader :top_level + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). # @return [Orb::Resources::Beta] attr_reader :beta + # A coupon represents a reusable discount configuration that can be applied either + # as a fixed or percentage amount to an invoice or subscription. Coupons are + # activated using a redemption code, which applies the discount to a subscription + # or invoice. The duration of a coupon determines how long it remains available + # for use by end users. # @return [Orb::Resources::Coupons] attr_reader :coupons + # The [Credit Note](/invoicing/credit-notes) resource represents a credit that has + # been applied to a particular invoice. # @return [Orb::Resources::CreditNotes] attr_reader :credit_notes + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. # @return [Orb::Resources::Customers] attr_reader :customers + # The [Event](/core-concepts#event) resource represents a usage event that has + # been created for a customer. Events are the core of Orb's usage-based billing + # model, and are used to calculate the usage charges for a given billing period. # @return [Orb::Resources::Events] attr_reader :events + # An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, + # representing the request for payment for a single subscription. This includes a + # set of line items, which correspond to prices in the subscription's plan and can + # represent fixed recurring fees or usage-based fees. They are generated at the + # end of a billing period, or as the result of an action, such as a cancellation. # @return [Orb::Resources::InvoiceLineItems] attr_reader :invoice_line_items + # An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, + # representing the request for payment for a single subscription. This includes a + # set of line items, which correspond to prices in the subscription's plan and can + # represent fixed recurring fees or usage-based fees. They are generated at the + # end of a billing period, or as the result of an action, such as a cancellation. # @return [Orb::Resources::Invoices] attr_reader :invoices + # The Item resource represents a sellable product or good. Items are associated + # with all line items, billable metrics, and prices and are used for defining + # external sync behavior for invoices and tax calculation purposes. # @return [Orb::Resources::Items] attr_reader :items + # The Metric resource represents a calculation of a quantity based on events. + # Metrics are defined by the query that transforms raw usage events into + # meaningful values for your customers. # @return [Orb::Resources::Metrics] attr_reader :metrics + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). # @return [Orb::Resources::Plans] attr_reader :plans + # The Price resource represents a price that can be billed on a subscription, + # resulting in a charge on an invoice in the form of an invoice line item. Prices + # take a quantity and determine an amount to bill. + # + # Orb supports a few different pricing models out of the box. Each of these models + # is serialized differently in a given Price object. The model_type field + # determines the key for the configuration object that is present. + # + # For more on the types of prices, see + # [the core concepts documentation](/core-concepts#plan-and-price) # @return [Orb::Resources::Prices] attr_reader :prices # @return [Orb::Resources::Subscriptions] attr_reader :subscriptions + # [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, + # usage, or credit balance and trigger webhooks when a threshold is exceeded. + # + # Alerts created through the API can be scoped to either customers or + # subscriptions. # @return [Orb::Resources::Alerts] attr_reader :alerts @@ -66,9 +133,14 @@ class Client < Orb::Internal::Transport::BaseClient # @return [Orb::Resources::SubscriptionChanges] attr_reader :subscription_changes + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. # @return [Orb::Resources::CreditBlocks] attr_reader :credit_blocks + # The LicenseType resource represents a type of license that can be assigned to + # users. License types are used during billing by grouping metrics on the + # configured grouping key. # @return [Orb::Resources::LicenseTypes] attr_reader :license_types diff --git a/lib/orb/internal/util.rb b/lib/orb/internal/util.rb index b91e727e5..c89bac6ff 100644 --- a/lib/orb/internal/util.rb +++ b/lib/orb/internal/util.rb @@ -490,6 +490,37 @@ def writable_enum(&blk) JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)} class << self + # @api private + # + # @param query [Hash{Symbol=>Object}] + # + # @return [Hash{Symbol=>Object}] + def encode_query_params(query) + out = {} + query.each { write_query_param_element!(out, _1, _2) } + out + end + + # @api private + # + # @param collection [Hash{Symbol=>Object}] + # @param key [String] + # @param element [Object] + # + # @return [nil] + private def write_query_param_element!(collection, key, element) + case element + in Hash + element.each do |name, value| + write_query_param_element!(collection, "#{key}[#{name}]", value) + end + in Array + collection["#{key}[]"] = element.map(&:to_s) + else + collection[key] = element.to_s + end + end + # @api private # # @param y [Enumerator::Yielder] diff --git a/lib/orb/models/billable_metric.rb b/lib/orb/models/billable_metric.rb index fb35f7ee8..2fc2e4e4f 100644 --- a/lib/orb/models/billable_metric.rb +++ b/lib/orb/models/billable_metric.rb @@ -41,7 +41,14 @@ class BillableMetric < Orb::Internal::Type::BaseModel # @return [Symbol, Orb::Models::BillableMetric::Status] required :status, enum: -> { Orb::BillableMetric::Status } - # @!method initialize(id:, description:, item:, metadata:, name:, status:) + # @!attribute parameter_definitions + # + # @return [ArrayObject}>, nil] + optional :parameter_definitions, + Orb::Internal::Type::ArrayOf[Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown]], + nil?: true + + # @!method initialize(id:, description:, item:, metadata:, name:, status:, parameter_definitions: nil) # Some parameter documentations has been truncated, see # {Orb::Models::BillableMetric} for more details. # @@ -60,6 +67,8 @@ class BillableMetric < Orb::Internal::Type::BaseModel # @param name [String] # # @param status [Symbol, Orb::Models::BillableMetric::Status] + # + # @param parameter_definitions [ArrayObject}>, nil] # @see Orb::Models::BillableMetric#status module Status diff --git a/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb b/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb index 692554310..ab7edc34d 100644 --- a/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb +++ b/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb @@ -243,6 +243,12 @@ class InvoiceSettings < Orb::Internal::Type::BaseModel # @return [String, nil] optional :item_id, String, nil?: true + # @!attribute mark_as_paid + # If true, the new credits purchase invoice will be marked as paid. + # + # @return [Boolean, nil] + optional :mark_as_paid, Orb::Internal::Type::Boolean + # @!attribute memo # An optional memo to display on the invoice. # @@ -254,7 +260,8 @@ class InvoiceSettings < Orb::Internal::Type::BaseModel # based on the invoice or issuance date, depending on the account's configured due # date calculation method. A value of '0' here represents that the invoice is due # on issue, whereas a value of '30' represents that the customer has 30 days to - # pay the invoice. Do not set this field if you want to set a custom due date. + # pay the invoice. You must set either `net_terms` or `custom_due_date`, but not + # both. # # @return [Integer, nil] optional :net_terms, Integer, nil?: true @@ -266,7 +273,7 @@ class InvoiceSettings < Orb::Internal::Type::BaseModel # @return [Boolean, nil] optional :require_successful_payment, Orb::Internal::Type::Boolean - # @!method initialize(auto_collection:, custom_due_date: nil, invoice_date: nil, item_id: nil, memo: nil, net_terms: nil, require_successful_payment: nil) + # @!method initialize(auto_collection:, custom_due_date: nil, invoice_date: nil, item_id: nil, mark_as_paid: nil, memo: nil, net_terms: nil, require_successful_payment: nil) # Some parameter documentations has been truncated, see # {Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings} # for more details. @@ -284,6 +291,8 @@ class InvoiceSettings < Orb::Internal::Type::BaseModel # # @param item_id [String, nil] The ID of the Item to be used for the invoice line item. If not provided, a defa # + # @param mark_as_paid [Boolean] If true, the new credits purchase invoice will be marked as paid. + # # @param memo [String, nil] An optional memo to display on the invoice. # # @param net_terms [Integer, nil] The net terms determines the due date of the invoice. Due date is calculated bas diff --git a/lib/orb/models/customers/credits/ledger_create_entry_params.rb b/lib/orb/models/customers/credits/ledger_create_entry_params.rb index 4277f2781..ff4ced7d8 100644 --- a/lib/orb/models/customers/credits/ledger_create_entry_params.rb +++ b/lib/orb/models/customers/credits/ledger_create_entry_params.rb @@ -241,6 +241,12 @@ class InvoiceSettings < Orb::Internal::Type::BaseModel # @return [String, nil] optional :item_id, String, nil?: true + # @!attribute mark_as_paid + # If true, the new credits purchase invoice will be marked as paid. + # + # @return [Boolean, nil] + optional :mark_as_paid, Orb::Internal::Type::Boolean + # @!attribute memo # An optional memo to display on the invoice. # @@ -252,7 +258,8 @@ class InvoiceSettings < Orb::Internal::Type::BaseModel # based on the invoice or issuance date, depending on the account's configured due # date calculation method. A value of '0' here represents that the invoice is due # on issue, whereas a value of '30' represents that the customer has 30 days to - # pay the invoice. Do not set this field if you want to set a custom due date. + # pay the invoice. You must set either `net_terms` or `custom_due_date`, but not + # both. # # @return [Integer, nil] optional :net_terms, Integer, nil?: true @@ -264,7 +271,7 @@ class InvoiceSettings < Orb::Internal::Type::BaseModel # @return [Boolean, nil] optional :require_successful_payment, Orb::Internal::Type::Boolean - # @!method initialize(auto_collection:, custom_due_date: nil, invoice_date: nil, item_id: nil, memo: nil, net_terms: nil, require_successful_payment: nil) + # @!method initialize(auto_collection:, custom_due_date: nil, invoice_date: nil, item_id: nil, mark_as_paid: nil, memo: nil, net_terms: nil, require_successful_payment: nil) # Some parameter documentations has been truncated, see # {Orb::Models::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings} for # more details. @@ -282,6 +289,8 @@ class InvoiceSettings < Orb::Internal::Type::BaseModel # # @param item_id [String, nil] The ID of the Item to be used for the invoice line item. If not provided, a defa # + # @param mark_as_paid [Boolean] If true, the new credits purchase invoice will be marked as paid. + # # @param memo [String, nil] An optional memo to display on the invoice. # # @param net_terms [Integer, nil] The net terms determines the due date of the invoice. Due date is calculated bas diff --git a/lib/orb/models/invoice_create_params.rb b/lib/orb/models/invoice_create_params.rb index 09b33e506..d8152407e 100644 --- a/lib/orb/models/invoice_create_params.rb +++ b/lib/orb/models/invoice_create_params.rb @@ -26,6 +26,14 @@ class InvoiceCreateParams < Orb::Internal::Type::BaseModel # @return [Array] required :line_items, -> { Orb::Internal::Type::ArrayOf[Orb::InvoiceCreateParams::LineItem] } + # @!attribute auto_collection + # Determines whether this invoice will automatically attempt to charge a saved + # payment method, if any. If not specified, the invoice inherits the customer's + # auto_collection setting. + # + # @return [Boolean, nil] + optional :auto_collection, Orb::Internal::Type::Boolean, nil?: true + # @!attribute customer_id # The id of the `Customer` to create this invoice for. One of `customer_id` and # `external_customer_id` are required. @@ -86,7 +94,7 @@ class InvoiceCreateParams < Orb::Internal::Type::BaseModel # @return [Boolean, nil] optional :will_auto_issue, Orb::Internal::Type::Boolean - # @!method initialize(currency:, invoice_date:, line_items:, customer_id: nil, discount: nil, due_date: nil, external_customer_id: nil, memo: nil, metadata: nil, net_terms: nil, will_auto_issue: nil, request_options: {}) + # @!method initialize(currency:, invoice_date:, line_items:, auto_collection: nil, customer_id: nil, discount: nil, due_date: nil, external_customer_id: nil, memo: nil, metadata: nil, net_terms: nil, will_auto_issue: nil, request_options: {}) # Some parameter documentations has been truncated, see # {Orb::Models::InvoiceCreateParams} for more details. # @@ -96,6 +104,8 @@ class InvoiceCreateParams < Orb::Internal::Type::BaseModel # # @param line_items [Array] # + # @param auto_collection [Boolean, nil] Determines whether this invoice will automatically attempt to charge a saved pay + # # @param customer_id [String, nil] The id of the `Customer` to create this invoice for. One of `customer_id` and `e # # @param discount [Orb::Models::PercentageDiscount, Orb::Models::TrialDiscount, Orb::Models::UsageDiscount, Orb::Models::AmountDiscount, nil] An optional discount to attach to the invoice. diff --git a/lib/orb/models/invoice_update_params.rb b/lib/orb/models/invoice_update_params.rb index 19e71ca4d..ad976891a 100644 --- a/lib/orb/models/invoice_update_params.rb +++ b/lib/orb/models/invoice_update_params.rb @@ -7,6 +7,14 @@ class InvoiceUpdateParams < Orb::Internal::Type::BaseModel extend Orb::Internal::Type::RequestParameters::Converter include Orb::Internal::Type::RequestParameters + # @!attribute auto_collection + # Determines whether this invoice will automatically attempt to charge a saved + # payment method, if any. Can only be modified on draft invoices. If not + # specified, the invoice's existing setting is unchanged. + # + # @return [Boolean, nil] + optional :auto_collection, Orb::Internal::Type::Boolean, nil?: true + # @!attribute due_date # An optional custom due date for the invoice. If not set, the due date will be # calculated based on the `net_terms` value. @@ -38,10 +46,12 @@ class InvoiceUpdateParams < Orb::Internal::Type::BaseModel # @return [Integer, nil] optional :net_terms, Integer, nil?: true - # @!method initialize(due_date: nil, invoice_date: nil, metadata: nil, net_terms: nil, request_options: {}) + # @!method initialize(auto_collection: nil, due_date: nil, invoice_date: nil, metadata: nil, net_terms: nil, request_options: {}) # Some parameter documentations has been truncated, see # {Orb::Models::InvoiceUpdateParams} for more details. # + # @param auto_collection [Boolean, nil] Determines whether this invoice will automatically attempt to charge a saved pay + # # @param due_date [Date, Time, nil] An optional custom due date for the invoice. If not set, the due date will be ca # # @param invoice_date [Date, Time, nil] The date of the invoice. Can only be modified for one-off draft invoices. diff --git a/lib/orb/models/item.rb b/lib/orb/models/item.rb index 91a12d569..7eabb3b3b 100644 --- a/lib/orb/models/item.rb +++ b/lib/orb/models/item.rb @@ -99,6 +99,7 @@ module ExternalConnectionName AVALARA = :avalara ANROK = :anrok NUMERAL = :numeral + STRIPE_TAX = :stripe_tax # @!method self.values # @return [Array] diff --git a/lib/orb/models/item_update_params.rb b/lib/orb/models/item_update_params.rb index 2f7baa7fc..c895a947b 100644 --- a/lib/orb/models/item_update_params.rb +++ b/lib/orb/models/item_update_params.rb @@ -75,6 +75,7 @@ module ExternalConnectionName AVALARA = :avalara ANROK = :anrok NUMERAL = :numeral + STRIPE_TAX = :stripe_tax # @!method self.values # @return [Array] diff --git a/lib/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rb b/lib/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rb index cb8e1b8c2..293da72d7 100644 --- a/lib/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rb +++ b/lib/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rb @@ -215,6 +215,12 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # @return [String] required :unit_price, String + # @!attribute grouping_key + # The property used to group this price + # + # @return [String, nil] + optional :grouping_key, String, nil?: true + # @!attribute prorate # If true, the unit price will be prorated to the billing period # @@ -227,7 +233,7 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # @return [String, nil] optional :second_dimension, String, nil?: true - # @!method initialize(first_dimension:, matrix_scaling_factors:, unit_price:, prorate: nil, second_dimension: nil) + # @!method initialize(first_dimension:, matrix_scaling_factors:, unit_price:, grouping_key: nil, prorate: nil, second_dimension: nil) # Configuration for scalable_matrix_with_unit_pricing pricing # # @param first_dimension [String] Used to determine the unit rate @@ -236,6 +242,8 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # # @param unit_price [String] The final unit price to rate against the output of the matrix # + # @param grouping_key [String, nil] The property used to group this price + # # @param prorate [Boolean, nil] If true, the unit price will be prorated to the billing period # # @param second_dimension [String, nil] Used to determine the unit rate (optional) diff --git a/lib/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rb b/lib/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rb index 1af5d5020..c025afa96 100644 --- a/lib/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rb +++ b/lib/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rb @@ -221,6 +221,12 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # @return [String] required :unit_price, String + # @!attribute grouping_key + # The property used to group this price + # + # @return [String, nil] + optional :grouping_key, String, nil?: true + # @!attribute prorate # If true, the unit price will be prorated to the billing period # @@ -233,7 +239,7 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # @return [String, nil] optional :second_dimension, String, nil?: true - # @!method initialize(first_dimension:, matrix_scaling_factors:, unit_price:, prorate: nil, second_dimension: nil) + # @!method initialize(first_dimension:, matrix_scaling_factors:, unit_price:, grouping_key: nil, prorate: nil, second_dimension: nil) # Configuration for scalable_matrix_with_unit_pricing pricing # # @param first_dimension [String] Used to determine the unit rate @@ -242,6 +248,8 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # # @param unit_price [String] The final unit price to rate against the output of the matrix # + # @param grouping_key [String, nil] The property used to group this price + # # @param prorate [Boolean, nil] If true, the unit price will be prorated to the billing period # # @param second_dimension [String, nil] Used to determine the unit rate (optional) diff --git a/lib/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rb b/lib/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rb index d5cff2984..b60c01a1b 100644 --- a/lib/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rb +++ b/lib/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rb @@ -226,6 +226,12 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # @return [String] required :unit_price, String + # @!attribute grouping_key + # The property used to group this price + # + # @return [String, nil] + optional :grouping_key, String, nil?: true + # @!attribute prorate # If true, the unit price will be prorated to the billing period # @@ -238,7 +244,7 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # @return [String, nil] optional :second_dimension, String, nil?: true - # @!method initialize(first_dimension:, matrix_scaling_factors:, unit_price:, prorate: nil, second_dimension: nil) + # @!method initialize(first_dimension:, matrix_scaling_factors:, unit_price:, grouping_key: nil, prorate: nil, second_dimension: nil) # Configuration for scalable_matrix_with_unit_pricing pricing # # @param first_dimension [String] Used to determine the unit rate @@ -247,6 +253,8 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # # @param unit_price [String] The final unit price to rate against the output of the matrix # + # @param grouping_key [String, nil] The property used to group this price + # # @param prorate [Boolean, nil] If true, the unit price will be prorated to the billing period # # @param second_dimension [String, nil] Used to determine the unit rate (optional) diff --git a/lib/orb/models/price.rb b/lib/orb/models/price.rb index 37b1961aa..95ca4599b 100644 --- a/lib/orb/models/price.rb +++ b/lib/orb/models/price.rb @@ -9916,6 +9916,12 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # @return [String] required :unit_price, String + # @!attribute grouping_key + # The property used to group this price + # + # @return [String, nil] + optional :grouping_key, String, nil?: true + # @!attribute prorate # If true, the unit price will be prorated to the billing period # @@ -9928,7 +9934,7 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # @return [String, nil] optional :second_dimension, String, nil?: true - # @!method initialize(first_dimension:, matrix_scaling_factors:, unit_price:, prorate: nil, second_dimension: nil) + # @!method initialize(first_dimension:, matrix_scaling_factors:, unit_price:, grouping_key: nil, prorate: nil, second_dimension: nil) # Configuration for scalable_matrix_with_unit_pricing pricing # # @param first_dimension [String] Used to determine the unit rate @@ -9937,6 +9943,8 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # # @param unit_price [String] The final unit price to rate against the output of the matrix # + # @param grouping_key [String, nil] The property used to group this price + # # @param prorate [Boolean, nil] If true, the unit price will be prorated to the billing period # # @param second_dimension [String, nil] Used to determine the unit rate (optional) diff --git a/lib/orb/models/price_create_params.rb b/lib/orb/models/price_create_params.rb index 3f3438eeb..f0a250ea0 100644 --- a/lib/orb/models/price_create_params.rb +++ b/lib/orb/models/price_create_params.rb @@ -1250,6 +1250,12 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # @return [String] required :unit_price, String + # @!attribute grouping_key + # The property used to group this price + # + # @return [String, nil] + optional :grouping_key, String, nil?: true + # @!attribute prorate # If true, the unit price will be prorated to the billing period # @@ -1262,7 +1268,7 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # @return [String, nil] optional :second_dimension, String, nil?: true - # @!method initialize(first_dimension:, matrix_scaling_factors:, unit_price:, prorate: nil, second_dimension: nil) + # @!method initialize(first_dimension:, matrix_scaling_factors:, unit_price:, grouping_key: nil, prorate: nil, second_dimension: nil) # Configuration for scalable_matrix_with_unit_pricing pricing # # @param first_dimension [String] Used to determine the unit rate @@ -1271,6 +1277,8 @@ class ScalableMatrixWithUnitPricingConfig < Orb::Internal::Type::BaseModel # # @param unit_price [String] The final unit price to rate against the output of the matrix # + # @param grouping_key [String, nil] The property used to group this price + # # @param prorate [Boolean, nil] If true, the unit price will be prorated to the billing period # # @param second_dimension [String, nil] Used to determine the unit rate (optional) diff --git a/lib/orb/models/price_evaluate_multiple_params.rb b/lib/orb/models/price_evaluate_multiple_params.rb index a79a1693d..d068cc760 100644 --- a/lib/orb/models/price_evaluate_multiple_params.rb +++ b/lib/orb/models/price_evaluate_multiple_params.rb @@ -74,6 +74,15 @@ class PriceEvaluation < Orb::Internal::Type::BaseModel # @return [Array, nil] optional :grouping_keys, Orb::Internal::Type::ArrayOf[String] + # @!attribute metric_parameter_overrides + # Optional overrides for parameterized billable metric parameters. If the metric + # has parameter definitions and no overrides are provided, defaults will be used. + # + # @return [Hash{Symbol=>Object}, nil] + optional :metric_parameter_overrides, + Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown], + nil?: true + # @!attribute price # New floating price request body params. # @@ -86,7 +95,7 @@ class PriceEvaluation < Orb::Internal::Type::BaseModel # @return [String, nil] optional :price_id, String, nil?: true - # @!method initialize(external_price_id: nil, filter: nil, grouping_keys: nil, price: nil, price_id: nil) + # @!method initialize(external_price_id: nil, filter: nil, grouping_keys: nil, metric_parameter_overrides: nil, price: nil, price_id: nil) # Some parameter documentations has been truncated, see # {Orb::Models::PriceEvaluateMultipleParams::PriceEvaluation} for more details. # @@ -96,6 +105,8 @@ class PriceEvaluation < Orb::Internal::Type::BaseModel # # @param grouping_keys [Array] Properties (or [computed properties](/extensibility/advanced-metrics#computed-pr # + # @param metric_parameter_overrides [Hash{Symbol=>Object}, nil] Optional overrides for parameterized billable metric parameters. If the metric h + # # @param price [Orb::Models::NewFloatingUnitPrice, Orb::Models::NewFloatingTieredPrice, Orb::Models::NewFloatingBulkPrice, Orb::Models::PriceEvaluateMultipleParams::PriceEvaluation::Price::BulkWithFilters, Orb::Models::NewFloatingPackagePrice, Orb::Models::NewFloatingMatrixPrice, Orb::Models::NewFloatingThresholdTotalAmountPrice, Orb::Models::NewFloatingTieredPackagePrice, Orb::Models::NewFloatingTieredWithMinimumPrice, Orb::Models::NewFloatingGroupedTieredPrice, Orb::Models::NewFloatingTieredPackageWithMinimumPrice, Orb::Models::NewFloatingPackageWithAllocationPrice, Orb::Models::NewFloatingUnitWithPercentPrice, Orb::Models::NewFloatingMatrixWithAllocationPrice, Orb::Models::NewFloatingTieredWithProrationPrice, Orb::Models::NewFloatingUnitWithProrationPrice, Orb::Models::NewFloatingGroupedAllocationPrice, Orb::Models::NewFloatingBulkWithProrationPrice, Orb::Models::NewFloatingGroupedWithProratedMinimumPrice, Orb::Models::NewFloatingGroupedWithMeteredMinimumPrice, Orb::Models::PriceEvaluateMultipleParams::PriceEvaluation::Price::GroupedWithMinMaxThresholds, Orb::Models::NewFloatingMatrixWithDisplayNamePrice, Orb::Models::NewFloatingGroupedTieredPackagePrice, Orb::Models::NewFloatingMaxGroupTieredPackagePrice, Orb::Models::NewFloatingScalableMatrixWithUnitPricingPrice, Orb::Models::NewFloatingScalableMatrixWithTieredPricingPrice, Orb::Models::NewFloatingCumulativeGroupedBulkPrice, Orb::Models::PriceEvaluateMultipleParams::PriceEvaluation::Price::CumulativeGroupedAllocation, Orb::Models::NewFloatingMinimumCompositePrice, Orb::Models::PriceEvaluateMultipleParams::PriceEvaluation::Price::Percent, Orb::Models::PriceEvaluateMultipleParams::PriceEvaluation::Price::EventOutput, nil] New floating price request body params. # # @param price_id [String, nil] The ID of a price to evaluate that exists in your Orb account. diff --git a/lib/orb/models/price_evaluate_params.rb b/lib/orb/models/price_evaluate_params.rb index 3f56c757b..81dc48cb2 100644 --- a/lib/orb/models/price_evaluate_params.rb +++ b/lib/orb/models/price_evaluate_params.rb @@ -47,7 +47,16 @@ class PriceEvaluateParams < Orb::Internal::Type::BaseModel # @return [Array, nil] optional :grouping_keys, Orb::Internal::Type::ArrayOf[String] - # @!method initialize(timeframe_end:, timeframe_start:, customer_id: nil, external_customer_id: nil, filter: nil, grouping_keys: nil, request_options: {}) + # @!attribute metric_parameter_overrides + # Optional overrides for parameterized billable metric parameters. If the metric + # has parameter definitions and no overrides are provided, defaults will be used. + # + # @return [Hash{Symbol=>Object}, nil] + optional :metric_parameter_overrides, + Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown], + nil?: true + + # @!method initialize(timeframe_end:, timeframe_start:, customer_id: nil, external_customer_id: nil, filter: nil, grouping_keys: nil, metric_parameter_overrides: nil, request_options: {}) # Some parameter documentations has been truncated, see # {Orb::Models::PriceEvaluateParams} for more details. # @@ -63,6 +72,8 @@ class PriceEvaluateParams < Orb::Internal::Type::BaseModel # # @param grouping_keys [Array] Properties (or [computed properties](/extensibility/advanced-metrics#computed-pr # + # @param metric_parameter_overrides [Hash{Symbol=>Object}, nil] Optional overrides for parameterized billable metric parameters. If the metric h + # # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/orb/models/price_evaluate_preview_events_params.rb b/lib/orb/models/price_evaluate_preview_events_params.rb index b98bad63c..9efa6f4c9 100644 --- a/lib/orb/models/price_evaluate_preview_events_params.rb +++ b/lib/orb/models/price_evaluate_preview_events_params.rb @@ -132,6 +132,15 @@ class PriceEvaluation < Orb::Internal::Type::BaseModel # @return [Array, nil] optional :grouping_keys, Orb::Internal::Type::ArrayOf[String] + # @!attribute metric_parameter_overrides + # Optional overrides for parameterized billable metric parameters. If the metric + # has parameter definitions and no overrides are provided, defaults will be used. + # + # @return [Hash{Symbol=>Object}, nil] + optional :metric_parameter_overrides, + Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown], + nil?: true + # @!attribute price # New floating price request body params. # @@ -148,7 +157,7 @@ class PriceEvaluation < Orb::Internal::Type::BaseModel # @return [String, nil] optional :price_id, String, nil?: true - # @!method initialize(external_price_id: nil, filter: nil, grouping_keys: nil, price: nil, price_id: nil) + # @!method initialize(external_price_id: nil, filter: nil, grouping_keys: nil, metric_parameter_overrides: nil, price: nil, price_id: nil) # Some parameter documentations has been truncated, see # {Orb::Models::PriceEvaluatePreviewEventsParams::PriceEvaluation} for more # details. @@ -159,6 +168,8 @@ class PriceEvaluation < Orb::Internal::Type::BaseModel # # @param grouping_keys [Array] Properties (or [computed properties](/extensibility/advanced-metrics#computed-pr # + # @param metric_parameter_overrides [Hash{Symbol=>Object}, nil] Optional overrides for parameterized billable metric parameters. If the metric h + # # @param price [Orb::Models::NewFloatingUnitPrice, Orb::Models::NewFloatingTieredPrice, Orb::Models::NewFloatingBulkPrice, Orb::Models::PriceEvaluatePreviewEventsParams::PriceEvaluation::Price::BulkWithFilters, Orb::Models::NewFloatingPackagePrice, Orb::Models::NewFloatingMatrixPrice, Orb::Models::NewFloatingThresholdTotalAmountPrice, Orb::Models::NewFloatingTieredPackagePrice, Orb::Models::NewFloatingTieredWithMinimumPrice, Orb::Models::NewFloatingGroupedTieredPrice, Orb::Models::NewFloatingTieredPackageWithMinimumPrice, Orb::Models::NewFloatingPackageWithAllocationPrice, Orb::Models::NewFloatingUnitWithPercentPrice, Orb::Models::NewFloatingMatrixWithAllocationPrice, Orb::Models::NewFloatingTieredWithProrationPrice, Orb::Models::NewFloatingUnitWithProrationPrice, Orb::Models::NewFloatingGroupedAllocationPrice, Orb::Models::NewFloatingBulkWithProrationPrice, Orb::Models::NewFloatingGroupedWithProratedMinimumPrice, Orb::Models::NewFloatingGroupedWithMeteredMinimumPrice, Orb::Models::PriceEvaluatePreviewEventsParams::PriceEvaluation::Price::GroupedWithMinMaxThresholds, Orb::Models::NewFloatingMatrixWithDisplayNamePrice, Orb::Models::NewFloatingGroupedTieredPackagePrice, Orb::Models::NewFloatingMaxGroupTieredPackagePrice, Orb::Models::NewFloatingScalableMatrixWithUnitPricingPrice, Orb::Models::NewFloatingScalableMatrixWithTieredPricingPrice, Orb::Models::NewFloatingCumulativeGroupedBulkPrice, Orb::Models::PriceEvaluatePreviewEventsParams::PriceEvaluation::Price::CumulativeGroupedAllocation, Orb::Models::NewFloatingMinimumCompositePrice, Orb::Models::PriceEvaluatePreviewEventsParams::PriceEvaluation::Price::Percent, Orb::Models::PriceEvaluatePreviewEventsParams::PriceEvaluation::Price::EventOutput, nil] New floating price request body params. # # @param price_id [String, nil] The ID of a price to evaluate that exists in your Orb account. diff --git a/lib/orb/models/price_interval.rb b/lib/orb/models/price_interval.rb index e3068635e..5dd678086 100644 --- a/lib/orb/models/price_interval.rb +++ b/lib/orb/models/price_interval.rb @@ -89,7 +89,16 @@ class PriceInterval < Orb::Internal::Type::BaseModel # @return [Array, nil] required :usage_customer_ids, Orb::Internal::Type::ArrayOf[String], nil?: true - # @!method initialize(id:, billing_cycle_day:, can_defer_billing:, current_billing_period_end_date:, current_billing_period_start_date:, end_date:, filter:, fixed_fee_quantity_transitions:, price:, start_date:, usage_customer_ids:) + # @!attribute metric_parameter_overrides + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + # + # @return [Hash{Symbol=>Object}, nil] + optional :metric_parameter_overrides, + Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown], + nil?: true + + # @!method initialize(id:, billing_cycle_day:, can_defer_billing:, current_billing_period_end_date:, current_billing_period_start_date:, end_date:, filter:, fixed_fee_quantity_transitions:, price:, start_date:, usage_customer_ids:, metric_parameter_overrides: nil) # Some parameter documentations has been truncated, see # {Orb::Models::PriceInterval} for more details. # @@ -118,6 +127,8 @@ class PriceInterval < Orb::Internal::Type::BaseModel # @param start_date [Time] The start date of the price interval. This is the date that Orb starts billing f # # @param usage_customer_ids [Array, nil] A list of customer IDs whose usage events will be aggregated and billed under th + # + # @param metric_parameter_overrides [Hash{Symbol=>Object}, nil] Override values for parameterized billable metric variables. Keys are parameter end end end diff --git a/lib/orb/models/subscription_create_params.rb b/lib/orb/models/subscription_create_params.rb index 246c1d0f0..5ec065b60 100644 --- a/lib/orb/models/subscription_create_params.rb +++ b/lib/orb/models/subscription_create_params.rb @@ -422,6 +422,15 @@ class AddPrice < Orb::Internal::Type::BaseModel # @return [String, nil] optional :maximum_amount, String, nil?: true + # @!attribute metric_parameter_overrides + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + # + # @return [Hash{Symbol=>Object}, nil] + optional :metric_parameter_overrides, + Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown], + nil?: true + # @!attribute minimum_amount # @deprecated # @@ -457,7 +466,7 @@ class AddPrice < Orb::Internal::Type::BaseModel # @return [Time, nil] optional :start_date, Time, nil?: true - # @!method initialize(allocation_price: nil, discounts: nil, end_date: nil, external_price_id: nil, maximum_amount: nil, minimum_amount: nil, plan_phase_order: nil, price: nil, price_id: nil, start_date: nil) + # @!method initialize(allocation_price: nil, discounts: nil, end_date: nil, external_price_id: nil, maximum_amount: nil, metric_parameter_overrides: nil, minimum_amount: nil, plan_phase_order: nil, price: nil, price_id: nil, start_date: nil) # Some parameter documentations has been truncated, see # {Orb::Models::SubscriptionCreateParams::AddPrice} for more details. # @@ -471,6 +480,8 @@ class AddPrice < Orb::Internal::Type::BaseModel # # @param maximum_amount [String, nil] [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for # + # @param metric_parameter_overrides [Hash{Symbol=>Object}, nil] Override values for parameterized billable metric variables. Keys are parameter + # # @param minimum_amount [String, nil] [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for # # @param plan_phase_order [Integer, nil] The phase to add this price to. @@ -2085,6 +2096,15 @@ class ReplacePrice < Orb::Internal::Type::BaseModel # @return [String, nil] optional :maximum_amount, String, nil?: true + # @!attribute metric_parameter_overrides + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + # + # @return [Hash{Symbol=>Object}, nil] + optional :metric_parameter_overrides, + Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown], + nil?: true + # @!attribute minimum_amount # @deprecated # @@ -2106,7 +2126,7 @@ class ReplacePrice < Orb::Internal::Type::BaseModel # @return [String, nil] optional :price_id, String, nil?: true - # @!method initialize(replaces_price_id:, allocation_price: nil, discounts: nil, external_price_id: nil, fixed_price_quantity: nil, maximum_amount: nil, minimum_amount: nil, price: nil, price_id: nil) + # @!method initialize(replaces_price_id:, allocation_price: nil, discounts: nil, external_price_id: nil, fixed_price_quantity: nil, maximum_amount: nil, metric_parameter_overrides: nil, minimum_amount: nil, price: nil, price_id: nil) # Some parameter documentations has been truncated, see # {Orb::Models::SubscriptionCreateParams::ReplacePrice} for more details. # @@ -2122,6 +2142,8 @@ class ReplacePrice < Orb::Internal::Type::BaseModel # # @param maximum_amount [String, nil] [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for # + # @param metric_parameter_overrides [Hash{Symbol=>Object}, nil] Override values for parameterized billable metric variables. Keys are parameter + # # @param minimum_amount [String, nil] [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for # # @param price [Orb::Models::NewSubscriptionUnitPrice, Orb::Models::NewSubscriptionTieredPrice, Orb::Models::NewSubscriptionBulkPrice, Orb::Models::SubscriptionCreateParams::ReplacePrice::Price::BulkWithFilters, Orb::Models::NewSubscriptionPackagePrice, Orb::Models::NewSubscriptionMatrixPrice, Orb::Models::NewSubscriptionThresholdTotalAmountPrice, Orb::Models::NewSubscriptionTieredPackagePrice, Orb::Models::NewSubscriptionTieredWithMinimumPrice, Orb::Models::NewSubscriptionGroupedTieredPrice, Orb::Models::NewSubscriptionTieredPackageWithMinimumPrice, Orb::Models::NewSubscriptionPackageWithAllocationPrice, Orb::Models::NewSubscriptionUnitWithPercentPrice, Orb::Models::NewSubscriptionMatrixWithAllocationPrice, Orb::Models::SubscriptionCreateParams::ReplacePrice::Price::TieredWithProration, Orb::Models::NewSubscriptionUnitWithProrationPrice, Orb::Models::NewSubscriptionGroupedAllocationPrice, Orb::Models::NewSubscriptionBulkWithProrationPrice, Orb::Models::NewSubscriptionGroupedWithProratedMinimumPrice, Orb::Models::NewSubscriptionGroupedWithMeteredMinimumPrice, Orb::Models::SubscriptionCreateParams::ReplacePrice::Price::GroupedWithMinMaxThresholds, Orb::Models::NewSubscriptionMatrixWithDisplayNamePrice, Orb::Models::NewSubscriptionGroupedTieredPackagePrice, Orb::Models::NewSubscriptionMaxGroupTieredPackagePrice, Orb::Models::NewSubscriptionScalableMatrixWithUnitPricingPrice, Orb::Models::NewSubscriptionScalableMatrixWithTieredPricingPrice, Orb::Models::NewSubscriptionCumulativeGroupedBulkPrice, Orb::Models::SubscriptionCreateParams::ReplacePrice::Price::CumulativeGroupedAllocation, Orb::Models::NewSubscriptionMinimumCompositePrice, Orb::Models::SubscriptionCreateParams::ReplacePrice::Price::Percent, Orb::Models::SubscriptionCreateParams::ReplacePrice::Price::EventOutput, nil] New subscription price request body params. diff --git a/lib/orb/models/subscription_price_intervals_params.rb b/lib/orb/models/subscription_price_intervals_params.rb index 6a3d839d5..55717ebbe 100644 --- a/lib/orb/models/subscription_price_intervals_params.rb +++ b/lib/orb/models/subscription_price_intervals_params.rb @@ -137,6 +137,15 @@ class Add < Orb::Internal::Type::BaseModel # @return [Float, nil] optional :maximum_amount, Float, nil?: true + # @!attribute metric_parameter_overrides + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values (number or string). + # + # @return [Hash{Symbol=>Object}, nil] + optional :metric_parameter_overrides, + Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown], + nil?: true + # @!attribute minimum_amount # The minimum amount that will be billed for this price interval for a given # billing period. @@ -167,7 +176,7 @@ class Add < Orb::Internal::Type::BaseModel # @return [Array, nil] optional :usage_customer_ids, Orb::Internal::Type::ArrayOf[String], nil?: true - # @!method initialize(start_date:, allocation_price: nil, can_defer_billing: nil, discounts: nil, end_date: nil, external_price_id: nil, filter: nil, fixed_fee_quantity_transitions: nil, maximum_amount: nil, minimum_amount: nil, price: nil, price_id: nil, usage_customer_ids: nil) + # @!method initialize(start_date:, allocation_price: nil, can_defer_billing: nil, discounts: nil, end_date: nil, external_price_id: nil, filter: nil, fixed_fee_quantity_transitions: nil, maximum_amount: nil, metric_parameter_overrides: nil, minimum_amount: nil, price: nil, price_id: nil, usage_customer_ids: nil) # Some parameter documentations has been truncated, see # {Orb::Models::SubscriptionPriceIntervalsParams::Add} for more details. # @@ -189,6 +198,8 @@ class Add < Orb::Internal::Type::BaseModel # # @param maximum_amount [Float, nil] The maximum amount that will be billed for this price interval for a given billi # + # @param metric_parameter_overrides [Hash{Symbol=>Object}, nil] Override values for parameterized billable metric variables. Keys are parameter + # # @param minimum_amount [Float, nil] The minimum amount that will be billed for this price interval for a given billi # # @param price [Orb::Models::NewFloatingUnitPrice, Orb::Models::NewFloatingTieredPrice, Orb::Models::NewFloatingBulkPrice, Orb::Models::SubscriptionPriceIntervalsParams::Add::Price::BulkWithFilters, Orb::Models::NewFloatingPackagePrice, Orb::Models::NewFloatingMatrixPrice, Orb::Models::NewFloatingThresholdTotalAmountPrice, Orb::Models::NewFloatingTieredPackagePrice, Orb::Models::NewFloatingTieredWithMinimumPrice, Orb::Models::NewFloatingGroupedTieredPrice, Orb::Models::NewFloatingTieredPackageWithMinimumPrice, Orb::Models::NewFloatingPackageWithAllocationPrice, Orb::Models::NewFloatingUnitWithPercentPrice, Orb::Models::NewFloatingMatrixWithAllocationPrice, Orb::Models::NewFloatingTieredWithProrationPrice, Orb::Models::NewFloatingUnitWithProrationPrice, Orb::Models::NewFloatingGroupedAllocationPrice, Orb::Models::NewFloatingBulkWithProrationPrice, Orb::Models::NewFloatingGroupedWithProratedMinimumPrice, Orb::Models::NewFloatingGroupedWithMeteredMinimumPrice, Orb::Models::SubscriptionPriceIntervalsParams::Add::Price::GroupedWithMinMaxThresholds, Orb::Models::NewFloatingMatrixWithDisplayNamePrice, Orb::Models::NewFloatingGroupedTieredPackagePrice, Orb::Models::NewFloatingMaxGroupTieredPackagePrice, Orb::Models::NewFloatingScalableMatrixWithUnitPricingPrice, Orb::Models::NewFloatingScalableMatrixWithTieredPricingPrice, Orb::Models::NewFloatingCumulativeGroupedBulkPrice, Orb::Models::SubscriptionPriceIntervalsParams::Add::Price::CumulativeGroupedAllocation, Orb::Models::NewFloatingMinimumCompositePrice, Orb::Models::SubscriptionPriceIntervalsParams::Add::Price::Percent, Orb::Models::SubscriptionPriceIntervalsParams::Add::Price::EventOutput, nil] New floating price request body params. @@ -1674,6 +1685,15 @@ class Edit < Orb::Internal::Type::BaseModel }, nil?: true + # @!attribute metric_parameter_overrides + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values (number or string). + # + # @return [Hash{Symbol=>Object}, nil] + optional :metric_parameter_overrides, + Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown], + nil?: true + # @!attribute start_date # The updated start date of this price interval. If not specified, the start date # will not be updated. @@ -1692,7 +1712,7 @@ class Edit < Orb::Internal::Type::BaseModel # @return [Array, nil] optional :usage_customer_ids, Orb::Internal::Type::ArrayOf[String], nil?: true - # @!method initialize(price_interval_id:, billing_cycle_day: nil, can_defer_billing: nil, end_date: nil, filter: nil, fixed_fee_quantity_transitions: nil, start_date: nil, usage_customer_ids: nil) + # @!method initialize(price_interval_id:, billing_cycle_day: nil, can_defer_billing: nil, end_date: nil, filter: nil, fixed_fee_quantity_transitions: nil, metric_parameter_overrides: nil, start_date: nil, usage_customer_ids: nil) # Some parameter documentations has been truncated, see # {Orb::Models::SubscriptionPriceIntervalsParams::Edit} for more details. # @@ -1708,6 +1728,8 @@ class Edit < Orb::Internal::Type::BaseModel # # @param fixed_fee_quantity_transitions [Array, nil] A list of fixed fee quantity transitions to use for this price interval. Note th # + # @param metric_parameter_overrides [Hash{Symbol=>Object}, nil] Override values for parameterized billable metric variables. Keys are parameter + # # @param start_date [Time, Symbol, Orb::Models::BillingCycleRelativeDate] The updated start date of this price interval. If not specified, the start date # # @param usage_customer_ids [Array, nil] A list of customer IDs whose usage events will be aggregated and billed under th diff --git a/lib/orb/models/subscription_schedule_plan_change_params.rb b/lib/orb/models/subscription_schedule_plan_change_params.rb index fe626f46f..c303eeecc 100644 --- a/lib/orb/models/subscription_schedule_plan_change_params.rb +++ b/lib/orb/models/subscription_schedule_plan_change_params.rb @@ -387,6 +387,15 @@ class AddPrice < Orb::Internal::Type::BaseModel # @return [String, nil] optional :maximum_amount, String, nil?: true + # @!attribute metric_parameter_overrides + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + # + # @return [Hash{Symbol=>Object}, nil] + optional :metric_parameter_overrides, + Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown], + nil?: true + # @!attribute minimum_amount # @deprecated # @@ -422,7 +431,7 @@ class AddPrice < Orb::Internal::Type::BaseModel # @return [Time, nil] optional :start_date, Time, nil?: true - # @!method initialize(allocation_price: nil, discounts: nil, end_date: nil, external_price_id: nil, maximum_amount: nil, minimum_amount: nil, plan_phase_order: nil, price: nil, price_id: nil, start_date: nil) + # @!method initialize(allocation_price: nil, discounts: nil, end_date: nil, external_price_id: nil, maximum_amount: nil, metric_parameter_overrides: nil, minimum_amount: nil, plan_phase_order: nil, price: nil, price_id: nil, start_date: nil) # Some parameter documentations has been truncated, see # {Orb::Models::SubscriptionSchedulePlanChangeParams::AddPrice} for more details. # @@ -436,6 +445,8 @@ class AddPrice < Orb::Internal::Type::BaseModel # # @param maximum_amount [String, nil] [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for # + # @param metric_parameter_overrides [Hash{Symbol=>Object}, nil] Override values for parameterized billable metric variables. Keys are parameter + # # @param minimum_amount [String, nil] [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for # # @param plan_phase_order [Integer, nil] The phase to add this price to. @@ -2063,6 +2074,15 @@ class ReplacePrice < Orb::Internal::Type::BaseModel # @return [String, nil] optional :maximum_amount, String, nil?: true + # @!attribute metric_parameter_overrides + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + # + # @return [Hash{Symbol=>Object}, nil] + optional :metric_parameter_overrides, + Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown], + nil?: true + # @!attribute minimum_amount # @deprecated # @@ -2088,7 +2108,7 @@ class ReplacePrice < Orb::Internal::Type::BaseModel # @return [String, nil] optional :price_id, String, nil?: true - # @!method initialize(replaces_price_id:, allocation_price: nil, discounts: nil, external_price_id: nil, fixed_price_quantity: nil, maximum_amount: nil, minimum_amount: nil, price: nil, price_id: nil) + # @!method initialize(replaces_price_id:, allocation_price: nil, discounts: nil, external_price_id: nil, fixed_price_quantity: nil, maximum_amount: nil, metric_parameter_overrides: nil, minimum_amount: nil, price: nil, price_id: nil) # Some parameter documentations has been truncated, see # {Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice} for more # details. @@ -2105,6 +2125,8 @@ class ReplacePrice < Orb::Internal::Type::BaseModel # # @param maximum_amount [String, nil] [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for # + # @param metric_parameter_overrides [Hash{Symbol=>Object}, nil] Override values for parameterized billable metric variables. Keys are parameter + # # @param minimum_amount [String, nil] [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for # # @param price [Orb::Models::NewSubscriptionUnitPrice, Orb::Models::NewSubscriptionTieredPrice, Orb::Models::NewSubscriptionBulkPrice, Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::Price::BulkWithFilters, Orb::Models::NewSubscriptionPackagePrice, Orb::Models::NewSubscriptionMatrixPrice, Orb::Models::NewSubscriptionThresholdTotalAmountPrice, Orb::Models::NewSubscriptionTieredPackagePrice, Orb::Models::NewSubscriptionTieredWithMinimumPrice, Orb::Models::NewSubscriptionGroupedTieredPrice, Orb::Models::NewSubscriptionTieredPackageWithMinimumPrice, Orb::Models::NewSubscriptionPackageWithAllocationPrice, Orb::Models::NewSubscriptionUnitWithPercentPrice, Orb::Models::NewSubscriptionMatrixWithAllocationPrice, Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::Price::TieredWithProration, Orb::Models::NewSubscriptionUnitWithProrationPrice, Orb::Models::NewSubscriptionGroupedAllocationPrice, Orb::Models::NewSubscriptionBulkWithProrationPrice, Orb::Models::NewSubscriptionGroupedWithProratedMinimumPrice, Orb::Models::NewSubscriptionGroupedWithMeteredMinimumPrice, Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::Price::GroupedWithMinMaxThresholds, Orb::Models::NewSubscriptionMatrixWithDisplayNamePrice, Orb::Models::NewSubscriptionGroupedTieredPackagePrice, Orb::Models::NewSubscriptionMaxGroupTieredPackagePrice, Orb::Models::NewSubscriptionScalableMatrixWithUnitPricingPrice, Orb::Models::NewSubscriptionScalableMatrixWithTieredPricingPrice, Orb::Models::NewSubscriptionCumulativeGroupedBulkPrice, Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::Price::CumulativeGroupedAllocation, Orb::Models::NewSubscriptionMinimumCompositePrice, Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::Price::Percent, Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::Price::EventOutput, nil] New subscription price request body params. diff --git a/lib/orb/resources/alerts.rb b/lib/orb/resources/alerts.rb index a8a2400e0..596c76a4b 100644 --- a/lib/orb/resources/alerts.rb +++ b/lib/orb/resources/alerts.rb @@ -2,6 +2,11 @@ module Orb module Resources + # [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, + # usage, or credit balance and trigger webhooks when a threshold is exceeded. + # + # Alerts created through the API can be scoped to either customers or + # subscriptions. class Alerts # This endpoint retrieves an alert by its ID. # @@ -88,10 +93,11 @@ def update(alert_configuration_id, params) # @see Orb::Models::AlertListParams def list(params = {}) parsed, options = Orb::AlertListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "alerts", - query: parsed.transform_keys( + query: query.transform_keys( created_at_gt: "created_at[gt]", created_at_gte: "created_at[gte]", created_at_lt: "created_at[lt]", @@ -228,10 +234,11 @@ def create_for_subscription(subscription_id, params) # @see Orb::Models::AlertDisableParams def disable(alert_configuration_id, params = {}) parsed, options = Orb::AlertDisableParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :post, path: ["alerts/%1$s/disable", alert_configuration_id], - query: parsed, + query: query, model: Orb::Alert, options: options ) @@ -254,10 +261,11 @@ def disable(alert_configuration_id, params = {}) # @see Orb::Models::AlertEnableParams def enable(alert_configuration_id, params = {}) parsed, options = Orb::AlertEnableParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :post, path: ["alerts/%1$s/enable", alert_configuration_id], - query: parsed, + query: query, model: Orb::Alert, options: options ) diff --git a/lib/orb/resources/beta.rb b/lib/orb/resources/beta.rb index 55dc38d4f..74faadf89 100644 --- a/lib/orb/resources/beta.rb +++ b/lib/orb/resources/beta.rb @@ -2,7 +2,15 @@ module Orb module Resources + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). class Beta + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). # @return [Orb::Resources::Beta::ExternalPlanID] attr_reader :external_plan_id diff --git a/lib/orb/resources/beta/external_plan_id.rb b/lib/orb/resources/beta/external_plan_id.rb index c7588afe3..460729d3c 100644 --- a/lib/orb/resources/beta/external_plan_id.rb +++ b/lib/orb/resources/beta/external_plan_id.rb @@ -3,6 +3,10 @@ module Orb module Resources class Beta + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). class ExternalPlanID # This endpoint allows the creation of a new plan version for an existing plan. # diff --git a/lib/orb/resources/coupons.rb b/lib/orb/resources/coupons.rb index 0810c9960..5fee9ad22 100644 --- a/lib/orb/resources/coupons.rb +++ b/lib/orb/resources/coupons.rb @@ -2,7 +2,17 @@ module Orb module Resources + # A coupon represents a reusable discount configuration that can be applied either + # as a fixed or percentage amount to an invoice or subscription. Coupons are + # activated using a redemption code, which applies the discount to a subscription + # or invoice. The duration of a coupon determines how long it remains available + # for use by end users. class Coupons + # A coupon represents a reusable discount configuration that can be applied either + # as a fixed or percentage amount to an invoice or subscription. Coupons are + # activated using a redemption code, which applies the discount to a subscription + # or invoice. The duration of a coupon determines how long it remains available + # for use by end users. # @return [Orb::Resources::Coupons::Subscriptions] attr_reader :subscriptions @@ -59,10 +69,11 @@ def create(params) # @see Orb::Models::CouponListParams def list(params = {}) parsed, options = Orb::CouponListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "coupons", - query: parsed, + query: query, page: Orb::Internal::Page, model: Orb::Coupon, options: options diff --git a/lib/orb/resources/coupons/subscriptions.rb b/lib/orb/resources/coupons/subscriptions.rb index 94052dadc..b5820704d 100644 --- a/lib/orb/resources/coupons/subscriptions.rb +++ b/lib/orb/resources/coupons/subscriptions.rb @@ -3,6 +3,11 @@ module Orb module Resources class Coupons + # A coupon represents a reusable discount configuration that can be applied either + # as a fixed or percentage amount to an invoice or subscription. Coupons are + # activated using a redemption code, which applies the discount to a subscription + # or invoice. The duration of a coupon determines how long it remains available + # for use by end users. class Subscriptions # Some parameter documentations has been truncated, see # {Orb::Models::Coupons::SubscriptionListParams} for more details. @@ -27,10 +32,11 @@ class Subscriptions # @see Orb::Models::Coupons::SubscriptionListParams def list(coupon_id, params = {}) parsed, options = Orb::Coupons::SubscriptionListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["coupons/%1$s/subscriptions", coupon_id], - query: parsed, + query: query, page: Orb::Internal::Page, model: Orb::Subscription, options: options diff --git a/lib/orb/resources/credit_blocks.rb b/lib/orb/resources/credit_blocks.rb index 1766e5698..5143b056e 100644 --- a/lib/orb/resources/credit_blocks.rb +++ b/lib/orb/resources/credit_blocks.rb @@ -2,6 +2,8 @@ module Orb module Resources + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. class CreditBlocks # This endpoint returns a credit block identified by its block_id. # diff --git a/lib/orb/resources/credit_notes.rb b/lib/orb/resources/credit_notes.rb index 12b4c79eb..63d54e443 100644 --- a/lib/orb/resources/credit_notes.rb +++ b/lib/orb/resources/credit_notes.rb @@ -2,6 +2,8 @@ module Orb module Resources + # The [Credit Note](/invoicing/credit-notes) resource represents a credit that has + # been applied to a particular invoice. class CreditNotes # Some parameter documentations has been truncated, see # {Orb::Models::CreditNoteCreateParams} for more details. @@ -90,10 +92,11 @@ def create(params) # @see Orb::Models::CreditNoteListParams def list(params = {}) parsed, options = Orb::CreditNoteListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "credit_notes", - query: parsed.transform_keys( + query: query.transform_keys( created_at_gt: "created_at[gt]", created_at_gte: "created_at[gte]", created_at_lt: "created_at[lt]", diff --git a/lib/orb/resources/customers.rb b/lib/orb/resources/customers.rb index f9884e667..e87837069 100644 --- a/lib/orb/resources/customers.rb +++ b/lib/orb/resources/customers.rb @@ -2,13 +2,69 @@ module Orb module Resources + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. class Customers + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. # @return [Orb::Resources::Customers::Costs] attr_reader :costs + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. # @return [Orb::Resources::Customers::Credits] attr_reader :credits + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. # @return [Orb::Resources::Customers::BalanceTransactions] attr_reader :balance_transactions @@ -184,10 +240,11 @@ def update(customer_id, params = {}) # @see Orb::Models::CustomerListParams def list(params = {}) parsed, options = Orb::CustomerListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "customers", - query: parsed.transform_keys( + query: query.transform_keys( created_at_gt: "created_at[gt]", created_at_gte: "created_at[gte]", created_at_lt: "created_at[lt]", diff --git a/lib/orb/resources/customers/balance_transactions.rb b/lib/orb/resources/customers/balance_transactions.rb index 54bd859be..5f5daf0e4 100644 --- a/lib/orb/resources/customers/balance_transactions.rb +++ b/lib/orb/resources/customers/balance_transactions.rb @@ -3,6 +3,24 @@ module Orb module Resources class Customers + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. class BalanceTransactions # Creates an immutable balance transaction that updates the customer's balance and # returns back the newly created transaction. @@ -81,10 +99,11 @@ def create(customer_id, params) # @see Orb::Models::Customers::BalanceTransactionListParams def list(customer_id, params = {}) parsed, options = Orb::Customers::BalanceTransactionListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["customers/%1$s/balance_transactions", customer_id], - query: parsed.transform_keys( + query: query.transform_keys( operation_time_gt: "operation_time[gt]", operation_time_gte: "operation_time[gte]", operation_time_lt: "operation_time[lt]", diff --git a/lib/orb/resources/customers/costs.rb b/lib/orb/resources/customers/costs.rb index cfd45df0e..0640f9141 100644 --- a/lib/orb/resources/customers/costs.rb +++ b/lib/orb/resources/customers/costs.rb @@ -3,6 +3,24 @@ module Orb module Resources class Customers + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. class Costs # Some parameter documentations has been truncated, see # {Orb::Models::Customers::CostListParams} for more details. @@ -144,10 +162,11 @@ class Costs # @see Orb::Models::Customers::CostListParams def list(customer_id, params = {}) parsed, options = Orb::Customers::CostListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["customers/%1$s/costs", customer_id], - query: parsed, + query: query, model: Orb::Models::Customers::CostListResponse, options: options ) @@ -293,10 +312,11 @@ def list(customer_id, params = {}) # @see Orb::Models::Customers::CostListByExternalIDParams def list_by_external_id(external_customer_id, params = {}) parsed, options = Orb::Customers::CostListByExternalIDParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["customers/external_customer_id/%1$s/costs", external_customer_id], - query: parsed, + query: query, model: Orb::Models::Customers::CostListByExternalIDResponse, options: options ) diff --git a/lib/orb/resources/customers/credits.rb b/lib/orb/resources/customers/credits.rb index b1474157f..a8e33fbef 100644 --- a/lib/orb/resources/customers/credits.rb +++ b/lib/orb/resources/customers/credits.rb @@ -3,10 +3,16 @@ module Orb module Resources class Customers + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. class Credits + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. # @return [Orb::Resources::Customers::Credits::Ledger] attr_reader :ledger + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. # @return [Orb::Resources::Customers::Credits::TopUps] attr_reader :top_ups @@ -53,10 +59,11 @@ class Credits # @see Orb::Models::Customers::CreditListParams def list(customer_id, params = {}) parsed, options = Orb::Customers::CreditListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["customers/%1$s/credits", customer_id], - query: parsed.transform_keys( + query: query.transform_keys( effective_date_gt: "effective_date[gt]", effective_date_gte: "effective_date[gte]", effective_date_lt: "effective_date[lt]", @@ -111,10 +118,11 @@ def list(customer_id, params = {}) # @see Orb::Models::Customers::CreditListByExternalIDParams def list_by_external_id(external_customer_id, params = {}) parsed, options = Orb::Customers::CreditListByExternalIDParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["customers/external_customer_id/%1$s/credits", external_customer_id], - query: parsed.transform_keys( + query: query.transform_keys( effective_date_gt: "effective_date[gt]", effective_date_gte: "effective_date[gte]", effective_date_lt: "effective_date[lt]", diff --git a/lib/orb/resources/customers/credits/ledger.rb b/lib/orb/resources/customers/credits/ledger.rb index 53f729595..f755374c4 100644 --- a/lib/orb/resources/customers/credits/ledger.rb +++ b/lib/orb/resources/customers/credits/ledger.rb @@ -4,6 +4,8 @@ module Orb module Resources class Customers class Credits + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. class Ledger # Some parameter documentations has been truncated, see # {Orb::Models::Customers::Credits::LedgerListParams} for more details. @@ -119,10 +121,11 @@ class Ledger # @see Orb::Models::Customers::Credits::LedgerListParams def list(customer_id, params = {}) parsed, options = Orb::Customers::Credits::LedgerListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["customers/%1$s/credits/ledger", customer_id], - query: parsed.transform_keys( + query: query.transform_keys( created_at_gt: "created_at[gt]", created_at_gte: "created_at[gte]", created_at_lt: "created_at[lt]", @@ -187,8 +190,12 @@ def list(customer_id, params = {}) # also generate a one-off invoice for the customer for the credits pre-purchase. # Note that you _must_ provide the `per_unit_cost_basis`, since the total charges # on the invoice are calculated by multiplying the cost basis with the number of - # credit units added. Additionally, Orb also enforces invoice generation when a - # non-zero `per_unit_cost_basis` value is provided. + # credit units added. + # + # - if `per_unit_cost_basis` is greater than zero, an invoice will be generated + # and `invoice_settings` must be included + # - if `invoice_settings` is passed, one of either `custom_due_date` or + # `net_terms` is required to determine the due date # # ## Deducting Credits # @@ -349,8 +356,12 @@ def create_entry(customer_id, params) # also generate a one-off invoice for the customer for the credits pre-purchase. # Note that you _must_ provide the `per_unit_cost_basis`, since the total charges # on the invoice are calculated by multiplying the cost basis with the number of - # credit units added. Additionally, Orb also enforces invoice generation when a - # non-zero `per_unit_cost_basis` value is provided. + # credit units added. + # + # - if `per_unit_cost_basis` is greater than zero, an invoice will be generated + # and `invoice_settings` must be included + # - if `invoice_settings` is passed, one of either `custom_due_date` or + # `net_terms` is required to determine the due date # # ## Deducting Credits # @@ -572,10 +583,11 @@ def create_entry_by_external_id(external_customer_id, params) # @see Orb::Models::Customers::Credits::LedgerListByExternalIDParams def list_by_external_id(external_customer_id, params = {}) parsed, options = Orb::Customers::Credits::LedgerListByExternalIDParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["customers/external_customer_id/%1$s/credits/ledger", external_customer_id], - query: parsed.transform_keys( + query: query.transform_keys( created_at_gt: "created_at[gt]", created_at_gte: "created_at[gte]", created_at_lt: "created_at[lt]", diff --git a/lib/orb/resources/customers/credits/top_ups.rb b/lib/orb/resources/customers/credits/top_ups.rb index 6e505ee38..5ff1daab9 100644 --- a/lib/orb/resources/customers/credits/top_ups.rb +++ b/lib/orb/resources/customers/credits/top_ups.rb @@ -4,6 +4,8 @@ module Orb module Resources class Customers class Credits + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. class TopUps # Some parameter documentations has been truncated, see # {Orb::Models::Customers::Credits::TopUpCreateParams} for more details. @@ -72,10 +74,11 @@ def create(customer_id, params) # @see Orb::Models::Customers::Credits::TopUpListParams def list(customer_id, params = {}) parsed, options = Orb::Customers::Credits::TopUpListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["customers/%1$s/credits/top_ups", customer_id], - query: parsed, + query: query, page: Orb::Internal::Page, model: Orb::Models::Customers::Credits::TopUpListResponse, options: options @@ -206,10 +209,11 @@ def delete_by_external_id(top_up_id, params) # @see Orb::Models::Customers::Credits::TopUpListByExternalIDParams def list_by_external_id(external_customer_id, params = {}) parsed, options = Orb::Customers::Credits::TopUpListByExternalIDParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["customers/external_customer_id/%1$s/credits/top_ups", external_customer_id], - query: parsed, + query: query, page: Orb::Internal::Page, model: Orb::Models::Customers::Credits::TopUpListByExternalIDResponse, options: options diff --git a/lib/orb/resources/dimensional_price_groups.rb b/lib/orb/resources/dimensional_price_groups.rb index c2741d78d..a05cc21c3 100644 --- a/lib/orb/resources/dimensional_price_groups.rb +++ b/lib/orb/resources/dimensional_price_groups.rb @@ -114,10 +114,11 @@ def update(dimensional_price_group_id, params = {}) # @see Orb::Models::DimensionalPriceGroupListParams def list(params = {}) parsed, options = Orb::DimensionalPriceGroupListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "dimensional_price_groups", - query: parsed, + query: query, page: Orb::Internal::Page, model: Orb::DimensionalPriceGroup, options: options diff --git a/lib/orb/resources/events.rb b/lib/orb/resources/events.rb index 8ff588529..1cb66fa8f 100644 --- a/lib/orb/resources/events.rb +++ b/lib/orb/resources/events.rb @@ -2,10 +2,19 @@ module Orb module Resources + # The [Event](/core-concepts#event) resource represents a usage event that has + # been created for a customer. Events are the core of Orb's usage-based billing + # model, and are used to calculate the usage charges for a given billing period. class Events + # The [Event](/core-concepts#event) resource represents a usage event that has + # been created for a customer. Events are the core of Orb's usage-based billing + # model, and are used to calculate the usage charges for a given billing period. # @return [Orb::Resources::Events::Backfills] attr_reader :backfills + # The [Event](/core-concepts#event) resource represents a usage event that has + # been created for a customer. Events are the core of Orb's usage-based billing + # model, and are used to calculate the usage charges for a given billing period. # @return [Orb::Resources::Events::Volume] attr_reader :volume @@ -368,12 +377,13 @@ def deprecate(event_id, params = {}) # # @see Orb::Models::EventIngestParams def ingest(params) - parsed, options = Orb::EventIngestParams.dump_request(params) query_params = [:backfill_id, :debug] + parsed, options = Orb::EventIngestParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :post, path: "ingest", - query: parsed.slice(*query_params), + query: query, body: parsed.except(*query_params), model: Orb::Models::EventIngestResponse, options: options diff --git a/lib/orb/resources/events/backfills.rb b/lib/orb/resources/events/backfills.rb index ffd386a93..e0cd9eaef 100644 --- a/lib/orb/resources/events/backfills.rb +++ b/lib/orb/resources/events/backfills.rb @@ -3,6 +3,9 @@ module Orb module Resources class Events + # The [Event](/core-concepts#event) resource represents a usage event that has + # been created for a customer. Events are the core of Orb's usage-based billing + # model, and are used to calculate the usage charges for a given billing period. class Backfills # Some parameter documentations has been truncated, see # {Orb::Models::Events::BackfillCreateParams} for more details. @@ -104,10 +107,11 @@ def create(params) # @see Orb::Models::Events::BackfillListParams def list(params = {}) parsed, options = Orb::Events::BackfillListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "events/backfills", - query: parsed, + query: query, page: Orb::Internal::Page, model: Orb::Models::Events::BackfillListResponse, options: options diff --git a/lib/orb/resources/events/volume.rb b/lib/orb/resources/events/volume.rb index ec1bef47e..309757451 100644 --- a/lib/orb/resources/events/volume.rb +++ b/lib/orb/resources/events/volume.rb @@ -3,6 +3,9 @@ module Orb module Resources class Events + # The [Event](/core-concepts#event) resource represents a usage event that has + # been created for a customer. Events are the core of Orb's usage-based billing + # model, and are used to calculate the usage charges for a given billing period. class Volume # Some parameter documentations has been truncated, see # {Orb::Models::Events::VolumeListParams} for more details. @@ -38,10 +41,11 @@ class Volume # @see Orb::Models::Events::VolumeListParams def list(params) parsed, options = Orb::Events::VolumeListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "events/volume", - query: parsed, + query: query, model: Orb::Events::EventVolumes, options: options ) diff --git a/lib/orb/resources/invoice_line_items.rb b/lib/orb/resources/invoice_line_items.rb index 1ab149bd2..d9afc92fe 100644 --- a/lib/orb/resources/invoice_line_items.rb +++ b/lib/orb/resources/invoice_line_items.rb @@ -2,6 +2,11 @@ module Orb module Resources + # An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, + # representing the request for payment for a single subscription. This includes a + # set of line items, which correspond to prices in the subscription's plan and can + # represent fixed recurring fees or usage-based fees. They are generated at the + # end of a billing period, or as the result of an action, such as a cancellation. class InvoiceLineItems # Some parameter documentations has been truncated, see # {Orb::Models::InvoiceLineItemCreateParams} for more details. diff --git a/lib/orb/resources/invoices.rb b/lib/orb/resources/invoices.rb index 655398514..33735fcc3 100644 --- a/lib/orb/resources/invoices.rb +++ b/lib/orb/resources/invoices.rb @@ -2,13 +2,18 @@ module Orb module Resources + # An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, + # representing the request for payment for a single subscription. This includes a + # set of line items, which correspond to prices in the subscription's plan and can + # represent fixed recurring fees or usage-based fees. They are generated at the + # end of a billing period, or as the result of an action, such as a cancellation. class Invoices # Some parameter documentations has been truncated, see # {Orb::Models::InvoiceCreateParams} for more details. # # This endpoint is used to create a one-off invoice for a customer. # - # @overload create(currency:, invoice_date:, line_items:, customer_id: nil, discount: nil, due_date: nil, external_customer_id: nil, memo: nil, metadata: nil, net_terms: nil, will_auto_issue: nil, request_options: {}) + # @overload create(currency:, invoice_date:, line_items:, auto_collection: nil, customer_id: nil, discount: nil, due_date: nil, external_customer_id: nil, memo: nil, metadata: nil, net_terms: nil, will_auto_issue: nil, request_options: {}) # # @param currency [String] An ISO 4217 currency string. Must be the same as the customer's currency if it i # @@ -16,6 +21,8 @@ class Invoices # # @param line_items [Array] # + # @param auto_collection [Boolean, nil] Determines whether this invoice will automatically attempt to charge a saved pay + # # @param customer_id [String, nil] The id of the `Customer` to create this invoice for. One of `customer_id` and `e # # @param discount [Orb::Models::PercentageDiscount, Orb::Models::TrialDiscount, Orb::Models::UsageDiscount, Orb::Models::AmountDiscount, nil] An optional discount to attach to the invoice. @@ -45,18 +52,21 @@ def create(params) # Some parameter documentations has been truncated, see # {Orb::Models::InvoiceUpdateParams} for more details. # - # This endpoint allows you to update the `metadata`, `net_terms`, `due_date`, and - # `invoice_date` properties on an invoice. If you pass null for the metadata - # value, it will clear any existing metadata for that invoice. + # This endpoint allows you to update the `metadata`, `net_terms`, `due_date`, + # `invoice_date`, and `auto_collection` properties on an invoice. If you pass null + # for the metadata value, it will clear any existing metadata for that invoice. # # `metadata` can be modified regardless of invoice state. `net_terms`, `due_date`, - # and `invoice_date` can only be modified if the invoice is in a `draft` state. - # `invoice_date` can only be modified for non-subscription invoices. + # `invoice_date`, and `auto_collection` can only be modified if the invoice is in + # a `draft` state. `invoice_date` can only be modified for non-subscription + # invoices. # - # @overload update(invoice_id, due_date: nil, invoice_date: nil, metadata: nil, net_terms: nil, request_options: {}) + # @overload update(invoice_id, auto_collection: nil, due_date: nil, invoice_date: nil, metadata: nil, net_terms: nil, request_options: {}) # # @param invoice_id [String] # + # @param auto_collection [Boolean, nil] Determines whether this invoice will automatically attempt to charge a saved pay + # # @param due_date [Date, Time, nil] An optional custom due date for the invoice. If not set, the due date will be ca # # @param invoice_date [Date, Time, nil] The date of the invoice. Can only be modified for one-off draft invoices. @@ -145,10 +155,11 @@ def update(invoice_id, params = {}) # @see Orb::Models::InvoiceListParams def list(params = {}) parsed, options = Orb::InvoiceListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "invoices", - query: parsed.transform_keys( + query: query.transform_keys( amount_gt: "amount[gt]", amount_lt: "amount[lt]", due_date_gt: "due_date[gt]", @@ -227,10 +238,11 @@ def fetch(invoice_id, params = {}) # @see Orb::Models::InvoiceFetchUpcomingParams def fetch_upcoming(params) parsed, options = Orb::InvoiceFetchUpcomingParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "invoices/upcoming", - query: parsed, + query: query, model: Orb::Models::InvoiceFetchUpcomingResponse, options: options ) @@ -370,10 +382,11 @@ def issue_summary(invoice_id, params = {}) # @see Orb::Models::InvoiceListSummaryParams def list_summary(params = {}) parsed, options = Orb::InvoiceListSummaryParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "invoices/summary", - query: parsed.transform_keys( + query: query.transform_keys( amount_gt: "amount[gt]", amount_lt: "amount[lt]", due_date_gt: "due_date[gt]", diff --git a/lib/orb/resources/items.rb b/lib/orb/resources/items.rb index e01258cf0..25076ee23 100644 --- a/lib/orb/resources/items.rb +++ b/lib/orb/resources/items.rb @@ -2,6 +2,9 @@ module Orb module Resources + # The Item resource represents a sellable product or good. Items are associated + # with all line items, billable metrics, and prices and are used for defining + # external sync behavior for invoices and tax calculation purposes. class Items # Some parameter documentations has been truncated, see # {Orb::Models::ItemCreateParams} for more details. @@ -74,10 +77,11 @@ def update(item_id, params = {}) # @see Orb::Models::ItemListParams def list(params = {}) parsed, options = Orb::ItemListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "items", - query: parsed, + query: query, page: Orb::Internal::Page, model: Orb::Item, options: options diff --git a/lib/orb/resources/license_types.rb b/lib/orb/resources/license_types.rb index 31451b521..189d136c3 100644 --- a/lib/orb/resources/license_types.rb +++ b/lib/orb/resources/license_types.rb @@ -2,6 +2,9 @@ module Orb module Resources + # The LicenseType resource represents a type of license that can be assigned to + # users. License types are used during billing by grouping metrics on the + # configured grouping key. class LicenseTypes # Some parameter documentations has been truncated, see # {Orb::Models::LicenseTypeCreateParams} for more details. @@ -79,10 +82,11 @@ def retrieve(license_type_id, params = {}) # @see Orb::Models::LicenseTypeListParams def list(params = {}) parsed, options = Orb::LicenseTypeListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "license_types", - query: parsed, + query: query, page: Orb::Internal::Page, model: Orb::Models::LicenseTypeListResponse, options: options diff --git a/lib/orb/resources/licenses.rb b/lib/orb/resources/licenses.rb index 1f2f96bed..917f05e75 100644 --- a/lib/orb/resources/licenses.rb +++ b/lib/orb/resources/licenses.rb @@ -91,10 +91,11 @@ def retrieve(license_id, params = {}) # @see Orb::Models::LicenseListParams def list(params) parsed, options = Orb::LicenseListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "licenses", - query: parsed, + query: query, page: Orb::Internal::Page, model: Orb::Models::LicenseListResponse, options: options @@ -149,10 +150,11 @@ def deactivate(license_id, params = {}) # @see Orb::Models::LicenseRetrieveByExternalIDParams def retrieve_by_external_id(external_license_id, params) parsed, options = Orb::LicenseRetrieveByExternalIDParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["licenses/external_license_id/%1$s", external_license_id], - query: parsed, + query: query, model: Orb::Models::LicenseRetrieveByExternalIDResponse, options: options ) diff --git a/lib/orb/resources/licenses/external_licenses.rb b/lib/orb/resources/licenses/external_licenses.rb index c617b626e..dd6c6e2d7 100644 --- a/lib/orb/resources/licenses/external_licenses.rb +++ b/lib/orb/resources/licenses/external_licenses.rb @@ -37,10 +37,11 @@ class ExternalLicenses # @see Orb::Models::Licenses::ExternalLicenseGetUsageParams def get_usage(external_license_id, params) parsed, options = Orb::Licenses::ExternalLicenseGetUsageParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["licenses/external_licenses/%1$s/usage", external_license_id], - query: parsed, + query: query, model: Orb::Models::Licenses::ExternalLicenseGetUsageResponse, options: options ) diff --git a/lib/orb/resources/licenses/usage.rb b/lib/orb/resources/licenses/usage.rb index fddac2453..f33a4018b 100644 --- a/lib/orb/resources/licenses/usage.rb +++ b/lib/orb/resources/licenses/usage.rb @@ -35,10 +35,11 @@ class Usage # @see Orb::Models::Licenses::UsageGetAllUsageParams def get_all_usage(params) parsed, options = Orb::Licenses::UsageGetAllUsageParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "licenses/usage", - query: parsed, + query: query, model: Orb::Models::Licenses::UsageGetAllUsageResponse, options: options ) @@ -72,10 +73,11 @@ def get_all_usage(params) # @see Orb::Models::Licenses::UsageGetUsageParams def get_usage(license_id, params = {}) parsed, options = Orb::Licenses::UsageGetUsageParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["licenses/%1$s/usage", license_id], - query: parsed, + query: query, model: Orb::Models::Licenses::UsageGetUsageResponse, options: options ) diff --git a/lib/orb/resources/metrics.rb b/lib/orb/resources/metrics.rb index 59160c1cf..a94380ccc 100644 --- a/lib/orb/resources/metrics.rb +++ b/lib/orb/resources/metrics.rb @@ -2,6 +2,9 @@ module Orb module Resources + # The Metric resource represents a calculation of a quantity based on events. + # Metrics are defined by the query that transforms raw usage events into + # meaningful values for your customers. class Metrics # Some parameter documentations has been truncated, see # {Orb::Models::MetricCreateParams} for more details. @@ -95,10 +98,11 @@ def update(metric_id, params = {}) # @see Orb::Models::MetricListParams def list(params = {}) parsed, options = Orb::MetricListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "metrics", - query: parsed.transform_keys( + query: query.transform_keys( created_at_gt: "created_at[gt]", created_at_gte: "created_at[gte]", created_at_lt: "created_at[lt]", diff --git a/lib/orb/resources/plans.rb b/lib/orb/resources/plans.rb index fb38438a0..bddb9617a 100644 --- a/lib/orb/resources/plans.rb +++ b/lib/orb/resources/plans.rb @@ -2,10 +2,22 @@ module Orb module Resources + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). class Plans + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). # @return [Orb::Resources::Plans::ExternalPlanID] attr_reader :external_plan_id + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). # @return [Orb::Resources::Plans::Migrations] attr_reader :migrations @@ -110,10 +122,11 @@ def update(plan_id, params = {}) # @see Orb::Models::PlanListParams def list(params = {}) parsed, options = Orb::PlanListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "plans", - query: parsed.transform_keys( + query: query.transform_keys( created_at_gt: "created_at[gt]", created_at_gte: "created_at[gte]", created_at_lt: "created_at[lt]", diff --git a/lib/orb/resources/plans/external_plan_id.rb b/lib/orb/resources/plans/external_plan_id.rb index fca52c80d..0f3a4b5f3 100644 --- a/lib/orb/resources/plans/external_plan_id.rb +++ b/lib/orb/resources/plans/external_plan_id.rb @@ -3,6 +3,10 @@ module Orb module Resources class Plans + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). class ExternalPlanID # Some parameter documentations has been truncated, see # {Orb::Models::Plans::ExternalPlanIDUpdateParams} for more details. diff --git a/lib/orb/resources/plans/migrations.rb b/lib/orb/resources/plans/migrations.rb index 0dd959b35..188f407e3 100644 --- a/lib/orb/resources/plans/migrations.rb +++ b/lib/orb/resources/plans/migrations.rb @@ -3,6 +3,10 @@ module Orb module Resources class Plans + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). class Migrations # Fetch migration # @@ -52,10 +56,11 @@ def retrieve(migration_id, params) # @see Orb::Models::Plans::MigrationListParams def list(plan_id, params = {}) parsed, options = Orb::Plans::MigrationListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["plans/%1$s/migrations", plan_id], - query: parsed, + query: query, page: Orb::Internal::Page, model: Orb::Models::Plans::MigrationListResponse, options: options diff --git a/lib/orb/resources/prices.rb b/lib/orb/resources/prices.rb index aafe87f10..32e7c652f 100644 --- a/lib/orb/resources/prices.rb +++ b/lib/orb/resources/prices.rb @@ -2,7 +2,27 @@ module Orb module Resources + # The Price resource represents a price that can be billed on a subscription, + # resulting in a charge on an invoice in the form of an invoice line item. Prices + # take a quantity and determine an amount to bill. + # + # Orb supports a few different pricing models out of the box. Each of these models + # is serialized differently in a given Price object. The model_type field + # determines the key for the configuration object that is present. + # + # For more on the types of prices, see + # [the core concepts documentation](/core-concepts#plan-and-price) class Prices + # The Price resource represents a price that can be billed on a subscription, + # resulting in a charge on an invoice in the form of an invoice line item. Prices + # take a quantity and determine an amount to bill. + # + # Orb supports a few different pricing models out of the box. Each of these models + # is serialized differently in a given Price object. The model_type field + # determines the key for the configuration object that is present. + # + # For more on the types of prices, see + # [the core concepts documentation](/core-concepts#plan-and-price) # @return [Orb::Resources::Prices::ExternalPriceID] attr_reader :external_price_id @@ -176,10 +196,11 @@ def update(price_id, params = {}) # @see Orb::Models::PriceListParams def list(params = {}) parsed, options = Orb::PriceListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "prices", - query: parsed, + query: query, page: Orb::Internal::Page, model: Orb::Price, options: options @@ -215,7 +236,7 @@ def list(params = {}) # endpoint rather than a GET endpoint because it employs a JSON body rather than # query parameters. # - # @overload evaluate(price_id, timeframe_end:, timeframe_start:, customer_id: nil, external_customer_id: nil, filter: nil, grouping_keys: nil, request_options: {}) + # @overload evaluate(price_id, timeframe_end:, timeframe_start:, customer_id: nil, external_customer_id: nil, filter: nil, grouping_keys: nil, metric_parameter_overrides: nil, request_options: {}) # # @param price_id [String] # @@ -231,6 +252,8 @@ def list(params = {}) # # @param grouping_keys [Array] Properties (or [computed properties](/extensibility/advanced-metrics#computed-pr # + # @param metric_parameter_overrides [Hash{Symbol=>Object}, nil] Optional overrides for parameterized billable metric parameters. If the metric h + # # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [Orb::Models::PriceEvaluateResponse] diff --git a/lib/orb/resources/prices/external_price_id.rb b/lib/orb/resources/prices/external_price_id.rb index 39f5636fd..c8a3e738a 100644 --- a/lib/orb/resources/prices/external_price_id.rb +++ b/lib/orb/resources/prices/external_price_id.rb @@ -3,6 +3,16 @@ module Orb module Resources class Prices + # The Price resource represents a price that can be billed on a subscription, + # resulting in a charge on an invoice in the form of an invoice line item. Prices + # take a quantity and determine an amount to bill. + # + # Orb supports a few different pricing models out of the box. Each of these models + # is serialized differently in a given Price object. The model_type field + # determines the key for the configuration object that is present. + # + # For more on the types of prices, see + # [the core concepts documentation](/core-concepts#plan-and-price) class ExternalPriceID # Some parameter documentations has been truncated, see # {Orb::Models::Prices::ExternalPriceIDUpdateParams} for more details. diff --git a/lib/orb/resources/subscription_changes.rb b/lib/orb/resources/subscription_changes.rb index 933a0fa21..50fbd10b4 100644 --- a/lib/orb/resources/subscription_changes.rb +++ b/lib/orb/resources/subscription_changes.rb @@ -56,10 +56,11 @@ def retrieve(subscription_change_id, params = {}) # @see Orb::Models::SubscriptionChangeListParams def list(params = {}) parsed, options = Orb::SubscriptionChangeListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "subscription_changes", - query: parsed, + query: query, page: Orb::Internal::Page, model: Orb::Models::SubscriptionChangeListResponse, options: options diff --git a/lib/orb/resources/subscriptions.rb b/lib/orb/resources/subscriptions.rb index 49894815b..9317b1df9 100644 --- a/lib/orb/resources/subscriptions.rb +++ b/lib/orb/resources/subscriptions.rb @@ -432,10 +432,11 @@ def update(subscription_id, params = {}) # @see Orb::Models::SubscriptionListParams def list(params = {}) parsed, options = Orb::SubscriptionListParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "subscriptions", - query: parsed.transform_keys( + query: query.transform_keys( created_at_gt: "created_at[gt]", created_at_gte: "created_at[gte]", created_at_lt: "created_at[lt]", @@ -591,10 +592,11 @@ def fetch(subscription_id, params = {}) # @see Orb::Models::SubscriptionFetchCostsParams def fetch_costs(subscription_id, params = {}) parsed, options = Orb::SubscriptionFetchCostsParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["subscriptions/%1$s/costs", subscription_id], - query: parsed, + query: query, model: Orb::Models::SubscriptionFetchCostsResponse, options: options ) @@ -631,10 +633,11 @@ def fetch_costs(subscription_id, params = {}) # @see Orb::Models::SubscriptionFetchScheduleParams def fetch_schedule(subscription_id, params = {}) parsed, options = Orb::SubscriptionFetchScheduleParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["subscriptions/%1$s/schedule", subscription_id], - query: parsed.transform_keys( + query: query.transform_keys( start_date_gt: "start_date[gt]", start_date_gte: "start_date[gte]", start_date_lt: "start_date[lt]", @@ -875,10 +878,11 @@ def fetch_schedule(subscription_id, params = {}) # @see Orb::Models::SubscriptionFetchUsageParams def fetch_usage(subscription_id, params = {}) parsed, options = Orb::SubscriptionFetchUsageParams.dump_request(params) + query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["subscriptions/%1$s/usage", subscription_id], - query: parsed, + query: query, model: Orb::SubscriptionUsage, options: options ) diff --git a/lib/orb/version.rb b/lib/orb/version.rb index 89c1fe801..dbd18c4ba 100644 --- a/lib/orb/version.rb +++ b/lib/orb/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Orb - VERSION = "1.12.0" + VERSION = "1.13.0" end diff --git a/rbi/orb/client.rbi b/rbi/orb/client.rbi index 80a380e79..e3315db19 100644 --- a/rbi/orb/client.rbi +++ b/rbi/orb/client.rbi @@ -16,42 +16,109 @@ module Orb sig { returns(Orb::Resources::TopLevel) } attr_reader :top_level + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). sig { returns(Orb::Resources::Beta) } attr_reader :beta + # A coupon represents a reusable discount configuration that can be applied either + # as a fixed or percentage amount to an invoice or subscription. Coupons are + # activated using a redemption code, which applies the discount to a subscription + # or invoice. The duration of a coupon determines how long it remains available + # for use by end users. sig { returns(Orb::Resources::Coupons) } attr_reader :coupons + # The [Credit Note](/invoicing/credit-notes) resource represents a credit that has + # been applied to a particular invoice. sig { returns(Orb::Resources::CreditNotes) } attr_reader :credit_notes + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. sig { returns(Orb::Resources::Customers) } attr_reader :customers + # The [Event](/core-concepts#event) resource represents a usage event that has + # been created for a customer. Events are the core of Orb's usage-based billing + # model, and are used to calculate the usage charges for a given billing period. sig { returns(Orb::Resources::Events) } attr_reader :events + # An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, + # representing the request for payment for a single subscription. This includes a + # set of line items, which correspond to prices in the subscription's plan and can + # represent fixed recurring fees or usage-based fees. They are generated at the + # end of a billing period, or as the result of an action, such as a cancellation. sig { returns(Orb::Resources::InvoiceLineItems) } attr_reader :invoice_line_items + # An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, + # representing the request for payment for a single subscription. This includes a + # set of line items, which correspond to prices in the subscription's plan and can + # represent fixed recurring fees or usage-based fees. They are generated at the + # end of a billing period, or as the result of an action, such as a cancellation. sig { returns(Orb::Resources::Invoices) } attr_reader :invoices + # The Item resource represents a sellable product or good. Items are associated + # with all line items, billable metrics, and prices and are used for defining + # external sync behavior for invoices and tax calculation purposes. sig { returns(Orb::Resources::Items) } attr_reader :items + # The Metric resource represents a calculation of a quantity based on events. + # Metrics are defined by the query that transforms raw usage events into + # meaningful values for your customers. sig { returns(Orb::Resources::Metrics) } attr_reader :metrics + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). sig { returns(Orb::Resources::Plans) } attr_reader :plans + # The Price resource represents a price that can be billed on a subscription, + # resulting in a charge on an invoice in the form of an invoice line item. Prices + # take a quantity and determine an amount to bill. + # + # Orb supports a few different pricing models out of the box. Each of these models + # is serialized differently in a given Price object. The model_type field + # determines the key for the configuration object that is present. + # + # For more on the types of prices, see + # [the core concepts documentation](/core-concepts#plan-and-price) sig { returns(Orb::Resources::Prices) } attr_reader :prices sig { returns(Orb::Resources::Subscriptions) } attr_reader :subscriptions + # [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, + # usage, or credit balance and trigger webhooks when a threshold is exceeded. + # + # Alerts created through the API can be scoped to either customers or + # subscriptions. sig { returns(Orb::Resources::Alerts) } attr_reader :alerts @@ -61,9 +128,14 @@ module Orb sig { returns(Orb::Resources::SubscriptionChanges) } attr_reader :subscription_changes + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. sig { returns(Orb::Resources::CreditBlocks) } attr_reader :credit_blocks + # The LicenseType resource represents a type of license that can be assigned to + # users. License types are used during billing by grouping metrics on the + # configured grouping key. sig { returns(Orb::Resources::LicenseTypes) } attr_reader :license_types diff --git a/rbi/orb/internal/util.rbi b/rbi/orb/internal/util.rbi index a09f200a6..929f8e03b 100644 --- a/rbi/orb/internal/util.rbi +++ b/rbi/orb/internal/util.rbi @@ -295,6 +295,24 @@ module Orb T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp) class << self + # @api private + sig do + params(query: Orb::Internal::AnyHash).returns(Orb::Internal::AnyHash) + end + def encode_query_params(query) + end + + # @api private + sig do + params( + collection: Orb::Internal::AnyHash, + key: String, + element: T.anything + ).void + end + private def write_query_param_element!(collection, key, element) + end + # @api private sig do params( diff --git a/rbi/orb/models/billable_metric.rbi b/rbi/orb/models/billable_metric.rbi index 8a5bc40ee..f3fde7bf2 100644 --- a/rbi/orb/models/billable_metric.rbi +++ b/rbi/orb/models/billable_metric.rbi @@ -34,6 +34,9 @@ module Orb sig { returns(Orb::BillableMetric::Status::TaggedSymbol) } attr_accessor :status + sig { returns(T.nilable(T::Array[T::Hash[Symbol, T.anything]])) } + attr_accessor :parameter_definitions + # The Metric resource represents a calculation of a quantity based on events. # Metrics are defined by the query that transforms raw usage events into # meaningful values for your customers. @@ -44,7 +47,9 @@ module Orb item: Orb::Item::OrHash, metadata: T::Hash[Symbol, String], name: String, - status: Orb::BillableMetric::Status::OrSymbol + status: Orb::BillableMetric::Status::OrSymbol, + parameter_definitions: + T.nilable(T::Array[T::Hash[Symbol, T.anything]]) ).returns(T.attached_class) end def self.new( @@ -60,7 +65,8 @@ module Orb # `null`. metadata:, name:, - status: + status:, + parameter_definitions: nil ) end @@ -72,7 +78,9 @@ module Orb item: Orb::Item, metadata: T::Hash[Symbol, String], name: String, - status: Orb::BillableMetric::Status::TaggedSymbol + status: Orb::BillableMetric::Status::TaggedSymbol, + parameter_definitions: + T.nilable(T::Array[T::Hash[Symbol, T.anything]]) } ) end diff --git a/rbi/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi b/rbi/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi index 079c9db78..581e0385d 100644 --- a/rbi/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi +++ b/rbi/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi @@ -424,6 +424,13 @@ module Orb sig { returns(T.nilable(String)) } attr_accessor :item_id + # If true, the new credits purchase invoice will be marked as paid. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :mark_as_paid + + sig { params(mark_as_paid: T::Boolean).void } + attr_writer :mark_as_paid + # An optional memo to display on the invoice. sig { returns(T.nilable(String)) } attr_accessor :memo @@ -432,7 +439,8 @@ module Orb # based on the invoice or issuance date, depending on the account's configured due # date calculation method. A value of '0' here represents that the invoice is due # on issue, whereas a value of '30' represents that the customer has 30 days to - # pay the invoice. Do not set this field if you want to set a custom due date. + # pay the invoice. You must set either `net_terms` or `custom_due_date`, but not + # both. sig { returns(T.nilable(Integer)) } attr_accessor :net_terms @@ -460,6 +468,7 @@ module Orb Orb::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings::InvoiceDate::Variants ), item_id: T.nilable(String), + mark_as_paid: T::Boolean, memo: T.nilable(String), net_terms: T.nilable(Integer), require_successful_payment: T::Boolean @@ -479,13 +488,16 @@ module Orb # The ID of the Item to be used for the invoice line item. If not provided, a # default 'Credits' item will be used. item_id: nil, + # If true, the new credits purchase invoice will be marked as paid. + mark_as_paid: nil, # An optional memo to display on the invoice. memo: nil, # The net terms determines the due date of the invoice. Due date is calculated # based on the invoice or issuance date, depending on the account's configured due # date calculation method. A value of '0' here represents that the invoice is due # on issue, whereas a value of '30' represents that the customer has 30 days to - # pay the invoice. Do not set this field if you want to set a custom due date. + # pay the invoice. You must set either `net_terms` or `custom_due_date`, but not + # both. net_terms: nil, # If true, the new credit block will require that the corresponding invoice is # paid before it can be drawn down from. @@ -506,6 +518,7 @@ module Orb Orb::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings::InvoiceDate::Variants ), item_id: T.nilable(String), + mark_as_paid: T::Boolean, memo: T.nilable(String), net_terms: T.nilable(Integer), require_successful_payment: T::Boolean diff --git a/rbi/orb/models/customers/credits/ledger_create_entry_params.rbi b/rbi/orb/models/customers/credits/ledger_create_entry_params.rbi index cf552e1bf..e4a7bae1f 100644 --- a/rbi/orb/models/customers/credits/ledger_create_entry_params.rbi +++ b/rbi/orb/models/customers/credits/ledger_create_entry_params.rbi @@ -424,6 +424,13 @@ module Orb sig { returns(T.nilable(String)) } attr_accessor :item_id + # If true, the new credits purchase invoice will be marked as paid. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :mark_as_paid + + sig { params(mark_as_paid: T::Boolean).void } + attr_writer :mark_as_paid + # An optional memo to display on the invoice. sig { returns(T.nilable(String)) } attr_accessor :memo @@ -432,7 +439,8 @@ module Orb # based on the invoice or issuance date, depending on the account's configured due # date calculation method. A value of '0' here represents that the invoice is due # on issue, whereas a value of '30' represents that the customer has 30 days to - # pay the invoice. Do not set this field if you want to set a custom due date. + # pay the invoice. You must set either `net_terms` or `custom_due_date`, but not + # both. sig { returns(T.nilable(Integer)) } attr_accessor :net_terms @@ -460,6 +468,7 @@ module Orb Orb::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings::InvoiceDate::Variants ), item_id: T.nilable(String), + mark_as_paid: T::Boolean, memo: T.nilable(String), net_terms: T.nilable(Integer), require_successful_payment: T::Boolean @@ -479,13 +488,16 @@ module Orb # The ID of the Item to be used for the invoice line item. If not provided, a # default 'Credits' item will be used. item_id: nil, + # If true, the new credits purchase invoice will be marked as paid. + mark_as_paid: nil, # An optional memo to display on the invoice. memo: nil, # The net terms determines the due date of the invoice. Due date is calculated # based on the invoice or issuance date, depending on the account's configured due # date calculation method. A value of '0' here represents that the invoice is due # on issue, whereas a value of '30' represents that the customer has 30 days to - # pay the invoice. Do not set this field if you want to set a custom due date. + # pay the invoice. You must set either `net_terms` or `custom_due_date`, but not + # both. net_terms: nil, # If true, the new credit block will require that the corresponding invoice is # paid before it can be drawn down from. @@ -506,6 +518,7 @@ module Orb Orb::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings::InvoiceDate::Variants ), item_id: T.nilable(String), + mark_as_paid: T::Boolean, memo: T.nilable(String), net_terms: T.nilable(Integer), require_successful_payment: T::Boolean diff --git a/rbi/orb/models/invoice_create_params.rbi b/rbi/orb/models/invoice_create_params.rbi index dba8e8d75..90e9bf5cf 100644 --- a/rbi/orb/models/invoice_create_params.rbi +++ b/rbi/orb/models/invoice_create_params.rbi @@ -22,6 +22,12 @@ module Orb sig { returns(T::Array[Orb::InvoiceCreateParams::LineItem]) } attr_accessor :line_items + # Determines whether this invoice will automatically attempt to charge a saved + # payment method, if any. If not specified, the invoice inherits the customer's + # auto_collection setting. + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :auto_collection + # The id of the `Customer` to create this invoice for. One of `customer_id` and # `external_customer_id` are required. sig { returns(T.nilable(String)) } @@ -85,6 +91,7 @@ module Orb currency: String, invoice_date: Time, line_items: T::Array[Orb::InvoiceCreateParams::LineItem::OrHash], + auto_collection: T.nilable(T::Boolean), customer_id: T.nilable(String), discount: T.nilable( @@ -112,6 +119,10 @@ module Orb # set to the current time in the customer's timezone. invoice_date:, line_items:, + # Determines whether this invoice will automatically attempt to charge a saved + # payment method, if any. If not specified, the invoice inherits the customer's + # auto_collection setting. + auto_collection: nil, # The id of the `Customer` to create this invoice for. One of `customer_id` and # `external_customer_id` are required. customer_id: nil, @@ -150,6 +161,7 @@ module Orb currency: String, invoice_date: Time, line_items: T::Array[Orb::InvoiceCreateParams::LineItem], + auto_collection: T.nilable(T::Boolean), customer_id: T.nilable(String), discount: T.nilable( diff --git a/rbi/orb/models/invoice_update_params.rbi b/rbi/orb/models/invoice_update_params.rbi index 38f4c27bf..2eb4abe9a 100644 --- a/rbi/orb/models/invoice_update_params.rbi +++ b/rbi/orb/models/invoice_update_params.rbi @@ -9,6 +9,12 @@ module Orb OrHash = T.type_alias { T.any(Orb::InvoiceUpdateParams, Orb::Internal::AnyHash) } + # Determines whether this invoice will automatically attempt to charge a saved + # payment method, if any. Can only be modified on draft invoices. If not + # specified, the invoice's existing setting is unchanged. + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :auto_collection + # An optional custom due date for the invoice. If not set, the due date will be # calculated based on the `net_terms` value. sig { returns(T.nilable(Orb::InvoiceUpdateParams::DueDate::Variants)) } @@ -36,6 +42,7 @@ module Orb sig do params( + auto_collection: T.nilable(T::Boolean), due_date: T.nilable(Orb::InvoiceUpdateParams::DueDate::Variants), invoice_date: T.nilable(Orb::InvoiceUpdateParams::InvoiceDate::Variants), @@ -45,6 +52,10 @@ module Orb ).returns(T.attached_class) end def self.new( + # Determines whether this invoice will automatically attempt to charge a saved + # payment method, if any. Can only be modified on draft invoices. If not + # specified, the invoice's existing setting is unchanged. + auto_collection: nil, # An optional custom due date for the invoice. If not set, the due date will be # calculated based on the `net_terms` value. due_date: nil, @@ -67,6 +78,7 @@ module Orb sig do override.returns( { + auto_collection: T.nilable(T::Boolean), due_date: T.nilable(Orb::InvoiceUpdateParams::DueDate::Variants), invoice_date: T.nilable(Orb::InvoiceUpdateParams::InvoiceDate::Variants), diff --git a/rbi/orb/models/item.rbi b/rbi/orb/models/item.rbi index 0ca8dca13..6ea6f1f45 100644 --- a/rbi/orb/models/item.rbi +++ b/rbi/orb/models/item.rbi @@ -181,6 +181,11 @@ module Orb :numeral, Orb::Item::ExternalConnection::ExternalConnectionName::TaggedSymbol ) + STRIPE_TAX = + T.let( + :stripe_tax, + Orb::Item::ExternalConnection::ExternalConnectionName::TaggedSymbol + ) sig do override.returns( diff --git a/rbi/orb/models/item_update_params.rbi b/rbi/orb/models/item_update_params.rbi index 24227a907..355234c3c 100644 --- a/rbi/orb/models/item_update_params.rbi +++ b/rbi/orb/models/item_update_params.rbi @@ -162,6 +162,11 @@ module Orb :numeral, Orb::ItemUpdateParams::ExternalConnection::ExternalConnectionName::TaggedSymbol ) + STRIPE_TAX = + T.let( + :stripe_tax, + Orb::ItemUpdateParams::ExternalConnection::ExternalConnectionName::TaggedSymbol + ) sig do override.returns( diff --git a/rbi/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rbi b/rbi/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rbi index 4bdc53c0b..89e49109a 100644 --- a/rbi/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rbi +++ b/rbi/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rbi @@ -375,6 +375,10 @@ module Orb sig { returns(String) } attr_accessor :unit_price + # The property used to group this price + sig { returns(T.nilable(String)) } + attr_accessor :grouping_key + # If true, the unit price will be prorated to the billing period sig { returns(T.nilable(T::Boolean)) } attr_accessor :prorate @@ -392,6 +396,7 @@ module Orb Orb::NewFloatingScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor::OrHash ], unit_price: String, + grouping_key: T.nilable(String), prorate: T.nilable(T::Boolean), second_dimension: T.nilable(String) ).returns(T.attached_class) @@ -403,6 +408,8 @@ module Orb matrix_scaling_factors:, # The final unit price to rate against the output of the matrix unit_price:, + # The property used to group this price + grouping_key: nil, # If true, the unit price will be prorated to the billing period prorate: nil, # Used to determine the unit rate (optional) @@ -419,6 +426,7 @@ module Orb Orb::NewFloatingScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor ], unit_price: String, + grouping_key: T.nilable(String), prorate: T.nilable(T::Boolean), second_dimension: T.nilable(String) } diff --git a/rbi/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbi b/rbi/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbi index 0de7f6108..94d0b58a2 100644 --- a/rbi/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbi +++ b/rbi/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbi @@ -387,6 +387,10 @@ module Orb sig { returns(String) } attr_accessor :unit_price + # The property used to group this price + sig { returns(T.nilable(String)) } + attr_accessor :grouping_key + # If true, the unit price will be prorated to the billing period sig { returns(T.nilable(T::Boolean)) } attr_accessor :prorate @@ -404,6 +408,7 @@ module Orb Orb::NewPlanScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor::OrHash ], unit_price: String, + grouping_key: T.nilable(String), prorate: T.nilable(T::Boolean), second_dimension: T.nilable(String) ).returns(T.attached_class) @@ -415,6 +420,8 @@ module Orb matrix_scaling_factors:, # The final unit price to rate against the output of the matrix unit_price:, + # The property used to group this price + grouping_key: nil, # If true, the unit price will be prorated to the billing period prorate: nil, # Used to determine the unit rate (optional) @@ -431,6 +438,7 @@ module Orb Orb::NewPlanScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor ], unit_price: String, + grouping_key: T.nilable(String), prorate: T.nilable(T::Boolean), second_dimension: T.nilable(String) } diff --git a/rbi/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rbi b/rbi/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rbi index 142b5a939..b5d916bf2 100644 --- a/rbi/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rbi +++ b/rbi/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rbi @@ -387,6 +387,10 @@ module Orb sig { returns(String) } attr_accessor :unit_price + # The property used to group this price + sig { returns(T.nilable(String)) } + attr_accessor :grouping_key + # If true, the unit price will be prorated to the billing period sig { returns(T.nilable(T::Boolean)) } attr_accessor :prorate @@ -404,6 +408,7 @@ module Orb Orb::NewSubscriptionScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor::OrHash ], unit_price: String, + grouping_key: T.nilable(String), prorate: T.nilable(T::Boolean), second_dimension: T.nilable(String) ).returns(T.attached_class) @@ -415,6 +420,8 @@ module Orb matrix_scaling_factors:, # The final unit price to rate against the output of the matrix unit_price:, + # The property used to group this price + grouping_key: nil, # If true, the unit price will be prorated to the billing period prorate: nil, # Used to determine the unit rate (optional) @@ -431,6 +438,7 @@ module Orb Orb::NewSubscriptionScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor ], unit_price: String, + grouping_key: T.nilable(String), prorate: T.nilable(T::Boolean), second_dimension: T.nilable(String) } diff --git a/rbi/orb/models/price.rbi b/rbi/orb/models/price.rbi index 26e9a607c..f5a9d1c20 100644 --- a/rbi/orb/models/price.rbi +++ b/rbi/orb/models/price.rbi @@ -17378,6 +17378,10 @@ module Orb sig { returns(String) } attr_accessor :unit_price + # The property used to group this price + sig { returns(T.nilable(String)) } + attr_accessor :grouping_key + # If true, the unit price will be prorated to the billing period sig { returns(T.nilable(T::Boolean)) } attr_accessor :prorate @@ -17395,6 +17399,7 @@ module Orb Orb::Price::ScalableMatrixWithUnitPricing::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor::OrHash ], unit_price: String, + grouping_key: T.nilable(String), prorate: T.nilable(T::Boolean), second_dimension: T.nilable(String) ).returns(T.attached_class) @@ -17406,6 +17411,8 @@ module Orb matrix_scaling_factors:, # The final unit price to rate against the output of the matrix unit_price:, + # The property used to group this price + grouping_key: nil, # If true, the unit price will be prorated to the billing period prorate: nil, # Used to determine the unit rate (optional) @@ -17422,6 +17429,7 @@ module Orb Orb::Price::ScalableMatrixWithUnitPricing::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor ], unit_price: String, + grouping_key: T.nilable(String), prorate: T.nilable(T::Boolean), second_dimension: T.nilable(String) } diff --git a/rbi/orb/models/price_create_params.rbi b/rbi/orb/models/price_create_params.rbi index 24ec9eab6..4a99d81b0 100644 --- a/rbi/orb/models/price_create_params.rbi +++ b/rbi/orb/models/price_create_params.rbi @@ -2343,6 +2343,10 @@ module Orb sig { returns(String) } attr_accessor :unit_price + # The property used to group this price + sig { returns(T.nilable(String)) } + attr_accessor :grouping_key + # If true, the unit price will be prorated to the billing period sig { returns(T.nilable(T::Boolean)) } attr_accessor :prorate @@ -2360,6 +2364,7 @@ module Orb Orb::PriceCreateParams::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor::OrHash ], unit_price: String, + grouping_key: T.nilable(String), prorate: T.nilable(T::Boolean), second_dimension: T.nilable(String) ).returns(T.attached_class) @@ -2371,6 +2376,8 @@ module Orb matrix_scaling_factors:, # The final unit price to rate against the output of the matrix unit_price:, + # The property used to group this price + grouping_key: nil, # If true, the unit price will be prorated to the billing period prorate: nil, # Used to determine the unit rate (optional) @@ -2387,6 +2394,7 @@ module Orb Orb::PriceCreateParams::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor ], unit_price: String, + grouping_key: T.nilable(String), prorate: T.nilable(T::Boolean), second_dimension: T.nilable(String) } diff --git a/rbi/orb/models/price_evaluate_multiple_params.rbi b/rbi/orb/models/price_evaluate_multiple_params.rbi index 83448f3f2..74a91dd77 100644 --- a/rbi/orb/models/price_evaluate_multiple_params.rbi +++ b/rbi/orb/models/price_evaluate_multiple_params.rbi @@ -113,6 +113,11 @@ module Orb sig { params(grouping_keys: T::Array[String]).void } attr_writer :grouping_keys + # Optional overrides for parameterized billable metric parameters. If the metric + # has parameter definitions and no overrides are provided, defaults will be used. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :metric_parameter_overrides + # New floating price request body params. sig do returns( @@ -164,6 +169,7 @@ module Orb external_price_id: T.nilable(String), filter: T.nilable(String), grouping_keys: T::Array[String], + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]), price: T.nilable( T.any( @@ -214,6 +220,9 @@ module Orb # [computed properties](/extensibility/advanced-metrics#computed-properties)) used # to group the underlying billable metric grouping_keys: nil, + # Optional overrides for parameterized billable metric parameters. If the metric + # has parameter definitions and no overrides are provided, defaults will be used. + metric_parameter_overrides: nil, # New floating price request body params. price: nil, # The ID of a price to evaluate that exists in your Orb account. @@ -227,6 +236,8 @@ module Orb external_price_id: T.nilable(String), filter: T.nilable(String), grouping_keys: T::Array[String], + metric_parameter_overrides: + T.nilable(T::Hash[Symbol, T.anything]), price: T.nilable( T.any( diff --git a/rbi/orb/models/price_evaluate_params.rbi b/rbi/orb/models/price_evaluate_params.rbi index c1171289e..8f24a4b09 100644 --- a/rbi/orb/models/price_evaluate_params.rbi +++ b/rbi/orb/models/price_evaluate_params.rbi @@ -40,6 +40,11 @@ module Orb sig { params(grouping_keys: T::Array[String]).void } attr_writer :grouping_keys + # Optional overrides for parameterized billable metric parameters. If the metric + # has parameter definitions and no overrides are provided, defaults will be used. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :metric_parameter_overrides + sig do params( timeframe_end: Time, @@ -48,6 +53,7 @@ module Orb external_customer_id: T.nilable(String), filter: T.nilable(String), grouping_keys: T::Array[String], + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]), request_options: Orb::RequestOptions::OrHash ).returns(T.attached_class) end @@ -68,6 +74,9 @@ module Orb # [computed properties](/extensibility/advanced-metrics#computed-properties)) used # to group the underlying billable metric grouping_keys: nil, + # Optional overrides for parameterized billable metric parameters. If the metric + # has parameter definitions and no overrides are provided, defaults will be used. + metric_parameter_overrides: nil, request_options: {} ) end @@ -81,6 +90,7 @@ module Orb external_customer_id: T.nilable(String), filter: T.nilable(String), grouping_keys: T::Array[String], + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]), request_options: Orb::RequestOptions } ) diff --git a/rbi/orb/models/price_evaluate_preview_events_params.rbi b/rbi/orb/models/price_evaluate_preview_events_params.rbi index 393859127..d66854829 100644 --- a/rbi/orb/models/price_evaluate_preview_events_params.rbi +++ b/rbi/orb/models/price_evaluate_preview_events_params.rbi @@ -214,6 +214,11 @@ module Orb sig { params(grouping_keys: T::Array[String]).void } attr_writer :grouping_keys + # Optional overrides for parameterized billable metric parameters. If the metric + # has parameter definitions and no overrides are provided, defaults will be used. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :metric_parameter_overrides + # New floating price request body params. sig do returns( @@ -265,6 +270,7 @@ module Orb external_price_id: T.nilable(String), filter: T.nilable(String), grouping_keys: T::Array[String], + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]), price: T.nilable( T.any( @@ -315,6 +321,9 @@ module Orb # [computed properties](/extensibility/advanced-metrics#computed-properties)) used # to group the underlying billable metric grouping_keys: nil, + # Optional overrides for parameterized billable metric parameters. If the metric + # has parameter definitions and no overrides are provided, defaults will be used. + metric_parameter_overrides: nil, # New floating price request body params. price: nil, # The ID of a price to evaluate that exists in your Orb account. @@ -328,6 +337,8 @@ module Orb external_price_id: T.nilable(String), filter: T.nilable(String), grouping_keys: T::Array[String], + metric_parameter_overrides: + T.nilable(T::Hash[Symbol, T.anything]), price: T.nilable( T.any( diff --git a/rbi/orb/models/price_interval.rbi b/rbi/orb/models/price_interval.rbi index 1fc43022d..2122ad695 100644 --- a/rbi/orb/models/price_interval.rbi +++ b/rbi/orb/models/price_interval.rbi @@ -68,6 +68,11 @@ module Orb sig { returns(T.nilable(T::Array[String])) } attr_accessor :usage_customer_ids + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :metric_parameter_overrides + # The Price Interval resource represents a period of time for which a price will # bill on a subscription. A subscription’s price intervals define its billing # behavior. @@ -117,7 +122,8 @@ module Orb Orb::Price::EventOutput::OrHash ), start_date: Time, - usage_customer_ids: T.nilable(T::Array[String]) + usage_customer_ids: T.nilable(T::Array[String]), + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]) ).returns(T.attached_class) end def self.new( @@ -160,7 +166,10 @@ module Orb start_date:, # A list of customer IDs whose usage events will be aggregated and billed under # this price interval. - usage_customer_ids: + usage_customer_ids:, + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + metric_parameter_overrides: nil ) end @@ -178,7 +187,8 @@ module Orb T.nilable(T::Array[Orb::FixedFeeQuantityTransition]), price: Orb::Price::Variants, start_date: Time, - usage_customer_ids: T.nilable(T::Array[String]) + usage_customer_ids: T.nilable(T::Array[String]), + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]) } ) end diff --git a/rbi/orb/models/subscription_create_params.rbi b/rbi/orb/models/subscription_create_params.rbi index f4956f859..4c6d35e1e 100644 --- a/rbi/orb/models/subscription_create_params.rbi +++ b/rbi/orb/models/subscription_create_params.rbi @@ -569,6 +569,11 @@ module Orb sig { returns(T.nilable(String)) } attr_accessor :maximum_amount + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :metric_parameter_overrides + # [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for # this price. sig { returns(T.nilable(String)) } @@ -637,6 +642,7 @@ module Orb end_date: T.nilable(Time), external_price_id: T.nilable(String), maximum_amount: T.nilable(String), + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]), minimum_amount: T.nilable(String), plan_phase_order: T.nilable(Integer), price: @@ -694,6 +700,9 @@ module Orb # [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for # this price. maximum_amount: nil, + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + metric_parameter_overrides: nil, # [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for # this price. minimum_amount: nil, @@ -718,6 +727,8 @@ module Orb end_date: T.nilable(Time), external_price_id: T.nilable(String), maximum_amount: T.nilable(String), + metric_parameter_overrides: + T.nilable(T::Hash[Symbol, T.anything]), minimum_amount: T.nilable(String), plan_phase_order: T.nilable(Integer), price: @@ -3435,6 +3446,11 @@ module Orb sig { returns(T.nilable(String)) } attr_accessor :maximum_amount + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :metric_parameter_overrides + # [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for # the replacement price. sig { returns(T.nilable(String)) } @@ -3494,6 +3510,7 @@ module Orb external_price_id: T.nilable(String), fixed_price_quantity: T.nilable(Float), maximum_amount: T.nilable(String), + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]), minimum_amount: T.nilable(String), price: T.nilable( @@ -3549,6 +3566,9 @@ module Orb # [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for # the replacement price. maximum_amount: nil, + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + metric_parameter_overrides: nil, # [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for # the replacement price. minimum_amount: nil, @@ -3568,6 +3588,8 @@ module Orb external_price_id: T.nilable(String), fixed_price_quantity: T.nilable(Float), maximum_amount: T.nilable(String), + metric_parameter_overrides: + T.nilable(T::Hash[Symbol, T.anything]), minimum_amount: T.nilable(String), price: T.nilable( diff --git a/rbi/orb/models/subscription_price_intervals_params.rbi b/rbi/orb/models/subscription_price_intervals_params.rbi index 40d8aa2d1..5e1b2bd0f 100644 --- a/rbi/orb/models/subscription_price_intervals_params.rbi +++ b/rbi/orb/models/subscription_price_intervals_params.rbi @@ -229,6 +229,11 @@ module Orb sig { returns(T.nilable(Float)) } attr_accessor :maximum_amount + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values (number or string). + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :metric_parameter_overrides + # The minimum amount that will be billed for this price interval for a given # billing period. sig { returns(T.nilable(Float)) } @@ -315,6 +320,7 @@ module Orb ] ), maximum_amount: T.nilable(Float), + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]), minimum_amount: T.nilable(Float), price: T.nilable( @@ -383,6 +389,9 @@ module Orb # The maximum amount that will be billed for this price interval for a given # billing period. maximum_amount: nil, + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values (number or string). + metric_parameter_overrides: nil, # The minimum amount that will be billed for this price interval for a given # billing period. minimum_amount: nil, @@ -427,6 +436,8 @@ module Orb ] ), maximum_amount: T.nilable(Float), + metric_parameter_overrides: + T.nilable(T::Hash[Symbol, T.anything]), minimum_amount: T.nilable(Float), price: T.nilable( @@ -2884,6 +2895,11 @@ module Orb end attr_accessor :fixed_fee_quantity_transitions + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values (number or string). + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :metric_parameter_overrides + # The updated start date of this price interval. If not specified, the start date # will not be updated. sig do @@ -2923,6 +2939,7 @@ module Orb Orb::SubscriptionPriceIntervalsParams::Edit::FixedFeeQuantityTransition::OrHash ] ), + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]), start_date: T.any(Time, Orb::BillingCycleRelativeDate::OrSymbol), usage_customer_ids: T.nilable(T::Array[String]) ).returns(T.attached_class) @@ -2950,6 +2967,9 @@ module Orb # that this list will overwrite all existing fixed fee quantity transitions on the # price interval. fixed_fee_quantity_transitions: nil, + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values (number or string). + metric_parameter_overrides: nil, # The updated start date of this price interval. If not specified, the start date # will not be updated. start_date: nil, @@ -2978,6 +2998,8 @@ module Orb Orb::SubscriptionPriceIntervalsParams::Edit::FixedFeeQuantityTransition ] ), + metric_parameter_overrides: + T.nilable(T::Hash[Symbol, T.anything]), start_date: T.any(Time, Orb::BillingCycleRelativeDate::OrSymbol), usage_customer_ids: T.nilable(T::Array[String]) } diff --git a/rbi/orb/models/subscription_schedule_plan_change_params.rbi b/rbi/orb/models/subscription_schedule_plan_change_params.rbi index 5e61c1592..90de9c7f6 100644 --- a/rbi/orb/models/subscription_schedule_plan_change_params.rbi +++ b/rbi/orb/models/subscription_schedule_plan_change_params.rbi @@ -620,6 +620,11 @@ module Orb sig { returns(T.nilable(String)) } attr_accessor :maximum_amount + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :metric_parameter_overrides + # [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for # this price. sig { returns(T.nilable(String)) } @@ -688,6 +693,7 @@ module Orb end_date: T.nilable(Time), external_price_id: T.nilable(String), maximum_amount: T.nilable(String), + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]), minimum_amount: T.nilable(String), plan_phase_order: T.nilable(Integer), price: @@ -745,6 +751,9 @@ module Orb # [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for # this price. maximum_amount: nil, + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + metric_parameter_overrides: nil, # [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for # this price. minimum_amount: nil, @@ -769,6 +778,8 @@ module Orb end_date: T.nilable(Time), external_price_id: T.nilable(String), maximum_amount: T.nilable(String), + metric_parameter_overrides: + T.nilable(T::Hash[Symbol, T.anything]), minimum_amount: T.nilable(String), plan_phase_order: T.nilable(Integer), price: @@ -3494,6 +3505,11 @@ module Orb sig { returns(T.nilable(String)) } attr_accessor :maximum_amount + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :metric_parameter_overrides + # [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for # the replacement price. sig { returns(T.nilable(String)) } @@ -3553,6 +3569,7 @@ module Orb external_price_id: T.nilable(String), fixed_price_quantity: T.nilable(Float), maximum_amount: T.nilable(String), + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]), minimum_amount: T.nilable(String), price: T.nilable( @@ -3608,6 +3625,9 @@ module Orb # [DEPRECATED] Use add_adjustments instead. The subscription's maximum amount for # the replacement price. maximum_amount: nil, + # Override values for parameterized billable metric variables. Keys are parameter + # names, values are the override values. + metric_parameter_overrides: nil, # [DEPRECATED] Use add_adjustments instead. The subscription's minimum amount for # the replacement price. minimum_amount: nil, @@ -3627,6 +3647,8 @@ module Orb external_price_id: T.nilable(String), fixed_price_quantity: T.nilable(Float), maximum_amount: T.nilable(String), + metric_parameter_overrides: + T.nilable(T::Hash[Symbol, T.anything]), minimum_amount: T.nilable(String), price: T.nilable( diff --git a/rbi/orb/resources/alerts.rbi b/rbi/orb/resources/alerts.rbi index ba2b6abb3..b8153039b 100644 --- a/rbi/orb/resources/alerts.rbi +++ b/rbi/orb/resources/alerts.rbi @@ -2,6 +2,11 @@ module Orb module Resources + # [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, + # usage, or credit balance and trigger webhooks when a threshold is exceeded. + # + # Alerts created through the API can be scoped to either customers or + # subscriptions. class Alerts # This endpoint retrieves an alert by its ID. sig do diff --git a/rbi/orb/resources/beta.rbi b/rbi/orb/resources/beta.rbi index 3ca70860d..f7c9af3ad 100644 --- a/rbi/orb/resources/beta.rbi +++ b/rbi/orb/resources/beta.rbi @@ -2,7 +2,15 @@ module Orb module Resources + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). class Beta + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). sig { returns(Orb::Resources::Beta::ExternalPlanID) } attr_reader :external_plan_id diff --git a/rbi/orb/resources/beta/external_plan_id.rbi b/rbi/orb/resources/beta/external_plan_id.rbi index da8819701..ba1ad4099 100644 --- a/rbi/orb/resources/beta/external_plan_id.rbi +++ b/rbi/orb/resources/beta/external_plan_id.rbi @@ -3,6 +3,10 @@ module Orb module Resources class Beta + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). class ExternalPlanID # This endpoint allows the creation of a new plan version for an existing plan. sig do diff --git a/rbi/orb/resources/coupons.rbi b/rbi/orb/resources/coupons.rbi index 2bd98ce52..eb452ff88 100644 --- a/rbi/orb/resources/coupons.rbi +++ b/rbi/orb/resources/coupons.rbi @@ -2,7 +2,17 @@ module Orb module Resources + # A coupon represents a reusable discount configuration that can be applied either + # as a fixed or percentage amount to an invoice or subscription. Coupons are + # activated using a redemption code, which applies the discount to a subscription + # or invoice. The duration of a coupon determines how long it remains available + # for use by end users. class Coupons + # A coupon represents a reusable discount configuration that can be applied either + # as a fixed or percentage amount to an invoice or subscription. Coupons are + # activated using a redemption code, which applies the discount to a subscription + # or invoice. The duration of a coupon determines how long it remains available + # for use by end users. sig { returns(Orb::Resources::Coupons::Subscriptions) } attr_reader :subscriptions diff --git a/rbi/orb/resources/coupons/subscriptions.rbi b/rbi/orb/resources/coupons/subscriptions.rbi index e54836050..b44071715 100644 --- a/rbi/orb/resources/coupons/subscriptions.rbi +++ b/rbi/orb/resources/coupons/subscriptions.rbi @@ -3,6 +3,11 @@ module Orb module Resources class Coupons + # A coupon represents a reusable discount configuration that can be applied either + # as a fixed or percentage amount to an invoice or subscription. Coupons are + # activated using a redemption code, which applies the discount to a subscription + # or invoice. The duration of a coupon determines how long it remains available + # for use by end users. class Subscriptions # This endpoint returns a list of all subscriptions that have redeemed a given # coupon as a [paginated](/api-reference/pagination) list, ordered starting from diff --git a/rbi/orb/resources/credit_blocks.rbi b/rbi/orb/resources/credit_blocks.rbi index e6d1d058f..c6d46099d 100644 --- a/rbi/orb/resources/credit_blocks.rbi +++ b/rbi/orb/resources/credit_blocks.rbi @@ -2,6 +2,8 @@ module Orb module Resources + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. class CreditBlocks # This endpoint returns a credit block identified by its block_id. sig do diff --git a/rbi/orb/resources/credit_notes.rbi b/rbi/orb/resources/credit_notes.rbi index a20bf2b96..69ff2ebe1 100644 --- a/rbi/orb/resources/credit_notes.rbi +++ b/rbi/orb/resources/credit_notes.rbi @@ -2,6 +2,8 @@ module Orb module Resources + # The [Credit Note](/invoicing/credit-notes) resource represents a credit that has + # been applied to a particular invoice. class CreditNotes # This endpoint is used to create a single # [`Credit Note`](/invoicing/credit-notes). diff --git a/rbi/orb/resources/customers.rbi b/rbi/orb/resources/customers.rbi index 4105be5bd..dc75087a4 100644 --- a/rbi/orb/resources/customers.rbi +++ b/rbi/orb/resources/customers.rbi @@ -2,13 +2,69 @@ module Orb module Resources + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. class Customers + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. sig { returns(Orb::Resources::Customers::Costs) } attr_reader :costs + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. sig { returns(Orb::Resources::Customers::Credits) } attr_reader :credits + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. sig { returns(Orb::Resources::Customers::BalanceTransactions) } attr_reader :balance_transactions diff --git a/rbi/orb/resources/customers/balance_transactions.rbi b/rbi/orb/resources/customers/balance_transactions.rbi index b535aeb81..9137b1b13 100644 --- a/rbi/orb/resources/customers/balance_transactions.rbi +++ b/rbi/orb/resources/customers/balance_transactions.rbi @@ -3,6 +3,24 @@ module Orb module Resources class Customers + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. class BalanceTransactions # Creates an immutable balance transaction that updates the customer's balance and # returns back the newly created transaction. diff --git a/rbi/orb/resources/customers/costs.rbi b/rbi/orb/resources/customers/costs.rbi index 5268e33cc..3c9ce6925 100644 --- a/rbi/orb/resources/customers/costs.rbi +++ b/rbi/orb/resources/customers/costs.rbi @@ -3,6 +3,24 @@ module Orb module Resources class Customers + # A customer is a buyer of your products, and the other party to the billing + # relationship. + # + # In Orb, customers are assigned system generated identifiers automatically, but + # it's often desirable to have these match existing identifiers in your system. To + # avoid having to denormalize Orb ID information, you can pass in an + # `external_customer_id` with your own identifier. See + # [Customer ID Aliases](/events-and-metrics/customer-aliases) for further + # information about how these aliases work in Orb. + # + # In addition to having an identifier in your system, a customer may exist in a + # payment provider solution like Stripe. Use the `payment_provider_id` and the + # `payment_provider` enum field to express this mapping. + # + # A customer also has a timezone (from the standard + # [IANA timezone database](https://www.iana.org/time-zones)), which defaults to + # your account's timezone. See [Timezone localization](/essentials/timezones) for + # information on what this timezone parameter influences within Orb. class Costs # This endpoint is used to fetch a day-by-day snapshot of a customer's costs in # Orb, calculated by applying pricing information to the underlying usage (see the diff --git a/rbi/orb/resources/customers/credits.rbi b/rbi/orb/resources/customers/credits.rbi index a71e62720..e6388debc 100644 --- a/rbi/orb/resources/customers/credits.rbi +++ b/rbi/orb/resources/customers/credits.rbi @@ -3,10 +3,16 @@ module Orb module Resources class Customers + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. class Credits + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. sig { returns(Orb::Resources::Customers::Credits::Ledger) } attr_reader :ledger + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. sig { returns(Orb::Resources::Customers::Credits::TopUps) } attr_reader :top_ups diff --git a/rbi/orb/resources/customers/credits/ledger.rbi b/rbi/orb/resources/customers/credits/ledger.rbi index 519b90318..ddb714af4 100644 --- a/rbi/orb/resources/customers/credits/ledger.rbi +++ b/rbi/orb/resources/customers/credits/ledger.rbi @@ -4,6 +4,8 @@ module Orb module Resources class Customers class Credits + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. class Ledger # The credits ledger provides _auditing_ functionality over Orb's credits system # with a list of actions that have taken place to modify a customer's credit @@ -180,8 +182,12 @@ module Orb # also generate a one-off invoice for the customer for the credits pre-purchase. # Note that you _must_ provide the `per_unit_cost_basis`, since the total charges # on the invoice are calculated by multiplying the cost basis with the number of - # credit units added. Additionally, Orb also enforces invoice generation when a - # non-zero `per_unit_cost_basis` value is provided. + # credit units added. + # + # - if `per_unit_cost_basis` is greater than zero, an invoice will be generated + # and `invoice_settings` must be included + # - if `invoice_settings` is passed, one of either `custom_due_date` or + # `net_terms` is required to determine the due date # # ## Deducting Credits # @@ -369,8 +375,12 @@ module Orb # also generate a one-off invoice for the customer for the credits pre-purchase. # Note that you _must_ provide the `per_unit_cost_basis`, since the total charges # on the invoice are calculated by multiplying the cost basis with the number of - # credit units added. Additionally, Orb also enforces invoice generation when a - # non-zero `per_unit_cost_basis` value is provided. + # credit units added. + # + # - if `per_unit_cost_basis` is greater than zero, an invoice will be generated + # and `invoice_settings` must be included + # - if `invoice_settings` is passed, one of either `custom_due_date` or + # `net_terms` is required to determine the due date # # ## Deducting Credits # diff --git a/rbi/orb/resources/customers/credits/top_ups.rbi b/rbi/orb/resources/customers/credits/top_ups.rbi index ddbd5c1a4..81997577b 100644 --- a/rbi/orb/resources/customers/credits/top_ups.rbi +++ b/rbi/orb/resources/customers/credits/top_ups.rbi @@ -4,6 +4,8 @@ module Orb module Resources class Customers class Credits + # The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid + # credits within Orb. class TopUps # This endpoint allows you to create a new top-up for a specified customer's # balance. While this top-up is active, the customer's balance will added in diff --git a/rbi/orb/resources/events.rbi b/rbi/orb/resources/events.rbi index fb52ef2bf..8e93b1cd8 100644 --- a/rbi/orb/resources/events.rbi +++ b/rbi/orb/resources/events.rbi @@ -2,10 +2,19 @@ module Orb module Resources + # The [Event](/core-concepts#event) resource represents a usage event that has + # been created for a customer. Events are the core of Orb's usage-based billing + # model, and are used to calculate the usage charges for a given billing period. class Events + # The [Event](/core-concepts#event) resource represents a usage event that has + # been created for a customer. Events are the core of Orb's usage-based billing + # model, and are used to calculate the usage charges for a given billing period. sig { returns(Orb::Resources::Events::Backfills) } attr_reader :backfills + # The [Event](/core-concepts#event) resource represents a usage event that has + # been created for a customer. Events are the core of Orb's usage-based billing + # model, and are used to calculate the usage charges for a given billing period. sig { returns(Orb::Resources::Events::Volume) } attr_reader :volume diff --git a/rbi/orb/resources/events/backfills.rbi b/rbi/orb/resources/events/backfills.rbi index 8b2dbaf73..c9cbf1351 100644 --- a/rbi/orb/resources/events/backfills.rbi +++ b/rbi/orb/resources/events/backfills.rbi @@ -3,6 +3,9 @@ module Orb module Resources class Events + # The [Event](/core-concepts#event) resource represents a usage event that has + # been created for a customer. Events are the core of Orb's usage-based billing + # model, and are used to calculate the usage charges for a given billing period. class Backfills # Creating the backfill enables adding or replacing past events, even those that # are older than the ingestion grace period. Performing a backfill in Orb involves diff --git a/rbi/orb/resources/events/volume.rbi b/rbi/orb/resources/events/volume.rbi index 0d2e9c0b9..0b4716cfd 100644 --- a/rbi/orb/resources/events/volume.rbi +++ b/rbi/orb/resources/events/volume.rbi @@ -3,6 +3,9 @@ module Orb module Resources class Events + # The [Event](/core-concepts#event) resource represents a usage event that has + # been created for a customer. Events are the core of Orb's usage-based billing + # model, and are used to calculate the usage charges for a given billing period. class Volume # This endpoint returns the event volume for an account in a # [paginated list format](/api-reference/pagination). diff --git a/rbi/orb/resources/invoice_line_items.rbi b/rbi/orb/resources/invoice_line_items.rbi index c1426145f..efe3c14e4 100644 --- a/rbi/orb/resources/invoice_line_items.rbi +++ b/rbi/orb/resources/invoice_line_items.rbi @@ -2,6 +2,11 @@ module Orb module Resources + # An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, + # representing the request for payment for a single subscription. This includes a + # set of line items, which correspond to prices in the subscription's plan and can + # represent fixed recurring fees or usage-based fees. They are generated at the + # end of a billing period, or as the result of an action, such as a cancellation. class InvoiceLineItems # This creates a one-off fixed fee invoice line item on an Invoice. This can only # be done for invoices that are in a `draft` status. diff --git a/rbi/orb/resources/invoices.rbi b/rbi/orb/resources/invoices.rbi index fa2d0df3f..f950ec25a 100644 --- a/rbi/orb/resources/invoices.rbi +++ b/rbi/orb/resources/invoices.rbi @@ -2,6 +2,11 @@ module Orb module Resources + # An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, + # representing the request for payment for a single subscription. This includes a + # set of line items, which correspond to prices in the subscription's plan and can + # represent fixed recurring fees or usage-based fees. They are generated at the + # end of a billing period, or as the result of an action, such as a cancellation. class Invoices # This endpoint is used to create a one-off invoice for a customer. sig do @@ -9,6 +14,7 @@ module Orb currency: String, invoice_date: Time, line_items: T::Array[Orb::InvoiceCreateParams::LineItem::OrHash], + auto_collection: T.nilable(T::Boolean), customer_id: T.nilable(String), discount: T.nilable( @@ -36,6 +42,10 @@ module Orb # set to the current time in the customer's timezone. invoice_date:, line_items:, + # Determines whether this invoice will automatically attempt to charge a saved + # payment method, if any. If not specified, the invoice inherits the customer's + # auto_collection setting. + auto_collection: nil, # The id of the `Customer` to create this invoice for. One of `customer_id` and # `external_customer_id` are required. customer_id: nil, @@ -68,16 +78,18 @@ module Orb ) end - # This endpoint allows you to update the `metadata`, `net_terms`, `due_date`, and - # `invoice_date` properties on an invoice. If you pass null for the metadata - # value, it will clear any existing metadata for that invoice. + # This endpoint allows you to update the `metadata`, `net_terms`, `due_date`, + # `invoice_date`, and `auto_collection` properties on an invoice. If you pass null + # for the metadata value, it will clear any existing metadata for that invoice. # # `metadata` can be modified regardless of invoice state. `net_terms`, `due_date`, - # and `invoice_date` can only be modified if the invoice is in a `draft` state. - # `invoice_date` can only be modified for non-subscription invoices. + # `invoice_date`, and `auto_collection` can only be modified if the invoice is in + # a `draft` state. `invoice_date` can only be modified for non-subscription + # invoices. sig do params( invoice_id: String, + auto_collection: T.nilable(T::Boolean), due_date: T.nilable(Orb::InvoiceUpdateParams::DueDate::Variants), invoice_date: T.nilable(Orb::InvoiceUpdateParams::InvoiceDate::Variants), @@ -88,6 +100,10 @@ module Orb end def update( invoice_id, + # Determines whether this invoice will automatically attempt to charge a saved + # payment method, if any. Can only be modified on draft invoices. If not + # specified, the invoice's existing setting is unchanged. + auto_collection: nil, # An optional custom due date for the invoice. If not set, the due date will be # calculated based on the `net_terms` value. due_date: nil, diff --git a/rbi/orb/resources/items.rbi b/rbi/orb/resources/items.rbi index 7bba05c0e..263e6778d 100644 --- a/rbi/orb/resources/items.rbi +++ b/rbi/orb/resources/items.rbi @@ -2,6 +2,9 @@ module Orb module Resources + # The Item resource represents a sellable product or good. Items are associated + # with all line items, billable metrics, and prices and are used for defining + # external sync behavior for invoices and tax calculation purposes. class Items # This endpoint is used to create an [Item](/core-concepts#item). sig do diff --git a/rbi/orb/resources/license_types.rbi b/rbi/orb/resources/license_types.rbi index f15f27f23..b47531765 100644 --- a/rbi/orb/resources/license_types.rbi +++ b/rbi/orb/resources/license_types.rbi @@ -2,6 +2,9 @@ module Orb module Resources + # The LicenseType resource represents a type of license that can be assigned to + # users. License types are used during billing by grouping metrics on the + # configured grouping key. class LicenseTypes # This endpoint is used to create a new license type. # diff --git a/rbi/orb/resources/metrics.rbi b/rbi/orb/resources/metrics.rbi index cf1a608c0..1a14d0df1 100644 --- a/rbi/orb/resources/metrics.rbi +++ b/rbi/orb/resources/metrics.rbi @@ -2,6 +2,9 @@ module Orb module Resources + # The Metric resource represents a calculation of a quantity based on events. + # Metrics are defined by the query that transforms raw usage events into + # meaningful values for your customers. class Metrics # This endpoint is used to create a [metric](/core-concepts###metric) using a SQL # string. See [SQL support](/extensibility/advanced-metrics#sql-support) for a diff --git a/rbi/orb/resources/plans.rbi b/rbi/orb/resources/plans.rbi index 88e040c04..ff6c8155a 100644 --- a/rbi/orb/resources/plans.rbi +++ b/rbi/orb/resources/plans.rbi @@ -2,10 +2,22 @@ module Orb module Resources + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). class Plans + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). sig { returns(Orb::Resources::Plans::ExternalPlanID) } attr_reader :external_plan_id + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). sig { returns(Orb::Resources::Plans::Migrations) } attr_reader :migrations diff --git a/rbi/orb/resources/plans/external_plan_id.rbi b/rbi/orb/resources/plans/external_plan_id.rbi index 8737c304e..98ba3f09e 100644 --- a/rbi/orb/resources/plans/external_plan_id.rbi +++ b/rbi/orb/resources/plans/external_plan_id.rbi @@ -3,6 +3,10 @@ module Orb module Resources class Plans + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). class ExternalPlanID # This endpoint can be used to update the `external_plan_id`, and `metadata` of an # existing plan. diff --git a/rbi/orb/resources/plans/migrations.rbi b/rbi/orb/resources/plans/migrations.rbi index 836a432e0..0d3165214 100644 --- a/rbi/orb/resources/plans/migrations.rbi +++ b/rbi/orb/resources/plans/migrations.rbi @@ -3,6 +3,10 @@ module Orb module Resources class Plans + # The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be + # subscribed to by a customer. Plans define the billing behavior of the + # subscription. You can see more about how to configure prices in the + # [Price resource](/reference/price). class Migrations # Fetch migration sig do diff --git a/rbi/orb/resources/prices.rbi b/rbi/orb/resources/prices.rbi index 671f73eb9..77805d105 100644 --- a/rbi/orb/resources/prices.rbi +++ b/rbi/orb/resources/prices.rbi @@ -2,7 +2,27 @@ module Orb module Resources + # The Price resource represents a price that can be billed on a subscription, + # resulting in a charge on an invoice in the form of an invoice line item. Prices + # take a quantity and determine an amount to bill. + # + # Orb supports a few different pricing models out of the box. Each of these models + # is serialized differently in a given Price object. The model_type field + # determines the key for the configuration object that is present. + # + # For more on the types of prices, see + # [the core concepts documentation](/core-concepts#plan-and-price) class Prices + # The Price resource represents a price that can be billed on a subscription, + # resulting in a charge on an invoice in the form of an invoice line item. Prices + # take a quantity and determine an amount to bill. + # + # Orb supports a few different pricing models out of the box. Each of these models + # is serialized differently in a given Price object. The model_type field + # determines the key for the configuration object that is present. + # + # For more on the types of prices, see + # [the core concepts documentation](/core-concepts#plan-and-price) sig { returns(Orb::Resources::Prices::ExternalPriceID) } attr_reader :external_price_id @@ -284,6 +304,7 @@ module Orb external_customer_id: T.nilable(String), filter: T.nilable(String), grouping_keys: T::Array[String], + metric_parameter_overrides: T.nilable(T::Hash[Symbol, T.anything]), request_options: Orb::RequestOptions::OrHash ).returns(Orb::Models::PriceEvaluateResponse) end @@ -305,6 +326,9 @@ module Orb # [computed properties](/extensibility/advanced-metrics#computed-properties)) used # to group the underlying billable metric grouping_keys: nil, + # Optional overrides for parameterized billable metric parameters. If the metric + # has parameter definitions and no overrides are provided, defaults will be used. + metric_parameter_overrides: nil, request_options: {} ) end diff --git a/rbi/orb/resources/prices/external_price_id.rbi b/rbi/orb/resources/prices/external_price_id.rbi index 7135afcd9..37773062e 100644 --- a/rbi/orb/resources/prices/external_price_id.rbi +++ b/rbi/orb/resources/prices/external_price_id.rbi @@ -3,6 +3,16 @@ module Orb module Resources class Prices + # The Price resource represents a price that can be billed on a subscription, + # resulting in a charge on an invoice in the form of an invoice line item. Prices + # take a quantity and determine an amount to bill. + # + # Orb supports a few different pricing models out of the box. Each of these models + # is serialized differently in a given Price object. The model_type field + # determines the key for the configuration object that is present. + # + # For more on the types of prices, see + # [the core concepts documentation](/core-concepts#plan-and-price) class ExternalPriceID # This endpoint allows you to update the `metadata` property on a price. If you # pass null for the metadata value, it will clear any existing metadata for that diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh new file mode 100755 index 000000000..f25bc68e5 --- /dev/null +++ b/scripts/utils/upload-artifact.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# ANSI Color Codes +GREEN='\033[32m' +RED='\033[31m' +NC='\033[0m' # No Color + +DIST_DIR="dist" + +log_error() { + local msg="$1" + local headers="$2" + local body="$3" + echo -e "${RED}${msg}${NC}" + [[ -f "$headers" ]] && echo -e "${RED}Headers:$(cat "$headers")${NC}" + echo -e "${RED}Body: ${body}${NC}" + exit 1 +} + +upload_file() { + local file_name="$1" + local tmp_headers + tmp_headers=$(mktemp) + + if [ -f "$file_name" ]; then + echo -e "${GREEN}Processing file: $file_name${NC}" + pkg_file_name="${file_name#"${DIST_DIR}/"}" + + # Get signed URL for uploading artifact file + signed_url_response=$(curl -X POST -G "$URL" \ + -sS --retry 5 \ + -D "$tmp_headers" \ + --data-urlencode "filename=$pkg_file_name" \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json") + + # Validate JSON and extract URL + if ! signed_url=$(echo "$signed_url_response" | jq -e -r '.url' 2>/dev/null) || [[ "$signed_url" == "null" ]]; then + log_error "Failed to get valid signed URL" "$tmp_headers" "$signed_url_response" + fi + + # Set content-type based on file extension + local extension="${file_name##*.}" + local content_type + case "$extension" in + gem) content_type="application/octet-stream" ;; + gz) content_type="application/gzip" ;; + rz) content_type="application/octet-stream" ;; + html) content_type="text/html" ;; + *) content_type="application/octet-stream" ;; + esac + + # Upload file + upload_response=$(curl -v -X PUT \ + --retry 5 \ + --retry-all-errors \ + -D "$tmp_headers" \ + -H "Content-Type: $content_type" \ + --data-binary "@${file_name}" "$signed_url" 2>&1) + + if ! echo "$upload_response" | grep -q "HTTP/[0-9.]* 200"; then + log_error "Failed to upload artifact file" "$tmp_headers" "$upload_response" + fi + + # Insert small throttle to reduce rate limiting risk + sleep 0.1 + fi +} + +walk_tree() { + local current_dir="$1" + + for entry in "$current_dir"/*; do + # Check that entry is valid + [ -e "$entry" ] || [ -h "$entry" ] || continue + + if [ -d "$entry" ]; then + walk_tree "$entry" + else + upload_file "$entry" + fi + done +} + +cd "$(dirname "$0")/../.." + +echo "::group::Building gem" +VERSION_FILE="lib/${PACKAGE_NAME}/version.rb" +if [[ ! -f "$VERSION_FILE" ]]; then + echo -e "${RED}Version file not found: ${VERSION_FILE}${NC}" + exit 1 +fi +SHORT_SHA="${SHA:0:7}" +sed -i.bak -E "s/(VERSION = \"[^\"]+)\"/\1.beta.${SHORT_SHA}\"/" "$VERSION_FILE" +rm -f "${VERSION_FILE}.bak" + +gem build +mkdir -p "${DIST_DIR}/gems" +mv ./*.gem "${DIST_DIR}/gems/" +echo "::endgroup::" + +echo "::group::Generating gem index" +gem generate_index --directory "$DIST_DIR" +echo "::endgroup::" + +echo "::group::Uploading to pkg.stainless.com" +walk_tree "$DIST_DIR" +echo "::endgroup::" + +echo -e "${GREEN}Gem artifacts uploaded to Stainless storage.${NC}" +echo -e "\033[32mInstallation: bundle remove orb-billing && bundle add orb-billing --source 'https://pkg.stainless.com/s/orb-ruby/$SHA'\033[0m" diff --git a/sig/orb/internal/util.rbs b/sig/orb/internal/util.rbs index 09925b823..9b87dbb2e 100644 --- a/sig/orb/internal/util.rbs +++ b/sig/orb/internal/util.rbs @@ -106,6 +106,16 @@ module Orb JSON_CONTENT: Regexp JSONL_CONTENT: Regexp + def encode_query_params: ( + ::Hash[Symbol, top] query + ) -> ::Hash[Symbol, top] + + private def write_query_param_element!: ( + ::Hash[Symbol, top] collection, + String key, + top element + ) -> nil + def self?.write_multipart_content: ( Enumerator::Yielder y, val: top, diff --git a/sig/orb/models/billable_metric.rbs b/sig/orb/models/billable_metric.rbs index 80598c896..e20e2d987 100644 --- a/sig/orb/models/billable_metric.rbs +++ b/sig/orb/models/billable_metric.rbs @@ -7,7 +7,8 @@ module Orb item: Orb::Item, metadata: ::Hash[Symbol, String], name: String, - status: Orb::Models::BillableMetric::status + status: Orb::Models::BillableMetric::status, + parameter_definitions: ::Array[::Hash[Symbol, top]]? } class BillableMetric < Orb::Internal::Type::BaseModel @@ -23,13 +24,16 @@ module Orb attr_accessor status: Orb::Models::BillableMetric::status + attr_accessor parameter_definitions: ::Array[::Hash[Symbol, top]]? + def initialize: ( id: String, description: String?, item: Orb::Item, metadata: ::Hash[Symbol, String], name: String, - status: Orb::Models::BillableMetric::status + status: Orb::Models::BillableMetric::status, + ?parameter_definitions: ::Array[::Hash[Symbol, top]]? ) -> void def to_hash: -> { @@ -38,7 +42,8 @@ module Orb item: Orb::Item, metadata: ::Hash[Symbol, String], name: String, - status: Orb::Models::BillableMetric::status + status: Orb::Models::BillableMetric::status, + parameter_definitions: ::Array[::Hash[Symbol, top]]? } type status = :active | :draft | :archived diff --git a/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbs b/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbs index 43e460865..5916eb527 100644 --- a/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbs +++ b/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbs @@ -148,6 +148,7 @@ module Orb custom_due_date: Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings::custom_due_date?, invoice_date: Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings::invoice_date?, item_id: String?, + mark_as_paid: bool, memo: String?, net_terms: Integer?, require_successful_payment: bool @@ -162,6 +163,10 @@ module Orb attr_accessor item_id: String? + attr_reader mark_as_paid: bool? + + def mark_as_paid=: (bool) -> bool + attr_accessor memo: String? attr_accessor net_terms: Integer? @@ -175,6 +180,7 @@ module Orb ?custom_due_date: Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings::custom_due_date?, ?invoice_date: Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings::invoice_date?, ?item_id: String?, + ?mark_as_paid: bool, ?memo: String?, ?net_terms: Integer?, ?require_successful_payment: bool @@ -185,6 +191,7 @@ module Orb custom_due_date: Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings::custom_due_date?, invoice_date: Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings::invoice_date?, item_id: String?, + mark_as_paid: bool, memo: String?, net_terms: Integer?, require_successful_payment: bool diff --git a/sig/orb/models/customers/credits/ledger_create_entry_params.rbs b/sig/orb/models/customers/credits/ledger_create_entry_params.rbs index 264acd7f4..e203d537f 100644 --- a/sig/orb/models/customers/credits/ledger_create_entry_params.rbs +++ b/sig/orb/models/customers/credits/ledger_create_entry_params.rbs @@ -148,6 +148,7 @@ module Orb custom_due_date: Orb::Models::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings::custom_due_date?, invoice_date: Orb::Models::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings::invoice_date?, item_id: String?, + mark_as_paid: bool, memo: String?, net_terms: Integer?, require_successful_payment: bool @@ -162,6 +163,10 @@ module Orb attr_accessor item_id: String? + attr_reader mark_as_paid: bool? + + def mark_as_paid=: (bool) -> bool + attr_accessor memo: String? attr_accessor net_terms: Integer? @@ -175,6 +180,7 @@ module Orb ?custom_due_date: Orb::Models::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings::custom_due_date?, ?invoice_date: Orb::Models::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings::invoice_date?, ?item_id: String?, + ?mark_as_paid: bool, ?memo: String?, ?net_terms: Integer?, ?require_successful_payment: bool @@ -185,6 +191,7 @@ module Orb custom_due_date: Orb::Models::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings::custom_due_date?, invoice_date: Orb::Models::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings::invoice_date?, item_id: String?, + mark_as_paid: bool, memo: String?, net_terms: Integer?, require_successful_payment: bool diff --git a/sig/orb/models/invoice_create_params.rbs b/sig/orb/models/invoice_create_params.rbs index 409087812..e27622440 100644 --- a/sig/orb/models/invoice_create_params.rbs +++ b/sig/orb/models/invoice_create_params.rbs @@ -5,6 +5,7 @@ module Orb currency: String, invoice_date: Time, line_items: ::Array[Orb::InvoiceCreateParams::LineItem], + auto_collection: bool?, customer_id: String?, discount: Orb::Models::discount?, due_date: Orb::Models::InvoiceCreateParams::due_date?, @@ -26,6 +27,8 @@ module Orb attr_accessor line_items: ::Array[Orb::InvoiceCreateParams::LineItem] + attr_accessor auto_collection: bool? + attr_accessor customer_id: String? attr_accessor discount: Orb::Models::discount? @@ -48,6 +51,7 @@ module Orb currency: String, invoice_date: Time, line_items: ::Array[Orb::InvoiceCreateParams::LineItem], + ?auto_collection: bool?, ?customer_id: String?, ?discount: Orb::Models::discount?, ?due_date: Orb::Models::InvoiceCreateParams::due_date?, @@ -63,6 +67,7 @@ module Orb currency: String, invoice_date: Time, line_items: ::Array[Orb::InvoiceCreateParams::LineItem], + auto_collection: bool?, customer_id: String?, discount: Orb::Models::discount?, due_date: Orb::Models::InvoiceCreateParams::due_date?, diff --git a/sig/orb/models/invoice_update_params.rbs b/sig/orb/models/invoice_update_params.rbs index a53b3ff17..1297a408a 100644 --- a/sig/orb/models/invoice_update_params.rbs +++ b/sig/orb/models/invoice_update_params.rbs @@ -2,6 +2,7 @@ module Orb module Models type invoice_update_params = { + auto_collection: bool?, due_date: Orb::Models::InvoiceUpdateParams::due_date?, invoice_date: Orb::Models::InvoiceUpdateParams::invoice_date?, metadata: ::Hash[Symbol, String?]?, @@ -13,6 +14,8 @@ module Orb extend Orb::Internal::Type::RequestParameters::Converter include Orb::Internal::Type::RequestParameters + attr_accessor auto_collection: bool? + attr_accessor due_date: Orb::Models::InvoiceUpdateParams::due_date? attr_accessor invoice_date: Orb::Models::InvoiceUpdateParams::invoice_date? @@ -22,6 +25,7 @@ module Orb attr_accessor net_terms: Integer? def initialize: ( + ?auto_collection: bool?, ?due_date: Orb::Models::InvoiceUpdateParams::due_date?, ?invoice_date: Orb::Models::InvoiceUpdateParams::invoice_date?, ?metadata: ::Hash[Symbol, String?]?, @@ -30,6 +34,7 @@ module Orb ) -> void def to_hash: -> { + auto_collection: bool?, due_date: Orb::Models::InvoiceUpdateParams::due_date?, invoice_date: Orb::Models::InvoiceUpdateParams::invoice_date?, metadata: ::Hash[Symbol, String?]?, diff --git a/sig/orb/models/item.rbs b/sig/orb/models/item.rbs index 5e548ea89..93734d488 100644 --- a/sig/orb/models/item.rbs +++ b/sig/orb/models/item.rbs @@ -71,6 +71,7 @@ module Orb | :avalara | :anrok | :numeral + | :stripe_tax module ExternalConnectionName extend Orb::Internal::Type::Enum @@ -83,6 +84,7 @@ module Orb AVALARA: :avalara ANROK: :anrok NUMERAL: :numeral + STRIPE_TAX: :stripe_tax def self?.values: -> ::Array[Orb::Models::Item::ExternalConnection::external_connection_name] end diff --git a/sig/orb/models/item_update_params.rbs b/sig/orb/models/item_update_params.rbs index 036dddb5f..34d01cbfa 100644 --- a/sig/orb/models/item_update_params.rbs +++ b/sig/orb/models/item_update_params.rbs @@ -62,6 +62,7 @@ module Orb | :avalara | :anrok | :numeral + | :stripe_tax module ExternalConnectionName extend Orb::Internal::Type::Enum @@ -74,6 +75,7 @@ module Orb AVALARA: :avalara ANROK: :anrok NUMERAL: :numeral + STRIPE_TAX: :stripe_tax def self?.values: -> ::Array[Orb::Models::ItemUpdateParams::ExternalConnection::external_connection_name] end diff --git a/sig/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rbs b/sig/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rbs index 80aa20e0f..0983db12b 100644 --- a/sig/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rbs +++ b/sig/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rbs @@ -132,6 +132,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::NewFloatingScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + grouping_key: String?, prorate: bool?, second_dimension: String? } @@ -143,6 +144,8 @@ module Orb attr_accessor unit_price: String + attr_accessor grouping_key: String? + attr_accessor prorate: bool? attr_accessor second_dimension: String? @@ -151,6 +154,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::NewFloatingScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + ?grouping_key: String?, ?prorate: bool?, ?second_dimension: String? ) -> void @@ -159,6 +163,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::NewFloatingScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + grouping_key: String?, prorate: bool?, second_dimension: String? } diff --git a/sig/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbs b/sig/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbs index 71b6950ee..3ac499582 100644 --- a/sig/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbs +++ b/sig/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbs @@ -137,6 +137,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::NewPlanScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + grouping_key: String?, prorate: bool?, second_dimension: String? } @@ -148,6 +149,8 @@ module Orb attr_accessor unit_price: String + attr_accessor grouping_key: String? + attr_accessor prorate: bool? attr_accessor second_dimension: String? @@ -156,6 +159,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::NewPlanScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + ?grouping_key: String?, ?prorate: bool?, ?second_dimension: String? ) -> void @@ -164,6 +168,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::NewPlanScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + grouping_key: String?, prorate: bool?, second_dimension: String? } diff --git a/sig/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rbs b/sig/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rbs index 6db9de554..f4ffc6a81 100644 --- a/sig/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rbs +++ b/sig/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rbs @@ -137,6 +137,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::NewSubscriptionScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + grouping_key: String?, prorate: bool?, second_dimension: String? } @@ -148,6 +149,8 @@ module Orb attr_accessor unit_price: String + attr_accessor grouping_key: String? + attr_accessor prorate: bool? attr_accessor second_dimension: String? @@ -156,6 +159,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::NewSubscriptionScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + ?grouping_key: String?, ?prorate: bool?, ?second_dimension: String? ) -> void @@ -164,6 +168,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::NewSubscriptionScalableMatrixWithUnitPricingPrice::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + grouping_key: String?, prorate: bool?, second_dimension: String? } diff --git a/sig/orb/models/price.rbs b/sig/orb/models/price.rbs index a656dcfb0..5e2c24f03 100644 --- a/sig/orb/models/price.rbs +++ b/sig/orb/models/price.rbs @@ -7352,6 +7352,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::Price::ScalableMatrixWithUnitPricing::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + grouping_key: String?, prorate: bool?, second_dimension: String? } @@ -7363,6 +7364,8 @@ module Orb attr_accessor unit_price: String + attr_accessor grouping_key: String? + attr_accessor prorate: bool? attr_accessor second_dimension: String? @@ -7371,6 +7374,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::Price::ScalableMatrixWithUnitPricing::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + ?grouping_key: String?, ?prorate: bool?, ?second_dimension: String? ) -> void @@ -7379,6 +7383,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::Price::ScalableMatrixWithUnitPricing::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + grouping_key: String?, prorate: bool?, second_dimension: String? } diff --git a/sig/orb/models/price_create_params.rbs b/sig/orb/models/price_create_params.rbs index d3f62871c..91b594a56 100644 --- a/sig/orb/models/price_create_params.rbs +++ b/sig/orb/models/price_create_params.rbs @@ -927,6 +927,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::PriceCreateParams::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + grouping_key: String?, prorate: bool?, second_dimension: String? } @@ -938,6 +939,8 @@ module Orb attr_accessor unit_price: String + attr_accessor grouping_key: String? + attr_accessor prorate: bool? attr_accessor second_dimension: String? @@ -946,6 +949,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::PriceCreateParams::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + ?grouping_key: String?, ?prorate: bool?, ?second_dimension: String? ) -> void @@ -954,6 +958,7 @@ module Orb first_dimension: String, matrix_scaling_factors: ::Array[Orb::PriceCreateParams::ScalableMatrixWithUnitPricingConfig::MatrixScalingFactor], unit_price: String, + grouping_key: String?, prorate: bool?, second_dimension: String? } diff --git a/sig/orb/models/price_evaluate_multiple_params.rbs b/sig/orb/models/price_evaluate_multiple_params.rbs index cbe037760..61cbdc7df 100644 --- a/sig/orb/models/price_evaluate_multiple_params.rbs +++ b/sig/orb/models/price_evaluate_multiple_params.rbs @@ -51,6 +51,7 @@ module Orb external_price_id: String?, filter: String?, grouping_keys: ::Array[String], + metric_parameter_overrides: ::Hash[Symbol, top]?, price: Orb::Models::PriceEvaluateMultipleParams::PriceEvaluation::price?, price_id: String? } @@ -64,6 +65,8 @@ module Orb def grouping_keys=: (::Array[String]) -> ::Array[String] + attr_accessor metric_parameter_overrides: ::Hash[Symbol, top]? + attr_accessor price: Orb::Models::PriceEvaluateMultipleParams::PriceEvaluation::price? attr_accessor price_id: String? @@ -72,6 +75,7 @@ module Orb ?external_price_id: String?, ?filter: String?, ?grouping_keys: ::Array[String], + ?metric_parameter_overrides: ::Hash[Symbol, top]?, ?price: Orb::Models::PriceEvaluateMultipleParams::PriceEvaluation::price?, ?price_id: String? ) -> void @@ -80,6 +84,7 @@ module Orb external_price_id: String?, filter: String?, grouping_keys: ::Array[String], + metric_parameter_overrides: ::Hash[Symbol, top]?, price: Orb::Models::PriceEvaluateMultipleParams::PriceEvaluation::price?, price_id: String? } diff --git a/sig/orb/models/price_evaluate_params.rbs b/sig/orb/models/price_evaluate_params.rbs index 94541df6e..b87c4819a 100644 --- a/sig/orb/models/price_evaluate_params.rbs +++ b/sig/orb/models/price_evaluate_params.rbs @@ -7,7 +7,8 @@ module Orb customer_id: String?, external_customer_id: String?, filter: String?, - grouping_keys: ::Array[String] + grouping_keys: ::Array[String], + metric_parameter_overrides: ::Hash[Symbol, top]? } & Orb::Internal::Type::request_parameters @@ -29,6 +30,8 @@ module Orb def grouping_keys=: (::Array[String]) -> ::Array[String] + attr_accessor metric_parameter_overrides: ::Hash[Symbol, top]? + def initialize: ( timeframe_end: Time, timeframe_start: Time, @@ -36,6 +39,7 @@ module Orb ?external_customer_id: String?, ?filter: String?, ?grouping_keys: ::Array[String], + ?metric_parameter_overrides: ::Hash[Symbol, top]?, ?request_options: Orb::request_opts ) -> void @@ -46,6 +50,7 @@ module Orb external_customer_id: String?, filter: String?, grouping_keys: ::Array[String], + metric_parameter_overrides: ::Hash[Symbol, top]?, request_options: Orb::RequestOptions } end diff --git a/sig/orb/models/price_evaluate_preview_events_params.rbs b/sig/orb/models/price_evaluate_preview_events_params.rbs index fbccbb140..b59ef66f5 100644 --- a/sig/orb/models/price_evaluate_preview_events_params.rbs +++ b/sig/orb/models/price_evaluate_preview_events_params.rbs @@ -97,6 +97,7 @@ module Orb external_price_id: String?, filter: String?, grouping_keys: ::Array[String], + metric_parameter_overrides: ::Hash[Symbol, top]?, price: Orb::Models::PriceEvaluatePreviewEventsParams::PriceEvaluation::price?, price_id: String? } @@ -110,6 +111,8 @@ module Orb def grouping_keys=: (::Array[String]) -> ::Array[String] + attr_accessor metric_parameter_overrides: ::Hash[Symbol, top]? + attr_accessor price: Orb::Models::PriceEvaluatePreviewEventsParams::PriceEvaluation::price? attr_accessor price_id: String? @@ -118,6 +121,7 @@ module Orb ?external_price_id: String?, ?filter: String?, ?grouping_keys: ::Array[String], + ?metric_parameter_overrides: ::Hash[Symbol, top]?, ?price: Orb::Models::PriceEvaluatePreviewEventsParams::PriceEvaluation::price?, ?price_id: String? ) -> void @@ -126,6 +130,7 @@ module Orb external_price_id: String?, filter: String?, grouping_keys: ::Array[String], + metric_parameter_overrides: ::Hash[Symbol, top]?, price: Orb::Models::PriceEvaluatePreviewEventsParams::PriceEvaluation::price?, price_id: String? } diff --git a/sig/orb/models/price_interval.rbs b/sig/orb/models/price_interval.rbs index 0fa4acf89..f9225a2e4 100644 --- a/sig/orb/models/price_interval.rbs +++ b/sig/orb/models/price_interval.rbs @@ -12,7 +12,8 @@ module Orb fixed_fee_quantity_transitions: ::Array[Orb::FixedFeeQuantityTransition]?, price: Orb::Models::price, start_date: Time, - usage_customer_ids: ::Array[String]? + usage_customer_ids: ::Array[String]?, + metric_parameter_overrides: ::Hash[Symbol, top]? } class PriceInterval < Orb::Internal::Type::BaseModel @@ -38,6 +39,8 @@ module Orb attr_accessor usage_customer_ids: ::Array[String]? + attr_accessor metric_parameter_overrides: ::Hash[Symbol, top]? + def initialize: ( id: String, billing_cycle_day: Integer, @@ -49,7 +52,8 @@ module Orb fixed_fee_quantity_transitions: ::Array[Orb::FixedFeeQuantityTransition]?, price: Orb::Models::price, start_date: Time, - usage_customer_ids: ::Array[String]? + usage_customer_ids: ::Array[String]?, + ?metric_parameter_overrides: ::Hash[Symbol, top]? ) -> void def to_hash: -> { @@ -63,7 +67,8 @@ module Orb fixed_fee_quantity_transitions: ::Array[Orb::FixedFeeQuantityTransition]?, price: Orb::Models::price, start_date: Time, - usage_customer_ids: ::Array[String]? + usage_customer_ids: ::Array[String]?, + metric_parameter_overrides: ::Hash[Symbol, top]? } end end diff --git a/sig/orb/models/subscription_create_params.rbs b/sig/orb/models/subscription_create_params.rbs index 1ff590972..0fdf79d24 100644 --- a/sig/orb/models/subscription_create_params.rbs +++ b/sig/orb/models/subscription_create_params.rbs @@ -236,6 +236,7 @@ module Orb end_date: Time?, external_price_id: String?, maximum_amount: String?, + metric_parameter_overrides: ::Hash[Symbol, top]?, minimum_amount: String?, plan_phase_order: Integer?, price: Orb::Models::SubscriptionCreateParams::AddPrice::price?, @@ -254,6 +255,8 @@ module Orb attr_accessor maximum_amount: String? + attr_accessor metric_parameter_overrides: ::Hash[Symbol, top]? + attr_accessor minimum_amount: String? attr_accessor plan_phase_order: Integer? @@ -270,6 +273,7 @@ module Orb ?end_date: Time?, ?external_price_id: String?, ?maximum_amount: String?, + ?metric_parameter_overrides: ::Hash[Symbol, top]?, ?minimum_amount: String?, ?plan_phase_order: Integer?, ?price: Orb::Models::SubscriptionCreateParams::AddPrice::price?, @@ -283,6 +287,7 @@ module Orb end_date: Time?, external_price_id: String?, maximum_amount: String?, + metric_parameter_overrides: ::Hash[Symbol, top]?, minimum_amount: String?, plan_phase_order: Integer?, price: Orb::Models::SubscriptionCreateParams::AddPrice::price?, @@ -1369,6 +1374,7 @@ module Orb external_price_id: String?, fixed_price_quantity: Float?, maximum_amount: String?, + metric_parameter_overrides: ::Hash[Symbol, top]?, minimum_amount: String?, price: Orb::Models::SubscriptionCreateParams::ReplacePrice::price?, price_id: String? @@ -1387,6 +1393,8 @@ module Orb attr_accessor maximum_amount: String? + attr_accessor metric_parameter_overrides: ::Hash[Symbol, top]? + attr_accessor minimum_amount: String? attr_accessor price: Orb::Models::SubscriptionCreateParams::ReplacePrice::price? @@ -1400,6 +1408,7 @@ module Orb ?external_price_id: String?, ?fixed_price_quantity: Float?, ?maximum_amount: String?, + ?metric_parameter_overrides: ::Hash[Symbol, top]?, ?minimum_amount: String?, ?price: Orb::Models::SubscriptionCreateParams::ReplacePrice::price?, ?price_id: String? @@ -1412,6 +1421,7 @@ module Orb external_price_id: String?, fixed_price_quantity: Float?, maximum_amount: String?, + metric_parameter_overrides: ::Hash[Symbol, top]?, minimum_amount: String?, price: Orb::Models::SubscriptionCreateParams::ReplacePrice::price?, price_id: String? diff --git a/sig/orb/models/subscription_price_intervals_params.rbs b/sig/orb/models/subscription_price_intervals_params.rbs index 09818bef2..2cbfabc8b 100644 --- a/sig/orb/models/subscription_price_intervals_params.rbs +++ b/sig/orb/models/subscription_price_intervals_params.rbs @@ -74,6 +74,7 @@ module Orb filter: String?, fixed_fee_quantity_transitions: ::Array[Orb::SubscriptionPriceIntervalsParams::Add::FixedFeeQuantityTransition]?, maximum_amount: Float?, + metric_parameter_overrides: ::Hash[Symbol, top]?, minimum_amount: Float?, price: Orb::Models::SubscriptionPriceIntervalsParams::Add::price?, price_id: String?, @@ -99,6 +100,8 @@ module Orb attr_accessor maximum_amount: Float? + attr_accessor metric_parameter_overrides: ::Hash[Symbol, top]? + attr_accessor minimum_amount: Float? attr_accessor price: Orb::Models::SubscriptionPriceIntervalsParams::Add::price? @@ -117,6 +120,7 @@ module Orb ?filter: String?, ?fixed_fee_quantity_transitions: ::Array[Orb::SubscriptionPriceIntervalsParams::Add::FixedFeeQuantityTransition]?, ?maximum_amount: Float?, + ?metric_parameter_overrides: ::Hash[Symbol, top]?, ?minimum_amount: Float?, ?price: Orb::Models::SubscriptionPriceIntervalsParams::Add::price?, ?price_id: String?, @@ -133,6 +137,7 @@ module Orb filter: String?, fixed_fee_quantity_transitions: ::Array[Orb::SubscriptionPriceIntervalsParams::Add::FixedFeeQuantityTransition]?, maximum_amount: Float?, + metric_parameter_overrides: ::Hash[Symbol, top]?, minimum_amount: Float?, price: Orb::Models::SubscriptionPriceIntervalsParams::Add::price?, price_id: String?, @@ -1108,6 +1113,7 @@ module Orb end_date: Orb::Models::SubscriptionPriceIntervalsParams::Edit::end_date?, filter: String?, fixed_fee_quantity_transitions: ::Array[Orb::SubscriptionPriceIntervalsParams::Edit::FixedFeeQuantityTransition]?, + metric_parameter_overrides: ::Hash[Symbol, top]?, start_date: Orb::Models::SubscriptionPriceIntervalsParams::Edit::start_date, usage_customer_ids: ::Array[String]? } @@ -1125,6 +1131,8 @@ module Orb attr_accessor fixed_fee_quantity_transitions: ::Array[Orb::SubscriptionPriceIntervalsParams::Edit::FixedFeeQuantityTransition]? + attr_accessor metric_parameter_overrides: ::Hash[Symbol, top]? + attr_reader start_date: Orb::Models::SubscriptionPriceIntervalsParams::Edit::start_date? def start_date=: ( @@ -1140,6 +1148,7 @@ module Orb ?end_date: Orb::Models::SubscriptionPriceIntervalsParams::Edit::end_date?, ?filter: String?, ?fixed_fee_quantity_transitions: ::Array[Orb::SubscriptionPriceIntervalsParams::Edit::FixedFeeQuantityTransition]?, + ?metric_parameter_overrides: ::Hash[Symbol, top]?, ?start_date: Orb::Models::SubscriptionPriceIntervalsParams::Edit::start_date, ?usage_customer_ids: ::Array[String]? ) -> void @@ -1151,6 +1160,7 @@ module Orb end_date: Orb::Models::SubscriptionPriceIntervalsParams::Edit::end_date?, filter: String?, fixed_fee_quantity_transitions: ::Array[Orb::SubscriptionPriceIntervalsParams::Edit::FixedFeeQuantityTransition]?, + metric_parameter_overrides: ::Hash[Symbol, top]?, start_date: Orb::Models::SubscriptionPriceIntervalsParams::Edit::start_date, usage_customer_ids: ::Array[String]? } diff --git a/sig/orb/models/subscription_schedule_plan_change_params.rbs b/sig/orb/models/subscription_schedule_plan_change_params.rbs index 11b2d7953..379ed6a25 100644 --- a/sig/orb/models/subscription_schedule_plan_change_params.rbs +++ b/sig/orb/models/subscription_schedule_plan_change_params.rbs @@ -212,6 +212,7 @@ module Orb end_date: Time?, external_price_id: String?, maximum_amount: String?, + metric_parameter_overrides: ::Hash[Symbol, top]?, minimum_amount: String?, plan_phase_order: Integer?, price: Orb::Models::SubscriptionSchedulePlanChangeParams::AddPrice::price?, @@ -230,6 +231,8 @@ module Orb attr_accessor maximum_amount: String? + attr_accessor metric_parameter_overrides: ::Hash[Symbol, top]? + attr_accessor minimum_amount: String? attr_accessor plan_phase_order: Integer? @@ -246,6 +249,7 @@ module Orb ?end_date: Time?, ?external_price_id: String?, ?maximum_amount: String?, + ?metric_parameter_overrides: ::Hash[Symbol, top]?, ?minimum_amount: String?, ?plan_phase_order: Integer?, ?price: Orb::Models::SubscriptionSchedulePlanChangeParams::AddPrice::price?, @@ -259,6 +263,7 @@ module Orb end_date: Time?, external_price_id: String?, maximum_amount: String?, + metric_parameter_overrides: ::Hash[Symbol, top]?, minimum_amount: String?, plan_phase_order: Integer?, price: Orb::Models::SubscriptionSchedulePlanChangeParams::AddPrice::price?, @@ -1346,6 +1351,7 @@ module Orb external_price_id: String?, fixed_price_quantity: Float?, maximum_amount: String?, + metric_parameter_overrides: ::Hash[Symbol, top]?, minimum_amount: String?, price: Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::price?, price_id: String? @@ -1364,6 +1370,8 @@ module Orb attr_accessor maximum_amount: String? + attr_accessor metric_parameter_overrides: ::Hash[Symbol, top]? + attr_accessor minimum_amount: String? attr_accessor price: Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::price? @@ -1377,6 +1385,7 @@ module Orb ?external_price_id: String?, ?fixed_price_quantity: Float?, ?maximum_amount: String?, + ?metric_parameter_overrides: ::Hash[Symbol, top]?, ?minimum_amount: String?, ?price: Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::price?, ?price_id: String? @@ -1389,6 +1398,7 @@ module Orb external_price_id: String?, fixed_price_quantity: Float?, maximum_amount: String?, + metric_parameter_overrides: ::Hash[Symbol, top]?, minimum_amount: String?, price: Orb::Models::SubscriptionSchedulePlanChangeParams::ReplacePrice::price?, price_id: String? diff --git a/sig/orb/resources/invoices.rbs b/sig/orb/resources/invoices.rbs index a1bb6b816..d63c3046c 100644 --- a/sig/orb/resources/invoices.rbs +++ b/sig/orb/resources/invoices.rbs @@ -5,6 +5,7 @@ module Orb currency: String, invoice_date: Time, line_items: ::Array[Orb::InvoiceCreateParams::LineItem], + ?auto_collection: bool?, ?customer_id: String?, ?discount: Orb::Models::discount?, ?due_date: Orb::Models::InvoiceCreateParams::due_date?, @@ -18,6 +19,7 @@ module Orb def update: ( String invoice_id, + ?auto_collection: bool?, ?due_date: Orb::Models::InvoiceUpdateParams::due_date?, ?invoice_date: Orb::Models::InvoiceUpdateParams::invoice_date?, ?metadata: ::Hash[Symbol, String?]?, diff --git a/sig/orb/resources/prices.rbs b/sig/orb/resources/prices.rbs index e8caf6b00..69f73f478 100644 --- a/sig/orb/resources/prices.rbs +++ b/sig/orb/resources/prices.rbs @@ -75,6 +75,7 @@ module Orb ?external_customer_id: String?, ?filter: String?, ?grouping_keys: ::Array[String], + ?metric_parameter_overrides: ::Hash[Symbol, top]?, ?request_options: Orb::request_opts ) -> Orb::Models::PriceEvaluateResponse diff --git a/test/orb/client_test.rb b/test/orb/client_test.rb index 16c538372..ecdbb3063 100644 --- a/test/orb/client_test.rb +++ b/test/orb/client_test.rb @@ -100,19 +100,21 @@ def test_client_retry_after_seconds end def test_client_retry_after_date + time_now = Time.now + stub_request(:post, "http://localhost/customers").to_return_json( status: 500, - headers: {"retry-after" => (Time.now + 10).httpdate}, + headers: {"retry-after" => (time_now + 10).httpdate}, body: {} ) orb = Orb::Client.new(base_url: "http://localhost", api_key: "My API Key", max_retries: 1) + Thread.current.thread_variable_set(:time_now, time_now) assert_raises(Orb::Errors::InternalServerError) do - Thread.current.thread_variable_set(:time_now, Time.now) orb.customers.create(email: "dev@stainless.com", name: "x") - Thread.current.thread_variable_set(:time_now, nil) end + Thread.current.thread_variable_set(:time_now, nil) assert_requested(:any, /./, times: 2) assert_in_delta(10, Thread.current.thread_variable_get(:mock_sleep).last, 1.0) diff --git a/test/orb/resources/metrics_test.rb b/test/orb/resources/metrics_test.rb index 5be80c464..73015c116 100644 --- a/test/orb/resources/metrics_test.rb +++ b/test/orb/resources/metrics_test.rb @@ -23,7 +23,8 @@ def test_create_required_params item: Orb::Item, metadata: ^(Orb::Internal::Type::HashOf[String]), name: String, - status: Orb::BillableMetric::Status + status: Orb::BillableMetric::Status, + parameter_definitions: ^(Orb::Internal::Type::ArrayOf[Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown]]) | nil } end end @@ -42,7 +43,8 @@ def test_update item: Orb::Item, metadata: ^(Orb::Internal::Type::HashOf[String]), name: String, - status: Orb::BillableMetric::Status + status: Orb::BillableMetric::Status, + parameter_definitions: ^(Orb::Internal::Type::ArrayOf[Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown]]) | nil } end end @@ -68,7 +70,8 @@ def test_list item: Orb::Item, metadata: ^(Orb::Internal::Type::HashOf[String]), name: String, - status: Orb::BillableMetric::Status + status: Orb::BillableMetric::Status, + parameter_definitions: ^(Orb::Internal::Type::ArrayOf[Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown]]) | nil } end end @@ -87,7 +90,8 @@ def test_fetch item: Orb::Item, metadata: ^(Orb::Internal::Type::HashOf[String]), name: String, - status: Orb::BillableMetric::Status + status: Orb::BillableMetric::Status, + parameter_definitions: ^(Orb::Internal::Type::ArrayOf[Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown]]) | nil } end end