metronome-sdk 1.0.0 → 2.1.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.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +91 -0
  3. data/README.md +1 -1
  4. data/lib/metronome_sdk/errors.rb +25 -11
  5. data/lib/metronome_sdk/file_part.rb +10 -7
  6. data/lib/metronome_sdk/internal/body_cursor_page.rb +1 -1
  7. data/lib/metronome_sdk/internal/cursor_page.rb +1 -1
  8. data/lib/metronome_sdk/internal/cursor_page_without_limit.rb +1 -1
  9. data/lib/metronome_sdk/internal/transport/base_client.rb +11 -7
  10. data/lib/metronome_sdk/internal/transport/pooled_net_requester.rb +34 -31
  11. data/lib/metronome_sdk/internal/type/base_page.rb +1 -1
  12. data/lib/metronome_sdk/internal/type/enum.rb +25 -0
  13. data/lib/metronome_sdk/internal/type/file_input.rb +7 -4
  14. data/lib/metronome_sdk/internal/util.rb +8 -7
  15. data/lib/metronome_sdk/models/contract.rb +1 -0
  16. data/lib/metronome_sdk/models/contract_v2.rb +275 -6
  17. data/lib/metronome_sdk/models/contract_without_amendments.rb +2 -2
  18. data/lib/metronome_sdk/models/hierarchy_configuration.rb +123 -2
  19. data/lib/metronome_sdk/models/payment_gate_config.rb +1 -0
  20. data/lib/metronome_sdk/models/payment_gate_config_v2.rb +1 -0
  21. data/lib/metronome_sdk/models/subscription.rb +95 -1
  22. data/lib/metronome_sdk/models/v1/alert_archive_params.rb +8 -4
  23. data/lib/metronome_sdk/models/v1/alert_create_params.rb +38 -36
  24. data/lib/metronome_sdk/models/v1/contract_amend_params.rb +1 -0
  25. data/lib/metronome_sdk/models/v1/contract_create_params.rb +157 -9
  26. data/lib/metronome_sdk/models/v1/contract_list_balances_params.rb +9 -1
  27. data/lib/metronome_sdk/models/v1/customer_create_params.rb +11 -1
  28. data/lib/metronome_sdk/models/v1/customer_detail.rb +9 -1
  29. data/lib/metronome_sdk/models/v1/customer_preview_events_params.rb +19 -25
  30. data/lib/metronome_sdk/models/v1/customer_preview_events_response.rb +3 -3
  31. data/lib/metronome_sdk/models/v1/customer_retrieve_billing_configurations_response.rb +1 -0
  32. data/lib/metronome_sdk/models/v1/customer_set_billing_configurations_params.rb +1 -0
  33. data/lib/metronome_sdk/models/v1/customers/alert_list_params.rb +3 -3
  34. data/lib/metronome_sdk/models/v1/customers/alert_reset_params.rb +2 -2
  35. data/lib/metronome_sdk/models/v1/customers/alert_retrieve_params.rb +12 -12
  36. data/lib/metronome_sdk/models/v1/customers/billing_config_create_params.rb +6 -1
  37. data/lib/metronome_sdk/models/v1/customers/billing_config_delete_params.rb +1 -0
  38. data/lib/metronome_sdk/models/v1/customers/billing_config_retrieve_params.rb +1 -0
  39. data/lib/metronome_sdk/models/v1/customers/billing_config_retrieve_response.rb +6 -1
  40. data/lib/metronome_sdk/models/v1/customers/commit_create_params.rb +1 -1
  41. data/lib/metronome_sdk/models/v1/customers/customer_alert.rb +41 -38
  42. data/lib/metronome_sdk/models/v1/customers/invoice.rb +256 -16
  43. data/lib/metronome_sdk/models/v1/customers/invoice_retrieve_pdf_params.rb +30 -0
  44. data/lib/metronome_sdk/models/v1/payment.rb +157 -0
  45. data/lib/metronome_sdk/models/v1/payment_attempt_params.rb +28 -0
  46. data/lib/metronome_sdk/models/v1/payment_attempt_response.rb +18 -0
  47. data/lib/metronome_sdk/models/v1/payment_cancel_params.rb +28 -0
  48. data/lib/metronome_sdk/models/v1/payment_cancel_response.rb +18 -0
  49. data/lib/metronome_sdk/models/v1/payment_list_params.rb +53 -0
  50. data/lib/metronome_sdk/models/v1/payment_status.rb +19 -0
  51. data/lib/metronome_sdk/models/v1/setting_upsert_avalara_credentials_params.rb +65 -0
  52. data/lib/metronome_sdk/models/v1/setting_upsert_avalara_credentials_response.rb +12 -0
  53. data/lib/metronome_sdk/models/v1/settings/billing_provider_create_params.rb +73 -0
  54. data/lib/metronome_sdk/models/v1/settings/billing_provider_create_response.rb +31 -0
  55. data/lib/metronome_sdk/models/v1/settings/billing_provider_list_params.rb +26 -0
  56. data/lib/metronome_sdk/models/v1/settings/billing_provider_list_response.rb +105 -0
  57. data/lib/metronome_sdk/models/v2/contract_edit_commit_params.rb +9 -1
  58. data/lib/metronome_sdk/models/v2/contract_edit_credit_params.rb +9 -1
  59. data/lib/metronome_sdk/models/v2/contract_edit_params.rb +219 -9
  60. data/lib/metronome_sdk/models/v2/contract_get_edit_history_response.rb +195 -8
  61. data/lib/metronome_sdk/resources/v1/alerts.rb +57 -53
  62. data/lib/metronome_sdk/resources/v1/contracts.rb +8 -5
  63. data/lib/metronome_sdk/resources/v1/credit_grants.rb +10 -5
  64. data/lib/metronome_sdk/resources/v1/customers/alerts.rb +70 -51
  65. data/lib/metronome_sdk/resources/v1/customers/billing_config.rb +7 -4
  66. data/lib/metronome_sdk/resources/v1/customers/commits.rb +2 -1
  67. data/lib/metronome_sdk/resources/v1/customers/invoices.rb +57 -1
  68. data/lib/metronome_sdk/resources/v1/customers/plans.rb +8 -4
  69. data/lib/metronome_sdk/resources/v1/customers.rb +13 -8
  70. data/lib/metronome_sdk/resources/v1/payments.rb +102 -0
  71. data/lib/metronome_sdk/resources/v1/plans.rb +8 -4
  72. data/lib/metronome_sdk/resources/v1/settings/billing_providers.rb +75 -0
  73. data/lib/metronome_sdk/resources/v1/settings.rb +55 -0
  74. data/lib/metronome_sdk/resources/v1/usage.rb +4 -2
  75. data/lib/metronome_sdk/resources/v1.rb +8 -0
  76. data/lib/metronome_sdk/resources/v2/contracts.rb +9 -3
  77. data/lib/metronome_sdk/version.rb +1 -1
  78. data/lib/metronome_sdk.rb +17 -0
  79. data/rbi/metronome_sdk/errors.rbi +29 -2
  80. data/rbi/metronome_sdk/file_part.rbi +1 -1
  81. data/rbi/metronome_sdk/internal/transport/base_client.rbi +4 -5
  82. data/rbi/metronome_sdk/internal/type/base_page.rbi +1 -1
  83. data/rbi/metronome_sdk/internal/util.rbi +1 -1
  84. data/rbi/metronome_sdk/models/contract.rbi +5 -0
  85. data/rbi/metronome_sdk/models/contract_v2.rbi +635 -10
  86. data/rbi/metronome_sdk/models/contract_without_amendments.rbi +2 -2
  87. data/rbi/metronome_sdk/models/hierarchy_configuration.rbi +286 -6
  88. data/rbi/metronome_sdk/models/payment_gate_config.rbi +5 -0
  89. data/rbi/metronome_sdk/models/payment_gate_config_v2.rbi +5 -0
  90. data/rbi/metronome_sdk/models/subscription.rbi +190 -0
  91. data/rbi/metronome_sdk/models/v1/alert_archive_params.rbi +6 -4
  92. data/rbi/metronome_sdk/models/v1/alert_create_params.rbi +51 -47
  93. data/rbi/metronome_sdk/models/v1/contract_amend_params.rbi +5 -0
  94. data/rbi/metronome_sdk/models/v1/contract_create_params.rbi +326 -10
  95. data/rbi/metronome_sdk/models/v1/contract_list_balances_params.rbi +11 -0
  96. data/rbi/metronome_sdk/models/v1/customer_create_params.rbi +11 -0
  97. data/rbi/metronome_sdk/models/v1/customer_detail.rbi +8 -0
  98. data/rbi/metronome_sdk/models/v1/customer_preview_events_params.rbi +24 -32
  99. data/rbi/metronome_sdk/models/v1/customer_preview_events_response.rbi +10 -9
  100. data/rbi/metronome_sdk/models/v1/customer_retrieve_billing_configurations_response.rbi +5 -0
  101. data/rbi/metronome_sdk/models/v1/customer_set_billing_configurations_params.rbi +5 -0
  102. data/rbi/metronome_sdk/models/v1/customers/alert_list_params.rbi +4 -4
  103. data/rbi/metronome_sdk/models/v1/customers/alert_reset_params.rbi +2 -2
  104. data/rbi/metronome_sdk/models/v1/customers/alert_retrieve_params.rbi +14 -14
  105. data/rbi/metronome_sdk/models/v1/customers/billing_config_create_params.rbi +11 -0
  106. data/rbi/metronome_sdk/models/v1/customers/billing_config_delete_params.rbi +5 -0
  107. data/rbi/metronome_sdk/models/v1/customers/billing_config_retrieve_params.rbi +5 -0
  108. data/rbi/metronome_sdk/models/v1/customers/billing_config_retrieve_response.rbi +6 -0
  109. data/rbi/metronome_sdk/models/v1/customers/commit_create_params.rbi +2 -2
  110. data/rbi/metronome_sdk/models/v1/customers/customer_alert.rbi +53 -44
  111. data/rbi/metronome_sdk/models/v1/customers/invoice.rbi +462 -38
  112. data/rbi/metronome_sdk/models/v1/customers/invoice_retrieve_pdf_params.rbi +50 -0
  113. data/rbi/metronome_sdk/models/v1/payment.rbi +324 -0
  114. data/rbi/metronome_sdk/models/v1/payment_attempt_params.rbi +48 -0
  115. data/rbi/metronome_sdk/models/v1/payment_attempt_response.rbi +35 -0
  116. data/rbi/metronome_sdk/models/v1/payment_cancel_params.rbi +48 -0
  117. data/rbi/metronome_sdk/models/v1/payment_cancel_response.rbi +35 -0
  118. data/rbi/metronome_sdk/models/v1/payment_list_params.rbi +91 -0
  119. data/rbi/metronome_sdk/models/v1/payment_status.rbi +33 -0
  120. data/rbi/metronome_sdk/models/v1/setting_upsert_avalara_credentials_params.rbi +115 -0
  121. data/rbi/metronome_sdk/models/v1/setting_upsert_avalara_credentials_response.rbi +25 -0
  122. data/rbi/metronome_sdk/models/v1/settings/billing_provider_create_params.rbi +157 -0
  123. data/rbi/metronome_sdk/models/v1/settings/billing_provider_create_response.rbi +75 -0
  124. data/rbi/metronome_sdk/models/v1/settings/billing_provider_list_params.rbi +50 -0
  125. data/rbi/metronome_sdk/models/v1/settings/billing_provider_list_response.rbi +245 -0
  126. data/rbi/metronome_sdk/models/v2/contract_edit_commit_params.rbi +18 -0
  127. data/rbi/metronome_sdk/models/v2/contract_edit_credit_params.rbi +18 -0
  128. data/rbi/metronome_sdk/models/v2/contract_edit_params.rbi +536 -12
  129. data/rbi/metronome_sdk/models/v2/contract_get_edit_history_response.rbi +462 -14
  130. data/rbi/metronome_sdk/resources/v1/alerts.rbi +68 -64
  131. data/rbi/metronome_sdk/resources/v1/contracts.rbi +8 -4
  132. data/rbi/metronome_sdk/resources/v1/credit_grants.rbi +10 -5
  133. data/rbi/metronome_sdk/resources/v1/customers/alerts.rbi +73 -54
  134. data/rbi/metronome_sdk/resources/v1/customers/billing_config.rbi +8 -4
  135. data/rbi/metronome_sdk/resources/v1/customers/commits.rbi +3 -2
  136. data/rbi/metronome_sdk/resources/v1/customers/invoices.rbi +38 -1
  137. data/rbi/metronome_sdk/resources/v1/customers/plans.rbi +8 -4
  138. data/rbi/metronome_sdk/resources/v1/customers.rbi +17 -11
  139. data/rbi/metronome_sdk/resources/v1/payments.rbi +72 -0
  140. data/rbi/metronome_sdk/resources/v1/plans.rbi +8 -4
  141. data/rbi/metronome_sdk/resources/v1/settings/billing_providers.rbi +63 -0
  142. data/rbi/metronome_sdk/resources/v1/settings.rbi +47 -0
  143. data/rbi/metronome_sdk/resources/v1/usage.rbi +4 -2
  144. data/rbi/metronome_sdk/resources/v1.rbi +6 -0
  145. data/rbi/metronome_sdk/resources/v2/contracts.rbi +14 -0
  146. data/sig/metronome_sdk/errors.rbs +7 -0
  147. data/sig/metronome_sdk/file_part.rbs +1 -1
  148. data/sig/metronome_sdk/models/contract.rbs +2 -0
  149. data/sig/metronome_sdk/models/contract_v2.rbs +241 -12
  150. data/sig/metronome_sdk/models/hierarchy_configuration.rbs +87 -6
  151. data/sig/metronome_sdk/models/payment_gate_config.rbs +2 -1
  152. data/sig/metronome_sdk/models/payment_gate_config_v2.rbs +2 -1
  153. data/sig/metronome_sdk/models/subscription.rbs +80 -0
  154. data/sig/metronome_sdk/models/v1/contract_amend_params.rbs +2 -1
  155. data/sig/metronome_sdk/models/v1/contract_create_params.rbs +91 -5
  156. data/sig/metronome_sdk/models/v1/contract_list_balances_params.rbs +7 -0
  157. data/sig/metronome_sdk/models/v1/customer_create_params.rbs +2 -0
  158. data/sig/metronome_sdk/models/v1/customer_detail.rbs +5 -0
  159. data/sig/metronome_sdk/models/v1/customer_preview_events_params.rbs +0 -7
  160. data/sig/metronome_sdk/models/v1/customer_preview_events_response.rbs +6 -4
  161. data/sig/metronome_sdk/models/v1/customer_retrieve_billing_configurations_response.rbs +2 -0
  162. data/sig/metronome_sdk/models/v1/customer_set_billing_configurations_params.rbs +2 -0
  163. data/sig/metronome_sdk/models/v1/customers/billing_config_create_params.rbs +2 -0
  164. data/sig/metronome_sdk/models/v1/customers/billing_config_delete_params.rbs +2 -0
  165. data/sig/metronome_sdk/models/v1/customers/billing_config_retrieve_params.rbs +2 -0
  166. data/sig/metronome_sdk/models/v1/customers/customer_alert.rbs +2 -0
  167. data/sig/metronome_sdk/models/v1/customers/invoice.rbs +244 -19
  168. data/sig/metronome_sdk/models/v1/customers/invoice_retrieve_pdf_params.rbs +32 -0
  169. data/sig/metronome_sdk/models/v1/payment.rbs +198 -0
  170. data/sig/metronome_sdk/models/v1/payment_attempt_params.rbs +30 -0
  171. data/sig/metronome_sdk/models/v1/payment_attempt_response.rbs +15 -0
  172. data/sig/metronome_sdk/models/v1/payment_cancel_params.rbs +30 -0
  173. data/sig/metronome_sdk/models/v1/payment_cancel_response.rbs +15 -0
  174. data/sig/metronome_sdk/models/v1/payment_list_params.rbs +56 -0
  175. data/sig/metronome_sdk/models/v1/payment_status.rbs +19 -0
  176. data/sig/metronome_sdk/models/v1/setting_upsert_avalara_credentials_params.rbs +54 -0
  177. data/sig/metronome_sdk/models/v1/setting_upsert_avalara_credentials_response.rbs +13 -0
  178. data/sig/metronome_sdk/models/v1/settings/billing_provider_create_params.rbs +64 -0
  179. data/sig/metronome_sdk/models/v1/settings/billing_provider_create_response.rbs +34 -0
  180. data/sig/metronome_sdk/models/v1/settings/billing_provider_list_params.rbs +28 -0
  181. data/sig/metronome_sdk/models/v1/settings/billing_provider_list_response.rbs +102 -0
  182. data/sig/metronome_sdk/models/v2/contract_edit_commit_params.rbs +9 -0
  183. data/sig/metronome_sdk/models/v2/contract_edit_credit_params.rbs +9 -0
  184. data/sig/metronome_sdk/models/v2/contract_edit_params.rbs +184 -7
  185. data/sig/metronome_sdk/models/v2/contract_get_edit_history_response.rbs +221 -18
  186. data/sig/metronome_sdk/resources/v1/contracts.rbs +1 -0
  187. data/sig/metronome_sdk/resources/v1/customers/invoices.rbs +6 -0
  188. data/sig/metronome_sdk/resources/v1/payments.rbs +30 -0
  189. data/sig/metronome_sdk/resources/v1/settings/billing_providers.rbs +23 -0
  190. data/sig/metronome_sdk/resources/v1/settings.rbs +19 -0
  191. data/sig/metronome_sdk/resources/v1.rbs +4 -0
  192. data/sig/metronome_sdk/resources/v2/contracts.rbs +3 -0
  193. metadata +53 -2
@@ -4,16 +4,15 @@ module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
6
  class Alerts
7
- # Create a new alert to monitor customer spending, balances, and billing metrics
8
- # in real-time. Metronome's alert system provides industry-leading speed with
9
- # immediate evaluation capabilities, enabling you to proactively manage customer
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 alerts that continuously monitor various
13
- # billing thresholds including spend limits, credit balances, commitment
14
- # utilization, and invoice totals. Alerts can be configured globally for all
15
- # customers or targeted to specific customer accounts. Custom fields can be used
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 alert configuration with its unique ID and current status
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
- # - Alert metadata including type, threshold values, and update timestamps
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 alert must have a unique `uniqueness_key` within
41
- # your organization. Use `release_uniqueness_key` : `true` when archiving to
42
- # reuse keys
43
- # - Alert type requirements: Different alert types require specific fields (e.g.,
44
- # `billable_metric_id` for usage alerts, `credit_type_id` for credit-based
45
- # alerts)
46
- # - Webhook delivery: Alerts trigger webhook notifications for real-time
47
- # integration with your systems. Configure webhook endpoints before creating
48
- # alerts
49
- # - Performance at scale: Metronome's event-driven architecture processes alert
50
- # evaluations in real-time as usage events stream in, unlike competitors who
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 alert
76
+ # Type of the threshold notification
77
77
  alert_type:,
78
- # Name of the alert
78
+ # Name of the threshold notification
79
79
  name:,
80
- # Threshold value of the alert policy. Depending upon the alert type, this number
81
- # may represent a financial amount, the days remaining, or a percentage reached.
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 alerts of type `usage_threshold_reached`, specifies which billable metric to
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 alert
87
- # applies to, by looking at the credit_grant_type field on the credit grant. This
88
- # field is only defined for CreditPercentage and CreditBalance alerts
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 alert type
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 alert types that support advanced filtering.
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 alert for this specific customer. To create an
98
- # alert for all customers, do not specify a `customer_id`.
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 alert will evaluate immediately on customers that already meet the
101
- # alert threshold. If false, it will only evaluate on future customers that
102
- # trigger the alert threshold. Defaults to true.
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` alerts. Scope alert to a specific
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 alerts. A list of invoice types to
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 alert for this specific plan. To create an alert
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 an alert and remove it from active monitoring across all
122
- # customers. Archived alerts stop evaluating immediately and can optionally
123
- # release their uniqueness key for reuse in future alert configurations.
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 alerts that are no longer needed
128
- # - Clean up test or deprecated alert configurations
129
- # - Free up uniqueness keys for reuse with new alerts
130
- # - Stop alert evaluations without losing historical configuration data
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 alert's ID
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 alerts cannot be re-enabled; create a
142
- # new alert to resume monitoring
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 alerts
145
- # - Immediate effect: Alert evaluation stops instantly across all customers
146
- # - Historical preservation: Archive operation maintains alert history and
147
- # configuration for compliance and auditing
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 alert
159
+ # The Metronome ID of the threshold notification
157
160
  id:,
158
- # If true, resets the uniqueness key on this alert so it can be re-used
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
  )
@@ -389,7 +389,7 @@ module MetronomeSDK
389
389
 
390
390
  # Amendments will be replaced by Contract editing. New clients should implement
391
391
  # using the `editContract` endpoint. Read more about the migration to contract
392
- # editing [here](https://docs.metronome.com/migrate-amendments-to-edits/) and
392
+ # editing [here](/guides/implement-metronome/migrate-amendments-to-edits/) and
393
393
  # reach out to your Metronome representative for more details. Once contract
394
394
  # editing is enabled, access to this endpoint will be removed.
395
395
  sig do
@@ -553,6 +553,7 @@ module MetronomeSDK
553
553
  id: String,
554
554
  covering_date: Time,
555
555
  effective_before: Time,
556
+ exclude_zero_balances: T::Boolean,
556
557
  include_archived: T::Boolean,
557
558
  include_balance: T::Boolean,
558
559
  include_contract_balances: T::Boolean,
@@ -574,6 +575,8 @@ module MetronomeSDK
574
575
  covering_date: nil,
575
576
  # Include only balances that have any access before the provided date (exclusive)
576
577
  effective_before: nil,
578
+ # Exclude balances with zero amounts from the response.
579
+ exclude_zero_balances: nil,
577
580
  # Include archived credits and credits from archived contracts.
578
581
  include_archived: nil,
579
582
  # Include the balance of credits and commits in the response. Setting this flag
@@ -736,11 +739,12 @@ module MetronomeSDK
736
739
  )
737
740
  end
738
741
 
739
- # Update or and an end date to a contract. Ending a contract early will impact
742
+ # Update or add an end date to a contract. Ending a contract early will impact
740
743
  # draft usage statements, truncate any terms, and remove upcoming scheduled
741
744
  # invoices. Moving the date into the future will only extend the contract length.
742
- # Terms and scheduled invoices are not extended. Use this if a contract's end date
743
- # has changed or if a perpetual contract ends.
745
+ # Terms and scheduled invoices are not extended. In-advance subscriptions will not
746
+ # be extended. Use this if a contract's end date has changed or if a perpetual
747
+ # contract ends.
744
748
  sig do
745
749
  params(
746
750
  contract_id: String,
@@ -4,7 +4,8 @@ module MetronomeSDK
4
4
  module Resources
5
5
  class V1
6
6
  class CreditGrants
7
- # Create a new credit grant
7
+ # Create a new credit grant. This is a Plans (deprecated) endpoint. New clients
8
+ # should implement using Contracts.
8
9
  sig do
9
10
  params(
10
11
  customer_id: String,
@@ -65,7 +66,8 @@ module MetronomeSDK
65
66
  )
66
67
  end
67
68
 
68
- # List credit grants. This list does not included voided grants.
69
+ # List credit grants. This list does not included voided grants. This is a Plans
70
+ # (deprecated) endpoint. New clients should implement using Contracts.
69
71
  sig do
70
72
  params(
71
73
  limit: Integer,
@@ -105,7 +107,8 @@ module MetronomeSDK
105
107
  )
106
108
  end
107
109
 
108
- # Edit an existing credit grant
110
+ # Edit an existing credit grant. This is a Plans (deprecated) endpoint. New
111
+ # clients should implement using Contracts.
109
112
  sig do
110
113
  params(
111
114
  id: String,
@@ -130,7 +133,8 @@ module MetronomeSDK
130
133
 
131
134
  # Fetches a list of credit ledger entries. Returns lists of ledgers per customer.
132
135
  # Ledger entries are returned in chronological order. Ledger entries associated
133
- # with voided credit grants are not included.
136
+ # with voided credit grants are not included. This is a Plans (deprecated)
137
+ # endpoint. New clients should implement using Contracts.
134
138
  sig do
135
139
  params(
136
140
  next_page: String,
@@ -170,7 +174,8 @@ module MetronomeSDK
170
174
  )
171
175
  end
172
176
 
173
- # Void a credit grant
177
+ # Void a credit grant. This is a Plans (deprecated) endpoint. New clients should
178
+ # implement using Contracts.
174
179
  sig do
175
180
  params(
176
181
  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 alert-customer pair.
9
- # This endpoint provides instant visibility into whether a customer has triggered
10
- # an alert condition, enabling you to monitor account health and take proactive
11
- # action based on current alert states.
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 alert threshold
16
+ # - Check if a specific customer is currently violating an threshold notification
16
17
  # (`in_alarm` status)
17
- # - Verify alert configuration details and threshold values for a customer
18
- # - Integrate alert status checks into customer support tools or admin interfaces
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`- Customer has breached the alert threshold
28
- # - `evaluating` - Alert has yet to be evaluated (typically due to a customer or
29
- # alert having just been created)
30
- # - `null` - Alert has been archived
31
- # - `triggered_by`: Additional context about what caused the alert to trigger
32
- # (when applicable)
33
- # - alert: Complete alert configuration including:
34
- # - Alert ID, name, and type
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
- # - Alert status (enabled, disabled, or archived)
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 alert history, use webhook notifications or event logs
44
- # - Archived alerts: Returns null for customer_status if the alert has been
45
- # archived, but still includes the alert configuration details
46
- # - Integration patterns: This endpoint can be used to check a customer's alert
47
- # status, but shouldn't be scraped. You should instead rely on the webhook
48
- # notification to understand when customers are moved to IN_ALARM.
49
- # - Error handling: Returns 404 if either the customer or alert ID doesn't exist
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 alert
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` alerts. Retrieve the alert for a
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 alerts are enabled during migration, this flag denotes whether to
75
- # fetch alerts for plans or contracts.
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 alert configurations and their current statuses for a specific
82
- # customer in a single API call. This endpoint provides a comprehensive view of
83
- # all alerts monitoring a customer account.
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 alerts for a customer in dashboards or admin panels
88
- # - Quickly identify which alerts a customer is currently triggering
89
- # - Audit alert coverage for specific accounts
90
- # - Filter alerts by status (enabled, disabled, or archived)
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 alert configuration and threshold details
97
- # - Alert metadata including type, name, and last update time
98
- # - `next_page`: Pagination cursor for retrieving additional results
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 alerts unless alert_statuses filter is
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 alerts
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 alert status. If absent, only enabled alerts
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 alert for a customer, clearing
134
- # any previous state and triggering a fresh assessment against current thresholds.
135
- # This endpoint ensures alert accuracy after configuration changes or data
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 alerts after fixing data issues
141
- # - Re-evaluate alerts after adjusting customer balances or credits
142
- # - Test alert behavior during development and debugging
143
- # - Resolve stuck alerts that may be in an incorrect state
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 alert has been reset and re-evaluation
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 alert
188
+ # The Metronome ID of the threshold notification
170
189
  alert_id:,
171
190
  # The Metronome ID of the customer
172
191
  customer_id:,
@@ -5,7 +5,8 @@ module MetronomeSDK
5
5
  class V1
6
6
  class Customers
7
7
  class BillingConfig
8
- # Set the billing configuration for a given customer.
8
+ # Set the billing configuration for a given customer. This is a Plans (deprecated)
9
+ # endpoint. New clients should implement using Contracts.
9
10
  sig do
10
11
  params(
11
12
  customer_id: String,
@@ -32,13 +33,15 @@ module MetronomeSDK
32
33
  aws_product_code: nil,
33
34
  # Body param:
34
35
  aws_region: nil,
35
- # Body param:
36
+ # Body param: The collection method for the customer's invoices. NOTE:
37
+ # `auto_charge_payment_intent` and `manually_charge_payment_intent` are in beta.
36
38
  stripe_collection_method: nil,
37
39
  request_options: {}
38
40
  )
39
41
  end
40
42
 
41
- # Fetch the billing configuration for the given customer.
43
+ # Fetch the billing configuration for the given customer. This is a Plans
44
+ # (deprecated) endpoint. New clients should implement using Contracts.
42
45
  sig do
43
46
  params(
44
47
  customer_id: String,
@@ -58,7 +61,8 @@ module MetronomeSDK
58
61
  end
59
62
 
60
63
  # Delete the billing configuration for a given customer. Note: this is unsupported
61
- # for Azure and AWS Marketplace customers.
64
+ # for Azure and AWS Marketplace customers. This is a Plans (deprecated) endpoint.
65
+ # New clients should implement using Contracts.
62
66
  sig do
63
67
  params(
64
68
  customer_id: String,
@@ -34,7 +34,8 @@ module MetronomeSDK
34
34
  # #### Billing configuration:
35
35
  #
36
36
  # - invoice_contract_id is required for postpaid commits and for prepaid commits
37
- # with billing (only optional for free prepaid commits)
37
+ # with billing (only optional for free prepaid commits) unless do_not_invoice is
38
+ # set to true
38
39
  # - For postpaid commits: access_schedule and invoice_schedule must have matching
39
40
  # amounts
40
41
  # - For postpaid commits: only one schedule item is allowed in both schedules.
@@ -123,7 +124,7 @@ module MetronomeSDK
123
124
  description: nil,
124
125
  # The contract that this commit will be billed on. This is required for "POSTPAID"
125
126
  # commits and for "PREPAID" commits unless there is no invoice schedule above
126
- # (i.e., the commit is 'free').
127
+ # (i.e., the commit is 'free'), or if do_not_invoice is set to true.
127
128
  invoice_contract_id: nil,
128
129
  # Required for "POSTPAID" commits: the true up invoice will be generated at this
129
130
  # time and only one schedule item is allowed; the total must match
@@ -159,7 +159,8 @@ module MetronomeSDK
159
159
  )
160
160
  end
161
161
 
162
- # Add a one time charge to the specified invoice
162
+ # Add a one time charge to the specified invoice. This is a Plans (deprecated)
163
+ # endpoint. New clients should implement using Contracts.
163
164
  sig do
164
165
  params(
165
166
  customer_id: String,
@@ -287,6 +288,42 @@ module MetronomeSDK
287
288
  )
288
289
  end
289
290
 
291
+ # Retrieve a PDF version of a specific invoice by its unique identifier. This
292
+ # endpoint generates a professionally formatted invoice document suitable for
293
+ # sharing with customers, accounting teams, or for record-keeping purposes.
294
+ #
295
+ # ### Use this endpoint to:
296
+ #
297
+ # - Provide customers with downloadable or emailable copies of their invoices
298
+ # - Support accounting and finance teams with official billing documents
299
+ # - Maintain accurate records of billing transactions for audits and compliance
300
+ #
301
+ # ### Key response details:
302
+ #
303
+ # - The response is a binary PDF file representing the full invoice
304
+ # - The PDF includes all standard invoice information such as line items, totals,
305
+ # billing period, and customer details
306
+ # - The document is formatted for clarity and professionalism, suitable for
307
+ # official use
308
+ #
309
+ # ### Usage guidelines:
310
+ #
311
+ # - Ensure the `invoice_id` corresponds to an existing invoice for the specified
312
+ # `customer_id`
313
+ # - The PDF is generated on-demand; frequent requests for the same invoice may
314
+ # impact performance
315
+ # - Use appropriate headers to handle the binary response in your application
316
+ # (e.g., setting `Content-Type: application/pdf`)
317
+ sig do
318
+ params(
319
+ customer_id: String,
320
+ invoice_id: String,
321
+ request_options: MetronomeSDK::RequestOptions::OrHash
322
+ ).returns(StringIO)
323
+ end
324
+ def retrieve_pdf(customer_id:, invoice_id:, request_options: {})
325
+ end
326
+
290
327
  # @api private
291
328
  sig { params(client: MetronomeSDK::Client).returns(T.attached_class) }
292
329
  def self.new(client:)
@@ -5,7 +5,8 @@ module MetronomeSDK
5
5
  class V1
6
6
  class Customers
7
7
  class Plans
8
- # List the given customer's plans in reverse-chronological order.
8
+ # List the given customer's plans in reverse-chronological order. This is a Plans
9
+ # (deprecated) endpoint. New clients should implement using Contracts.
9
10
  sig do
10
11
  params(
11
12
  customer_id: String,
@@ -31,7 +32,8 @@ module MetronomeSDK
31
32
 
32
33
  # Associate an existing customer with a plan for a specified date range. See the
33
34
  # [price adjustments documentation](https://plans-docs.metronome.com/pricing/managing-plans/#price-adjustments)
34
- # for details on the price adjustments.
35
+ # for details on the price adjustments. This is a Plans (deprecated) endpoint. New
36
+ # clients should implement using Contracts.
35
37
  sig do
36
38
  params(
37
39
  customer_id: String,
@@ -82,7 +84,8 @@ module MetronomeSDK
82
84
  )
83
85
  end
84
86
 
85
- # Change the end date of a customer's plan.
87
+ # Change the end date of a customer's plan. This is a Plans (deprecated) endpoint.
88
+ # New clients should implement using Contracts.
86
89
  sig do
87
90
  params(
88
91
  customer_id: String,
@@ -116,7 +119,8 @@ module MetronomeSDK
116
119
 
117
120
  # Lists a customer plans adjustments. See the
118
121
  # [price adjustments documentation](https://plans-docs.metronome.com/pricing/managing-plans/#price-adjustments)
119
- # for details.
122
+ # for details. This is a Plans (deprecated) endpoint. New clients should implement
123
+ # using Contracts.
120
124
  sig do
121
125
  params(
122
126
  customer_id: String,