metronome-sdk 3.4.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +84 -0
- data/README.md +1 -1
- data/lib/metronome_sdk/client.rb +15 -1
- data/lib/metronome_sdk/internal/transport/base_client.rb +2 -0
- data/lib/metronome_sdk/internal/util.rb +22 -7
- data/lib/metronome_sdk/models/base_threshold_commit.rb +10 -1
- data/lib/metronome_sdk/models/contract_v2.rb +443 -15
- data/lib/metronome_sdk/models/credit.rb +74 -4
- data/lib/metronome_sdk/models/override.rb +9 -8
- data/lib/metronome_sdk/models/prepaid_balance_threshold_configuration.rb +27 -1
- data/lib/metronome_sdk/models/prepaid_balance_threshold_configuration_v2.rb +28 -2
- data/lib/metronome_sdk/models/spend_threshold_configuration.rb +26 -1
- data/lib/metronome_sdk/models/spend_threshold_configuration_v2.rb +30 -4
- data/lib/metronome_sdk/models/update_base_threshold_commit.rb +11 -1
- data/lib/metronome_sdk/models/v1/alert_create_params.rb +1 -0
- data/lib/metronome_sdk/models/v1/contract_amend_params.rb +2 -189
- data/lib/metronome_sdk/models/v1/contract_create_params.rb +3 -191
- data/lib/metronome_sdk/models/v1/contract_list_seat_balances_params.rb +119 -0
- data/lib/metronome_sdk/models/v1/contract_list_seat_balances_response.rb +315 -0
- data/lib/metronome_sdk/models/v1/contracts/product_create_params.rb +31 -1
- data/lib/metronome_sdk/models/v1/contracts/product_update_params.rb +31 -1
- data/lib/metronome_sdk/models/v1/customers/customer_alert.rb +1 -0
- data/lib/metronome_sdk/models/v1/customers/invoice.rb +8 -1
- data/lib/metronome_sdk/models/v1/customers/invoice_list_params.rb +29 -1
- data/lib/metronome_sdk/models/v1/package_create_params.rb +2 -30
- data/lib/metronome_sdk/models/v1/package_list_response.rb +28 -9
- data/lib/metronome_sdk/models/v1/package_retrieve_response.rb +29 -9
- data/lib/metronome_sdk/models/v2/contract_edit_params.rb +67 -20
- data/lib/metronome_sdk/models/v2/contract_get_edit_history_response.rb +496 -15
- data/lib/metronome_sdk/resources/v1/contracts/products.rb +6 -2
- data/lib/metronome_sdk/resources/v1/contracts.rb +76 -2
- data/lib/metronome_sdk/resources/v1/customers/invoices.rb +5 -1
- data/lib/metronome_sdk/resources/v1/packages.rb +1 -3
- data/lib/metronome_sdk/version.rb +1 -1
- data/lib/metronome_sdk.rb +3 -1
- data/rbi/metronome_sdk/internal/util.rbi +8 -0
- data/rbi/metronome_sdk/models/base_threshold_commit.rbi +24 -5
- data/rbi/metronome_sdk/models/contract_v2.rbi +916 -19
- data/rbi/metronome_sdk/models/credit.rbi +139 -3
- data/rbi/metronome_sdk/models/override.rbi +9 -12
- data/rbi/metronome_sdk/models/prepaid_balance_threshold_configuration.rbi +54 -3
- data/rbi/metronome_sdk/models/prepaid_balance_threshold_configuration_v2.rbi +55 -4
- data/rbi/metronome_sdk/models/spend_threshold_configuration.rbi +54 -3
- data/rbi/metronome_sdk/models/spend_threshold_configuration_v2.rbi +58 -9
- data/rbi/metronome_sdk/models/update_base_threshold_commit.rbi +22 -4
- data/rbi/metronome_sdk/models/v1/alert_create_params.rbi +5 -0
- data/rbi/metronome_sdk/models/v1/contract_amend_params.rbi +3 -416
- data/rbi/metronome_sdk/models/v1/contract_create_params.rbi +5 -418
- data/rbi/metronome_sdk/models/v1/contract_list_seat_balances_params.rbi +179 -0
- data/rbi/metronome_sdk/models/v1/contract_list_seat_balances_response.rbi +714 -0
- data/rbi/metronome_sdk/models/v1/contracts/product_create_params.rbi +74 -0
- data/rbi/metronome_sdk/models/v1/contracts/product_update_params.rbi +74 -0
- data/rbi/metronome_sdk/models/v1/customers/customer_alert.rbi +5 -0
- data/rbi/metronome_sdk/models/v1/customers/invoice.rbi +9 -0
- data/rbi/metronome_sdk/models/v1/customers/invoice_list_params.rbi +75 -0
- data/rbi/metronome_sdk/models/v1/package_create_params.rbi +3 -76
- data/rbi/metronome_sdk/models/v1/package_list_response.rbi +72 -15
- data/rbi/metronome_sdk/models/v1/package_retrieve_response.rbi +72 -17
- data/rbi/metronome_sdk/models/v2/contract_edit_params.rbi +133 -28
- data/rbi/metronome_sdk/models/v2/contract_get_edit_history_response.rbi +1174 -145
- data/rbi/metronome_sdk/resources/v1/contracts/products.rbi +18 -0
- data/rbi/metronome_sdk/resources/v1/contracts.rbi +88 -3
- data/rbi/metronome_sdk/resources/v1/customers/invoices.rbi +7 -0
- data/rbi/metronome_sdk/resources/v1/packages.rbi +0 -3
- data/sig/metronome_sdk/internal/util.rbs +4 -0
- data/sig/metronome_sdk/models/base_threshold_commit.rbs +13 -3
- data/sig/metronome_sdk/models/contract_v2.rbs +401 -16
- data/sig/metronome_sdk/models/credit.rbs +69 -0
- data/sig/metronome_sdk/models/override.rbs +8 -10
- data/sig/metronome_sdk/models/prepaid_balance_threshold_configuration.rbs +22 -3
- data/sig/metronome_sdk/models/prepaid_balance_threshold_configuration_v2.rbs +23 -4
- data/sig/metronome_sdk/models/spend_threshold_configuration.rbs +22 -3
- data/sig/metronome_sdk/models/spend_threshold_configuration_v2.rbs +26 -7
- data/sig/metronome_sdk/models/update_base_threshold_commit.rbs +15 -2
- data/sig/metronome_sdk/models/v1/alert_create_params.rbs +3 -1
- data/sig/metronome_sdk/models/v1/contract_amend_params.rbs +3 -147
- data/sig/metronome_sdk/models/v1/contract_create_params.rbs +3 -147
- data/sig/metronome_sdk/models/v1/contract_list_seat_balances_params.rbs +96 -0
- data/sig/metronome_sdk/models/v1/contract_list_seat_balances_response.rbs +299 -0
- data/sig/metronome_sdk/models/v1/contracts/product_create_params.rbs +20 -0
- data/sig/metronome_sdk/models/v1/contracts/product_update_params.rbs +20 -0
- data/sig/metronome_sdk/models/v1/customers/customer_alert.rbs +3 -1
- data/sig/metronome_sdk/models/v1/customers/invoice.rbs +7 -0
- data/sig/metronome_sdk/models/v1/customers/invoice_list_params.rbs +29 -1
- data/sig/metronome_sdk/models/v1/package_create_params.rbs +3 -30
- data/sig/metronome_sdk/models/v1/package_list_response.rbs +33 -15
- data/sig/metronome_sdk/models/v1/package_retrieve_response.rbs +33 -15
- data/sig/metronome_sdk/models/v2/contract_edit_params.rbs +33 -10
- data/sig/metronome_sdk/models/v2/contract_get_edit_history_response.rbs +409 -19
- data/sig/metronome_sdk/resources/v1/contracts/products.rbs +2 -0
- data/sig/metronome_sdk/resources/v1/contracts.rbs +15 -0
- data/sig/metronome_sdk/resources/v1/customers/invoices.rbs +2 -0
- data/sig/metronome_sdk/resources/v1/packages.rbs +0 -1
- metadata +8 -2
|
@@ -34,6 +34,8 @@ module MetronomeSDK
|
|
|
34
34
|
T.nilable(
|
|
35
35
|
MetronomeSDK::V1::Contracts::QuantityRounding::OrHash
|
|
36
36
|
),
|
|
37
|
+
sql_breakdown_granularity:
|
|
38
|
+
MetronomeSDK::V1::Contracts::ProductCreateParams::SqlBreakdownGranularity::OrSymbol,
|
|
37
39
|
tags: T::Array[String],
|
|
38
40
|
request_options: MetronomeSDK::RequestOptions::OrHash
|
|
39
41
|
).returns(
|
|
@@ -84,6 +86,13 @@ module MetronomeSDK
|
|
|
84
86
|
# the method is "round up" and the decimal places is 0, then the quantity will be
|
|
85
87
|
# rounded up to the nearest integer.
|
|
86
88
|
quantity_rounding: nil,
|
|
89
|
+
# Defines the breakdown behavior when calculating usage from SQL Billable Metrics.
|
|
90
|
+
# If set to 'service_period' (default), the usage will be evaluated once for all
|
|
91
|
+
# events the invoice service period and the usage will be applied at the last
|
|
92
|
+
# instant of the invoice. If set to 'hour', it will be broken down and evaluated
|
|
93
|
+
# for each hour. For most use cases, 'hour' is recommended. The setting has no
|
|
94
|
+
# effect for Streaming Billable Metrics.
|
|
95
|
+
sql_breakdown_granularity: nil,
|
|
87
96
|
tags: nil,
|
|
88
97
|
request_options: {}
|
|
89
98
|
)
|
|
@@ -134,6 +143,8 @@ module MetronomeSDK
|
|
|
134
143
|
T.nilable(
|
|
135
144
|
MetronomeSDK::V1::Contracts::QuantityRounding::OrHash
|
|
136
145
|
),
|
|
146
|
+
sql_breakdown_granularity:
|
|
147
|
+
MetronomeSDK::V1::Contracts::ProductUpdateParams::SqlBreakdownGranularity::OrSymbol,
|
|
137
148
|
tags: T::Array[String],
|
|
138
149
|
request_options: MetronomeSDK::RequestOptions::OrHash
|
|
139
150
|
).returns(
|
|
@@ -192,6 +203,13 @@ module MetronomeSDK
|
|
|
192
203
|
# the method is "round up" and the decimal places is 0, then the quantity will be
|
|
193
204
|
# rounded up to the nearest integer.
|
|
194
205
|
quantity_rounding: nil,
|
|
206
|
+
# Defines the breakdown behavior when calculating usage from SQL Billable Metrics.
|
|
207
|
+
# If set to 'service_period' (default), the usage will be evaluated once for all
|
|
208
|
+
# events the invoice service period and the usage will be applied at the last
|
|
209
|
+
# instant of the invoice. If set to 'hour', it will be broken down and evaluated
|
|
210
|
+
# for each hour. For most use cases, 'hour' is recommended. The setting has no
|
|
211
|
+
# effect for Streaming Billable Metrics.
|
|
212
|
+
sql_breakdown_granularity: nil,
|
|
195
213
|
# If not provided, defaults to product's current tags
|
|
196
214
|
tags: nil,
|
|
197
215
|
request_options: {}
|
|
@@ -19,8 +19,8 @@ module MetronomeSDK
|
|
|
19
19
|
|
|
20
20
|
# Contracts define a customer's products, pricing, discounts, access duration, and
|
|
21
21
|
# billing configuration. Contracts serve as the central billing agreement for both
|
|
22
|
-
# PLG and Enterprise customers
|
|
23
|
-
# products and services directly from your product or CRM.
|
|
22
|
+
# PLG and Enterprise customers. You can automatically grant customers access to
|
|
23
|
+
# your products and services directly from your product or CRM.
|
|
24
24
|
#
|
|
25
25
|
# ### Use this endpoint to:
|
|
26
26
|
#
|
|
@@ -245,7 +245,7 @@ module MetronomeSDK
|
|
|
245
245
|
package_alias: nil,
|
|
246
246
|
# If provided, provisions a customer on a package instead of creating a
|
|
247
247
|
# traditional contract. When specified, only customer_id, starting_at, package_id,
|
|
248
|
-
# and
|
|
248
|
+
# uniqueness_key, transition, and custom_fields are allowed.
|
|
249
249
|
package_id: nil,
|
|
250
250
|
prepaid_balance_threshold_configuration: nil,
|
|
251
251
|
# This field's availability is dependent on your client's configuration.
|
|
@@ -568,6 +568,10 @@ module MetronomeSDK
|
|
|
568
568
|
#
|
|
569
569
|
# ### Usage guidelines:
|
|
570
570
|
#
|
|
571
|
+
# - **Balance ledger details**: Use the
|
|
572
|
+
# [listBalances](https://docs.metronome.com/api-reference/credits-and-commits/list-balances)
|
|
573
|
+
# endpoint instead to understand detailed ledger drawdowns for each individual
|
|
574
|
+
# balance
|
|
571
575
|
# - **Draft invoice handling**: Use `invoice_inclusion_mode` to control whether
|
|
572
576
|
# pending draft invoice deductions are included (`FINALIZED_AND_DRAFT`, the
|
|
573
577
|
# default) or excluded (`FINALIZED`) from the balance calculation
|
|
@@ -630,6 +634,9 @@ module MetronomeSDK
|
|
|
630
634
|
#
|
|
631
635
|
# ### Usage guidelines:
|
|
632
636
|
#
|
|
637
|
+
# - Use the
|
|
638
|
+
# [getNetBalance](https://docs.metronome.com/api-reference/credits-and-commits/get-the-net-balance-of-a-customer)
|
|
639
|
+
# endpoint to retrieve a single combined current balance
|
|
633
640
|
# - Date filtering: Use `effective_before` to include only balances with access
|
|
634
641
|
# before a specific date (exclusive)
|
|
635
642
|
# - Set `include_balance=true` for calculated balance amounts on each commit or
|
|
@@ -689,6 +696,84 @@ module MetronomeSDK
|
|
|
689
696
|
)
|
|
690
697
|
end
|
|
691
698
|
|
|
699
|
+
# Retrieve detailed balance for seat-based credits and commits from the contract's
|
|
700
|
+
# subscriptions, broken down by individual seats.
|
|
701
|
+
#
|
|
702
|
+
# ### Use this endpoint to:
|
|
703
|
+
#
|
|
704
|
+
# - Display per-seat balance information in customer dashboards
|
|
705
|
+
# - Filter balance data by subscription or specific seats
|
|
706
|
+
#
|
|
707
|
+
# ### Key response fields:
|
|
708
|
+
#
|
|
709
|
+
# An array of seat balance objects containing:
|
|
710
|
+
#
|
|
711
|
+
# - Seat id
|
|
712
|
+
# - Balance: current total balance across all commits and credits
|
|
713
|
+
#
|
|
714
|
+
# ### Usage guidelines:
|
|
715
|
+
#
|
|
716
|
+
# - Date filtering: use `covering_date` OR `starting_at`/`ending_before` to filter
|
|
717
|
+
# balance data by time range
|
|
718
|
+
# - Set `include_credits_and_commits=true` for detailed commits and credits
|
|
719
|
+
# breakdown per seat
|
|
720
|
+
# - Set `include_ledgers=true` for detailed transaction history per commit/credit
|
|
721
|
+
# per seat
|
|
722
|
+
sig do
|
|
723
|
+
params(
|
|
724
|
+
contract_id: String,
|
|
725
|
+
customer_id: String,
|
|
726
|
+
covering_date: Time,
|
|
727
|
+
cursor: String,
|
|
728
|
+
effective_before: Time,
|
|
729
|
+
include_credits_and_commits: T::Boolean,
|
|
730
|
+
include_ledgers: T::Boolean,
|
|
731
|
+
limit: Integer,
|
|
732
|
+
seat_ids: T::Array[String],
|
|
733
|
+
starting_at: Time,
|
|
734
|
+
subscription_ids: T::Array[String],
|
|
735
|
+
request_options: MetronomeSDK::RequestOptions::OrHash
|
|
736
|
+
).returns(MetronomeSDK::Models::V1::ContractListSeatBalancesResponse)
|
|
737
|
+
end
|
|
738
|
+
def list_seat_balances(
|
|
739
|
+
# The contract ID to retrieve seat balances for
|
|
740
|
+
contract_id:,
|
|
741
|
+
# The customer ID to retrieve seat balances for
|
|
742
|
+
customer_id:,
|
|
743
|
+
# Include only commits or credits with access that cover this specific date
|
|
744
|
+
# (cannot be used with starting_at or ending_before).
|
|
745
|
+
covering_date: nil,
|
|
746
|
+
# Page token from a previous response to retrieve the next page
|
|
747
|
+
cursor: nil,
|
|
748
|
+
# Include only commits or credits with access effective on or before this date
|
|
749
|
+
# (cannot be used with covering_date).
|
|
750
|
+
effective_before: nil,
|
|
751
|
+
# Include credits and commits in the response
|
|
752
|
+
include_credits_and_commits: nil,
|
|
753
|
+
# Include ledger entries for each commit and commit. `include_credits_and_commits`
|
|
754
|
+
# must be set to `true` for `include_ledgers=true` to apply.
|
|
755
|
+
include_ledgers: nil,
|
|
756
|
+
# Maximum number of seats to return. Range: 1-100. Default: 25. When
|
|
757
|
+
# `include_credits_and_commits = true`, if the total commits/credits across all
|
|
758
|
+
# seats exceeds 100, a limit of 100 applies to the total credits and commits.
|
|
759
|
+
# Seats are included greedily to maximize the number of seats returned. Example:
|
|
760
|
+
# if seat 1 has 98 commits and seat 2 has 10 commits, both seats will be returned
|
|
761
|
+
# (total: 108 commits). Each returned seat includes all of its associated credits
|
|
762
|
+
# and commits.
|
|
763
|
+
limit: nil,
|
|
764
|
+
# Optional filter to only include specific seats.
|
|
765
|
+
seat_ids: nil,
|
|
766
|
+
# Include only commits or credits with access effective on or after this date
|
|
767
|
+
# (cannot be used with covering_date).
|
|
768
|
+
starting_at: nil,
|
|
769
|
+
# Optional filter to only include seats from specific subscriptions. If
|
|
770
|
+
# subscriptions ids are not mapped to SEAT_BASED subscriptions, error will be
|
|
771
|
+
# returned.
|
|
772
|
+
subscription_ids: nil,
|
|
773
|
+
request_options: {}
|
|
774
|
+
)
|
|
775
|
+
end
|
|
776
|
+
|
|
692
777
|
# For a specific customer and contract, get the rates at a specific point in time.
|
|
693
778
|
# This endpoint takes the contract's rate card into consideration, including
|
|
694
779
|
# scheduled changes. It also takes into account overrides on the contract.
|
|
@@ -120,6 +120,7 @@ module MetronomeSDK
|
|
|
120
120
|
sig do
|
|
121
121
|
params(
|
|
122
122
|
customer_id: String,
|
|
123
|
+
contract_id: String,
|
|
123
124
|
credit_type_id: String,
|
|
124
125
|
ending_before: Time,
|
|
125
126
|
limit: Integer,
|
|
@@ -129,6 +130,8 @@ module MetronomeSDK
|
|
|
129
130
|
MetronomeSDK::V1::Customers::InvoiceListParams::Sort::OrSymbol,
|
|
130
131
|
starting_on: Time,
|
|
131
132
|
status: String,
|
|
133
|
+
type:
|
|
134
|
+
MetronomeSDK::V1::Customers::InvoiceListParams::Type::OrSymbol,
|
|
132
135
|
request_options: MetronomeSDK::RequestOptions::OrHash
|
|
133
136
|
).returns(
|
|
134
137
|
MetronomeSDK::Internal::CursorPage[
|
|
@@ -139,6 +142,8 @@ module MetronomeSDK
|
|
|
139
142
|
def list(
|
|
140
143
|
# Path param
|
|
141
144
|
customer_id:,
|
|
145
|
+
# Query param: Only return invoices for the specified contract
|
|
146
|
+
contract_id: nil,
|
|
142
147
|
# Query param: Only return invoices for the specified credit type
|
|
143
148
|
credit_type_id: nil,
|
|
144
149
|
# Query param: RFC 3339 timestamp (exclusive). Invoices will only be returned for
|
|
@@ -159,6 +164,8 @@ module MetronomeSDK
|
|
|
159
164
|
starting_on: nil,
|
|
160
165
|
# Query param: Invoice status, e.g. DRAFT, FINALIZED, or VOID
|
|
161
166
|
status: nil,
|
|
167
|
+
# Query param: Filter invoices by type. Defaults to returning all invoice types.
|
|
168
|
+
type: nil,
|
|
162
169
|
request_options: {}
|
|
163
170
|
)
|
|
164
171
|
end
|
|
@@ -59,8 +59,6 @@ module MetronomeSDK
|
|
|
59
59
|
name: String,
|
|
60
60
|
aliases:
|
|
61
61
|
T::Array[MetronomeSDK::V1::PackageCreateParams::Alias::OrHash],
|
|
62
|
-
billing_anchor_date:
|
|
63
|
-
MetronomeSDK::V1::PackageCreateParams::BillingAnchorDate::OrSymbol,
|
|
64
62
|
billing_provider:
|
|
65
63
|
MetronomeSDK::V1::PackageCreateParams::BillingProvider::OrSymbol,
|
|
66
64
|
commits:
|
|
@@ -112,7 +110,6 @@ module MetronomeSDK
|
|
|
112
110
|
# multiple packages, it will reference the package to which it was most recently
|
|
113
111
|
# assigned. It is not exposed to end customers.
|
|
114
112
|
aliases: nil,
|
|
115
|
-
billing_anchor_date: nil,
|
|
116
113
|
billing_provider: nil,
|
|
117
114
|
commits: nil,
|
|
118
115
|
contract_name: nil,
|
|
@@ -45,8 +45,12 @@ module MetronomeSDK
|
|
|
45
45
|
-> top?
|
|
46
46
|
} -> top?
|
|
47
47
|
|
|
48
|
+
RFC_3986_NOT_PCHARS: Regexp
|
|
49
|
+
|
|
48
50
|
def self?.uri_origin: (URI::Generic uri) -> String
|
|
49
51
|
|
|
52
|
+
def self?.encode_path: (String | Integer path) -> String
|
|
53
|
+
|
|
50
54
|
def self?.interpolate_path: (String | ::Array[String] path) -> String
|
|
51
55
|
|
|
52
56
|
def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module MetronomeSDK
|
|
2
2
|
module Models
|
|
3
3
|
type base_threshold_commit =
|
|
4
|
-
{ product_id: String, description: String, name: String }
|
|
4
|
+
{ product_id: String, description: String, name: String, priority: Float }
|
|
5
5
|
|
|
6
6
|
class BaseThresholdCommit < MetronomeSDK::Internal::Type::BaseModel
|
|
7
7
|
attr_accessor product_id: String
|
|
@@ -14,13 +14,23 @@ module MetronomeSDK
|
|
|
14
14
|
|
|
15
15
|
def name=: (String) -> String
|
|
16
16
|
|
|
17
|
+
attr_reader priority: Float?
|
|
18
|
+
|
|
19
|
+
def priority=: (Float) -> Float
|
|
20
|
+
|
|
17
21
|
def initialize: (
|
|
18
22
|
product_id: String,
|
|
19
23
|
?description: String,
|
|
20
|
-
?name: String
|
|
24
|
+
?name: String,
|
|
25
|
+
?priority: Float
|
|
21
26
|
) -> void
|
|
22
27
|
|
|
23
|
-
def to_hash: -> {
|
|
28
|
+
def to_hash: -> {
|
|
29
|
+
product_id: String,
|
|
30
|
+
description: String,
|
|
31
|
+
name: String,
|
|
32
|
+
priority: Float
|
|
33
|
+
}
|
|
24
34
|
end
|
|
25
35
|
end
|
|
26
36
|
end
|