Class: MetronomeSDK::Resources::V1::Contracts::Products
- Inherits:
-
Object
- Object
- MetronomeSDK::Resources::V1::Contracts::Products
- Defined in:
- lib/metronome_sdk/resources/v1/contracts/products.rb
Instance Method Summary collapse
-
#archive(product_id: , request_options: {}) ⇒ MetronomeSDK::Models::V1::Contracts::ProductArchiveResponse
Archive a product.
-
#create(name: , type: , billable_metric_id: nil, composite_product_ids: nil, composite_tags: nil, custom_fields: nil, exclude_free_usage: nil, is_refundable: nil, netsuite_internal_item_id: nil, netsuite_overage_item_id: nil, presentation_group_key: nil, pricing_group_key: nil, quantity_conversion: nil, quantity_rounding: nil, tags: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::Contracts::ProductCreateResponse
Some parameter documentations has been truncated, see Models::V1::Contracts::ProductCreateParams for more details.
-
#initialize(client:) ⇒ Products
constructor
private
A new instance of Products.
-
#list(limit: nil, next_page: nil, archive_filter: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPage<MetronomeSDK::Models::V1::Contracts::ProductListResponse>
Some parameter documentations has been truncated, see Models::V1::Contracts::ProductListParams for more details.
-
#retrieve(id: , request_options: {}) ⇒ MetronomeSDK::Models::V1::Contracts::ProductRetrieveResponse
Retrieve a product by its ID, including all metadata and historical changes.
-
#update(product_id: , starting_at: , billable_metric_id: nil, composite_product_ids: nil, composite_tags: nil, exclude_free_usage: nil, is_refundable: nil, name: nil, netsuite_internal_item_id: nil, netsuite_overage_item_id: nil, presentation_group_key: nil, pricing_group_key: nil, quantity_conversion: nil, quantity_rounding: nil, tags: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::Contracts::ProductUpdateResponse
Some parameter documentations has been truncated, see Models::V1::Contracts::ProductUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Products
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 Products.
211 212 213 |
# File 'lib/metronome_sdk/resources/v1/contracts/products.rb', line 211 def initialize(client:) @client = client end |
Instance Method Details
#archive(product_id: , request_options: {}) ⇒ MetronomeSDK::Models::V1::Contracts::ProductArchiveResponse
Archive a product. Any current rate cards associated with this product will continue to function as normal. However, it will no longer be available as an option for newly created rates. Once you archive a product, you can still retrieve it in the UI and API, but you cannot unarchive it.
197 198 199 200 201 202 203 204 205 206 |
# File 'lib/metronome_sdk/resources/v1/contracts/products.rb', line 197 def archive(params) parsed, = MetronomeSDK::V1::Contracts::ProductArchiveParams.dump_request(params) @client.request( method: :post, path: "v1/contract-pricing/products/archive", body: parsed, model: MetronomeSDK::Models::V1::Contracts::ProductArchiveResponse, options: ) end |
#create(name: , type: , billable_metric_id: nil, composite_product_ids: nil, composite_tags: nil, custom_fields: nil, exclude_free_usage: nil, is_refundable: nil, netsuite_internal_item_id: nil, netsuite_overage_item_id: nil, presentation_group_key: nil, pricing_group_key: nil, quantity_conversion: nil, quantity_rounding: nil, tags: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::Contracts::ProductCreateResponse
Some parameter documentations has been truncated, see Models::V1::Contracts::ProductCreateParams for more details.
Create a new product object. Products in Metronome represent your company’s individual product or service offerings. A Product can be thought of as the basic unit of a line item on the invoice. This is analogous to SKUs or items in an ERP system. Give the product a meaningful name as they will appear on customer invoices.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/metronome_sdk/resources/v1/contracts/products.rb', line 54 def create(params) parsed, = MetronomeSDK::V1::Contracts::ProductCreateParams.dump_request(params) @client.request( method: :post, path: "v1/contract-pricing/products/create", body: parsed, model: MetronomeSDK::Models::V1::Contracts::ProductCreateResponse, options: ) end |
#list(limit: nil, next_page: nil, archive_filter: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPage<MetronomeSDK::Models::V1::Contracts::ProductListResponse>
Some parameter documentations has been truncated, see Models::V1::Contracts::ProductListParams for more details.
Get a paginated list of all products in your organization with their complete configuration, version history, and metadata. By default excludes archived products unless explicitly requested via the ‘archive_filter` parameter.
169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/metronome_sdk/resources/v1/contracts/products.rb', line 169 def list(params = {}) parsed, = MetronomeSDK::V1::Contracts::ProductListParams.dump_request(params) query_params = [:limit, :next_page] @client.request( method: :post, path: "v1/contract-pricing/products/list", query: parsed.slice(*query_params), body: parsed.except(*query_params), page: MetronomeSDK::Internal::CursorPage, model: MetronomeSDK::Models::V1::Contracts::ProductListResponse, options: ) end |
#retrieve(id: , request_options: {}) ⇒ MetronomeSDK::Models::V1::Contracts::ProductRetrieveResponse
Retrieve a product by its ID, including all metadata and historical changes.
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/metronome_sdk/resources/v1/contracts/products.rb', line 75 def retrieve(params) parsed, = MetronomeSDK::V1::Contracts::ProductRetrieveParams.dump_request(params) @client.request( method: :post, path: "v1/contract-pricing/products/get", body: parsed, model: MetronomeSDK::Models::V1::Contracts::ProductRetrieveResponse, options: ) end |
#update(product_id: , starting_at: , billable_metric_id: nil, composite_product_ids: nil, composite_tags: nil, exclude_free_usage: nil, is_refundable: nil, name: nil, netsuite_internal_item_id: nil, netsuite_overage_item_id: nil, presentation_group_key: nil, pricing_group_key: nil, quantity_conversion: nil, quantity_rounding: nil, tags: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::Contracts::ProductUpdateResponse
Some parameter documentations has been truncated, see Models::V1::Contracts::ProductUpdateParams for more details.
Updates a product’s configuration while maintaining billing continuity for active customers. Use this endpoint to modify product names, metrics, pricing rules, and composite settings without disrupting ongoing billing cycles. Changes are scheduled using the starting_at timestamp, which must be on an hour boundary—set future dates to schedule updates ahead of time, or past dates for retroactive changes. Returns the updated product ID upon success.
### Usage guidance:
-
Product type cannot be changed after creation. For incorrect product types, create a new product and archive the original instead.
138 139 140 141 142 143 144 145 146 147 |
# File 'lib/metronome_sdk/resources/v1/contracts/products.rb', line 138 def update(params) parsed, = MetronomeSDK::V1::Contracts::ProductUpdateParams.dump_request(params) @client.request( method: :post, path: "v1/contract-pricing/products/update", body: parsed, model: MetronomeSDK::Models::V1::Contracts::ProductUpdateResponse, options: ) end |