Class: MetronomeSDK::Resources::V1::Customers::Commits
- Inherits:
-
Object
- Object
- MetronomeSDK::Resources::V1::Customers::Commits
- Defined in:
- lib/metronome_sdk/resources/v1/customers/commits.rb
Instance Method Summary collapse
-
#create(access_schedule: , customer_id: , priority: , product_id: , type: , applicable_contract_ids: nil, applicable_product_ids: nil, applicable_product_tags: nil, custom_fields: nil, description: nil, invoice_contract_id: nil, invoice_schedule: nil, name: nil, netsuite_sales_order_id: nil, rate_type: nil, salesforce_opportunity_id: nil, specifiers: nil, uniqueness_key: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::Customers::CommitCreateResponse
Some parameter documentations has been truncated, see Models::V1::Customers::CommitCreateParams for more details.
-
#initialize(client:) ⇒ Commits
constructor
private
A new instance of Commits.
-
#list(customer_id: , commit_id: nil, covering_date: nil, effective_before: nil, include_archived: nil, include_balance: nil, include_contract_commits: nil, include_ledgers: nil, limit: nil, next_page: nil, starting_at: nil, request_options: {}) ⇒ MetronomeSDK::Internal::BodyCursorPage<MetronomeSDK::Models::Commit>
Some parameter documentations has been truncated, see Models::V1::Customers::CommitListParams for more details.
-
#update_end_date(commit_id: , customer_id: , access_ending_before: nil, invoices_ending_before: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::Customers::CommitUpdateEndDateResponse
Some parameter documentations has been truncated, see Models::V1::Customers::CommitUpdateEndDateParams for more details.
Constructor Details
#initialize(client:) ⇒ Commits
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Commits.
260 261 262 |
# File 'lib/metronome_sdk/resources/v1/customers/commits.rb', line 260 def initialize(client:) @client = client end |
Instance Method Details
#create(access_schedule: , customer_id: , priority: , product_id: , type: , applicable_contract_ids: nil, applicable_product_ids: nil, applicable_product_tags: nil, custom_fields: nil, description: nil, invoice_contract_id: nil, invoice_schedule: nil, name: nil, netsuite_sales_order_id: nil, rate_type: nil, salesforce_opportunity_id: nil, specifiers: nil, uniqueness_key: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::Customers::CommitCreateResponse
Some parameter documentations has been truncated, see Models::V1::Customers::CommitCreateParams for more details.
Creates customer-level commits that establish spending commitments for customers across their Metronome usage. Commits represent contracted spending obligations that can be either prepaid (paid upfront) or postpaid (billed later).
Note: In most cases, you should add commitments directly to customer contracts using the contract/create or contract/edit APIs.
### Use this endpoint to:
Use this endpoint when you need to establish customer-level spending commitments that can be applied across multiple contracts or scoped to specific contracts. Customer-level commits are ideal for:
-
Enterprise-wide minimum spending agreements that span multiple contracts
-
Multi-contract volume commitments with shared spending pools
-
Cross-contract discount tiers based on aggregate usage
#### Commit type Requirements:
-
You must specify either “prepaid” or “postpaid” as the commit type:
-
Prepaid commits: Customer pays upfront; invoice_schedule is optional (if omitted, creates a commit without an invoice)
-
Postpaid commits: Customer pays when the commitment expires (the end of the access_schedule); invoice_schedule is required and must match access_schedule totals.
#### Billing configuration:
-
invoice_contract_id is required for postpaid commits and for prepaid commits with billing (only optional for free prepaid commits) unless do_not_invoice is set to true
-
For postpaid commits: access_schedule and invoice_schedule must have matching amounts
-
For postpaid commits: only one schedule item is allowed in both schedules.
#### Scoping flexibility:
Customer-level commits can be configured in a few ways:
-
Contract-specific: Use the ‘applicable_contract_ids` field to limit the commit to specific contracts
-
Cross-contract: Leave ‘applicable_contract_ids` empty to allow the commit to be used across all of the customer’s contracts
#### Product targeting:
Commits can be scoped to specific products using applicable_product_ids, applicable_product_tags, or specifiers, or left unrestricted to apply to all products.
#### Priority considerations:
When multiple commits are applicable, the one with the lower priority value will be consumed first. If there is a tie, contract level commits and credits will be applied before customer level commits and credits. Plan your priority scheme carefully to ensure commits are applied in the desired order.
### Usage guidelines:
⚠️ Preferred Alternative: In most cases, you should add commits directly to contracts using the create contract or edit contract APIs instead of creating customer-level commits. Contract-level commits provide better organization and are the recommended approach for standard use cases.
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/metronome_sdk/resources/v1/customers/commits.rb', line 118 def create(params) parsed, = MetronomeSDK::V1::Customers::CommitCreateParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/customerCommits/create", body: parsed, model: MetronomeSDK::Models::V1::Customers::CommitCreateResponse, options: ) end |
#list(customer_id: , commit_id: nil, covering_date: nil, effective_before: nil, include_archived: nil, include_balance: nil, include_contract_commits: nil, include_ledgers: nil, limit: nil, next_page: nil, starting_at: nil, request_options: {}) ⇒ MetronomeSDK::Internal::BodyCursorPage<MetronomeSDK::Models::Commit>
Some parameter documentations has been truncated, see Models::V1::Customers::CommitListParams for more details.
Retrieve all commit agreements for a customer, including both prepaid and postpaid commitments. This endpoint provides comprehensive visibility into contractual spending obligations, enabling you to track commitment utilization and manage customer contracts effectively.
### Use this endpoint to:
-
Display commitment balances and utilization in customer dashboards
-
Track prepaid commitment drawdown and remaining balances
-
Monitor postpaid commitment progress toward minimum thresholds
-
Build commitment tracking and forecasting tools
-
Show commitment history with optional ledger details
-
Manage rollover balances between contract periods
### Key response fields:
An array of Commit objects containing:
-
Commit type: PREPAID (pay upfront) or POSTPAID (pay at true-up)
-
Rate type: COMMIT_RATE (discounted) or LIST_RATE (standard pricing)
-
Access schedule: When commitment funds become available
-
Invoice schedule: When the customer is billed
-
Product targeting: Which product(s) usage is eligible to draw from this commit
-
Optional ledger entries: Transaction history (if ‘include_ledgers=true`)
-
Balance information: Current available amount (if ‘include_balance=true`)
-
Rollover settings: Fraction of unused amount that carries forward
### Usage guidelines:
-
Pagination: Results limited to 25 commits per page; use ‘next_page’ for more
-
Date filtering options:
-
‘covering_date`: Commits active on a specific date
-
‘starting_at`: Commits with access on/after a date
-
‘effective_before`: Commits with access before a date (exclusive)
-
-
Scope options:
-
‘include_contract_commits`: Include contract-level commits (not just customer-level)
-
‘include_archived`: Include archived commits and commits from archived contracts
-
-
Performance considerations:
-
include_ledgers: Adds detailed transaction history (slower)
-
include_balance: Adds current balance calculation (slower)
-
-
Optional filtering: Use commit_id to retrieve a specific commit
205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/metronome_sdk/resources/v1/customers/commits.rb', line 205 def list(params) parsed, = MetronomeSDK::V1::Customers::CommitListParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/customerCommits/list", body: parsed, page: MetronomeSDK::Internal::BodyCursorPage, model: MetronomeSDK::Commit, options: ) end |
#update_end_date(commit_id: , customer_id: , access_ending_before: nil, invoices_ending_before: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::Customers::CommitUpdateEndDateResponse
Some parameter documentations has been truncated, see Models::V1::Customers::CommitUpdateEndDateParams for more details.
Shortens the end date of a prepaid commit to terminate it earlier than originally scheduled. Use this endpoint when you need to cancel or reduce the duration of an existing prepaid commit. Only works with prepaid commit types and can only move the end date forward (earlier), not extend it.
### Usage guidelines:
To extend commit end dates or make other comprehensive edits, use the ‘edit commit’ endpoint instead.
246 247 248 249 250 251 252 253 254 255 |
# File 'lib/metronome_sdk/resources/v1/customers/commits.rb', line 246 def update_end_date(params) parsed, = MetronomeSDK::V1::Customers::CommitUpdateEndDateParams.dump_request(params) @client.request( method: :post, path: "v1/contracts/customerCommits/updateEndDate", body: parsed, model: MetronomeSDK::Models::V1::Customers::CommitUpdateEndDateResponse, options: ) end |