metronome-sdk 1.0.0 → 2.0.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 +55 -0
- data/README.md +1 -1
- data/lib/metronome_sdk/errors.rb +25 -11
- data/lib/metronome_sdk/file_part.rb +10 -7
- data/lib/metronome_sdk/internal/body_cursor_page.rb +1 -1
- data/lib/metronome_sdk/internal/cursor_page.rb +1 -1
- data/lib/metronome_sdk/internal/cursor_page_without_limit.rb +1 -1
- data/lib/metronome_sdk/internal/transport/base_client.rb +11 -7
- data/lib/metronome_sdk/internal/transport/pooled_net_requester.rb +7 -10
- data/lib/metronome_sdk/internal/type/base_page.rb +1 -1
- data/lib/metronome_sdk/internal/type/enum.rb +25 -0
- data/lib/metronome_sdk/internal/type/file_input.rb +7 -4
- data/lib/metronome_sdk/internal/util.rb +8 -7
- data/lib/metronome_sdk/models/contract_v2.rb +256 -6
- data/lib/metronome_sdk/models/contract_without_amendments.rb +2 -2
- data/lib/metronome_sdk/models/hierarchy_configuration.rb +99 -2
- data/lib/metronome_sdk/models/payment_gate_config.rb +1 -0
- data/lib/metronome_sdk/models/payment_gate_config_v2.rb +1 -0
- data/lib/metronome_sdk/models/subscription.rb +85 -1
- data/lib/metronome_sdk/models/v1/alert_archive_params.rb +8 -4
- data/lib/metronome_sdk/models/v1/alert_create_params.rb +38 -36
- data/lib/metronome_sdk/models/v1/contract_amend_params.rb +1 -0
- data/lib/metronome_sdk/models/v1/contract_create_params.rb +101 -3
- data/lib/metronome_sdk/models/v1/customer_detail.rb +9 -1
- data/lib/metronome_sdk/models/v1/customer_preview_events_params.rb +5 -15
- data/lib/metronome_sdk/models/v1/customer_preview_events_response.rb +3 -3
- data/lib/metronome_sdk/models/v1/customers/alert_list_params.rb +3 -3
- data/lib/metronome_sdk/models/v1/customers/alert_reset_params.rb +2 -2
- data/lib/metronome_sdk/models/v1/customers/alert_retrieve_params.rb +12 -12
- data/lib/metronome_sdk/models/v1/customers/customer_alert.rb +40 -38
- data/lib/metronome_sdk/models/v1/customers/invoice.rb +136 -18
- data/lib/metronome_sdk/models/v1/customers/invoice_retrieve_pdf_params.rb +30 -0
- data/lib/metronome_sdk/models/v1/payment.rb +151 -0
- data/lib/metronome_sdk/models/v1/payment_attempt_params.rb +28 -0
- data/lib/metronome_sdk/models/v1/payment_attempt_response.rb +18 -0
- data/lib/metronome_sdk/models/v1/payment_cancel_params.rb +28 -0
- data/lib/metronome_sdk/models/v1/payment_cancel_response.rb +18 -0
- data/lib/metronome_sdk/models/v1/payment_list_params.rb +53 -0
- data/lib/metronome_sdk/models/v1/payment_status.rb +19 -0
- data/lib/metronome_sdk/models/v2/contract_edit_commit_params.rb +9 -1
- data/lib/metronome_sdk/models/v2/contract_edit_credit_params.rb +9 -1
- data/lib/metronome_sdk/models/v2/contract_edit_params.rb +186 -3
- data/lib/metronome_sdk/models/v2/contract_get_edit_history_response.rb +195 -8
- data/lib/metronome_sdk/resources/v1/alerts.rb +57 -53
- data/lib/metronome_sdk/resources/v1/contracts.rb +4 -3
- data/lib/metronome_sdk/resources/v1/customers/alerts.rb +70 -51
- data/lib/metronome_sdk/resources/v1/customers/invoices.rb +55 -0
- data/lib/metronome_sdk/resources/v1/customers.rb +7 -4
- data/lib/metronome_sdk/resources/v1/payments.rb +102 -0
- data/lib/metronome_sdk/resources/v1/usage.rb +4 -2
- data/lib/metronome_sdk/resources/v1.rb +4 -0
- data/lib/metronome_sdk/resources/v2/contracts.rb +9 -3
- data/lib/metronome_sdk/version.rb +1 -1
- data/lib/metronome_sdk.rb +9 -0
- data/rbi/metronome_sdk/errors.rbi +29 -2
- data/rbi/metronome_sdk/file_part.rbi +1 -1
- data/rbi/metronome_sdk/internal/transport/base_client.rbi +4 -5
- data/rbi/metronome_sdk/internal/type/base_page.rbi +1 -1
- data/rbi/metronome_sdk/internal/util.rbi +1 -1
- data/rbi/metronome_sdk/models/contract_v2.rbi +603 -10
- data/rbi/metronome_sdk/models/contract_without_amendments.rbi +2 -2
- data/rbi/metronome_sdk/models/hierarchy_configuration.rbi +250 -6
- data/rbi/metronome_sdk/models/payment_gate_config.rbi +5 -0
- data/rbi/metronome_sdk/models/payment_gate_config_v2.rbi +5 -0
- data/rbi/metronome_sdk/models/subscription.rbi +175 -0
- data/rbi/metronome_sdk/models/v1/alert_archive_params.rbi +6 -4
- data/rbi/metronome_sdk/models/v1/alert_create_params.rbi +51 -47
- data/rbi/metronome_sdk/models/v1/contract_amend_params.rbi +5 -0
- data/rbi/metronome_sdk/models/v1/contract_create_params.rbi +257 -4
- data/rbi/metronome_sdk/models/v1/customer_detail.rbi +8 -0
- data/rbi/metronome_sdk/models/v1/customer_preview_events_params.rbi +6 -21
- data/rbi/metronome_sdk/models/v1/customer_preview_events_response.rbi +10 -9
- data/rbi/metronome_sdk/models/v1/customers/alert_list_params.rbi +4 -4
- data/rbi/metronome_sdk/models/v1/customers/alert_reset_params.rbi +2 -2
- data/rbi/metronome_sdk/models/v1/customers/alert_retrieve_params.rbi +14 -14
- data/rbi/metronome_sdk/models/v1/customers/customer_alert.rbi +48 -44
- data/rbi/metronome_sdk/models/v1/customers/invoice.rbi +246 -58
- data/rbi/metronome_sdk/models/v1/customers/invoice_retrieve_pdf_params.rbi +50 -0
- data/rbi/metronome_sdk/models/v1/payment.rbi +316 -0
- data/rbi/metronome_sdk/models/v1/payment_attempt_params.rbi +48 -0
- data/rbi/metronome_sdk/models/v1/payment_attempt_response.rbi +35 -0
- data/rbi/metronome_sdk/models/v1/payment_cancel_params.rbi +48 -0
- data/rbi/metronome_sdk/models/v1/payment_cancel_response.rbi +35 -0
- data/rbi/metronome_sdk/models/v1/payment_list_params.rbi +91 -0
- data/rbi/metronome_sdk/models/v1/payment_status.rbi +33 -0
- data/rbi/metronome_sdk/models/v2/contract_edit_commit_params.rbi +18 -0
- data/rbi/metronome_sdk/models/v2/contract_edit_credit_params.rbi +18 -0
- data/rbi/metronome_sdk/models/v2/contract_edit_params.rbi +498 -6
- data/rbi/metronome_sdk/models/v2/contract_get_edit_history_response.rbi +462 -14
- data/rbi/metronome_sdk/resources/v1/alerts.rbi +68 -64
- data/rbi/metronome_sdk/resources/v1/contracts.rbi +4 -3
- data/rbi/metronome_sdk/resources/v1/customers/alerts.rbi +73 -54
- data/rbi/metronome_sdk/resources/v1/customers/invoices.rbi +36 -0
- data/rbi/metronome_sdk/resources/v1/customers.rbi +7 -4
- data/rbi/metronome_sdk/resources/v1/payments.rbi +72 -0
- data/rbi/metronome_sdk/resources/v1/usage.rbi +4 -2
- data/rbi/metronome_sdk/resources/v1.rbi +3 -0
- data/rbi/metronome_sdk/resources/v2/contracts.rbi +14 -0
- data/sig/metronome_sdk/errors.rbs +7 -0
- data/sig/metronome_sdk/file_part.rbs +1 -1
- data/sig/metronome_sdk/models/contract_v2.rbs +239 -12
- data/sig/metronome_sdk/models/hierarchy_configuration.rbs +87 -6
- data/sig/metronome_sdk/models/payment_gate_config.rbs +2 -1
- data/sig/metronome_sdk/models/payment_gate_config_v2.rbs +2 -1
- data/sig/metronome_sdk/models/subscription.rbs +80 -0
- data/sig/metronome_sdk/models/v1/contract_amend_params.rbs +2 -1
- data/sig/metronome_sdk/models/v1/contract_create_params.rbs +91 -5
- data/sig/metronome_sdk/models/v1/customer_detail.rbs +5 -0
- data/sig/metronome_sdk/models/v1/customer_preview_events_params.rbs +0 -7
- data/sig/metronome_sdk/models/v1/customer_preview_events_response.rbs +6 -4
- data/sig/metronome_sdk/models/v1/customers/invoice.rbs +137 -24
- data/sig/metronome_sdk/models/v1/customers/invoice_retrieve_pdf_params.rbs +32 -0
- data/sig/metronome_sdk/models/v1/payment.rbs +191 -0
- data/sig/metronome_sdk/models/v1/payment_attempt_params.rbs +30 -0
- data/sig/metronome_sdk/models/v1/payment_attempt_response.rbs +15 -0
- data/sig/metronome_sdk/models/v1/payment_cancel_params.rbs +30 -0
- data/sig/metronome_sdk/models/v1/payment_cancel_response.rbs +15 -0
- data/sig/metronome_sdk/models/v1/payment_list_params.rbs +56 -0
- data/sig/metronome_sdk/models/v1/payment_status.rbs +19 -0
- data/sig/metronome_sdk/models/v2/contract_edit_commit_params.rbs +9 -0
- data/sig/metronome_sdk/models/v2/contract_edit_credit_params.rbs +9 -0
- data/sig/metronome_sdk/models/v2/contract_edit_params.rbs +182 -7
- data/sig/metronome_sdk/models/v2/contract_get_edit_history_response.rbs +221 -18
- data/sig/metronome_sdk/resources/v1/customers/invoices.rbs +6 -0
- data/sig/metronome_sdk/resources/v1/payments.rbs +30 -0
- data/sig/metronome_sdk/resources/v1.rbs +2 -0
- data/sig/metronome_sdk/resources/v2/contracts.rbs +3 -0
- metadata +29 -2
|
@@ -4,16 +4,15 @@ module MetronomeSDK
|
|
|
4
4
|
module Resources
|
|
5
5
|
class V1
|
|
6
6
|
class Alerts
|
|
7
|
-
# Create a new
|
|
8
|
-
# in real-time. Metronome's
|
|
9
|
-
# immediate evaluation capabilities, enabling you to
|
|
10
|
-
# accounts and prevent revenue leakage.
|
|
7
|
+
# Create a new threshold notification to monitor customer spending, balances, and
|
|
8
|
+
# billing metrics in real-time. Metronome's notification system provides
|
|
9
|
+
# industry-leading speed with immediate evaluation capabilities, enabling you to
|
|
10
|
+
# proactively manage customer accounts and prevent revenue leakage.
|
|
11
11
|
#
|
|
12
|
-
# This endpoint creates configurable
|
|
13
|
-
# billing thresholds including spend limits, credit balances,
|
|
14
|
-
# utilization, and invoice totals.
|
|
15
|
-
# customers or targeted to specific customer accounts.
|
|
16
|
-
# on certain alert types to further target alerts to groups of customers.
|
|
12
|
+
# This endpoint creates configurable threshold notifications that continuously
|
|
13
|
+
# monitor various billing thresholds including spend limits, credit balances,
|
|
14
|
+
# commitment utilization, and invoice totals. Threshold notifications can be
|
|
15
|
+
# configured globally for all customers or targeted to specific customer accounts.
|
|
17
16
|
#
|
|
18
17
|
# ### Use this endpoint to:
|
|
19
18
|
#
|
|
@@ -29,26 +28,27 @@ module MetronomeSDK
|
|
|
29
28
|
#
|
|
30
29
|
# A successful response returns a CustomerAlert object containing:
|
|
31
30
|
#
|
|
32
|
-
# - The
|
|
31
|
+
# - The threshold notification configuration with its unique ID and current status
|
|
33
32
|
# - The customer's evaluation status (ok, in_alarm, or evaluating)
|
|
34
|
-
# -
|
|
33
|
+
# - Threshold notification metadata including type, threshold values, and update
|
|
34
|
+
# timestamps
|
|
35
35
|
#
|
|
36
36
|
# ### Usage guidelines:
|
|
37
37
|
#
|
|
38
38
|
# - Immediate evaluation: Set `evaluate_on_create` : `true` (default) for instant
|
|
39
39
|
# evaluation against existing customers
|
|
40
|
-
# - Uniqueness constraints: Each
|
|
41
|
-
# your organization. Use `release_uniqueness_key` :
|
|
42
|
-
# reuse keys
|
|
43
|
-
# -
|
|
44
|
-
# `billable_metric_id` for usage
|
|
45
|
-
#
|
|
46
|
-
# - Webhook delivery:
|
|
47
|
-
# integration with your systems. Configure webhook endpoints before
|
|
48
|
-
#
|
|
49
|
-
# - Performance at scale: Metronome's event-driven architecture processes
|
|
50
|
-
# evaluations in real-time as usage events stream in,
|
|
51
|
-
# rely on periodic polling or batch evaluation cycles
|
|
40
|
+
# - Uniqueness constraints: Each threshold notification must have a unique
|
|
41
|
+
# `uniqueness_key` within your organization. Use `release_uniqueness_key` :
|
|
42
|
+
# `true` when archiving to reuse keys
|
|
43
|
+
# - Notification type requirements: Different threshold notification types require
|
|
44
|
+
# specific fields (e.g., `billable_metric_id` for usage notifications,
|
|
45
|
+
# `credit_type_id` for credit-based threshold notifications)
|
|
46
|
+
# - Webhook delivery: Threshold notifications trigger webhook notifications for
|
|
47
|
+
# real-time integration with your systems. Configure webhook endpoints before
|
|
48
|
+
# creating threshold notifications
|
|
49
|
+
# - Performance at scale: Metronome's event-driven architecture processes
|
|
50
|
+
# threshold notification evaluations in real-time as usage events stream in,
|
|
51
|
+
# unlike competitors who rely on periodic polling or batch evaluation cycles
|
|
52
52
|
sig do
|
|
53
53
|
params(
|
|
54
54
|
alert_type:
|
|
@@ -73,42 +73,44 @@ module MetronomeSDK
|
|
|
73
73
|
).returns(MetronomeSDK::Models::V1::AlertCreateResponse)
|
|
74
74
|
end
|
|
75
75
|
def create(
|
|
76
|
-
# Type of the
|
|
76
|
+
# Type of the threshold notification
|
|
77
77
|
alert_type:,
|
|
78
|
-
# Name of the
|
|
78
|
+
# Name of the threshold notification
|
|
79
79
|
name:,
|
|
80
|
-
# Threshold value of the
|
|
81
|
-
# may represent a financial amount, the days remaining, or a
|
|
80
|
+
# Threshold value of the notification policy. Depending upon the notification
|
|
81
|
+
# type, this number may represent a financial amount, the days remaining, or a
|
|
82
|
+
# percentage reached.
|
|
82
83
|
threshold:,
|
|
83
|
-
# For
|
|
84
|
-
# track the usage for.
|
|
84
|
+
# For threshold notifications of type `usage_threshold_reached`, specifies which
|
|
85
|
+
# billable metric to track the usage for.
|
|
85
86
|
billable_metric_id: nil,
|
|
86
|
-
# An array of strings, representing a way to filter the credit grant this
|
|
87
|
-
# applies to, by looking at the credit_grant_type field on
|
|
88
|
-
# field is only defined for CreditPercentage and
|
|
87
|
+
# An array of strings, representing a way to filter the credit grant this
|
|
88
|
+
# threshold notification applies to, by looking at the credit_grant_type field on
|
|
89
|
+
# the credit grant. This field is only defined for CreditPercentage and
|
|
90
|
+
# CreditBalance notifications
|
|
89
91
|
credit_grant_type_filters: nil,
|
|
90
|
-
# ID of the credit's currency, defaults to USD. If the specific
|
|
92
|
+
# ID of the credit's currency, defaults to USD. If the specific notification type
|
|
91
93
|
# requires a pricing unit/currency, find the ID in the
|
|
92
94
|
# [Metronome app](https://app.metronome.com/offering/pricing-units).
|
|
93
95
|
credit_type_id: nil,
|
|
94
|
-
# A list of custom field filters for
|
|
95
|
-
# Only present for contract invoices.
|
|
96
|
+
# A list of custom field filters for threshold notification types that support
|
|
97
|
+
# advanced filtering. Only present for contract invoices.
|
|
96
98
|
custom_field_filters: nil,
|
|
97
|
-
# If provided, will create this
|
|
98
|
-
#
|
|
99
|
+
# If provided, will create this threshold notification for this specific customer.
|
|
100
|
+
# To create a notification for all customers, do not specify a `customer_id`.
|
|
99
101
|
customer_id: nil,
|
|
100
|
-
# If true, the
|
|
101
|
-
#
|
|
102
|
-
# trigger the
|
|
102
|
+
# If true, the threshold notification will evaluate immediately on customers that
|
|
103
|
+
# already meet the notification threshold. If false, it will only evaluate on
|
|
104
|
+
# future customers that trigger the threshold. Defaults to true.
|
|
103
105
|
evaluate_on_create: nil,
|
|
104
|
-
# Only present for `spend_threshold_reached`
|
|
105
|
-
# group key on individual line items.
|
|
106
|
+
# Only present for `spend_threshold_reached` notifications. Scope notification to
|
|
107
|
+
# a specific group key on individual line items.
|
|
106
108
|
group_values: nil,
|
|
107
|
-
# Only supported for invoice_total_reached
|
|
108
|
-
# evaluate.
|
|
109
|
+
# Only supported for invoice_total_reached threshold notifications. A list of
|
|
110
|
+
# invoice types to evaluate.
|
|
109
111
|
invoice_types_filter: nil,
|
|
110
|
-
# If provided, will create this
|
|
111
|
-
# for all customers, do not specify a `plan_id`.
|
|
112
|
+
# If provided, will create this threshold notification for this specific plan. To
|
|
113
|
+
# create a notification for all customers, do not specify a `plan_id`.
|
|
112
114
|
plan_id: nil,
|
|
113
115
|
# Prevents the creation of duplicates. If a request to create a record is made
|
|
114
116
|
# with a previously used uniqueness key, a new record will not be created and the
|
|
@@ -118,33 +120,34 @@ module MetronomeSDK
|
|
|
118
120
|
)
|
|
119
121
|
end
|
|
120
122
|
|
|
121
|
-
# Permanently disable
|
|
122
|
-
# customers. Archived
|
|
123
|
-
# release their uniqueness key for reuse
|
|
123
|
+
# Permanently disable a threshold notification and remove it from active
|
|
124
|
+
# monitoring across all customers. Archived threshold notifications stop
|
|
125
|
+
# evaluating immediately and can optionally release their uniqueness key for reuse
|
|
126
|
+
# in future threshold notification configurations.
|
|
124
127
|
#
|
|
125
128
|
# ### Use this endpoint to:
|
|
126
129
|
#
|
|
127
|
-
# - Decommission
|
|
128
|
-
# - Clean up test or deprecated
|
|
129
|
-
# - Free up uniqueness keys for reuse with new
|
|
130
|
-
# - Stop
|
|
130
|
+
# - Decommission threshold notifications that are no longer needed
|
|
131
|
+
# - Clean up test or deprecated threshold notification configurations
|
|
132
|
+
# - Free up uniqueness keys for reuse with new threshold notifications
|
|
133
|
+
# - Stop threshold notification evaluations without losing historical
|
|
134
|
+
# configuration data
|
|
131
135
|
# - Disable outdated monitoring rules during pricing model transitions
|
|
132
136
|
#
|
|
133
137
|
# ### Key response fields:
|
|
134
138
|
#
|
|
135
|
-
# - data: Object containing the archived
|
|
136
|
-
# - Alert evaluation stops immediately for all affected customers
|
|
137
|
-
# - Historical alert data and configurations remain accessible for audit purposes
|
|
139
|
+
# - data: Object containing the archived threshold notification's ID
|
|
138
140
|
#
|
|
139
141
|
# ### Usage guidelines:
|
|
140
142
|
#
|
|
141
|
-
# - Irreversible for evaluation: Archived
|
|
142
|
-
# new
|
|
143
|
+
# - Irreversible for evaluation: Archived threshold notifications cannot be
|
|
144
|
+
# re-enabled; create a new threshold notification to resume monitoring
|
|
143
145
|
# - Uniqueness key handling: Set `release_uniqueness_key` : `true` to reuse the
|
|
144
|
-
# key in future
|
|
145
|
-
# - Immediate effect:
|
|
146
|
-
#
|
|
147
|
-
#
|
|
146
|
+
# key in future threshold notifications
|
|
147
|
+
# - Immediate effect: Threshold notification evaluation stops instantly across all
|
|
148
|
+
# customers
|
|
149
|
+
# - Historical preservation: Archive operation maintains threshold notification
|
|
150
|
+
# history and configuration for compliance and auditing
|
|
148
151
|
sig do
|
|
149
152
|
params(
|
|
150
153
|
id: String,
|
|
@@ -153,9 +156,10 @@ module MetronomeSDK
|
|
|
153
156
|
).returns(MetronomeSDK::Models::V1::AlertArchiveResponse)
|
|
154
157
|
end
|
|
155
158
|
def archive(
|
|
156
|
-
# The Metronome ID of the
|
|
159
|
+
# The Metronome ID of the threshold notification
|
|
157
160
|
id:,
|
|
158
|
-
# If true, resets the uniqueness key on this
|
|
161
|
+
# If true, resets the uniqueness key on this threshold notification so it can be
|
|
162
|
+
# re-used
|
|
159
163
|
release_uniqueness_key: nil,
|
|
160
164
|
request_options: {}
|
|
161
165
|
)
|
|
@@ -736,11 +736,12 @@ module MetronomeSDK
|
|
|
736
736
|
)
|
|
737
737
|
end
|
|
738
738
|
|
|
739
|
-
# Update or
|
|
739
|
+
# Update or add an end date to a contract. Ending a contract early will impact
|
|
740
740
|
# draft usage statements, truncate any terms, and remove upcoming scheduled
|
|
741
741
|
# invoices. Moving the date into the future will only extend the contract length.
|
|
742
|
-
# Terms and scheduled invoices are not extended.
|
|
743
|
-
# has changed or if a perpetual
|
|
742
|
+
# Terms and scheduled invoices are not extended. In-advance subscriptions will not
|
|
743
|
+
# be extended. Use this if a contract's end date has changed or if a perpetual
|
|
744
|
+
# contract ends.
|
|
744
745
|
sig do
|
|
745
746
|
params(
|
|
746
747
|
contract_id: String,
|
|
@@ -5,17 +5,26 @@ module MetronomeSDK
|
|
|
5
5
|
class V1
|
|
6
6
|
class Customers
|
|
7
7
|
class Alerts
|
|
8
|
-
# Retrieve the real-time evaluation status for a specific
|
|
9
|
-
# This endpoint provides instant visibility into
|
|
10
|
-
#
|
|
11
|
-
# action based on current
|
|
8
|
+
# Retrieve the real-time evaluation status for a specific threshold
|
|
9
|
+
# notification-customer pair. This endpoint provides instant visibility into
|
|
10
|
+
# whether a customer has triggered a threshold notification condition, enabling
|
|
11
|
+
# you to monitor account health and take proactive action based on current
|
|
12
|
+
# threshold notification states.
|
|
12
13
|
#
|
|
13
14
|
# ### Use this endpoint to:
|
|
14
15
|
#
|
|
15
|
-
# - Check if a specific customer is currently violating an
|
|
16
|
+
# - Check if a specific customer is currently violating an threshold notification
|
|
16
17
|
# (`in_alarm` status)
|
|
17
|
-
# - Verify
|
|
18
|
-
#
|
|
18
|
+
# - Verify threshold notification configuration details and threshold values for a
|
|
19
|
+
# customer
|
|
20
|
+
# - Monitor the evaluation state of newly created or recently modified threshold
|
|
21
|
+
# notification
|
|
22
|
+
# - Build dashboards or automated workflows that respond to specific threshold
|
|
23
|
+
# notification conditions
|
|
24
|
+
# - Validate threshold notification behavior before deploying to production
|
|
25
|
+
# customers
|
|
26
|
+
# - Integrate threshold notification status checks into customer support tools or
|
|
27
|
+
# admin interfaces
|
|
19
28
|
#
|
|
20
29
|
# ### Key response fields:
|
|
21
30
|
#
|
|
@@ -24,29 +33,32 @@ module MetronomeSDK
|
|
|
24
33
|
# - `customer_status`: The current evaluation state
|
|
25
34
|
#
|
|
26
35
|
# - `ok` - Customer is within acceptable thresholds
|
|
27
|
-
# - `in_alarm
|
|
28
|
-
# - `evaluating` -
|
|
29
|
-
#
|
|
30
|
-
# - `null` -
|
|
31
|
-
# - `triggered_by`: Additional context about what caused the
|
|
32
|
-
# (when applicable)
|
|
33
|
-
# - alert: Complete
|
|
34
|
-
# -
|
|
36
|
+
# - `in_alarm` - Customer has breached the threshold for the notification
|
|
37
|
+
# - `evaluating` - Notification is currently being evaluated (typically during
|
|
38
|
+
# initial setup)
|
|
39
|
+
# - `null` - Notification has been archived
|
|
40
|
+
# - `triggered_by`: Additional context about what caused the notification to
|
|
41
|
+
# trigger (when applicable)
|
|
42
|
+
# - alert: Complete threshold notification configuration including:
|
|
43
|
+
# - Notification ID, name, and type
|
|
35
44
|
# - Current threshold values and credit type information
|
|
36
|
-
# -
|
|
45
|
+
# - Notification status (enabled, disabled, or archived)
|
|
37
46
|
# - Last update timestamp
|
|
38
47
|
# - Any applied filters (credit grant types, custom fields, group values)
|
|
39
48
|
#
|
|
40
49
|
# ### Usage guidelines:
|
|
41
50
|
#
|
|
42
51
|
# - Customer status: Returns the current evaluation state, not historical data.
|
|
43
|
-
# For
|
|
44
|
-
# -
|
|
45
|
-
#
|
|
46
|
-
# -
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
52
|
+
# For threshold notification history, use webhook notifications or event logs
|
|
53
|
+
# - Required parameters: Both customer_id and alert_id must be valid UUIDs that
|
|
54
|
+
# exist in your organization
|
|
55
|
+
# - Archived notifications: Returns null for customer_status if the notification
|
|
56
|
+
# has been archived, but still includes the notification configuration details
|
|
57
|
+
# - Performance considerations: This endpoint queries live evaluation state,
|
|
58
|
+
# making it ideal for real-time monitoring but not for bulk status checks
|
|
59
|
+
# - Integration patterns: Best used for on-demand status checks in response to
|
|
60
|
+
# user actions or as part of targeted monitoring workflows
|
|
61
|
+
# - Error handling: Returns 404 if either the customer or alert_id doesn't exist
|
|
50
62
|
# or isn't accessible to your organization
|
|
51
63
|
sig do
|
|
52
64
|
params(
|
|
@@ -64,45 +76,51 @@ module MetronomeSDK
|
|
|
64
76
|
)
|
|
65
77
|
end
|
|
66
78
|
def retrieve(
|
|
67
|
-
# The Metronome ID of the
|
|
79
|
+
# The Metronome ID of the threshold notification
|
|
68
80
|
alert_id:,
|
|
69
81
|
# The Metronome ID of the customer
|
|
70
82
|
customer_id:,
|
|
71
|
-
# Only present for `spend_threshold_reached`
|
|
72
|
-
# specific group key-value pair.
|
|
83
|
+
# Only present for `spend_threshold_reached` notifications. Retrieve the
|
|
84
|
+
# notification for a specific group key-value pair.
|
|
73
85
|
group_values: nil,
|
|
74
|
-
# When parallel
|
|
75
|
-
# fetch
|
|
86
|
+
# When parallel threshold notifications are enabled during migration, this flag
|
|
87
|
+
# denotes whether to fetch notifications for plans or contracts.
|
|
76
88
|
plans_or_contracts: nil,
|
|
77
89
|
request_options: {}
|
|
78
90
|
)
|
|
79
91
|
end
|
|
80
92
|
|
|
81
|
-
# Retrieve all
|
|
82
|
-
# customer in a single API call. This endpoint provides a
|
|
83
|
-
# all
|
|
93
|
+
# Retrieve all threshold notification configurations and their current statuses
|
|
94
|
+
# for a specific customer in a single API call. This endpoint provides a
|
|
95
|
+
# comprehensive view of all threshold notification monitoring a customer account.
|
|
84
96
|
#
|
|
85
97
|
# ### Use this endpoint to:
|
|
86
98
|
#
|
|
87
|
-
# - Display all active
|
|
88
|
-
#
|
|
89
|
-
# -
|
|
90
|
-
#
|
|
99
|
+
# - Display all active threshold notifications for a customer in dashboards or
|
|
100
|
+
# admin panels
|
|
101
|
+
# - Quickly identify which threshold notifications a customer is currently
|
|
102
|
+
# triggering
|
|
103
|
+
# - Audit threshold notification coverage for specific accounts
|
|
104
|
+
# - Filter threshold notifications by status (enabled, disabled, or archived)
|
|
91
105
|
#
|
|
92
106
|
# ### Key response fields:
|
|
93
107
|
#
|
|
94
108
|
# - data: Array of CustomerAlert objects, each containing:
|
|
95
109
|
# - Current evaluation status (`ok`, `in_alarm`, `evaluating`, or `null`)
|
|
96
|
-
# - Complete
|
|
97
|
-
# -
|
|
98
|
-
# -
|
|
110
|
+
# - Complete threshold notification configuration and threshold details
|
|
111
|
+
# - Threshold notification metadata including type, name, and last update time
|
|
112
|
+
# - next_page: Pagination cursor for retrieving additional results
|
|
99
113
|
#
|
|
100
114
|
# ### Usage guidelines:
|
|
101
115
|
#
|
|
102
|
-
# - Default behavior: Returns only enabled
|
|
103
|
-
# specified
|
|
116
|
+
# - Default behavior: Returns only enabled threshold notifications unless
|
|
117
|
+
# `alert_statuses` filter is specified
|
|
104
118
|
# - Pagination: Use the `next_page` cursor to retrieve all results for customers
|
|
105
|
-
# with many
|
|
119
|
+
# with many notifications
|
|
120
|
+
# - Performance: Efficiently retrieves multiple threshold notification statuses in
|
|
121
|
+
# a single request instead of making individual calls
|
|
122
|
+
# - Filtering: Pass the `alert_statuses` array to include disabled or archived
|
|
123
|
+
# threshold notifications in results
|
|
106
124
|
sig do
|
|
107
125
|
params(
|
|
108
126
|
customer_id: String,
|
|
@@ -123,30 +141,31 @@ module MetronomeSDK
|
|
|
123
141
|
customer_id:,
|
|
124
142
|
# Query param: Cursor that indicates where the next page of results should start.
|
|
125
143
|
next_page: nil,
|
|
126
|
-
# Body param: Optionally filter by
|
|
127
|
-
# will be returned.
|
|
144
|
+
# Body param: Optionally filter by threshold notification status. If absent, only
|
|
145
|
+
# enabled notifications will be returned.
|
|
128
146
|
alert_statuses: nil,
|
|
129
147
|
request_options: {}
|
|
130
148
|
)
|
|
131
149
|
end
|
|
132
150
|
|
|
133
|
-
# Force an immediate re-evaluation of a specific
|
|
134
|
-
# any previous state and triggering a fresh assessment against
|
|
135
|
-
# This endpoint ensures
|
|
136
|
-
# corrections.
|
|
151
|
+
# Force an immediate re-evaluation of a specific threshold notification for a
|
|
152
|
+
# customer, clearing any previous state and triggering a fresh assessment against
|
|
153
|
+
# current thresholds. This endpoint ensures threshold notification accuracy after
|
|
154
|
+
# configuration changes or data corrections.
|
|
137
155
|
#
|
|
138
156
|
# ### Use this endpoint to:
|
|
139
157
|
#
|
|
140
|
-
# - Clear false positive
|
|
141
|
-
# - Re-evaluate
|
|
142
|
-
#
|
|
143
|
-
# -
|
|
158
|
+
# - Clear false positive threshold notifications after fixing data issues
|
|
159
|
+
# - Re-evaluate threshold notifications after adjusting customer balances or
|
|
160
|
+
# credits
|
|
161
|
+
# - Test threshold notification behavior during development and debugging
|
|
162
|
+
# - Resolve stuck threshold notification that may be in an incorrect state
|
|
144
163
|
# - Trigger immediate evaluation after threshold modifications
|
|
145
164
|
#
|
|
146
165
|
# ### Key response fields:
|
|
147
166
|
#
|
|
148
|
-
# - 200 Success: Confirmation that the
|
|
149
|
-
# initiated
|
|
167
|
+
# - 200 Success: Confirmation that the threshold notification has been reset and
|
|
168
|
+
# re-evaluation initiated
|
|
150
169
|
# - No response body is returned - the operation completes asynchronously
|
|
151
170
|
#
|
|
152
171
|
# ### Usage guidelines:
|
|
@@ -166,7 +185,7 @@ module MetronomeSDK
|
|
|
166
185
|
).void
|
|
167
186
|
end
|
|
168
187
|
def reset(
|
|
169
|
-
# The Metronome ID of the
|
|
188
|
+
# The Metronome ID of the threshold notification
|
|
170
189
|
alert_id:,
|
|
171
190
|
# The Metronome ID of the customer
|
|
172
191
|
customer_id:,
|
|
@@ -287,6 +287,42 @@ module MetronomeSDK
|
|
|
287
287
|
)
|
|
288
288
|
end
|
|
289
289
|
|
|
290
|
+
# Retrieve a PDF version of a specific invoice by its unique identifier. This
|
|
291
|
+
# endpoint generates a professionally formatted invoice document suitable for
|
|
292
|
+
# sharing with customers, accounting teams, or for record-keeping purposes.
|
|
293
|
+
#
|
|
294
|
+
# ### Use this endpoint to:
|
|
295
|
+
#
|
|
296
|
+
# - Provide customers with downloadable or emailable copies of their invoices
|
|
297
|
+
# - Support accounting and finance teams with official billing documents
|
|
298
|
+
# - Maintain accurate records of billing transactions for audits and compliance
|
|
299
|
+
#
|
|
300
|
+
# ### Key response details:
|
|
301
|
+
#
|
|
302
|
+
# - The response is a binary PDF file representing the full invoice
|
|
303
|
+
# - The PDF includes all standard invoice information such as line items, totals,
|
|
304
|
+
# billing period, and customer details
|
|
305
|
+
# - The document is formatted for clarity and professionalism, suitable for
|
|
306
|
+
# official use
|
|
307
|
+
#
|
|
308
|
+
# ### Usage guidelines:
|
|
309
|
+
#
|
|
310
|
+
# - Ensure the `invoice_id` corresponds to an existing invoice for the specified
|
|
311
|
+
# `customer_id`
|
|
312
|
+
# - The PDF is generated on-demand; frequent requests for the same invoice may
|
|
313
|
+
# impact performance
|
|
314
|
+
# - Use appropriate headers to handle the binary response in your application
|
|
315
|
+
# (e.g., setting `Content-Type: application/pdf`)
|
|
316
|
+
sig do
|
|
317
|
+
params(
|
|
318
|
+
customer_id: String,
|
|
319
|
+
invoice_id: String,
|
|
320
|
+
request_options: MetronomeSDK::RequestOptions::OrHash
|
|
321
|
+
).returns(StringIO)
|
|
322
|
+
end
|
|
323
|
+
def retrieve_pdf(customer_id:, invoice_id:, request_options: {})
|
|
324
|
+
end
|
|
325
|
+
|
|
290
326
|
# @api private
|
|
291
327
|
sig { params(client: MetronomeSDK::Client).returns(T.attached_class) }
|
|
292
328
|
def self.new(client:)
|
|
@@ -156,7 +156,7 @@ module MetronomeSDK
|
|
|
156
156
|
# - Ingest aliases remain idempotent for archived customers. In order to reuse an
|
|
157
157
|
# ingest alias, first remove the ingest alias from the customer prior to
|
|
158
158
|
# archiving.
|
|
159
|
-
# - Any
|
|
159
|
+
# - Any notifications associated with the customer will no longer be triggered.
|
|
160
160
|
sig do
|
|
161
161
|
params(
|
|
162
162
|
id: String,
|
|
@@ -232,10 +232,10 @@ module MetronomeSDK
|
|
|
232
232
|
)
|
|
233
233
|
end
|
|
234
234
|
|
|
235
|
-
# Preview how a set of events will affect a customer's
|
|
236
|
-
#
|
|
235
|
+
# Preview how a set of events will affect a customer's invoices. Generates draft
|
|
236
|
+
# invoices for a customer using their current contract configuration and the
|
|
237
237
|
# provided events. This is useful for testing how new events will affect the
|
|
238
|
-
# customer's
|
|
238
|
+
# customer's invoices before they are actually processed.
|
|
239
239
|
sig do
|
|
240
240
|
params(
|
|
241
241
|
customer_id: String,
|
|
@@ -300,6 +300,9 @@ module MetronomeSDK
|
|
|
300
300
|
# through system A (e.g. Stripe) but will now be billed through system B (e.g.
|
|
301
301
|
# AWS). Once created, the new configuration can then be associated to the
|
|
302
302
|
# customer's contract.
|
|
303
|
+
# - Multiple configurations can be added per destination. For example, you can
|
|
304
|
+
# create two Stripe billing configurations for a Metronome customer that each
|
|
305
|
+
# have a distinct `collection_method`.
|
|
303
306
|
#
|
|
304
307
|
# ### Delivery method options:
|
|
305
308
|
#
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module MetronomeSDK
|
|
4
|
+
module Resources
|
|
5
|
+
class V1
|
|
6
|
+
class Payments
|
|
7
|
+
# Fetch all payment attempts for the given invoice.
|
|
8
|
+
sig do
|
|
9
|
+
params(
|
|
10
|
+
customer_id: String,
|
|
11
|
+
invoice_id: String,
|
|
12
|
+
limit: Integer,
|
|
13
|
+
next_page: String,
|
|
14
|
+
statuses: T::Array[MetronomeSDK::V1::PaymentStatus::OrSymbol],
|
|
15
|
+
request_options: MetronomeSDK::RequestOptions::OrHash
|
|
16
|
+
).returns(
|
|
17
|
+
MetronomeSDK::Internal::BodyCursorPage[MetronomeSDK::V1::Payment]
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
def list(
|
|
21
|
+
customer_id:,
|
|
22
|
+
invoice_id:,
|
|
23
|
+
# The maximum number of payments to return. Defaults to 25.
|
|
24
|
+
limit: nil,
|
|
25
|
+
# The next page token from a previous response.
|
|
26
|
+
next_page: nil,
|
|
27
|
+
statuses: nil,
|
|
28
|
+
request_options: {}
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Trigger a new attempt by canceling any existing attempts for this invoice and
|
|
33
|
+
# creating a new Payment. This will trigger another attempt to charge the
|
|
34
|
+
# Customer's configured Payment Gateway. Payment can only be attempted if all of
|
|
35
|
+
# the following are true:
|
|
36
|
+
#
|
|
37
|
+
# - The Metronome Invoice is finalized
|
|
38
|
+
# - PLG Invoicing is configured for the Customer
|
|
39
|
+
# - You cannot attempt payments for invoices that have already been `paid` or
|
|
40
|
+
# `voided`.
|
|
41
|
+
#
|
|
42
|
+
# Attempting to payment on an ineligible Invoice or Customer will result in a
|
|
43
|
+
# `400` response.
|
|
44
|
+
sig do
|
|
45
|
+
params(
|
|
46
|
+
customer_id: String,
|
|
47
|
+
invoice_id: String,
|
|
48
|
+
request_options: MetronomeSDK::RequestOptions::OrHash
|
|
49
|
+
).returns(MetronomeSDK::Models::V1::PaymentAttemptResponse)
|
|
50
|
+
end
|
|
51
|
+
def attempt(customer_id:, invoice_id:, request_options: {})
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Cancel an existing payment attempt for an invoice.
|
|
55
|
+
sig do
|
|
56
|
+
params(
|
|
57
|
+
customer_id: String,
|
|
58
|
+
invoice_id: String,
|
|
59
|
+
request_options: MetronomeSDK::RequestOptions::OrHash
|
|
60
|
+
).returns(MetronomeSDK::Models::V1::PaymentCancelResponse)
|
|
61
|
+
end
|
|
62
|
+
def cancel(customer_id:, invoice_id:, request_options: {})
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# @api private
|
|
66
|
+
sig { params(client: MetronomeSDK::Client).returns(T.attached_class) }
|
|
67
|
+
def self.new(client:)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -84,8 +84,7 @@ module MetronomeSDK
|
|
|
84
84
|
# ingestion, supports backdating 34 days, and is built to handle mission-critical
|
|
85
85
|
# usage data with enterprise-grade reliability. Metronome supports 100,000 events
|
|
86
86
|
# per second without requiring pre-aggregation or rollups and can scale up from
|
|
87
|
-
# there. See
|
|
88
|
-
# [Getting usage into Metronome](https://docs.metronome.com/connect-metronome/) to
|
|
87
|
+
# there. See the [Send usage events](/guides/events/send-usage-events) guide to
|
|
89
88
|
# learn more about usage events.
|
|
90
89
|
#
|
|
91
90
|
# ### Use this endpoint to:
|
|
@@ -128,6 +127,9 @@ module MetronomeSDK
|
|
|
128
127
|
# }
|
|
129
128
|
# ```
|
|
130
129
|
#
|
|
130
|
+
# Learn more about
|
|
131
|
+
# [usage event structure definitions](/guides/events/design-usage-events).
|
|
132
|
+
#
|
|
131
133
|
# #### Transaction ID
|
|
132
134
|
#
|
|
133
135
|
# The transaction_id serves as your idempotency key, ensuring events are processed
|
|
@@ -42,6 +42,9 @@ module MetronomeSDK
|
|
|
42
42
|
sig { returns(MetronomeSDK::Resources::V1::Contracts) }
|
|
43
43
|
attr_reader :contracts
|
|
44
44
|
|
|
45
|
+
sig { returns(MetronomeSDK::Resources::V1::Payments) }
|
|
46
|
+
attr_reader :payments
|
|
47
|
+
|
|
45
48
|
# @api private
|
|
46
49
|
sig { params(client: MetronomeSDK::Client).returns(T.attached_class) }
|
|
47
50
|
def self.new(client:)
|