orb-billing 0.1.0.pre.alpha.37 → 0.1.0.pre.alpha.39

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 (402) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +29 -5
  3. data/lib/orb/client.rb +4 -0
  4. data/lib/orb/internal/page.rb +6 -2
  5. data/lib/orb/internal/transport/base_client.rb +3 -3
  6. data/lib/orb/internal/transport/pooled_net_requester.rb +2 -2
  7. data/lib/orb/internal/type/array_of.rb +5 -3
  8. data/lib/orb/internal/type/base_model.rb +19 -16
  9. data/lib/orb/internal/type/base_page.rb +4 -1
  10. data/lib/orb/internal/type/{boolean_model.rb → boolean.rb} +2 -2
  11. data/lib/orb/internal/type/converter.rb +26 -23
  12. data/lib/orb/internal/type/enum.rb +10 -8
  13. data/lib/orb/internal/type/hash_of.rb +3 -1
  14. data/lib/orb/internal/util.rb +29 -50
  15. data/lib/orb/models/alert.rb +10 -10
  16. data/lib/orb/models/alert_create_for_customer_params.rb +3 -3
  17. data/lib/orb/models/alert_create_for_external_customer_params.rb +3 -3
  18. data/lib/orb/models/alert_create_for_subscription_params.rb +3 -3
  19. data/lib/orb/models/alert_list_params.rb +5 -5
  20. data/lib/orb/models/alert_update_params.rb +3 -3
  21. data/lib/orb/models/amount_discount.rb +1 -1
  22. data/lib/orb/models/billable_metric.rb +7 -7
  23. data/lib/orb/models/coupon.rb +7 -7
  24. data/lib/orb/models/coupon_create_params.rb +2 -2
  25. data/lib/orb/models/coupon_list_params.rb +3 -3
  26. data/lib/orb/models/coupons/subscription_list_params.rb +1 -1
  27. data/lib/orb/models/credit_note.rb +1 -1
  28. data/lib/orb/models/credit_note_list_params.rb +5 -5
  29. data/lib/orb/models/customer.rb +237 -237
  30. data/lib/orb/models/customer_create_params.rb +229 -229
  31. data/lib/orb/models/customer_list_params.rb +5 -5
  32. data/lib/orb/models/customer_update_by_external_id_params.rb +230 -230
  33. data/lib/orb/models/customer_update_params.rb +230 -230
  34. data/lib/orb/models/customers/balance_transaction_create_response.rb +2 -2
  35. data/lib/orb/models/customers/balance_transaction_list_params.rb +5 -5
  36. data/lib/orb/models/customers/balance_transaction_list_response.rb +2 -2
  37. data/lib/orb/models/customers/cost_list_by_external_id_params.rb +6 -6
  38. data/lib/orb/models/customers/cost_list_params.rb +6 -6
  39. data/lib/orb/models/customers/credit_list_by_external_id_params.rb +3 -3
  40. data/lib/orb/models/customers/credit_list_params.rb +3 -3
  41. data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb +22 -22
  42. data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rb +22 -22
  43. data/lib/orb/models/customers/credits/ledger_create_entry_params.rb +22 -22
  44. data/lib/orb/models/customers/credits/ledger_create_entry_response.rb +22 -22
  45. data/lib/orb/models/customers/credits/ledger_list_by_external_id_params.rb +5 -5
  46. data/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rb +22 -22
  47. data/lib/orb/models/customers/credits/ledger_list_params.rb +5 -5
  48. data/lib/orb/models/customers/credits/ledger_list_response.rb +22 -22
  49. data/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rb +10 -10
  50. data/lib/orb/models/customers/credits/top_up_create_by_external_id_response.rb +9 -9
  51. data/lib/orb/models/customers/credits/top_up_create_params.rb +10 -10
  52. data/lib/orb/models/customers/credits/top_up_create_response.rb +9 -9
  53. data/lib/orb/models/customers/credits/top_up_list_by_external_id_params.rb +1 -1
  54. data/lib/orb/models/customers/credits/top_up_list_by_external_id_response.rb +9 -9
  55. data/lib/orb/models/customers/credits/top_up_list_params.rb +1 -1
  56. data/lib/orb/models/customers/credits/top_up_list_response.rb +9 -9
  57. data/lib/orb/models/dimensional_price_group.rb +7 -7
  58. data/lib/orb/models/dimensional_price_group_create_params.rb +2 -2
  59. data/lib/orb/models/dimensional_price_group_list_params.rb +1 -1
  60. data/lib/orb/models/evaluate_price_group.rb +1 -1
  61. data/lib/orb/models/event_ingest_params.rb +8 -8
  62. data/lib/orb/models/event_ingest_response.rb +4 -4
  63. data/lib/orb/models/event_search_params.rb +5 -5
  64. data/lib/orb/models/event_search_response.rb +9 -9
  65. data/lib/orb/models/event_update_params.rb +4 -4
  66. data/lib/orb/models/events/backfill_close_response.rb +8 -8
  67. data/lib/orb/models/events/backfill_create_params.rb +12 -12
  68. data/lib/orb/models/events/backfill_create_response.rb +8 -8
  69. data/lib/orb/models/events/backfill_fetch_response.rb +8 -8
  70. data/lib/orb/models/events/backfill_list_params.rb +1 -1
  71. data/lib/orb/models/events/backfill_list_response.rb +8 -8
  72. data/lib/orb/models/events/backfill_revert_response.rb +8 -8
  73. data/lib/orb/models/events/event_volumes.rb +1 -1
  74. data/lib/orb/models/events/volume_list_params.rb +7 -7
  75. data/lib/orb/models/invoice.rb +278 -278
  76. data/lib/orb/models/invoice_create_params.rb +13 -12
  77. data/lib/orb/models/invoice_fetch_upcoming_response.rb +274 -274
  78. data/lib/orb/models/invoice_issue_params.rb +5 -5
  79. data/lib/orb/models/invoice_line_item_create_params.rb +1 -1
  80. data/lib/orb/models/invoice_line_item_create_response.rb +32 -32
  81. data/lib/orb/models/invoice_list_params.rb +13 -13
  82. data/lib/orb/models/invoice_update_params.rb +2 -2
  83. data/lib/orb/models/item.rb +2 -2
  84. data/lib/orb/models/item_list_params.rb +1 -1
  85. data/lib/orb/models/metric_create_params.rb +2 -2
  86. data/lib/orb/models/metric_list_params.rb +5 -5
  87. data/lib/orb/models/metric_update_params.rb +2 -2
  88. data/lib/orb/models/pagination_metadata.rb +1 -1
  89. data/lib/orb/models/percentage_discount.rb +2 -2
  90. data/lib/orb/models/plan.rb +40 -40
  91. data/lib/orb/models/plan_create_params.rb +292 -292
  92. data/lib/orb/models/plan_list_params.rb +5 -5
  93. data/lib/orb/models/plan_update_params.rb +4 -4
  94. data/lib/orb/models/plans/external_plan_id_update_params.rb +4 -4
  95. data/lib/orb/models/price.rb +186 -186
  96. data/lib/orb/models/price_create_params.rb +21 -21
  97. data/lib/orb/models/price_evaluate_params.rb +4 -4
  98. data/lib/orb/models/price_list_params.rb +1 -1
  99. data/lib/orb/models/price_update_params.rb +2 -2
  100. data/lib/orb/models/prices/external_price_id_update_params.rb +2 -2
  101. data/lib/orb/models/subscription.rb +120 -93
  102. data/lib/orb/models/subscription_cancel_params.rb +4 -4
  103. data/lib/orb/models/subscription_cancel_response.rb +156 -78
  104. data/lib/orb/models/subscription_change_apply_params.rb +33 -0
  105. data/lib/orb/models/subscription_change_apply_response.rb +1372 -0
  106. data/lib/orb/models/subscription_change_cancel_params.rb +19 -0
  107. data/lib/orb/models/subscription_change_cancel_response.rb +1372 -0
  108. data/lib/orb/models/subscription_change_retrieve_params.rb +19 -0
  109. data/lib/orb/models/subscription_change_retrieve_response.rb +1372 -0
  110. data/lib/orb/models/subscription_create_params.rb +705 -705
  111. data/lib/orb/models/subscription_create_response.rb +156 -78
  112. data/lib/orb/models/subscription_fetch_costs_params.rb +6 -6
  113. data/lib/orb/models/subscription_fetch_schedule_params.rb +5 -5
  114. data/lib/orb/models/subscription_fetch_schedule_response.rb +2 -2
  115. data/lib/orb/models/subscription_fetch_usage_params.rb +8 -8
  116. data/lib/orb/models/subscription_list_params.rb +5 -5
  117. data/lib/orb/models/subscription_price_intervals_params.rb +358 -358
  118. data/lib/orb/models/subscription_price_intervals_response.rb +158 -78
  119. data/lib/orb/models/subscription_schedule_plan_change_params.rb +715 -715
  120. data/lib/orb/models/subscription_schedule_plan_change_response.rb +158 -78
  121. data/lib/orb/models/subscription_trigger_phase_params.rb +4 -4
  122. data/lib/orb/models/subscription_trigger_phase_response.rb +158 -78
  123. data/lib/orb/models/subscription_unschedule_cancellation_response.rb +158 -78
  124. data/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rb +159 -79
  125. data/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rb +158 -78
  126. data/lib/orb/models/subscription_update_fixed_fee_quantity_params.rb +9 -9
  127. data/lib/orb/models/subscription_update_fixed_fee_quantity_response.rb +158 -78
  128. data/lib/orb/models/subscription_update_params.rb +11 -11
  129. data/lib/orb/models/subscription_update_trial_params.rb +4 -4
  130. data/lib/orb/models/subscription_update_trial_response.rb +158 -78
  131. data/lib/orb/models/trial_discount.rb +1 -1
  132. data/lib/orb/models/usage_discount.rb +2 -2
  133. data/lib/orb/request_options.rb +7 -7
  134. data/lib/orb/resources/alerts.rb +40 -35
  135. data/lib/orb/resources/coupons/subscriptions.rb +3 -3
  136. data/lib/orb/resources/coupons.rb +9 -9
  137. data/lib/orb/resources/credit_notes.rb +10 -5
  138. data/lib/orb/resources/customers/balance_transactions.rb +28 -23
  139. data/lib/orb/resources/customers/costs.rb +232 -232
  140. data/lib/orb/resources/customers/credits/ledger.rb +348 -338
  141. data/lib/orb/resources/customers/credits/top_ups.rb +12 -12
  142. data/lib/orb/resources/customers/credits.rb +8 -8
  143. data/lib/orb/resources/customers.rb +61 -56
  144. data/lib/orb/resources/dimensional_price_groups.rb +6 -6
  145. data/lib/orb/resources/events/backfills.rb +49 -49
  146. data/lib/orb/resources/events/volume.rb +10 -10
  147. data/lib/orb/resources/events.rb +295 -295
  148. data/lib/orb/resources/invoice_line_items.rb +1 -1
  149. data/lib/orb/resources/invoices.rb +40 -31
  150. data/lib/orb/resources/items.rb +1 -1
  151. data/lib/orb/resources/metrics.rb +13 -8
  152. data/lib/orb/resources/plans/external_plan_id.rb +14 -14
  153. data/lib/orb/resources/plans.rb +24 -19
  154. data/lib/orb/resources/prices/external_price_id.rb +4 -4
  155. data/lib/orb/resources/prices.rb +30 -30
  156. data/lib/orb/resources/subscription_changes.rb +87 -0
  157. data/lib/orb/resources/subscriptions.rb +817 -807
  158. data/lib/orb/resources/top_level.rb +4 -4
  159. data/lib/orb/version.rb +1 -1
  160. data/lib/orb.rb +8 -1
  161. data/rbi/lib/orb/client.rbi +5 -4
  162. data/rbi/lib/orb/errors.rbi +3 -6
  163. data/rbi/lib/orb/internal/page.rbi +3 -6
  164. data/rbi/lib/orb/internal/transport/base_client.rbi +13 -27
  165. data/rbi/lib/orb/internal/transport/pooled_net_requester.rbi +7 -13
  166. data/rbi/lib/orb/internal/type/array_of.rbi +10 -18
  167. data/rbi/lib/orb/internal/type/base_model.rbi +45 -64
  168. data/rbi/lib/orb/internal/type/base_page.rbi +5 -10
  169. data/rbi/lib/orb/internal/type/{boolean_model.rbi → boolean.rbi} +5 -9
  170. data/rbi/lib/orb/internal/type/converter.rbi +25 -31
  171. data/rbi/lib/orb/internal/type/enum.rbi +14 -20
  172. data/rbi/lib/orb/internal/type/hash_of.rbi +8 -16
  173. data/rbi/lib/orb/internal/type/request_parameters.rbi +1 -2
  174. data/rbi/lib/orb/internal/type/union.rbi +10 -20
  175. data/rbi/lib/orb/internal/type/unknown.rbi +4 -8
  176. data/rbi/lib/orb/internal/util.rbi +40 -72
  177. data/rbi/lib/orb/internal.rbi +1 -1
  178. data/rbi/lib/orb/models/alert.rbi +21 -33
  179. data/rbi/lib/orb/models/alert_create_for_customer_params.rbi +8 -13
  180. data/rbi/lib/orb/models/alert_create_for_external_customer_params.rbi +8 -13
  181. data/rbi/lib/orb/models/alert_create_for_subscription_params.rbi +8 -13
  182. data/rbi/lib/orb/models/alert_disable_params.rbi +2 -4
  183. data/rbi/lib/orb/models/alert_enable_params.rbi +2 -4
  184. data/rbi/lib/orb/models/alert_list_params.rbi +3 -6
  185. data/rbi/lib/orb/models/alert_retrieve_params.rbi +2 -4
  186. data/rbi/lib/orb/models/alert_update_params.rbi +7 -11
  187. data/rbi/lib/orb/models/amount_discount.rbi +4 -7
  188. data/rbi/lib/orb/models/billable_metric.rbi +10 -13
  189. data/rbi/lib/orb/models/billing_cycle_relative_date.rbi +1 -2
  190. data/rbi/lib/orb/models/coupon.rbi +9 -11
  191. data/rbi/lib/orb/models/coupon_archive_params.rbi +2 -4
  192. data/rbi/lib/orb/models/coupon_create_params.rbi +8 -14
  193. data/rbi/lib/orb/models/coupon_fetch_params.rbi +2 -4
  194. data/rbi/lib/orb/models/coupon_list_params.rbi +3 -4
  195. data/rbi/lib/orb/models/coupons/subscription_list_params.rbi +3 -5
  196. data/rbi/lib/orb/models/credit_note.rbi +22 -45
  197. data/rbi/lib/orb/models/credit_note_create_params.rbi +5 -10
  198. data/rbi/lib/orb/models/credit_note_fetch_params.rbi +2 -4
  199. data/rbi/lib/orb/models/credit_note_list_params.rbi +3 -6
  200. data/rbi/lib/orb/models/customer.rbi +256 -281
  201. data/rbi/lib/orb/models/customer_create_params.rbi +251 -276
  202. data/rbi/lib/orb/models/customer_delete_params.rbi +2 -4
  203. data/rbi/lib/orb/models/customer_fetch_by_external_id_params.rbi +2 -4
  204. data/rbi/lib/orb/models/customer_fetch_params.rbi +2 -4
  205. data/rbi/lib/orb/models/customer_list_params.rbi +3 -6
  206. data/rbi/lib/orb/models/customer_sync_payment_methods_from_gateway_by_external_customer_id_params.rbi +2 -4
  207. data/rbi/lib/orb/models/customer_sync_payment_methods_from_gateway_params.rbi +2 -4
  208. data/rbi/lib/orb/models/customer_update_by_external_id_params.rbi +252 -277
  209. data/rbi/lib/orb/models/customer_update_params.rbi +252 -277
  210. data/rbi/lib/orb/models/customers/balance_transaction_create_params.rbi +3 -6
  211. data/rbi/lib/orb/models/customers/balance_transaction_create_response.rbi +10 -19
  212. data/rbi/lib/orb/models/customers/balance_transaction_list_params.rbi +3 -6
  213. data/rbi/lib/orb/models/customers/balance_transaction_list_response.rbi +10 -19
  214. data/rbi/lib/orb/models/customers/cost_list_by_external_id_params.rbi +8 -10
  215. data/rbi/lib/orb/models/customers/cost_list_by_external_id_response.rbi +6 -12
  216. data/rbi/lib/orb/models/customers/cost_list_params.rbi +8 -10
  217. data/rbi/lib/orb/models/customers/cost_list_response.rbi +6 -12
  218. data/rbi/lib/orb/models/customers/credit_list_by_external_id_params.rbi +3 -4
  219. data/rbi/lib/orb/models/customers/credit_list_by_external_id_response.rbi +2 -4
  220. data/rbi/lib/orb/models/customers/credit_list_params.rbi +3 -4
  221. data/rbi/lib/orb/models/customers/credit_list_response.rbi +2 -4
  222. data/rbi/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi +26 -33
  223. data/rbi/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbi +79 -136
  224. data/rbi/lib/orb/models/customers/credits/ledger_create_entry_params.rbi +26 -33
  225. data/rbi/lib/orb/models/customers/credits/ledger_create_entry_response.rbi +78 -135
  226. data/rbi/lib/orb/models/customers/credits/ledger_list_by_external_id_params.rbi +5 -10
  227. data/rbi/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rbi +79 -136
  228. data/rbi/lib/orb/models/customers/credits/ledger_list_params.rbi +5 -10
  229. data/rbi/lib/orb/models/customers/credits/ledger_list_response.rbi +74 -131
  230. data/rbi/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rbi +13 -19
  231. data/rbi/lib/orb/models/customers/credits/top_up_create_by_external_id_response.rbi +12 -18
  232. data/rbi/lib/orb/models/customers/credits/top_up_create_params.rbi +13 -19
  233. data/rbi/lib/orb/models/customers/credits/top_up_create_response.rbi +12 -18
  234. data/rbi/lib/orb/models/customers/credits/top_up_delete_by_external_id_params.rbi +2 -4
  235. data/rbi/lib/orb/models/customers/credits/top_up_delete_params.rbi +2 -4
  236. data/rbi/lib/orb/models/customers/credits/top_up_list_by_external_id_params.rbi +3 -5
  237. data/rbi/lib/orb/models/customers/credits/top_up_list_by_external_id_response.rbi +12 -18
  238. data/rbi/lib/orb/models/customers/credits/top_up_list_params.rbi +3 -5
  239. data/rbi/lib/orb/models/customers/credits/top_up_list_response.rbi +12 -18
  240. data/rbi/lib/orb/models/dimensional_price_group.rbi +8 -9
  241. data/rbi/lib/orb/models/dimensional_price_group_create_params.rbi +4 -7
  242. data/rbi/lib/orb/models/dimensional_price_group_list_params.rbi +3 -5
  243. data/rbi/lib/orb/models/dimensional_price_group_retrieve_params.rbi +2 -4
  244. data/rbi/lib/orb/models/dimensional_price_groups/external_dimensional_price_group_id_retrieve_params.rbi +2 -4
  245. data/rbi/lib/orb/models/dimensional_price_groups.rbi +2 -4
  246. data/rbi/lib/orb/models/discount.rbi +1 -2
  247. data/rbi/lib/orb/models/evaluate_price_group.rbi +3 -6
  248. data/rbi/lib/orb/models/event_deprecate_params.rbi +2 -4
  249. data/rbi/lib/orb/models/event_deprecate_response.rbi +2 -4
  250. data/rbi/lib/orb/models/event_ingest_params.rbi +10 -13
  251. data/rbi/lib/orb/models/event_ingest_response.rbi +10 -16
  252. data/rbi/lib/orb/models/event_search_params.rbi +7 -9
  253. data/rbi/lib/orb/models/event_search_response.rbi +11 -14
  254. data/rbi/lib/orb/models/event_update_params.rbi +5 -6
  255. data/rbi/lib/orb/models/event_update_response.rbi +2 -4
  256. data/rbi/lib/orb/models/events/backfill_close_params.rbi +2 -4
  257. data/rbi/lib/orb/models/events/backfill_close_response.rbi +10 -14
  258. data/rbi/lib/orb/models/events/backfill_create_params.rbi +13 -16
  259. data/rbi/lib/orb/models/events/backfill_create_response.rbi +10 -14
  260. data/rbi/lib/orb/models/events/backfill_fetch_params.rbi +2 -4
  261. data/rbi/lib/orb/models/events/backfill_fetch_response.rbi +10 -14
  262. data/rbi/lib/orb/models/events/backfill_list_params.rbi +3 -5
  263. data/rbi/lib/orb/models/events/backfill_list_response.rbi +10 -14
  264. data/rbi/lib/orb/models/events/backfill_revert_params.rbi +2 -4
  265. data/rbi/lib/orb/models/events/backfill_revert_response.rbi +10 -14
  266. data/rbi/lib/orb/models/events/event_volumes.rbi +5 -9
  267. data/rbi/lib/orb/models/events/volume_list_params.rbi +9 -11
  268. data/rbi/lib/orb/models/invoice.rbi +388 -465
  269. data/rbi/lib/orb/models/invoice_create_params.rbi +19 -26
  270. data/rbi/lib/orb/models/invoice_fetch_params.rbi +2 -4
  271. data/rbi/lib/orb/models/invoice_fetch_upcoming_params.rbi +2 -4
  272. data/rbi/lib/orb/models/invoice_fetch_upcoming_response.rbi +381 -460
  273. data/rbi/lib/orb/models/invoice_issue_params.rbi +6 -8
  274. data/rbi/lib/orb/models/invoice_level_discount.rbi +1 -2
  275. data/rbi/lib/orb/models/invoice_line_item_create_params.rbi +3 -5
  276. data/rbi/lib/orb/models/invoice_line_item_create_response.rbi +101 -143
  277. data/rbi/lib/orb/models/invoice_list_params.rbi +8 -13
  278. data/rbi/lib/orb/models/invoice_mark_paid_params.rbi +2 -4
  279. data/rbi/lib/orb/models/invoice_pay_params.rbi +2 -4
  280. data/rbi/lib/orb/models/invoice_update_params.rbi +4 -6
  281. data/rbi/lib/orb/models/invoice_void_params.rbi +2 -4
  282. data/rbi/lib/orb/models/item.rbi +7 -12
  283. data/rbi/lib/orb/models/item_create_params.rbi +2 -4
  284. data/rbi/lib/orb/models/item_fetch_params.rbi +2 -4
  285. data/rbi/lib/orb/models/item_list_params.rbi +3 -5
  286. data/rbi/lib/orb/models/item_update_params.rbi +5 -10
  287. data/rbi/lib/orb/models/metric_create_params.rbi +4 -6
  288. data/rbi/lib/orb/models/metric_fetch_params.rbi +2 -4
  289. data/rbi/lib/orb/models/metric_list_params.rbi +3 -6
  290. data/rbi/lib/orb/models/metric_update_params.rbi +4 -6
  291. data/rbi/lib/orb/models/pagination_metadata.rbi +2 -4
  292. data/rbi/lib/orb/models/percentage_discount.rbi +5 -8
  293. data/rbi/lib/orb/models/plan.rbi +180 -219
  294. data/rbi/lib/orb/models/plan_create_params.rbi +670 -951
  295. data/rbi/lib/orb/models/plan_fetch_params.rbi +2 -4
  296. data/rbi/lib/orb/models/plan_list_params.rbi +4 -8
  297. data/rbi/lib/orb/models/plan_update_params.rbi +6 -8
  298. data/rbi/lib/orb/models/plans/external_plan_id_fetch_params.rbi +2 -4
  299. data/rbi/lib/orb/models/plans/external_plan_id_update_params.rbi +6 -8
  300. data/rbi/lib/orb/models/price.rbi +827 -1494
  301. data/rbi/lib/orb/models/price_create_params.rbi +60 -101
  302. data/rbi/lib/orb/models/price_evaluate_params.rbi +6 -9
  303. data/rbi/lib/orb/models/price_evaluate_response.rbi +2 -4
  304. data/rbi/lib/orb/models/price_fetch_params.rbi +2 -4
  305. data/rbi/lib/orb/models/price_list_params.rbi +3 -5
  306. data/rbi/lib/orb/models/price_update_params.rbi +4 -6
  307. data/rbi/lib/orb/models/prices/external_price_id_fetch_params.rbi +2 -4
  308. data/rbi/lib/orb/models/prices/external_price_id_update_params.rbi +4 -6
  309. data/rbi/lib/orb/models/subscription.rbi +167 -187
  310. data/rbi/lib/orb/models/subscription_cancel_params.rbi +5 -7
  311. data/rbi/lib/orb/models/subscription_cancel_response.rbi +224 -178
  312. data/rbi/lib/orb/models/subscription_change_apply_params.rbi +40 -0
  313. data/rbi/lib/orb/models/subscription_change_apply_response.rbi +1554 -0
  314. data/rbi/lib/orb/models/subscription_change_cancel_params.rbi +18 -0
  315. data/rbi/lib/orb/models/subscription_change_cancel_response.rbi +1565 -0
  316. data/rbi/lib/orb/models/subscription_change_retrieve_params.rbi +18 -0
  317. data/rbi/lib/orb/models/subscription_change_retrieve_response.rbi +1581 -0
  318. data/rbi/lib/orb/models/subscription_create_params.rbi +1372 -1968
  319. data/rbi/lib/orb/models/subscription_create_response.rbi +224 -178
  320. data/rbi/lib/orb/models/subscription_fetch_costs_params.rbi +8 -10
  321. data/rbi/lib/orb/models/subscription_fetch_costs_response.rbi +6 -12
  322. data/rbi/lib/orb/models/subscription_fetch_params.rbi +2 -4
  323. data/rbi/lib/orb/models/subscription_fetch_schedule_params.rbi +3 -6
  324. data/rbi/lib/orb/models/subscription_fetch_schedule_response.rbi +6 -10
  325. data/rbi/lib/orb/models/subscription_fetch_usage_params.rbi +12 -17
  326. data/rbi/lib/orb/models/subscription_list_params.rbi +4 -8
  327. data/rbi/lib/orb/models/subscription_price_intervals_params.rbi +772 -1124
  328. data/rbi/lib/orb/models/subscription_price_intervals_response.rbi +228 -178
  329. data/rbi/lib/orb/models/subscription_schedule_plan_change_params.rbi +1396 -1993
  330. data/rbi/lib/orb/models/subscription_schedule_plan_change_response.rbi +238 -182
  331. data/rbi/lib/orb/models/subscription_trigger_phase_params.rbi +5 -7
  332. data/rbi/lib/orb/models/subscription_trigger_phase_response.rbi +224 -178
  333. data/rbi/lib/orb/models/subscription_unschedule_cancellation_params.rbi +2 -4
  334. data/rbi/lib/orb/models/subscription_unschedule_cancellation_response.rbi +238 -182
  335. data/rbi/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_params.rbi +2 -4
  336. data/rbi/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbi +265 -199
  337. data/rbi/lib/orb/models/subscription_unschedule_pending_plan_changes_params.rbi +2 -4
  338. data/rbi/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rbi +264 -198
  339. data/rbi/lib/orb/models/subscription_update_fixed_fee_quantity_params.rbi +11 -15
  340. data/rbi/lib/orb/models/subscription_update_fixed_fee_quantity_response.rbi +238 -182
  341. data/rbi/lib/orb/models/subscription_update_params.rbi +12 -15
  342. data/rbi/lib/orb/models/subscription_update_trial_params.rbi +6 -9
  343. data/rbi/lib/orb/models/subscription_update_trial_response.rbi +224 -178
  344. data/rbi/lib/orb/models/subscription_usage.rbi +24 -43
  345. data/rbi/lib/orb/models/subscriptions.rbi +2 -4
  346. data/rbi/lib/orb/models/top_level_ping_params.rbi +2 -4
  347. data/rbi/lib/orb/models/top_level_ping_response.rbi +2 -4
  348. data/rbi/lib/orb/models/trial_discount.rbi +4 -8
  349. data/rbi/lib/orb/models/usage_discount.rbi +5 -8
  350. data/rbi/lib/orb/request_options.rbi +9 -11
  351. data/rbi/lib/orb/resources/alerts.rbi +44 -60
  352. data/rbi/lib/orb/resources/coupons/subscriptions.rbi +6 -9
  353. data/rbi/lib/orb/resources/coupons.rbi +18 -25
  354. data/rbi/lib/orb/resources/credit_notes.rbi +9 -15
  355. data/rbi/lib/orb/resources/customers/balance_transactions.rbi +26 -31
  356. data/rbi/lib/orb/resources/customers/costs.rbi +241 -246
  357. data/rbi/lib/orb/resources/customers/credits/ledger.rbi +387 -396
  358. data/rbi/lib/orb/resources/customers/credits/top_ups.rbi +29 -40
  359. data/rbi/lib/orb/resources/customers/credits.rbi +15 -20
  360. data/rbi/lib/orb/resources/customers.rbi +407 -417
  361. data/rbi/lib/orb/resources/dimensional_price_groups/external_dimensional_price_group_id.rbi +2 -4
  362. data/rbi/lib/orb/resources/dimensional_price_groups.rbi +13 -19
  363. data/rbi/lib/orb/resources/events/backfills.rbi +61 -69
  364. data/rbi/lib/orb/resources/events/volume.rbi +19 -22
  365. data/rbi/lib/orb/resources/events.rbi +311 -319
  366. data/rbi/lib/orb/resources/invoice_line_items.rbi +4 -7
  367. data/rbi/lib/orb/resources/invoices.rbi +62 -76
  368. data/rbi/lib/orb/resources/items.rbi +7 -14
  369. data/rbi/lib/orb/resources/metrics.rbi +17 -25
  370. data/rbi/lib/orb/resources/plans/external_plan_id.rbi +21 -25
  371. data/rbi/lib/orb/resources/plans.rbi +63 -71
  372. data/rbi/lib/orb/resources/prices/external_price_id.rbi +9 -13
  373. data/rbi/lib/orb/resources/prices.rbi +77 -87
  374. data/rbi/lib/orb/resources/subscription_changes.rbi +61 -0
  375. data/rbi/lib/orb/resources/subscriptions.rbi +933 -963
  376. data/rbi/lib/orb/resources/top_level.rbi +6 -8
  377. data/rbi/lib/orb/version.rbi +1 -1
  378. data/sig/orb/client.rbs +2 -0
  379. data/sig/orb/internal/type/array_of.rbs +2 -2
  380. data/sig/orb/internal/type/{boolean_model.rbs → boolean.rbs} +1 -1
  381. data/sig/orb/internal/util.rbs +5 -5
  382. data/sig/orb/models/subscription.rbs +14 -0
  383. data/sig/orb/models/subscription_cancel_response.rbs +47 -2
  384. data/sig/orb/models/subscription_change_apply_params.rbs +24 -0
  385. data/sig/orb/models/subscription_change_apply_response.rbs +784 -0
  386. data/sig/orb/models/subscription_change_cancel_params.rbs +15 -0
  387. data/sig/orb/models/subscription_change_cancel_response.rbs +784 -0
  388. data/sig/orb/models/subscription_change_retrieve_params.rbs +15 -0
  389. data/sig/orb/models/subscription_change_retrieve_response.rbs +784 -0
  390. data/sig/orb/models/subscription_create_response.rbs +47 -2
  391. data/sig/orb/models/subscription_price_intervals_response.rbs +47 -2
  392. data/sig/orb/models/subscription_schedule_plan_change_response.rbs +47 -2
  393. data/sig/orb/models/subscription_trigger_phase_response.rbs +47 -2
  394. data/sig/orb/models/subscription_unschedule_cancellation_response.rbs +47 -2
  395. data/sig/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbs +47 -2
  396. data/sig/orb/models/subscription_unschedule_pending_plan_changes_response.rbs +47 -2
  397. data/sig/orb/models/subscription_update_fixed_fee_quantity_response.rbs +47 -2
  398. data/sig/orb/models/subscription_update_trial_response.rbs +47 -2
  399. data/sig/orb/resources/customers.rbs +2 -2
  400. data/sig/orb/resources/subscription_changes.rbs +24 -0
  401. data/sig/orb/version.rbs +1 -1
  402. metadata +26 -5
@@ -4,261 +4,261 @@ module Orb
4
4
  module Resources
5
5
  class Subscriptions
6
6
  # A subscription represents the purchase of a plan by a customer. The customer is
7
- # identified by either the `customer_id` or the `external_customer_id`, and
8
- # exactly one of these fields must be provided.
9
- #
10
- # By default, subscriptions begin on the day that they're created and renew
11
- # automatically for each billing cycle at the cadence that's configured in the
12
- # plan definition.
13
- #
14
- # The default configuration for subscriptions in Orb is **In-advance billing** and
15
- # **Beginning of month alignment** (see
16
- # [Subscription](/core-concepts##subscription) for more details).
17
- #
18
- # In order to change the alignment behavior, Orb also supports billing
19
- # subscriptions on the day of the month they are created. If
20
- # `align_billing_with_subscription_start_date = true` is specified, subscriptions
21
- # have billing cycles that are aligned with their `start_date`. For example, a
22
- # subscription that begins on January 15th will have a billing cycle from January
23
- # 15th to February 15th. Every subsequent billing cycle will continue to start and
24
- # invoice on the 15th.
25
- #
26
- # If the "day" value is greater than the number of days in the month, the next
27
- # billing cycle will start at the end of the month. For example, if the start_date
28
- # is January 31st, the next billing cycle will start on February 28th.
29
- #
30
- # If a customer was created with a currency, Orb only allows subscribing the
31
- # customer to a plan with a matching `invoicing_currency`. If the customer does
32
- # not have a currency set, on subscription creation, we set the customer's
33
- # currency to be the `invoicing_currency` of the plan.
34
- #
35
- # ## Customize your customer's subscriptions
36
- #
37
- # Prices and adjustments in a plan can be added, removed, or replaced for the
38
- # subscription being created. This is useful when a customer has prices that
39
- # differ from the default prices for a specific plan.
40
- #
41
- # <Note>
42
- # This feature is only available for accounts that have migrated to Subscription Overrides Version 2. You can find your
43
- # Subscription Overrides Version at the bottom of your [Plans page](https://app.withorb.com/plans)
44
- # </Note>
45
- #
46
- # ### Adding Prices
47
- #
48
- # To add prices, provide a list of objects with the key `add_prices`. An object in
49
- # the list must specify an existing add-on price with a `price_id` or
50
- # `external_price_id` field, or create a new add-on price by including an object
51
- # with the key `price`, identical to what would be used in the request body for
52
- # the [create price endpoint](/api-reference/price/create-price). See the
53
- # [Price resource](/product-catalog/price-configuration) for the specification of
54
- # different price model configurations possible in this object.
55
- #
56
- # If the plan has phases, each object in the list must include a number with
57
- # `plan_phase_order` key to indicate which phase the price should be added to.
58
- #
59
- # An object in the list can specify an optional `start_date` and optional
60
- # `end_date`. This is equivalent to creating a price interval with the
61
- # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
62
- # If unspecified, the start or end date of the phase or subscription will be used.
63
- #
64
- # An object in the list can specify an optional `minimum_amount`,
65
- # `maximum_amount`, or `discounts`. This will create adjustments which apply only
66
- # to this price.
67
- #
68
- # Additionally, an object in the list can specify an optional `reference_id`. This
69
- # ID can be used to reference this price when
70
- # [adding an adjustment](#adding-adjustments) in the same API call. However the ID
71
- # is _transient_ and cannot be used to refer to the price in future API calls.
72
- #
73
- # ### Removing Prices
74
- #
75
- # To remove prices, provide a list of objects with the key `remove_prices`. An
76
- # object in the list must specify a plan price with either a `price_id` or
77
- # `external_price_id` field.
78
- #
79
- # ### Replacing Prices
80
- #
81
- # To replace prices, provide a list of objects with the key `replace_prices`. An
82
- # object in the list must specify a plan price to replace with the
83
- # `replaces_price_id` key, and it must specify a price to replace it with by
84
- # either referencing an existing add-on price with a `price_id` or
85
- # `external_price_id` field, or by creating a new add-on price by including an
86
- # object with the key `price`, identical to what would be used in the request body
87
- # for the [create price endpoint](/api-reference/price/create-price). See the
88
- # [Price resource](/product-catalog/price-configuration) for the specification of
89
- # different price model configurations possible in this object.
90
- #
91
- # For fixed fees, an object in the list can supply a `fixed_price_quantity`
92
- # instead of a `price`, `price_id`, or `external_price_id` field. This will update
93
- # only the quantity for the price, similar to the
94
- # [Update price quantity](/api-reference/subscription/update-price-quantity)
95
- # endpoint.
96
- #
97
- # The replacement price will have the same phase, if applicable, and the same
98
- # start and end dates as the price it replaces.
99
- #
100
- # An object in the list can specify an optional `minimum_amount`,
101
- # `maximum_amount`, or `discounts`. This will create adjustments which apply only
102
- # to this price.
103
- #
104
- # Additionally, an object in the list can specify an optional `reference_id`. This
105
- # ID can be used to reference the replacement price when
106
- # [adding an adjustment](#adding-adjustments) in the same API call. However the ID
107
- # is _transient_ and cannot be used to refer to the price in future API calls.
108
- #
109
- # ### Adding adjustments
110
- #
111
- # To add adjustments, provide a list of objects with the key `add_adjustments`. An
112
- # object in the list must include an object with the key `adjustment`, identical
113
- # to the adjustment object in the
114
- # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
115
- #
116
- # If the plan has phases, each object in the list must include a number with
117
- # `plan_phase_order` key to indicate which phase the adjustment should be added
118
- # to.
119
- #
120
- # An object in the list can specify an optional `start_date` and optional
121
- # `end_date`. If unspecified, the start or end date of the phase or subscription
122
- # will be used.
123
- #
124
- # ### Removing adjustments
125
- #
126
- # To remove adjustments, provide a list of objects with the key
127
- # `remove_adjustments`. An object in the list must include a key, `adjustment_id`,
128
- # with the ID of the adjustment to be removed.
129
- #
130
- # ### Replacing adjustments
131
- #
132
- # To replace adjustments, provide a list of objects with the key
133
- # `replace_adjustments`. An object in the list must specify a plan adjustment to
134
- # replace with the `replaces_adjustment_id` key, and it must specify an adjustment
135
- # to replace it with by including an object with the key `adjustment`, identical
136
- # to the adjustment object in the
137
- # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
138
- #
139
- # The replacement adjustment will have the same phase, if applicable, and the same
140
- # start and end dates as the adjustment it replaces.
141
- #
142
- # ## Price overrides (DEPRECATED)
143
- #
144
- # <Note>
145
- # Price overrides are being phased out in favor adding/removing/replacing prices. (See
146
- # [Customize your customer's subscriptions](/api-reference/subscription/create-subscription))
147
- # </Note>
148
- #
149
- # Price overrides are used to update some or all prices in a plan for the specific
150
- # subscription being created. This is useful when a new customer has negotiated a
151
- # rate that is unique to the customer.
152
- #
153
- # To override prices, provide a list of objects with the key `price_overrides`.
154
- # The price object in the list of overrides is expected to contain the existing
155
- # price id, the `model_type` and configuration. (See the
156
- # [Price resource](/product-catalog/price-configuration) for the specification of
157
- # different price model configurations.) The numerical values can be updated, but
158
- # the billable metric, cadence, type, and name of a price can not be overridden.
159
- #
160
- # ### Maximums and Minimums
161
- #
162
- # Minimums and maximums, much like price overrides, can be useful when a new
163
- # customer has negotiated a new or different minimum or maximum spend cap than the
164
- # default for a given price. If one exists for a price and null is provided for
165
- # the minimum/maximum override on creation, then there will be no minimum/maximum
166
- # on the new subscription. If no value is provided, then the default price maximum
167
- # or minimum is used.
168
- #
169
- # To add a minimum for a specific price, add `minimum_amount` to the specific
170
- # price in the `price_overrides` object.
171
- #
172
- # To add a maximum for a specific price, add `maximum_amount` to the specific
173
- # price in the `price_overrides` object.
174
- #
175
- # ### Minimum override example
176
- #
177
- # Price minimum override example:
178
- #
179
- # ```json
180
- # {
181
- # ...
182
- # "id": "price_id",
183
- # "model_type": "unit",
184
- # "unit_config": {
185
- # "unit_amount": "0.50"
186
- # },
187
- # "minimum_amount": "100.00"
188
- # ...
189
- # }
190
- # ```
191
- #
192
- # Removing an existing minimum example
193
- #
194
- # ```json
195
- # {
196
- # ...
197
- # "id": "price_id",
198
- # "model_type": "unit",
199
- # "unit_config": {
200
- # "unit_amount": "0.50"
201
- # },
202
- # "minimum_amount": null
203
- # ...
204
- # }
205
- # ```
206
- #
207
- # ### Discounts
208
- #
209
- # Discounts, like price overrides, can be useful when a new customer has
210
- # negotiated a new or different discount than the default for a price. If a
211
- # discount exists for a price and a null discount is provided on creation, then
212
- # there will be no discount on the new subscription.
213
- #
214
- # To add a discount for a specific price, add `discount` to the price in the
215
- # `price_overrides` object. Discount should be a dictionary of the format:
216
- #
217
- # ```ts
218
- # {
219
- # "discount_type": "amount" | "percentage" | "usage",
220
- # "amount_discount": string,
221
- # "percentage_discount": string,
222
- # "usage_discount": string
223
- # }
224
- # ```
225
- #
226
- # where either `amount_discount`, `percentage_discount`, or `usage_discount` is
227
- # provided.
228
- #
229
- # Price discount example
230
- #
231
- # ```json
232
- # {
233
- # ...
234
- # "id": "price_id",
235
- # "model_type": "unit",
236
- # "unit_config": {
237
- # "unit_amount": "0.50"
238
- # },
239
- # "discount": {"discount_type": "amount", "amount_discount": "175"},
240
- # }
241
- # ```
242
- #
243
- # Removing an existing discount example
244
- #
245
- # ```json
246
- # {
247
- # "customer_id": "customer_id",
248
- # "plan_id": "plan_id",
249
- # "discount": null,
250
- # "price_overrides": [ ... ]
251
- # ...
252
- # }
253
- # ```
254
- #
255
- # ## Threshold Billing
256
- #
257
- # Orb supports invoicing for a subscription when a preconfigured usage threshold
258
- # is hit. To enable threshold billing, pass in an `invoicing_threshold`, which is
259
- # specified in the subscription's invoicing currency, when creating a
260
- # subscription. E.g. pass in `10.00` to issue an invoice when usage amounts hit
261
- # $10.00 for a subscription that invoices in USD.
7
+ # identified by either the `customer_id` or the `external_customer_id`, and
8
+ # exactly one of these fields must be provided.
9
+ #
10
+ # By default, subscriptions begin on the day that they're created and renew
11
+ # automatically for each billing cycle at the cadence that's configured in the
12
+ # plan definition.
13
+ #
14
+ # The default configuration for subscriptions in Orb is **In-advance billing** and
15
+ # **Beginning of month alignment** (see
16
+ # [Subscription](/core-concepts##subscription) for more details).
17
+ #
18
+ # In order to change the alignment behavior, Orb also supports billing
19
+ # subscriptions on the day of the month they are created. If
20
+ # `align_billing_with_subscription_start_date = true` is specified, subscriptions
21
+ # have billing cycles that are aligned with their `start_date`. For example, a
22
+ # subscription that begins on January 15th will have a billing cycle from January
23
+ # 15th to February 15th. Every subsequent billing cycle will continue to start and
24
+ # invoice on the 15th.
25
+ #
26
+ # If the "day" value is greater than the number of days in the month, the next
27
+ # billing cycle will start at the end of the month. For example, if the start_date
28
+ # is January 31st, the next billing cycle will start on February 28th.
29
+ #
30
+ # If a customer was created with a currency, Orb only allows subscribing the
31
+ # customer to a plan with a matching `invoicing_currency`. If the customer does
32
+ # not have a currency set, on subscription creation, we set the customer's
33
+ # currency to be the `invoicing_currency` of the plan.
34
+ #
35
+ # ## Customize your customer's subscriptions
36
+ #
37
+ # Prices and adjustments in a plan can be added, removed, or replaced for the
38
+ # subscription being created. This is useful when a customer has prices that
39
+ # differ from the default prices for a specific plan.
40
+ #
41
+ # <Note>
42
+ # This feature is only available for accounts that have migrated to Subscription Overrides Version 2. You can find your
43
+ # Subscription Overrides Version at the bottom of your [Plans page](https://app.withorb.com/plans)
44
+ # </Note>
45
+ #
46
+ # ### Adding Prices
47
+ #
48
+ # To add prices, provide a list of objects with the key `add_prices`. An object in
49
+ # the list must specify an existing add-on price with a `price_id` or
50
+ # `external_price_id` field, or create a new add-on price by including an object
51
+ # with the key `price`, identical to what would be used in the request body for
52
+ # the [create price endpoint](/api-reference/price/create-price). See the
53
+ # [Price resource](/product-catalog/price-configuration) for the specification of
54
+ # different price model configurations possible in this object.
55
+ #
56
+ # If the plan has phases, each object in the list must include a number with
57
+ # `plan_phase_order` key to indicate which phase the price should be added to.
58
+ #
59
+ # An object in the list can specify an optional `start_date` and optional
60
+ # `end_date`. This is equivalent to creating a price interval with the
61
+ # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
62
+ # If unspecified, the start or end date of the phase or subscription will be used.
63
+ #
64
+ # An object in the list can specify an optional `minimum_amount`,
65
+ # `maximum_amount`, or `discounts`. This will create adjustments which apply only
66
+ # to this price.
67
+ #
68
+ # Additionally, an object in the list can specify an optional `reference_id`. This
69
+ # ID can be used to reference this price when
70
+ # [adding an adjustment](#adding-adjustments) in the same API call. However the ID
71
+ # is _transient_ and cannot be used to refer to the price in future API calls.
72
+ #
73
+ # ### Removing Prices
74
+ #
75
+ # To remove prices, provide a list of objects with the key `remove_prices`. An
76
+ # object in the list must specify a plan price with either a `price_id` or
77
+ # `external_price_id` field.
78
+ #
79
+ # ### Replacing Prices
80
+ #
81
+ # To replace prices, provide a list of objects with the key `replace_prices`. An
82
+ # object in the list must specify a plan price to replace with the
83
+ # `replaces_price_id` key, and it must specify a price to replace it with by
84
+ # either referencing an existing add-on price with a `price_id` or
85
+ # `external_price_id` field, or by creating a new add-on price by including an
86
+ # object with the key `price`, identical to what would be used in the request body
87
+ # for the [create price endpoint](/api-reference/price/create-price). See the
88
+ # [Price resource](/product-catalog/price-configuration) for the specification of
89
+ # different price model configurations possible in this object.
90
+ #
91
+ # For fixed fees, an object in the list can supply a `fixed_price_quantity`
92
+ # instead of a `price`, `price_id`, or `external_price_id` field. This will update
93
+ # only the quantity for the price, similar to the
94
+ # [Update price quantity](/api-reference/subscription/update-price-quantity)
95
+ # endpoint.
96
+ #
97
+ # The replacement price will have the same phase, if applicable, and the same
98
+ # start and end dates as the price it replaces.
99
+ #
100
+ # An object in the list can specify an optional `minimum_amount`,
101
+ # `maximum_amount`, or `discounts`. This will create adjustments which apply only
102
+ # to this price.
103
+ #
104
+ # Additionally, an object in the list can specify an optional `reference_id`. This
105
+ # ID can be used to reference the replacement price when
106
+ # [adding an adjustment](#adding-adjustments) in the same API call. However the ID
107
+ # is _transient_ and cannot be used to refer to the price in future API calls.
108
+ #
109
+ # ### Adding adjustments
110
+ #
111
+ # To add adjustments, provide a list of objects with the key `add_adjustments`. An
112
+ # object in the list must include an object with the key `adjustment`, identical
113
+ # to the adjustment object in the
114
+ # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
115
+ #
116
+ # If the plan has phases, each object in the list must include a number with
117
+ # `plan_phase_order` key to indicate which phase the adjustment should be added
118
+ # to.
119
+ #
120
+ # An object in the list can specify an optional `start_date` and optional
121
+ # `end_date`. If unspecified, the start or end date of the phase or subscription
122
+ # will be used.
123
+ #
124
+ # ### Removing adjustments
125
+ #
126
+ # To remove adjustments, provide a list of objects with the key
127
+ # `remove_adjustments`. An object in the list must include a key, `adjustment_id`,
128
+ # with the ID of the adjustment to be removed.
129
+ #
130
+ # ### Replacing adjustments
131
+ #
132
+ # To replace adjustments, provide a list of objects with the key
133
+ # `replace_adjustments`. An object in the list must specify a plan adjustment to
134
+ # replace with the `replaces_adjustment_id` key, and it must specify an adjustment
135
+ # to replace it with by including an object with the key `adjustment`, identical
136
+ # to the adjustment object in the
137
+ # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
138
+ #
139
+ # The replacement adjustment will have the same phase, if applicable, and the same
140
+ # start and end dates as the adjustment it replaces.
141
+ #
142
+ # ## Price overrides (DEPRECATED)
143
+ #
144
+ # <Note>
145
+ # Price overrides are being phased out in favor adding/removing/replacing prices. (See
146
+ # [Customize your customer's subscriptions](/api-reference/subscription/create-subscription))
147
+ # </Note>
148
+ #
149
+ # Price overrides are used to update some or all prices in a plan for the specific
150
+ # subscription being created. This is useful when a new customer has negotiated a
151
+ # rate that is unique to the customer.
152
+ #
153
+ # To override prices, provide a list of objects with the key `price_overrides`.
154
+ # The price object in the list of overrides is expected to contain the existing
155
+ # price id, the `model_type` and configuration. (See the
156
+ # [Price resource](/product-catalog/price-configuration) for the specification of
157
+ # different price model configurations.) The numerical values can be updated, but
158
+ # the billable metric, cadence, type, and name of a price can not be overridden.
159
+ #
160
+ # ### Maximums and Minimums
161
+ #
162
+ # Minimums and maximums, much like price overrides, can be useful when a new
163
+ # customer has negotiated a new or different minimum or maximum spend cap than the
164
+ # default for a given price. If one exists for a price and null is provided for
165
+ # the minimum/maximum override on creation, then there will be no minimum/maximum
166
+ # on the new subscription. If no value is provided, then the default price maximum
167
+ # or minimum is used.
168
+ #
169
+ # To add a minimum for a specific price, add `minimum_amount` to the specific
170
+ # price in the `price_overrides` object.
171
+ #
172
+ # To add a maximum for a specific price, add `maximum_amount` to the specific
173
+ # price in the `price_overrides` object.
174
+ #
175
+ # ### Minimum override example
176
+ #
177
+ # Price minimum override example:
178
+ #
179
+ # ```json
180
+ # {
181
+ # ...
182
+ # "id": "price_id",
183
+ # "model_type": "unit",
184
+ # "unit_config": {
185
+ # "unit_amount": "0.50"
186
+ # },
187
+ # "minimum_amount": "100.00"
188
+ # ...
189
+ # }
190
+ # ```
191
+ #
192
+ # Removing an existing minimum example
193
+ #
194
+ # ```json
195
+ # {
196
+ # ...
197
+ # "id": "price_id",
198
+ # "model_type": "unit",
199
+ # "unit_config": {
200
+ # "unit_amount": "0.50"
201
+ # },
202
+ # "minimum_amount": null
203
+ # ...
204
+ # }
205
+ # ```
206
+ #
207
+ # ### Discounts
208
+ #
209
+ # Discounts, like price overrides, can be useful when a new customer has
210
+ # negotiated a new or different discount than the default for a price. If a
211
+ # discount exists for a price and a null discount is provided on creation, then
212
+ # there will be no discount on the new subscription.
213
+ #
214
+ # To add a discount for a specific price, add `discount` to the price in the
215
+ # `price_overrides` object. Discount should be a dictionary of the format:
216
+ #
217
+ # ```ts
218
+ # {
219
+ # "discount_type": "amount" | "percentage" | "usage",
220
+ # "amount_discount": string,
221
+ # "percentage_discount": string,
222
+ # "usage_discount": string
223
+ # }
224
+ # ```
225
+ #
226
+ # where either `amount_discount`, `percentage_discount`, or `usage_discount` is
227
+ # provided.
228
+ #
229
+ # Price discount example
230
+ #
231
+ # ```json
232
+ # {
233
+ # ...
234
+ # "id": "price_id",
235
+ # "model_type": "unit",
236
+ # "unit_config": {
237
+ # "unit_amount": "0.50"
238
+ # },
239
+ # "discount": {"discount_type": "amount", "amount_discount": "175"},
240
+ # }
241
+ # ```
242
+ #
243
+ # Removing an existing discount example
244
+ #
245
+ # ```json
246
+ # {
247
+ # "customer_id": "customer_id",
248
+ # "plan_id": "plan_id",
249
+ # "discount": null,
250
+ # "price_overrides": [ ... ]
251
+ # ...
252
+ # }
253
+ # ```
254
+ #
255
+ # ## Threshold Billing
256
+ #
257
+ # Orb supports invoicing for a subscription when a preconfigured usage threshold
258
+ # is hit. To enable threshold billing, pass in an `invoicing_threshold`, which is
259
+ # specified in the subscription's invoicing currency, when creating a
260
+ # subscription. E.g. pass in `10.00` to issue an invoice when usage amounts hit
261
+ # $10.00 for a subscription that invoices in USD.
262
262
  sig do
263
263
  params(
264
264
  add_adjustments: T.nilable(T::Array[T.any(Orb::Models::SubscriptionCreateParams::AddAdjustment, Orb::Internal::AnyHash)]),
@@ -304,94 +304,92 @@ module Orb
304
304
  end
305
305
  def create(
306
306
  # Additional adjustments to be added to the subscription. (Only available for
307
- # accounts that have migrated off of legacy subscription overrides)
307
+ # accounts that have migrated off of legacy subscription overrides)
308
308
  add_adjustments: nil,
309
309
  # Additional prices to be added to the subscription. (Only available for accounts
310
- # that have migrated off of legacy subscription overrides)
310
+ # that have migrated off of legacy subscription overrides)
311
311
  add_prices: nil,
312
312
  align_billing_with_subscription_start_date: nil,
313
313
  # Determines whether issued invoices for this subscription will automatically be
314
- # charged with the saved payment method on the due date. If not specified, this
315
- # defaults to the behavior configured for this customer.
314
+ # charged with the saved payment method on the due date. If not specified, this
315
+ # defaults to the behavior configured for this customer.
316
316
  auto_collection: nil,
317
317
  aws_region: nil,
318
318
  billing_cycle_anchor_configuration: nil,
319
319
  # Redemption code to be used for this subscription. If the coupon cannot be found
320
- # by its redemption code, or cannot be redeemed, an error response will be
321
- # returned and the subscription creation or plan change will not be scheduled.
320
+ # by its redemption code, or cannot be redeemed, an error response will be
321
+ # returned and the subscription creation or plan change will not be scheduled.
322
322
  coupon_redemption_code: nil,
323
323
  credits_overage_rate: nil,
324
324
  customer_id: nil,
325
325
  # Determines the default memo on this subscription's invoices. Note that if this
326
- # is not provided, it is determined by the plan configuration.
326
+ # is not provided, it is determined by the plan configuration.
327
327
  default_invoice_memo: nil,
328
328
  end_date: nil,
329
329
  external_customer_id: nil,
330
330
  external_marketplace: nil,
331
331
  external_marketplace_reporting_id: nil,
332
332
  # The external_plan_id of the plan that the given subscription should be switched
333
- # to. Note that either this property or `plan_id` must be specified.
333
+ # to. Note that either this property or `plan_id` must be specified.
334
334
  external_plan_id: nil,
335
335
  # An additional filter to apply to usage queries. This filter must be expressed as
336
- # a boolean
337
- # [computed property](/extensibility/advanced-metrics#computed-properties). If
338
- # null, usage queries will not include any additional filter.
336
+ # a boolean
337
+ # [computed property](/extensibility/advanced-metrics#computed-properties). If
338
+ # null, usage queries will not include any additional filter.
339
339
  filter: nil,
340
340
  # The phase of the plan to start with
341
341
  initial_phase_order: nil,
342
342
  # When this subscription's accrued usage reaches this threshold, an invoice will
343
- # be issued for the subscription. If not specified, invoices will only be issued
344
- # at the end of the billing period.
343
+ # be issued for the subscription. If not specified, invoices will only be issued
344
+ # at the end of the billing period.
345
345
  invoicing_threshold: nil,
346
346
  # User-specified key/value pairs for the resource. Individual keys can be removed
347
- # by setting the value to `null`, and the entire metadata mapping can be cleared
348
- # by setting `metadata` to `null`.
347
+ # by setting the value to `null`, and the entire metadata mapping can be cleared
348
+ # by setting `metadata` to `null`.
349
349
  metadata: nil,
350
350
  # The net terms determines the difference between the invoice date and the issue
351
- # date for the invoice. If you intend the invoice to be due on issue, set this
352
- # to 0. If not provided, this defaults to the value specified in the plan.
351
+ # date for the invoice. If you intend the invoice to be due on issue, set this
352
+ # to 0. If not provided, this defaults to the value specified in the plan.
353
353
  net_terms: nil,
354
354
  per_credit_overage_amount: nil,
355
355
  # The plan that the given subscription should be switched to. Note that either
356
- # this property or `external_plan_id` must be specified.
356
+ # this property or `external_plan_id` must be specified.
357
357
  plan_id: nil,
358
358
  # Specifies which version of the plan to subscribe to. If null, the default
359
- # version will be used.
359
+ # version will be used.
360
360
  plan_version_number: nil,
361
361
  # Optionally provide a list of overrides for prices on the plan
362
362
  price_overrides: nil,
363
363
  # Plan adjustments to be removed from the subscription. (Only available for
364
- # accounts that have migrated off of legacy subscription overrides)
364
+ # accounts that have migrated off of legacy subscription overrides)
365
365
  remove_adjustments: nil,
366
366
  # Plan prices to be removed from the subscription. (Only available for accounts
367
- # that have migrated off of legacy subscription overrides)
367
+ # that have migrated off of legacy subscription overrides)
368
368
  remove_prices: nil,
369
369
  # Plan adjustments to be replaced with additional adjustments on the subscription.
370
- # (Only available for accounts that have migrated off of legacy subscription
371
- # overrides)
370
+ # (Only available for accounts that have migrated off of legacy subscription
371
+ # overrides)
372
372
  replace_adjustments: nil,
373
373
  # Plan prices to be replaced with additional prices on the subscription. (Only
374
- # available for accounts that have migrated off of legacy subscription overrides)
374
+ # available for accounts that have migrated off of legacy subscription overrides)
375
375
  replace_prices: nil,
376
376
  start_date: nil,
377
377
  # The duration of the trial period in days. If not provided, this defaults to the
378
- # value specified in the plan. If `0` is provided, the trial on the plan will be
379
- # skipped.
378
+ # value specified in the plan. If `0` is provided, the trial on the plan will be
379
+ # skipped.
380
380
  trial_duration_days: nil,
381
381
  # A list of customer IDs whose usage events will be aggregated and billed under
382
- # this subscription. By default, a subscription only considers usage events
383
- # associated with its attached customer's customer_id. When usage_customer_ids is
384
- # provided, the subscription includes usage events from the specified customers
385
- # only. Provided usage_customer_ids must be either the customer for this
386
- # subscription itself, or any of that customer's children.
382
+ # this subscription. By default, a subscription only considers usage events
383
+ # associated with its attached customer's customer_id. When usage_customer_ids is
384
+ # provided, the subscription includes usage events from the specified customers
385
+ # only. Provided usage_customer_ids must be either the customer for this
386
+ # subscription itself, or any of that customer's children.
387
387
  usage_customer_ids: nil,
388
388
  request_options: {}
389
- )
390
- end
391
-
389
+ ); end
392
390
  # This endpoint can be used to update the `metadata`, `net terms`,
393
- # `auto_collection`, `invoicing_threshold`, and `default_invoice_memo` properties
394
- # on a subscription.
391
+ # `auto_collection`, `invoicing_threshold`, and `default_invoice_memo` properties
392
+ # on a subscription.
395
393
  sig do
396
394
  params(
397
395
  subscription_id: String,
@@ -407,38 +405,36 @@ module Orb
407
405
  def update(
408
406
  subscription_id,
409
407
  # Determines whether issued invoices for this subscription will automatically be
410
- # charged with the saved payment method on the due date. This property defaults to
411
- # the plan's behavior.
408
+ # charged with the saved payment method on the due date. This property defaults to
409
+ # the plan's behavior.
412
410
  auto_collection: nil,
413
411
  # Determines the default memo on this subscription's invoices. Note that if this
414
- # is not provided, it is determined by the plan configuration.
412
+ # is not provided, it is determined by the plan configuration.
415
413
  default_invoice_memo: nil,
416
414
  # When this subscription's accrued usage reaches this threshold, an invoice will
417
- # be issued for the subscription. If not specified, invoices will only be issued
418
- # at the end of the billing period.
415
+ # be issued for the subscription. If not specified, invoices will only be issued
416
+ # at the end of the billing period.
419
417
  invoicing_threshold: nil,
420
418
  # User-specified key/value pairs for the resource. Individual keys can be removed
421
- # by setting the value to `null`, and the entire metadata mapping can be cleared
422
- # by setting `metadata` to `null`.
419
+ # by setting the value to `null`, and the entire metadata mapping can be cleared
420
+ # by setting `metadata` to `null`.
423
421
  metadata: nil,
424
422
  # Determines the difference between the invoice issue date for subscription
425
- # invoices as the date that they are due. A value of `0` here represents that the
426
- # invoice is due on issue, whereas a value of `30` represents that the customer
427
- # has a month to pay the invoice.
423
+ # invoices as the date that they are due. A value of `0` here represents that the
424
+ # invoice is due on issue, whereas a value of `30` represents that the customer
425
+ # has a month to pay the invoice.
428
426
  net_terms: nil,
429
427
  request_options: {}
430
- )
431
- end
432
-
428
+ ); end
433
429
  # This endpoint returns a list of all subscriptions for an account as a
434
- # [paginated](/api-reference/pagination) list, ordered starting from the most
435
- # recently created subscription. For a full discussion of the subscription
436
- # resource, see [Subscription](/core-concepts##subscription).
437
- #
438
- # Subscriptions can be filtered for a specific customer by using either the
439
- # customer_id or external_customer_id query parameters. To filter subscriptions
440
- # for multiple customers, use the customer_id[] or external_customer_id[] query
441
- # parameters.
430
+ # [paginated](/api-reference/pagination) list, ordered starting from the most
431
+ # recently created subscription. For a full discussion of the subscription
432
+ # resource, see [Subscription](/core-concepts##subscription).
433
+ #
434
+ # Subscriptions can be filtered for a specific customer by using either the
435
+ # customer_id or external_customer_id query parameters. To filter subscriptions
436
+ # for multiple customers, use the customer_id[] or external_customer_id[] query
437
+ # parameters.
442
438
  sig do
443
439
  params(
444
440
  created_at_gt: T.nilable(Time),
@@ -460,7 +456,7 @@ module Orb
460
456
  created_at_lt: nil,
461
457
  created_at_lte: nil,
462
458
  # Cursor for pagination. This can be populated by the `next_cursor` value returned
463
- # from the initial request.
459
+ # from the initial request.
464
460
  cursor: nil,
465
461
  customer_id: nil,
466
462
  external_customer_id: nil,
@@ -468,70 +464,68 @@ module Orb
468
464
  limit: nil,
469
465
  status: nil,
470
466
  request_options: {}
471
- )
472
- end
473
-
467
+ ); end
474
468
  # This endpoint can be used to cancel an existing subscription. It returns the
475
- # serialized subscription object with an `end_date` parameter that signifies when
476
- # the subscription will transition to an ended state.
477
- #
478
- # The body parameter `cancel_option` determines the cancellation behavior. Orb
479
- # supports three cancellation options:
480
- #
481
- # - `end_of_subscription_term`: stops the subscription from auto-renewing.
482
- # Subscriptions that have been cancelled with this option can still incur
483
- # charges for the remainder of their term:
484
- #
485
- # - Issuing this cancellation request for a monthly subscription will keep the
486
- # subscription active until the start of the subsequent month, and potentially
487
- # issue an invoice for any usage charges incurred in the intervening period.
488
- # - Issuing this cancellation request for a quarterly subscription will keep the
489
- # subscription active until the end of the quarter and potentially issue an
490
- # invoice for any usage charges incurred in the intervening period.
491
- # - Issuing this cancellation request for a yearly subscription will keep the
492
- # subscription active for the full year. For example, a yearly subscription
493
- # starting on 2021-11-01 and cancelled on 2021-12-08 will remain active until
494
- # 2022-11-01 and potentially issue charges in the intervening months for any
495
- # recurring monthly usage charges in its plan.
496
- # - **Note**: If a subscription's plan contains prices with difference cadences,
497
- # the end of term date will be determined by the largest cadence value. For
498
- # example, cancelling end of term for a subscription with a quarterly fixed
499
- # fee with a monthly usage fee will result in the subscription ending at the
500
- # end of the quarter.
501
- #
502
- # - `immediate`: ends the subscription immediately, setting the `end_date` to the
503
- # current time:
504
- #
505
- # - Subscriptions that have been cancelled with this option will be invoiced
506
- # immediately. This invoice will include any usage fees incurred in the
507
- # billing period up to the cancellation, along with any prorated recurring
508
- # fees for the billing period, if applicable.
509
- # - **Note**: If the subscription has a recurring fee that was paid in-advance,
510
- # the prorated amount for the remaining time period will be added to the
511
- # [customer's balance](list-balance-transactions) upon immediate cancellation.
512
- # However, if the customer is ineligible to use the customer balance, the
513
- # subscription cannot be cancelled immediately.
514
- #
515
- # - `requested_date`: ends the subscription on a specified date, which requires a
516
- # `cancellation_date` to be passed in. If no timezone is provided, the
517
- # customer's timezone is used. For example, a subscription starting on January
518
- # 1st with a monthly price can be set to be cancelled on the first of any month
519
- # after January 1st (e.g. March 1st, April 1st, May 1st). A subscription with
520
- # multiple prices with different cadences defines the "term" to be the highest
521
- # cadence of the prices.
522
- #
523
- # Upcoming subscriptions are only eligible for immediate cancellation, which will
524
- # set the `end_date` equal to the `start_date` upon cancellation.
525
- #
526
- # ## Backdated cancellations
527
- #
528
- # Orb allows you to cancel a subscription in the past as long as there are no paid
529
- # invoices between the `requested_date` and the current time. If the cancellation
530
- # is after the latest issued invoice, Orb will generate a balance refund for the
531
- # current period. If the cancellation is before the most recently issued invoice,
532
- # Orb will void the intervening invoice and generate a new one based on the new
533
- # dates for the subscription. See the section on
534
- # [cancellation behaviors](/product-catalog/creating-subscriptions#cancellation-behaviors).
469
+ # serialized subscription object with an `end_date` parameter that signifies when
470
+ # the subscription will transition to an ended state.
471
+ #
472
+ # The body parameter `cancel_option` determines the cancellation behavior. Orb
473
+ # supports three cancellation options:
474
+ #
475
+ # - `end_of_subscription_term`: stops the subscription from auto-renewing.
476
+ # Subscriptions that have been cancelled with this option can still incur
477
+ # charges for the remainder of their term:
478
+ #
479
+ # - Issuing this cancellation request for a monthly subscription will keep the
480
+ # subscription active until the start of the subsequent month, and potentially
481
+ # issue an invoice for any usage charges incurred in the intervening period.
482
+ # - Issuing this cancellation request for a quarterly subscription will keep the
483
+ # subscription active until the end of the quarter and potentially issue an
484
+ # invoice for any usage charges incurred in the intervening period.
485
+ # - Issuing this cancellation request for a yearly subscription will keep the
486
+ # subscription active for the full year. For example, a yearly subscription
487
+ # starting on 2021-11-01 and cancelled on 2021-12-08 will remain active until
488
+ # 2022-11-01 and potentially issue charges in the intervening months for any
489
+ # recurring monthly usage charges in its plan.
490
+ # - **Note**: If a subscription's plan contains prices with difference cadences,
491
+ # the end of term date will be determined by the largest cadence value. For
492
+ # example, cancelling end of term for a subscription with a quarterly fixed
493
+ # fee with a monthly usage fee will result in the subscription ending at the
494
+ # end of the quarter.
495
+ #
496
+ # - `immediate`: ends the subscription immediately, setting the `end_date` to the
497
+ # current time:
498
+ #
499
+ # - Subscriptions that have been cancelled with this option will be invoiced
500
+ # immediately. This invoice will include any usage fees incurred in the
501
+ # billing period up to the cancellation, along with any prorated recurring
502
+ # fees for the billing period, if applicable.
503
+ # - **Note**: If the subscription has a recurring fee that was paid in-advance,
504
+ # the prorated amount for the remaining time period will be added to the
505
+ # [customer's balance](list-balance-transactions) upon immediate cancellation.
506
+ # However, if the customer is ineligible to use the customer balance, the
507
+ # subscription cannot be cancelled immediately.
508
+ #
509
+ # - `requested_date`: ends the subscription on a specified date, which requires a
510
+ # `cancellation_date` to be passed in. If no timezone is provided, the
511
+ # customer's timezone is used. For example, a subscription starting on January
512
+ # 1st with a monthly price can be set to be cancelled on the first of any month
513
+ # after January 1st (e.g. March 1st, April 1st, May 1st). A subscription with
514
+ # multiple prices with different cadences defines the "term" to be the highest
515
+ # cadence of the prices.
516
+ #
517
+ # Upcoming subscriptions are only eligible for immediate cancellation, which will
518
+ # set the `end_date` equal to the `start_date` upon cancellation.
519
+ #
520
+ # ## Backdated cancellations
521
+ #
522
+ # Orb allows you to cancel a subscription in the past as long as there are no paid
523
+ # invoices between the `requested_date` and the current time. If the cancellation
524
+ # is after the latest issued invoice, Orb will generate a balance refund for the
525
+ # current period. If the cancellation is before the most recently issued invoice,
526
+ # Orb will void the intervening invoice and generate a new one based on the new
527
+ # dates for the subscription. See the section on
528
+ # [cancellation behaviors](/product-catalog/creating-subscriptions#cancellation-behaviors).
535
529
  sig do
536
530
  params(
537
531
  subscription_id: String,
@@ -547,18 +541,16 @@ module Orb
547
541
  # Determines the timing of subscription cancellation
548
542
  cancel_option:,
549
543
  # If false, this request will fail if it would void an issued invoice or create a
550
- # credit note. Consider using this as a safety mechanism if you do not expect
551
- # existing invoices to be changed.
544
+ # credit note. Consider using this as a safety mechanism if you do not expect
545
+ # existing invoices to be changed.
552
546
  allow_invoice_credit_or_void: nil,
553
547
  # The date that the cancellation should take effect. This parameter can only be
554
- # passed if the `cancel_option` is `requested_date`.
548
+ # passed if the `cancel_option` is `requested_date`.
555
549
  cancellation_date: nil,
556
550
  request_options: {}
557
- )
558
- end
559
-
551
+ ); end
560
552
  # This endpoint is used to fetch a [Subscription](/core-concepts##subscription)
561
- # given an identifier.
553
+ # given an identifier.
562
554
  sig do
563
555
  params(
564
556
  subscription_id: String,
@@ -566,19 +558,18 @@ module Orb
566
558
  )
567
559
  .returns(Orb::Models::Subscription)
568
560
  end
569
- def fetch(subscription_id, request_options: {})
570
- end
561
+ def fetch(subscription_id, request_options: {}); end
571
562
 
572
563
  # This endpoint is used to fetch a day-by-day snapshot of a subscription's costs
573
- # in Orb, calculated by applying pricing information to the underlying usage (see
574
- # the [subscription usage endpoint](fetch-subscription-usage) to fetch usage per
575
- # metric, in usage units rather than a currency).
576
- #
577
- # The semantics of this endpoint exactly mirror those of
578
- # [fetching a customer's costs](fetch-customer-costs). Use this endpoint to limit
579
- # your analysis of costs to a specific subscription for the customer (e.g. to
580
- # de-aggregate costs when a customer's subscription has started and stopped on the
581
- # same day).
564
+ # in Orb, calculated by applying pricing information to the underlying usage (see
565
+ # the [subscription usage endpoint](fetch-subscription-usage) to fetch usage per
566
+ # metric, in usage units rather than a currency).
567
+ #
568
+ # The semantics of this endpoint exactly mirror those of
569
+ # [fetching a customer's costs](fetch-customer-costs). Use this endpoint to limit
570
+ # your analysis of costs to a specific subscription for the customer (e.g. to
571
+ # de-aggregate costs when a customer's subscription has started and stopped on the
572
+ # same day).
582
573
  sig do
583
574
  params(
584
575
  subscription_id: String,
@@ -599,18 +590,16 @@ module Orb
599
590
  # Costs returned are inclusive of `timeframe_start`.
600
591
  timeframe_start: nil,
601
592
  # Controls whether Orb returns cumulative costs since the start of the billing
602
- # period, or incremental day-by-day costs. If your customer has minimums or
603
- # discounts, it's strongly recommended that you use the default cumulative
604
- # behavior.
593
+ # period, or incremental day-by-day costs. If your customer has minimums or
594
+ # discounts, it's strongly recommended that you use the default cumulative
595
+ # behavior.
605
596
  view_mode: nil,
606
597
  request_options: {}
607
- )
608
- end
609
-
598
+ ); end
610
599
  # This endpoint returns a [paginated](/api-reference/pagination) list of all plans
611
- # associated with a subscription along with their start and end dates. This list
612
- # contains the subscription's initial plan along with past and future plan
613
- # changes.
600
+ # associated with a subscription along with their start and end dates. This list
601
+ # contains the subscription's initial plan along with past and future plan
602
+ # changes.
614
603
  sig do
615
604
  params(
616
605
  subscription_id: String,
@@ -627,7 +616,7 @@ module Orb
627
616
  def fetch_schedule(
628
617
  subscription_id,
629
618
  # Cursor for pagination. This can be populated by the `next_cursor` value returned
630
- # from the initial request.
619
+ # from the initial request.
631
620
  cursor: nil,
632
621
  # The number of items to fetch. Defaults to 20.
633
622
  limit: nil,
@@ -636,203 +625,201 @@ module Orb
636
625
  start_date_lt: nil,
637
626
  start_date_lte: nil,
638
627
  request_options: {}
639
- )
640
- end
641
-
628
+ ); end
642
629
  # This endpoint is used to fetch a subscription's usage in Orb. Especially when
643
- # combined with optional query parameters, this endpoint is a powerful way to
644
- # build visualizations on top of Orb's event data and metrics.
645
- #
646
- # With no query parameters specified, this endpoint returns usage for the
647
- # subscription's _current billing period_ across each billable metric that
648
- # participates in the subscription. Usage quantities returned are the result of
649
- # evaluating the metric definition for the entirety of the customer's billing
650
- # period.
651
- #
652
- # ### Default response shape
653
- #
654
- # Orb returns a `data` array with an object corresponding to each billable metric.
655
- # Nested within this object is a `usage` array which has a `quantity` value and a
656
- # corresponding `timeframe_start` and `timeframe_end`. The `quantity` value
657
- # represents the calculated usage value for the billable metric over the specified
658
- # timeframe (inclusive of the `timeframe_start` timestamp and exclusive of the
659
- # `timeframe_end` timestamp).
660
- #
661
- # Orb will include _every_ window in the response starting from the beginning of
662
- # the billing period, even when there were no events (and therefore no usage) in
663
- # the window. This increases the size of the response but prevents the caller from
664
- # filling in gaps and handling cumbersome time-based logic.
665
- #
666
- # The query parameters in this endpoint serve to override this behavior and
667
- # provide some key functionality, as listed below. Note that this functionality
668
- # can also be used _in conjunction_ with each other, e.g. to display grouped usage
669
- # on a custom timeframe.
670
- #
671
- # ## Custom timeframe
672
- #
673
- # In order to view usage for a custom timeframe rather than the current billing
674
- # period, specify a `timeframe_start` and `timeframe_end`. This will calculate
675
- # quantities for usage incurred between timeframe_start (inclusive) and
676
- # timeframe_end (exclusive), i.e. `[timeframe_start, timeframe_end)`.
677
- #
678
- # Note:
679
- #
680
- # - These timestamps must be specified in ISO 8601 format and UTC timezone, e.g.
681
- # `2022-02-01T05:00:00Z`.
682
- # - Both parameters must be specified if either is specified.
683
- #
684
- # ## Grouping by custom attributes
685
- #
686
- # In order to view a single metric grouped by a specific _attribute_ that each
687
- # event is tagged with (e.g. `cluster`), you must additionally specify a
688
- # `billable_metric_id` and a `group_by` key. The `group_by` key denotes the event
689
- # property on which to group.
690
- #
691
- # When returning grouped usage, only usage for `billable_metric_id` is returned,
692
- # and a separate object in the `data` array is returned for each value of the
693
- # `group_by` key present in your events. The `quantity` value is the result of
694
- # evaluating the billable metric for events filtered to a single value of the
695
- # `group_by` key.
696
- #
697
- # Orb expects that events that match the billable metric will contain values in
698
- # the `properties` dictionary that correspond to the `group_by` key specified. By
699
- # default, Orb will not return a `null` group (i.e. events that match the metric
700
- # but do not have the key set). Currently, it is only possible to view usage
701
- # grouped by a single attribute at a time.
702
- #
703
- # When viewing grouped usage, Orb uses pagination to limit the response size to
704
- # 1000 groups by default. If there are more groups for a given subscription,
705
- # pagination metadata in the response can be used to fetch all of the data.
706
- #
707
- # The following example shows usage for an "API Requests" billable metric grouped
708
- # by `region`. Note the extra `metric_group` dictionary in the response, which
709
- # provides metadata about the group:
710
- #
711
- # ```json
712
- # {
713
- # "data": [
714
- # {
715
- # "usage": [
716
- # {
717
- # "quantity": 0.19291,
718
- # "timeframe_start": "2021-10-01T07:00:00Z",
719
- # "timeframe_end": "2021-10-02T07:00:00Z",
720
- # },
721
- # ...
722
- # ],
723
- # "metric_group": {
724
- # "property_key": "region",
725
- # "property_value": "asia/pacific"
726
- # },
727
- # "billable_metric": {
728
- # "id": "Fe9pbpMk86xpwdGB",
729
- # "name": "API Requests"
730
- # },
731
- # "view_mode": "periodic"
732
- # },
733
- # ...
734
- # ]
735
- # }
736
- # ```
737
- #
738
- # ## Windowed usage
739
- #
740
- # The `granularity` parameter can be used to _window_ the usage `quantity` value
741
- # into periods. When not specified, usage is returned for the entirety of the time
742
- # range.
743
- #
744
- # When `granularity = day` is specified with a timeframe longer than a day, Orb
745
- # will return a `quantity` value for each full day between `timeframe_start` and
746
- # `timeframe_end`. Note that the days are demarcated by the _customer's local
747
- # midnight_.
748
- #
749
- # For example, with `timeframe_start = 2022-02-01T05:00:00Z`,
750
- # `timeframe_end = 2022-02-04T01:00:00Z` and `granularity=day`, the following
751
- # windows will be returned for a customer in the `America/Los_Angeles` timezone
752
- # since local midnight is `08:00` UTC:
753
- #
754
- # - `[2022-02-01T05:00:00Z, 2022-02-01T08:00:00Z)`
755
- # - `[2022-02-01T08:00:00, 2022-02-02T08:00:00Z)`
756
- # - `[2022-02-02T08:00:00, 2022-02-03T08:00:00Z)`
757
- # - `[2022-02-03T08:00:00, 2022-02-04T01:00:00Z)`
758
- #
759
- # ```json
760
- # {
761
- # "data": [
762
- # {
763
- # "billable_metric": {
764
- # "id": "Q8w89wjTtBdejXKsm",
765
- # "name": "API Requests"
766
- # },
767
- # "usage": [
768
- # {
769
- # "quantity": 0,
770
- # "timeframe_end": "2022-02-01T08:00:00+00:00",
771
- # "timeframe_start": "2022-02-01T05:00:00+00:00"
772
- # },
773
- # {
774
- #
775
- # "quantity": 0,
776
- # "timeframe_end": "2022-02-02T08:00:00+00:00",
777
- # "timeframe_start": "2022-02-01T08:00:00+00:00"
778
- # },
779
- # {
780
- # "quantity": 0,
781
- # "timeframe_end": "2022-02-03T08:00:00+00:00",
782
- # "timeframe_start": "2022-02-02T08:00:00+00:00"
783
- # },
784
- # {
785
- # "quantity": 0,
786
- # "timeframe_end": "2022-02-04T01:00:00+00:00",
787
- # "timeframe_start": "2022-02-03T08:00:00+00:00"
788
- # }
789
- # ],
790
- # "view_mode": "periodic"
791
- # },
792
- # ...
793
- # ]
794
- # }
795
- # ```
796
- #
797
- # ## Decomposable vs. non-decomposable metrics
798
- #
799
- # Billable metrics fall into one of two categories: decomposable and
800
- # non-decomposable. A decomposable billable metric, such as a sum or a count, can
801
- # be displayed and aggregated across arbitrary timescales. On the other hand, a
802
- # non-decomposable metric is not meaningful when only a slice of the billing
803
- # window is considered.
804
- #
805
- # As an example, if we have a billable metric that's defined to count unique
806
- # users, displaying a graph of unique users for each day is not representative of
807
- # the billable metric value over the month (days could have an overlapping set of
808
- # 'unique' users). Instead, what's useful for any given day is the number of
809
- # unique users in the billing period so far, which are the _cumulative_ unique
810
- # users.
811
- #
812
- # Accordingly, this endpoint returns treats these two types of metrics differently
813
- # when `group_by` is specified:
814
- #
815
- # - Decomposable metrics can be grouped by any event property.
816
- # - Non-decomposable metrics can only be grouped by the corresponding price's
817
- # invoice grouping key. If no invoice grouping key is present, the metric does
818
- # not support `group_by`.
819
- #
820
- # ## Matrix prices
821
- #
822
- # When a billable metric is attached to a price that uses matrix pricing, it's
823
- # important to view usage grouped by those matrix dimensions. In this case, use
824
- # the query parameters `first_dimension_key`, `first_dimension_value` and
825
- # `second_dimension_key`, `second_dimension_value` while filtering to a specific
826
- # `billable_metric_id`.
827
- #
828
- # For example, if your compute metric has a separate unit price (i.e. a matrix
829
- # pricing model) per `region` and `provider`, your request might provide the
830
- # following parameters:
831
- #
832
- # - `first_dimension_key`: `region`
833
- # - `first_dimension_value`: `us-east-1`
834
- # - `second_dimension_key`: `provider`
835
- # - `second_dimension_value`: `aws`
630
+ # combined with optional query parameters, this endpoint is a powerful way to
631
+ # build visualizations on top of Orb's event data and metrics.
632
+ #
633
+ # With no query parameters specified, this endpoint returns usage for the
634
+ # subscription's _current billing period_ across each billable metric that
635
+ # participates in the subscription. Usage quantities returned are the result of
636
+ # evaluating the metric definition for the entirety of the customer's billing
637
+ # period.
638
+ #
639
+ # ### Default response shape
640
+ #
641
+ # Orb returns a `data` array with an object corresponding to each billable metric.
642
+ # Nested within this object is a `usage` array which has a `quantity` value and a
643
+ # corresponding `timeframe_start` and `timeframe_end`. The `quantity` value
644
+ # represents the calculated usage value for the billable metric over the specified
645
+ # timeframe (inclusive of the `timeframe_start` timestamp and exclusive of the
646
+ # `timeframe_end` timestamp).
647
+ #
648
+ # Orb will include _every_ window in the response starting from the beginning of
649
+ # the billing period, even when there were no events (and therefore no usage) in
650
+ # the window. This increases the size of the response but prevents the caller from
651
+ # filling in gaps and handling cumbersome time-based logic.
652
+ #
653
+ # The query parameters in this endpoint serve to override this behavior and
654
+ # provide some key functionality, as listed below. Note that this functionality
655
+ # can also be used _in conjunction_ with each other, e.g. to display grouped usage
656
+ # on a custom timeframe.
657
+ #
658
+ # ## Custom timeframe
659
+ #
660
+ # In order to view usage for a custom timeframe rather than the current billing
661
+ # period, specify a `timeframe_start` and `timeframe_end`. This will calculate
662
+ # quantities for usage incurred between timeframe_start (inclusive) and
663
+ # timeframe_end (exclusive), i.e. `[timeframe_start, timeframe_end)`.
664
+ #
665
+ # Note:
666
+ #
667
+ # - These timestamps must be specified in ISO 8601 format and UTC timezone, e.g.
668
+ # `2022-02-01T05:00:00Z`.
669
+ # - Both parameters must be specified if either is specified.
670
+ #
671
+ # ## Grouping by custom attributes
672
+ #
673
+ # In order to view a single metric grouped by a specific _attribute_ that each
674
+ # event is tagged with (e.g. `cluster`), you must additionally specify a
675
+ # `billable_metric_id` and a `group_by` key. The `group_by` key denotes the event
676
+ # property on which to group.
677
+ #
678
+ # When returning grouped usage, only usage for `billable_metric_id` is returned,
679
+ # and a separate object in the `data` array is returned for each value of the
680
+ # `group_by` key present in your events. The `quantity` value is the result of
681
+ # evaluating the billable metric for events filtered to a single value of the
682
+ # `group_by` key.
683
+ #
684
+ # Orb expects that events that match the billable metric will contain values in
685
+ # the `properties` dictionary that correspond to the `group_by` key specified. By
686
+ # default, Orb will not return a `null` group (i.e. events that match the metric
687
+ # but do not have the key set). Currently, it is only possible to view usage
688
+ # grouped by a single attribute at a time.
689
+ #
690
+ # When viewing grouped usage, Orb uses pagination to limit the response size to
691
+ # 1000 groups by default. If there are more groups for a given subscription,
692
+ # pagination metadata in the response can be used to fetch all of the data.
693
+ #
694
+ # The following example shows usage for an "API Requests" billable metric grouped
695
+ # by `region`. Note the extra `metric_group` dictionary in the response, which
696
+ # provides metadata about the group:
697
+ #
698
+ # ```json
699
+ # {
700
+ # "data": [
701
+ # {
702
+ # "usage": [
703
+ # {
704
+ # "quantity": 0.19291,
705
+ # "timeframe_start": "2021-10-01T07:00:00Z",
706
+ # "timeframe_end": "2021-10-02T07:00:00Z",
707
+ # },
708
+ # ...
709
+ # ],
710
+ # "metric_group": {
711
+ # "property_key": "region",
712
+ # "property_value": "asia/pacific"
713
+ # },
714
+ # "billable_metric": {
715
+ # "id": "Fe9pbpMk86xpwdGB",
716
+ # "name": "API Requests"
717
+ # },
718
+ # "view_mode": "periodic"
719
+ # },
720
+ # ...
721
+ # ]
722
+ # }
723
+ # ```
724
+ #
725
+ # ## Windowed usage
726
+ #
727
+ # The `granularity` parameter can be used to _window_ the usage `quantity` value
728
+ # into periods. When not specified, usage is returned for the entirety of the time
729
+ # range.
730
+ #
731
+ # When `granularity = day` is specified with a timeframe longer than a day, Orb
732
+ # will return a `quantity` value for each full day between `timeframe_start` and
733
+ # `timeframe_end`. Note that the days are demarcated by the _customer's local
734
+ # midnight_.
735
+ #
736
+ # For example, with `timeframe_start = 2022-02-01T05:00:00Z`,
737
+ # `timeframe_end = 2022-02-04T01:00:00Z` and `granularity=day`, the following
738
+ # windows will be returned for a customer in the `America/Los_Angeles` timezone
739
+ # since local midnight is `08:00` UTC:
740
+ #
741
+ # - `[2022-02-01T05:00:00Z, 2022-02-01T08:00:00Z)`
742
+ # - `[2022-02-01T08:00:00, 2022-02-02T08:00:00Z)`
743
+ # - `[2022-02-02T08:00:00, 2022-02-03T08:00:00Z)`
744
+ # - `[2022-02-03T08:00:00, 2022-02-04T01:00:00Z)`
745
+ #
746
+ # ```json
747
+ # {
748
+ # "data": [
749
+ # {
750
+ # "billable_metric": {
751
+ # "id": "Q8w89wjTtBdejXKsm",
752
+ # "name": "API Requests"
753
+ # },
754
+ # "usage": [
755
+ # {
756
+ # "quantity": 0,
757
+ # "timeframe_end": "2022-02-01T08:00:00+00:00",
758
+ # "timeframe_start": "2022-02-01T05:00:00+00:00"
759
+ # },
760
+ # {
761
+ #
762
+ # "quantity": 0,
763
+ # "timeframe_end": "2022-02-02T08:00:00+00:00",
764
+ # "timeframe_start": "2022-02-01T08:00:00+00:00"
765
+ # },
766
+ # {
767
+ # "quantity": 0,
768
+ # "timeframe_end": "2022-02-03T08:00:00+00:00",
769
+ # "timeframe_start": "2022-02-02T08:00:00+00:00"
770
+ # },
771
+ # {
772
+ # "quantity": 0,
773
+ # "timeframe_end": "2022-02-04T01:00:00+00:00",
774
+ # "timeframe_start": "2022-02-03T08:00:00+00:00"
775
+ # }
776
+ # ],
777
+ # "view_mode": "periodic"
778
+ # },
779
+ # ...
780
+ # ]
781
+ # }
782
+ # ```
783
+ #
784
+ # ## Decomposable vs. non-decomposable metrics
785
+ #
786
+ # Billable metrics fall into one of two categories: decomposable and
787
+ # non-decomposable. A decomposable billable metric, such as a sum or a count, can
788
+ # be displayed and aggregated across arbitrary timescales. On the other hand, a
789
+ # non-decomposable metric is not meaningful when only a slice of the billing
790
+ # window is considered.
791
+ #
792
+ # As an example, if we have a billable metric that's defined to count unique
793
+ # users, displaying a graph of unique users for each day is not representative of
794
+ # the billable metric value over the month (days could have an overlapping set of
795
+ # 'unique' users). Instead, what's useful for any given day is the number of
796
+ # unique users in the billing period so far, which are the _cumulative_ unique
797
+ # users.
798
+ #
799
+ # Accordingly, this endpoint returns treats these two types of metrics differently
800
+ # when `group_by` is specified:
801
+ #
802
+ # - Decomposable metrics can be grouped by any event property.
803
+ # - Non-decomposable metrics can only be grouped by the corresponding price's
804
+ # invoice grouping key. If no invoice grouping key is present, the metric does
805
+ # not support `group_by`.
806
+ #
807
+ # ## Matrix prices
808
+ #
809
+ # When a billable metric is attached to a price that uses matrix pricing, it's
810
+ # important to view usage grouped by those matrix dimensions. In this case, use
811
+ # the query parameters `first_dimension_key`, `first_dimension_value` and
812
+ # `second_dimension_key`, `second_dimension_value` while filtering to a specific
813
+ # `billable_metric_id`.
814
+ #
815
+ # For example, if your compute metric has a separate unit price (i.e. a matrix
816
+ # pricing model) per `region` and `provider`, your request might provide the
817
+ # following parameters:
818
+ #
819
+ # - `first_dimension_key`: `region`
820
+ # - `first_dimension_value`: `us-east-1`
821
+ # - `second_dimension_key`: `provider`
822
+ # - `second_dimension_value`: `aws`
836
823
  sig do
837
824
  params(
838
825
  subscription_id: String,
@@ -858,8 +845,8 @@ module Orb
858
845
  def fetch_usage(
859
846
  subscription_id,
860
847
  # When specified in conjunction with `group_by`, this parameter filters usage to a
861
- # single billable metric. Note that both `group_by` and `billable_metric_id` must
862
- # be specified together.
848
+ # single billable metric. Note that both `group_by` and `billable_metric_id` must
849
+ # be specified together.
863
850
  billable_metric_id: nil,
864
851
  first_dimension_key: nil,
865
852
  first_dimension_value: nil,
@@ -874,86 +861,84 @@ module Orb
874
861
  # Usage returned is inclusive of `timeframe_start`.
875
862
  timeframe_start: nil,
876
863
  # Controls whether Orb returns cumulative usage since the start of the billing
877
- # period, or incremental day-by-day usage. If your customer has minimums or
878
- # discounts, it's strongly recommended that you use the default cumulative
879
- # behavior.
864
+ # period, or incremental day-by-day usage. If your customer has minimums or
865
+ # discounts, it's strongly recommended that you use the default cumulative
866
+ # behavior.
880
867
  view_mode: nil,
881
868
  request_options: {}
882
- )
883
- end
884
-
869
+ ); end
885
870
  # This endpoint is used to add and edit subscription
886
- # [price intervals](/api-reference/price-interval/add-or-edit-price-intervals). By
887
- # making modifications to a subscription’s price intervals, you can
888
- # [flexibly and atomically control the billing behavior of a subscription](/product-catalog/modifying-subscriptions).
889
- #
890
- # ## Adding price intervals
891
- #
892
- # Prices can be added as price intervals to a subscription by specifying them in
893
- # the `add` array. A `price_id` or `external_price_id` from an add-on price or
894
- # previously removed plan price can be specified to reuse an existing price
895
- # definition (however, please note that prices from other plans cannot be added to
896
- # the subscription). Additionally, a new price can be specified using the `price`
897
- # field — this price will be created automatically.
898
- #
899
- # A `start_date` must be specified for the price interval. This is the date when
900
- # the price will start billing on the subscription, so this will notably result in
901
- # an immediate charge at this time for any billed in advance fixed fees. The
902
- # `end_date` will default to null, resulting in a price interval that will bill on
903
- # a continually recurring basis. Both of these dates can be set in the past or the
904
- # future and Orb will generate or modify invoices to ensure the subscription’s
905
- # invoicing behavior is correct.
906
- #
907
- # Additionally, a discount, minimum, or maximum can be specified on the price
908
- # interval. This will only apply to this price interval, not any other price
909
- # intervals on the subscription.
910
- #
911
- # ## Adjustment intervals
912
- #
913
- # An adjustment interval represents the time period that a particular adjustment
914
- # (a discount, minimum, or maximum) applies to the prices on a subscription.
915
- # Adjustment intervals can be added to a subscription by specifying them in the
916
- # `add_adjustments` array, or modified via the `edit_adjustments` array. When
917
- # creating an adjustment interval, you'll need to provide the definition of the
918
- # new adjustment (the type of adjustment, and which prices it applies to), as well
919
- # as the start and end dates for the adjustment interval. The start and end dates
920
- # of an existing adjustment interval can be edited via the `edit_adjustments`
921
- # field (just like price intervals). (To "change" the amount of a discount,
922
- # minimum, or maximum, then, you'll need to end the existing interval, and create
923
- # a new adjustment interval with the new amount and a start date that matches the
924
- # end date of the previous interval.)
925
- #
926
- # ## Editing price intervals
927
- #
928
- # Price intervals can be adjusted by specifying edits to make in the `edit` array.
929
- # A `price_interval_id` to edit must be specified — this can be retrieved from the
930
- # `price_intervals` field on the subscription.
931
- #
932
- # A new `start_date` or `end_date` can be specified to change the range of the
933
- # price interval, which will modify past or future invoices to ensure correctness.
934
- # If either of these dates are unspecified, they will default to the existing date
935
- # on the price interval. To remove a price interval entirely from a subscription,
936
- # set the `end_date` to be equivalent to the `start_date`.
937
- #
938
- # ## Fixed fee quantity transitions
939
- #
940
- # The fixed fee quantity transitions for a fixed fee price interval can also be
941
- # specified when adding or editing by passing an array for
942
- # `fixed_fee_quantity_transitions`. A fixed fee quantity transition must have a
943
- # `quantity` and an `effective_date`, which is the date after which the new
944
- # quantity will be used for billing. If a fixed fee quantity transition is
945
- # scheduled at a billing period boundary, the full quantity will be billed on an
946
- # invoice with the other prices on the subscription. If the fixed fee quantity
947
- # transition is scheduled mid-billing period, the difference between the existing
948
- # quantity and quantity specified in the transition will be prorated for the rest
949
- # of the billing period and billed immediately, which will generate a new invoice.
950
- #
951
- # Notably, the list of fixed fee quantity transitions passed will overwrite the
952
- # existing fixed fee quantity transitions on the price interval, so the entire
953
- # list of transitions must be specified to add additional transitions. The
954
- # existing list of transitions can be retrieved using the
955
- # `fixed_fee_quantity_transitions` property on a subscription’s serialized price
956
- # intervals.
871
+ # [price intervals](/api-reference/price-interval/add-or-edit-price-intervals). By
872
+ # making modifications to a subscription’s price intervals, you can
873
+ # [flexibly and atomically control the billing behavior of a subscription](/product-catalog/modifying-subscriptions).
874
+ #
875
+ # ## Adding price intervals
876
+ #
877
+ # Prices can be added as price intervals to a subscription by specifying them in
878
+ # the `add` array. A `price_id` or `external_price_id` from an add-on price or
879
+ # previously removed plan price can be specified to reuse an existing price
880
+ # definition (however, please note that prices from other plans cannot be added to
881
+ # the subscription). Additionally, a new price can be specified using the `price`
882
+ # field — this price will be created automatically.
883
+ #
884
+ # A `start_date` must be specified for the price interval. This is the date when
885
+ # the price will start billing on the subscription, so this will notably result in
886
+ # an immediate charge at this time for any billed in advance fixed fees. The
887
+ # `end_date` will default to null, resulting in a price interval that will bill on
888
+ # a continually recurring basis. Both of these dates can be set in the past or the
889
+ # future and Orb will generate or modify invoices to ensure the subscription’s
890
+ # invoicing behavior is correct.
891
+ #
892
+ # Additionally, a discount, minimum, or maximum can be specified on the price
893
+ # interval. This will only apply to this price interval, not any other price
894
+ # intervals on the subscription.
895
+ #
896
+ # ## Adjustment intervals
897
+ #
898
+ # An adjustment interval represents the time period that a particular adjustment
899
+ # (a discount, minimum, or maximum) applies to the prices on a subscription.
900
+ # Adjustment intervals can be added to a subscription by specifying them in the
901
+ # `add_adjustments` array, or modified via the `edit_adjustments` array. When
902
+ # creating an adjustment interval, you'll need to provide the definition of the
903
+ # new adjustment (the type of adjustment, and which prices it applies to), as well
904
+ # as the start and end dates for the adjustment interval. The start and end dates
905
+ # of an existing adjustment interval can be edited via the `edit_adjustments`
906
+ # field (just like price intervals). (To "change" the amount of a discount,
907
+ # minimum, or maximum, then, you'll need to end the existing interval, and create
908
+ # a new adjustment interval with the new amount and a start date that matches the
909
+ # end date of the previous interval.)
910
+ #
911
+ # ## Editing price intervals
912
+ #
913
+ # Price intervals can be adjusted by specifying edits to make in the `edit` array.
914
+ # A `price_interval_id` to edit must be specified — this can be retrieved from the
915
+ # `price_intervals` field on the subscription.
916
+ #
917
+ # A new `start_date` or `end_date` can be specified to change the range of the
918
+ # price interval, which will modify past or future invoices to ensure correctness.
919
+ # If either of these dates are unspecified, they will default to the existing date
920
+ # on the price interval. To remove a price interval entirely from a subscription,
921
+ # set the `end_date` to be equivalent to the `start_date`.
922
+ #
923
+ # ## Fixed fee quantity transitions
924
+ #
925
+ # The fixed fee quantity transitions for a fixed fee price interval can also be
926
+ # specified when adding or editing by passing an array for
927
+ # `fixed_fee_quantity_transitions`. A fixed fee quantity transition must have a
928
+ # `quantity` and an `effective_date`, which is the date after which the new
929
+ # quantity will be used for billing. If a fixed fee quantity transition is
930
+ # scheduled at a billing period boundary, the full quantity will be billed on an
931
+ # invoice with the other prices on the subscription. If the fixed fee quantity
932
+ # transition is scheduled mid-billing period, the difference between the existing
933
+ # quantity and quantity specified in the transition will be prorated for the rest
934
+ # of the billing period and billed immediately, which will generate a new invoice.
935
+ #
936
+ # Notably, the list of fixed fee quantity transitions passed will overwrite the
937
+ # existing fixed fee quantity transitions on the price interval, so the entire
938
+ # list of transitions must be specified to add additional transitions. The
939
+ # existing list of transitions can be retrieved using the
940
+ # `fixed_fee_quantity_transitions` property on a subscription’s serialized price
941
+ # intervals.
957
942
  sig do
958
943
  params(
959
944
  subscription_id: String,
@@ -973,200 +958,198 @@ module Orb
973
958
  # A list of adjustments to add to the subscription.
974
959
  add_adjustments: nil,
975
960
  # If false, this request will fail if it would void an issued invoice or create a
976
- # credit note. Consider using this as a safety mechanism if you do not expect
977
- # existing invoices to be changed.
961
+ # credit note. Consider using this as a safety mechanism if you do not expect
962
+ # existing invoices to be changed.
978
963
  allow_invoice_credit_or_void: nil,
979
964
  # A list of price intervals to edit on the subscription.
980
965
  edit: nil,
981
966
  # A list of adjustments to edit on the subscription.
982
967
  edit_adjustments: nil,
983
968
  request_options: {}
984
- )
985
- end
986
-
969
+ ); end
987
970
  # This endpoint can be used to change an existing subscription's plan. It returns
988
- # the serialized updated subscription object.
989
- #
990
- # The body parameter `change_option` determines when the plan change occurrs. Orb
991
- # supports three options:
992
- #
993
- # - `end_of_subscription_term`: changes the plan at the end of the existing plan's
994
- # term.
995
- # - Issuing this plan change request for a monthly subscription will keep the
996
- # existing plan active until the start of the subsequent month. Issuing this
997
- # plan change request for a yearly subscription will keep the existing plan
998
- # active for the full year. Charges incurred in the remaining period will be
999
- # invoiced as normal.
1000
- # - Example: The plan is billed monthly on the 1st of the month, the request is
1001
- # made on January 15th, so the plan will be changed on February 1st, and
1002
- # invoice will be issued on February 1st for the last month of the original
1003
- # plan.
1004
- # - `immediate`: changes the plan immediately.
1005
- # - Subscriptions that have their plan changed with this option will move to the
1006
- # new plan immediately, and be invoiced immediately.
1007
- # - This invoice will include any usage fees incurred in the billing period up
1008
- # to the change, along with any prorated recurring fees for the billing
1009
- # period, if applicable.
1010
- # - Example: The plan is billed monthly on the 1st of the month, the request is
1011
- # made on January 15th, so the plan will be changed on January 15th, and an
1012
- # invoice will be issued for the partial month, from January 1 to January 15,
1013
- # on the original plan.
1014
- # - `requested_date`: changes the plan on the requested date (`change_date`).
1015
- # - If no timezone is provided, the customer's timezone is used. The
1016
- # `change_date` body parameter is required if this option is chosen.
1017
- # - Example: The plan is billed monthly on the 1st of the month, the request is
1018
- # made on January 15th, with a requested `change_date` of February 15th, so
1019
- # the plan will be changed on February 15th, and invoices will be issued on
1020
- # February 1st and February 15th.
1021
- #
1022
- # Note that one of `plan_id` or `external_plan_id` is required in the request body
1023
- # for this operation.
1024
- #
1025
- # ## Customize your customer's subscriptions
1026
- #
1027
- # Prices and adjustments in a plan can be added, removed, or replaced on the
1028
- # subscription when you schedule the plan change. This is useful when a customer
1029
- # has prices that differ from the default prices for a specific plan.
1030
- #
1031
- # <Note>
1032
- # This feature is only available for accounts that have migrated to Subscription Overrides Version 2. You can find your
1033
- # Subscription Overrides Version at the bottom of your [Plans page](https://app.withorb.com/plans)
1034
- # </Note>
1035
- #
1036
- # ### Adding Prices
1037
- #
1038
- # To add prices, provide a list of objects with the key `add_prices`. An object in
1039
- # the list must specify an existing add-on price with a `price_id` or
1040
- # `external_price_id` field, or create a new add-on price by including an object
1041
- # with the key `price`, identical to what would be used in the request body for
1042
- # the [create price endpoint](/api-reference/price/create-price). See the
1043
- # [Price resource](/product-catalog/price-configuration) for the specification of
1044
- # different price model configurations possible in this object.
1045
- #
1046
- # If the plan has phases, each object in the list must include a number with
1047
- # `plan_phase_order` key to indicate which phase the price should be added to.
1048
- #
1049
- # An object in the list can specify an optional `start_date` and optional
1050
- # `end_date`. If `start_date` is unspecified, the start of the phase / plan change
1051
- # time will be used. If `end_date` is unspecified, it will finish at the end of
1052
- # the phase / have no end time.
1053
- #
1054
- # An object in the list can specify an optional `minimum_amount`,
1055
- # `maximum_amount`, or `discounts`. This will create adjustments which apply only
1056
- # to this price.
1057
- #
1058
- # Additionally, an object in the list can specify an optional `reference_id`. This
1059
- # ID can be used to reference this price when
1060
- # [adding an adjustment](#adding-adjustments) in the same API call. However the ID
1061
- # is _transient_ and cannot be used to refer to the price in future API calls.
1062
- #
1063
- # ### Removing Prices
1064
- #
1065
- # To remove prices, provide a list of objects with the key `remove_prices`. An
1066
- # object in the list must specify a plan price with either a `price_id` or
1067
- # `external_price_id` field.
1068
- #
1069
- # ### Replacing Prices
1070
- #
1071
- # To replace prices, provide a list of objects with the key `replace_prices`. An
1072
- # object in the list must specify a plan price to replace with the
1073
- # `replaces_price_id` key, and it must specify a price to replace it with by
1074
- # either referencing an existing add-on price with a `price_id` or
1075
- # `external_price_id` field, or by creating a new add-on price by including an
1076
- # object with the key `price`, identical to what would be used in the request body
1077
- # for the [create price endpoint](/api-reference/price/create-price). See the
1078
- # [Price resource](/product-catalog/price-configuration) for the specification of
1079
- # different price model configurations possible in this object.
1080
- #
1081
- # For fixed fees, an object in the list can supply a `fixed_price_quantity`
1082
- # instead of a `price`, `price_id`, or `external_price_id` field. This will update
1083
- # only the quantity for the price, similar to the
1084
- # [Update price quantity](/api-reference/subscription/update-price-quantity)
1085
- # endpoint.
1086
- #
1087
- # The replacement price will have the same phase, if applicable, and the same
1088
- # start and end dates as the price it replaces.
1089
- #
1090
- # An object in the list can specify an optional `minimum_amount`,
1091
- # `maximum_amount`, or `discounts`. This will create adjustments which apply only
1092
- # to this price.
1093
- #
1094
- # Additionally, an object in the list can specify an optional `reference_id`. This
1095
- # ID can be used to reference the replacement price when
1096
- # [adding an adjustment](#adding-adjustments) in the same API call. However the ID
1097
- # is _transient_ and cannot be used to refer to the price in future API calls.
1098
- #
1099
- # ### Adding adjustments
1100
- #
1101
- # To add adjustments, provide a list of objects with the key `add_adjustments`. An
1102
- # object in the list must include an object with the key `adjustment`, identical
1103
- # to the adjustment object in the
1104
- # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
1105
- #
1106
- # If the plan has phases, each object in the list must include a number with
1107
- # `plan_phase_order` key to indicate which phase the adjustment should be added
1108
- # to.
1109
- #
1110
- # An object in the list can specify an optional `start_date` and optional
1111
- # `end_date`. If `start_date` is unspecified, the start of the phase / plan change
1112
- # time will be used. If `end_date` is unspecified, it will finish at the end of
1113
- # the phase / have no end time.
1114
- #
1115
- # ### Removing adjustments
1116
- #
1117
- # To remove adjustments, provide a list of objects with the key
1118
- # `remove_adjustments`. An object in the list must include a key, `adjustment_id`,
1119
- # with the ID of the adjustment to be removed.
971
+ # the serialized updated subscription object.
972
+ #
973
+ # The body parameter `change_option` determines when the plan change occurrs. Orb
974
+ # supports three options:
975
+ #
976
+ # - `end_of_subscription_term`: changes the plan at the end of the existing plan's
977
+ # term.
978
+ # - Issuing this plan change request for a monthly subscription will keep the
979
+ # existing plan active until the start of the subsequent month. Issuing this
980
+ # plan change request for a yearly subscription will keep the existing plan
981
+ # active for the full year. Charges incurred in the remaining period will be
982
+ # invoiced as normal.
983
+ # - Example: The plan is billed monthly on the 1st of the month, the request is
984
+ # made on January 15th, so the plan will be changed on February 1st, and
985
+ # invoice will be issued on February 1st for the last month of the original
986
+ # plan.
987
+ # - `immediate`: changes the plan immediately.
988
+ # - Subscriptions that have their plan changed with this option will move to the
989
+ # new plan immediately, and be invoiced immediately.
990
+ # - This invoice will include any usage fees incurred in the billing period up
991
+ # to the change, along with any prorated recurring fees for the billing
992
+ # period, if applicable.
993
+ # - Example: The plan is billed monthly on the 1st of the month, the request is
994
+ # made on January 15th, so the plan will be changed on January 15th, and an
995
+ # invoice will be issued for the partial month, from January 1 to January 15,
996
+ # on the original plan.
997
+ # - `requested_date`: changes the plan on the requested date (`change_date`).
998
+ # - If no timezone is provided, the customer's timezone is used. The
999
+ # `change_date` body parameter is required if this option is chosen.
1000
+ # - Example: The plan is billed monthly on the 1st of the month, the request is
1001
+ # made on January 15th, with a requested `change_date` of February 15th, so
1002
+ # the plan will be changed on February 15th, and invoices will be issued on
1003
+ # February 1st and February 15th.
1004
+ #
1005
+ # Note that one of `plan_id` or `external_plan_id` is required in the request body
1006
+ # for this operation.
1007
+ #
1008
+ # ## Customize your customer's subscriptions
1009
+ #
1010
+ # Prices and adjustments in a plan can be added, removed, or replaced on the
1011
+ # subscription when you schedule the plan change. This is useful when a customer
1012
+ # has prices that differ from the default prices for a specific plan.
1013
+ #
1014
+ # <Note>
1015
+ # This feature is only available for accounts that have migrated to Subscription Overrides Version 2. You can find your
1016
+ # Subscription Overrides Version at the bottom of your [Plans page](https://app.withorb.com/plans)
1017
+ # </Note>
1018
+ #
1019
+ # ### Adding Prices
1020
+ #
1021
+ # To add prices, provide a list of objects with the key `add_prices`. An object in
1022
+ # the list must specify an existing add-on price with a `price_id` or
1023
+ # `external_price_id` field, or create a new add-on price by including an object
1024
+ # with the key `price`, identical to what would be used in the request body for
1025
+ # the [create price endpoint](/api-reference/price/create-price). See the
1026
+ # [Price resource](/product-catalog/price-configuration) for the specification of
1027
+ # different price model configurations possible in this object.
1028
+ #
1029
+ # If the plan has phases, each object in the list must include a number with
1030
+ # `plan_phase_order` key to indicate which phase the price should be added to.
1031
+ #
1032
+ # An object in the list can specify an optional `start_date` and optional
1033
+ # `end_date`. If `start_date` is unspecified, the start of the phase / plan change
1034
+ # time will be used. If `end_date` is unspecified, it will finish at the end of
1035
+ # the phase / have no end time.
1036
+ #
1037
+ # An object in the list can specify an optional `minimum_amount`,
1038
+ # `maximum_amount`, or `discounts`. This will create adjustments which apply only
1039
+ # to this price.
1040
+ #
1041
+ # Additionally, an object in the list can specify an optional `reference_id`. This
1042
+ # ID can be used to reference this price when
1043
+ # [adding an adjustment](#adding-adjustments) in the same API call. However the ID
1044
+ # is _transient_ and cannot be used to refer to the price in future API calls.
1045
+ #
1046
+ # ### Removing Prices
1047
+ #
1048
+ # To remove prices, provide a list of objects with the key `remove_prices`. An
1049
+ # object in the list must specify a plan price with either a `price_id` or
1050
+ # `external_price_id` field.
1051
+ #
1052
+ # ### Replacing Prices
1053
+ #
1054
+ # To replace prices, provide a list of objects with the key `replace_prices`. An
1055
+ # object in the list must specify a plan price to replace with the
1056
+ # `replaces_price_id` key, and it must specify a price to replace it with by
1057
+ # either referencing an existing add-on price with a `price_id` or
1058
+ # `external_price_id` field, or by creating a new add-on price by including an
1059
+ # object with the key `price`, identical to what would be used in the request body
1060
+ # for the [create price endpoint](/api-reference/price/create-price). See the
1061
+ # [Price resource](/product-catalog/price-configuration) for the specification of
1062
+ # different price model configurations possible in this object.
1063
+ #
1064
+ # For fixed fees, an object in the list can supply a `fixed_price_quantity`
1065
+ # instead of a `price`, `price_id`, or `external_price_id` field. This will update
1066
+ # only the quantity for the price, similar to the
1067
+ # [Update price quantity](/api-reference/subscription/update-price-quantity)
1068
+ # endpoint.
1069
+ #
1070
+ # The replacement price will have the same phase, if applicable, and the same
1071
+ # start and end dates as the price it replaces.
1072
+ #
1073
+ # An object in the list can specify an optional `minimum_amount`,
1074
+ # `maximum_amount`, or `discounts`. This will create adjustments which apply only
1075
+ # to this price.
1076
+ #
1077
+ # Additionally, an object in the list can specify an optional `reference_id`. This
1078
+ # ID can be used to reference the replacement price when
1079
+ # [adding an adjustment](#adding-adjustments) in the same API call. However the ID
1080
+ # is _transient_ and cannot be used to refer to the price in future API calls.
1081
+ #
1082
+ # ### Adding adjustments
1083
+ #
1084
+ # To add adjustments, provide a list of objects with the key `add_adjustments`. An
1085
+ # object in the list must include an object with the key `adjustment`, identical
1086
+ # to the adjustment object in the
1087
+ # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
1088
+ #
1089
+ # If the plan has phases, each object in the list must include a number with
1090
+ # `plan_phase_order` key to indicate which phase the adjustment should be added
1091
+ # to.
1092
+ #
1093
+ # An object in the list can specify an optional `start_date` and optional
1094
+ # `end_date`. If `start_date` is unspecified, the start of the phase / plan change
1095
+ # time will be used. If `end_date` is unspecified, it will finish at the end of
1096
+ # the phase / have no end time.
1097
+ #
1098
+ # ### Removing adjustments
1099
+ #
1100
+ # To remove adjustments, provide a list of objects with the key
1101
+ # `remove_adjustments`. An object in the list must include a key, `adjustment_id`,
1102
+ # with the ID of the adjustment to be removed.
1120
1103
  #
1121
- # ### Replacing adjustments
1122
- #
1123
- # To replace adjustments, provide a list of objects with the key
1124
- # `replace_adjustments`. An object in the list must specify a plan adjustment to
1125
- # replace with the `replaces_adjustment_id` key, and it must specify an adjustment
1126
- # to replace it with by including an object with the key `adjustment`, identical
1127
- # to the adjustment object in the
1128
- # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
1129
- #
1130
- # The replacement adjustment will have the same phase, if applicable, and the same
1131
- # start and end dates as the adjustment it replaces.
1132
- #
1133
- # ## Price overrides (DEPRECATED)
1134
- #
1135
- # <Note>
1136
- # Price overrides are being phased out in favor adding/removing/replacing prices. (See
1137
- # [Customize your customer's subscriptions](/api-reference/subscription/schedule-plan-change))
1138
- # </Note>
1139
- #
1140
- # Price overrides are used to update some or all prices in a plan for the specific
1141
- # subscription being created. This is useful when a new customer has negotiated a
1142
- # rate that is unique to the customer.
1104
+ # ### Replacing adjustments
1105
+ #
1106
+ # To replace adjustments, provide a list of objects with the key
1107
+ # `replace_adjustments`. An object in the list must specify a plan adjustment to
1108
+ # replace with the `replaces_adjustment_id` key, and it must specify an adjustment
1109
+ # to replace it with by including an object with the key `adjustment`, identical
1110
+ # to the adjustment object in the
1111
+ # [add/edit price intervals endpoint](/api-reference/price-interval/add-or-edit-price-intervals).
1112
+ #
1113
+ # The replacement adjustment will have the same phase, if applicable, and the same
1114
+ # start and end dates as the adjustment it replaces.
1115
+ #
1116
+ # ## Price overrides (DEPRECATED)
1117
+ #
1118
+ # <Note>
1119
+ # Price overrides are being phased out in favor adding/removing/replacing prices. (See
1120
+ # [Customize your customer's subscriptions](/api-reference/subscription/schedule-plan-change))
1121
+ # </Note>
1122
+ #
1123
+ # Price overrides are used to update some or all prices in a plan for the specific
1124
+ # subscription being created. This is useful when a new customer has negotiated a
1125
+ # rate that is unique to the customer.
1143
1126
  #
1144
- # To override prices, provide a list of objects with the key `price_overrides`.
1145
- # The price object in the list of overrides is expected to contain the existing
1146
- # price id, the `model_type` and configuration. (See the
1147
- # [Price resource](/product-catalog/price-configuration) for the specification of
1148
- # different price model configurations.) The numerical values can be updated, but
1149
- # the billable metric, cadence, type, and name of a price can not be overridden.
1150
- #
1151
- # ### Maximums, and minimums
1127
+ # To override prices, provide a list of objects with the key `price_overrides`.
1128
+ # The price object in the list of overrides is expected to contain the existing
1129
+ # price id, the `model_type` and configuration. (See the
1130
+ # [Price resource](/product-catalog/price-configuration) for the specification of
1131
+ # different price model configurations.) The numerical values can be updated, but
1132
+ # the billable metric, cadence, type, and name of a price can not be overridden.
1133
+ #
1134
+ # ### Maximums, and minimums
1152
1135
  #
1153
- # Price overrides are used to update some or all prices in the target plan.
1154
- # Minimums and maximums, much like price overrides, can be useful when a new
1155
- # customer has negotiated a new or different minimum or maximum spend cap than the
1156
- # default for the plan. The request format for maximums and minimums is the same
1157
- # as those in [subscription creation](create-subscription).
1158
- #
1159
- # ## Scheduling multiple plan changes
1136
+ # Price overrides are used to update some or all prices in the target plan.
1137
+ # Minimums and maximums, much like price overrides, can be useful when a new
1138
+ # customer has negotiated a new or different minimum or maximum spend cap than the
1139
+ # default for the plan. The request format for maximums and minimums is the same
1140
+ # as those in [subscription creation](create-subscription).
1141
+ #
1142
+ # ## Scheduling multiple plan changes
1160
1143
  #
1161
- # When scheduling multiple plan changes with the same date, the latest plan change
1162
- # on that day takes effect.
1144
+ # When scheduling multiple plan changes with the same date, the latest plan change
1145
+ # on that day takes effect.
1163
1146
  #
1164
- # ## Prorations for in-advance fees
1165
- #
1166
- # By default, Orb calculates the prorated difference in any fixed fees when making
1167
- # a plan change, adjusting the customer balance as needed. For details on this
1168
- # behavior, see
1169
- # [Modifying subscriptions](/product-catalog/modifying-subscriptions#prorations-for-in-advance-fees).
1147
+ # ## Prorations for in-advance fees
1148
+ #
1149
+ # By default, Orb calculates the prorated difference in any fixed fees when making
1150
+ # a plan change, adjusting the customer balance as needed. For details on this
1151
+ # behavior, see
1152
+ # [Modifying subscriptions](/product-catalog/modifying-subscriptions#prorations-for-in-advance-fees).
1170
1153
  sig do
1171
1154
  params(
1172
1155
  subscription_id: String,
@@ -1221,92 +1204,90 @@ module Orb
1221
1204
  subscription_id,
1222
1205
  change_option:,
1223
1206
  # Additional adjustments to be added to the subscription. (Only available for
1224
- # accounts that have migrated off of legacy subscription overrides)
1207
+ # accounts that have migrated off of legacy subscription overrides)
1225
1208
  add_adjustments: nil,
1226
1209
  # Additional prices to be added to the subscription. (Only available for accounts
1227
- # that have migrated off of legacy subscription overrides)
1210
+ # that have migrated off of legacy subscription overrides)
1228
1211
  add_prices: nil,
1229
1212
  # [DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be
1230
- # aligned with the plan change's effective date.
1213
+ # aligned with the plan change's effective date.
1231
1214
  align_billing_with_plan_change_date: nil,
1232
1215
  # Determines whether issued invoices for this subscription will automatically be
1233
- # charged with the saved payment method on the due date. If not specified, this
1234
- # defaults to the behavior configured for this customer.
1216
+ # charged with the saved payment method on the due date. If not specified, this
1217
+ # defaults to the behavior configured for this customer.
1235
1218
  auto_collection: nil,
1236
1219
  # Reset billing periods to be aligned with the plan change's effective date or
1237
- # start of the month. Defaults to `unchanged` which keeps subscription's existing
1238
- # billing cycle alignment.
1220
+ # start of the month. Defaults to `unchanged` which keeps subscription's existing
1221
+ # billing cycle alignment.
1239
1222
  billing_cycle_alignment: nil,
1240
1223
  billing_cycle_anchor_configuration: nil,
1241
1224
  # The date that the plan change should take effect. This parameter can only be
1242
- # passed if the `change_option` is `requested_date`. If a date with no time is
1243
- # passed, the plan change will happen at midnight in the customer's timezone.
1225
+ # passed if the `change_option` is `requested_date`. If a date with no time is
1226
+ # passed, the plan change will happen at midnight in the customer's timezone.
1244
1227
  change_date: nil,
1245
1228
  # Redemption code to be used for this subscription. If the coupon cannot be found
1246
- # by its redemption code, or cannot be redeemed, an error response will be
1247
- # returned and the subscription creation or plan change will not be scheduled.
1229
+ # by its redemption code, or cannot be redeemed, an error response will be
1230
+ # returned and the subscription creation or plan change will not be scheduled.
1248
1231
  coupon_redemption_code: nil,
1249
1232
  credits_overage_rate: nil,
1250
1233
  # Determines the default memo on this subscription's invoices. Note that if this
1251
- # is not provided, it is determined by the plan configuration.
1234
+ # is not provided, it is determined by the plan configuration.
1252
1235
  default_invoice_memo: nil,
1253
1236
  # The external_plan_id of the plan that the given subscription should be switched
1254
- # to. Note that either this property or `plan_id` must be specified.
1237
+ # to. Note that either this property or `plan_id` must be specified.
1255
1238
  external_plan_id: nil,
1256
1239
  # An additional filter to apply to usage queries. This filter must be expressed as
1257
- # a boolean
1258
- # [computed property](/extensibility/advanced-metrics#computed-properties). If
1259
- # null, usage queries will not include any additional filter.
1240
+ # a boolean
1241
+ # [computed property](/extensibility/advanced-metrics#computed-properties). If
1242
+ # null, usage queries will not include any additional filter.
1260
1243
  filter: nil,
1261
1244
  # The phase of the plan to start with
1262
1245
  initial_phase_order: nil,
1263
1246
  # When this subscription's accrued usage reaches this threshold, an invoice will
1264
- # be issued for the subscription. If not specified, invoices will only be issued
1265
- # at the end of the billing period.
1247
+ # be issued for the subscription. If not specified, invoices will only be issued
1248
+ # at the end of the billing period.
1266
1249
  invoicing_threshold: nil,
1267
1250
  # The net terms determines the difference between the invoice date and the issue
1268
- # date for the invoice. If you intend the invoice to be due on issue, set this
1269
- # to 0. If not provided, this defaults to the value specified in the plan.
1251
+ # date for the invoice. If you intend the invoice to be due on issue, set this
1252
+ # to 0. If not provided, this defaults to the value specified in the plan.
1270
1253
  net_terms: nil,
1271
1254
  per_credit_overage_amount: nil,
1272
1255
  # The plan that the given subscription should be switched to. Note that either
1273
- # this property or `external_plan_id` must be specified.
1256
+ # this property or `external_plan_id` must be specified.
1274
1257
  plan_id: nil,
1275
1258
  # Specifies which version of the plan to change to. If null, the default version
1276
- # will be used.
1259
+ # will be used.
1277
1260
  plan_version_number: nil,
1278
1261
  # Optionally provide a list of overrides for prices on the plan
1279
1262
  price_overrides: nil,
1280
1263
  # Plan adjustments to be removed from the subscription. (Only available for
1281
- # accounts that have migrated off of legacy subscription overrides)
1264
+ # accounts that have migrated off of legacy subscription overrides)
1282
1265
  remove_adjustments: nil,
1283
1266
  # Plan prices to be removed from the subscription. (Only available for accounts
1284
- # that have migrated off of legacy subscription overrides)
1267
+ # that have migrated off of legacy subscription overrides)
1285
1268
  remove_prices: nil,
1286
1269
  # Plan adjustments to be replaced with additional adjustments on the subscription.
1287
- # (Only available for accounts that have migrated off of legacy subscription
1288
- # overrides)
1270
+ # (Only available for accounts that have migrated off of legacy subscription
1271
+ # overrides)
1289
1272
  replace_adjustments: nil,
1290
1273
  # Plan prices to be replaced with additional prices on the subscription. (Only
1291
- # available for accounts that have migrated off of legacy subscription overrides)
1274
+ # available for accounts that have migrated off of legacy subscription overrides)
1292
1275
  replace_prices: nil,
1293
1276
  # The duration of the trial period in days. If not provided, this defaults to the
1294
- # value specified in the plan. If `0` is provided, the trial on the plan will be
1295
- # skipped.
1277
+ # value specified in the plan. If `0` is provided, the trial on the plan will be
1278
+ # skipped.
1296
1279
  trial_duration_days: nil,
1297
1280
  # A list of customer IDs whose usage events will be aggregated and billed under
1298
- # this subscription. By default, a subscription only considers usage events
1299
- # associated with its attached customer's customer_id. When usage_customer_ids is
1300
- # provided, the subscription includes usage events from the specified customers
1301
- # only. Provided usage_customer_ids must be either the customer for this
1302
- # subscription itself, or any of that customer's children.
1281
+ # this subscription. By default, a subscription only considers usage events
1282
+ # associated with its attached customer's customer_id. When usage_customer_ids is
1283
+ # provided, the subscription includes usage events from the specified customers
1284
+ # only. Provided usage_customer_ids must be either the customer for this
1285
+ # subscription itself, or any of that customer's children.
1303
1286
  usage_customer_ids: nil,
1304
1287
  request_options: {}
1305
- )
1306
- end
1307
-
1288
+ ); end
1308
1289
  # Manually trigger a phase, effective the given date (or the current time, if not
1309
- # specified).
1290
+ # specified).
1310
1291
  sig do
1311
1292
  params(
1312
1293
  subscription_id: String,
@@ -1319,22 +1300,20 @@ module Orb
1319
1300
  def trigger_phase(
1320
1301
  subscription_id,
1321
1302
  # If false, this request will fail if it would void an issued invoice or create a
1322
- # credit note. Consider using this as a safety mechanism if you do not expect
1323
- # existing invoices to be changed.
1303
+ # credit note. Consider using this as a safety mechanism if you do not expect
1304
+ # existing invoices to be changed.
1324
1305
  allow_invoice_credit_or_void: nil,
1325
1306
  # The date on which the phase change should take effect. If not provided, defaults
1326
- # to today in the customer's timezone.
1307
+ # to today in the customer's timezone.
1327
1308
  effective_date: nil,
1328
1309
  request_options: {}
1329
- )
1330
- end
1331
-
1310
+ ); end
1332
1311
  # This endpoint can be used to unschedule any pending cancellations for a
1333
- # subscription.
1312
+ # subscription.
1334
1313
  #
1335
- # To be eligible, the subscription must currently be active and have a future
1336
- # cancellation. This operation will turn on auto-renew, ensuring that the
1337
- # subscription does not end at the currently scheduled cancellation time.
1314
+ # To be eligible, the subscription must currently be active and have a future
1315
+ # cancellation. This operation will turn on auto-renew, ensuring that the
1316
+ # subscription does not end at the currently scheduled cancellation time.
1338
1317
  sig do
1339
1318
  params(
1340
1319
  subscription_id: String,
@@ -1342,14 +1321,13 @@ module Orb
1342
1321
  )
1343
1322
  .returns(Orb::Models::SubscriptionUnscheduleCancellationResponse)
1344
1323
  end
1345
- def unschedule_cancellation(subscription_id, request_options: {})
1346
- end
1324
+ def unschedule_cancellation(subscription_id, request_options: {}); end
1347
1325
 
1348
1326
  # This endpoint can be used to clear scheduled updates to the quantity for a fixed
1349
- # fee.
1327
+ # fee.
1350
1328
  #
1351
- # If there are no updates scheduled, a request validation error will be returned
1352
- # with a 400 status code.
1329
+ # If there are no updates scheduled, a request validation error will be returned
1330
+ # with a 400 status code.
1353
1331
  sig do
1354
1332
  params(
1355
1333
  subscription_id: String,
@@ -1363,11 +1341,9 @@ module Orb
1363
1341
  # Price for which the updates should be cleared. Must be a fixed fee.
1364
1342
  price_id:,
1365
1343
  request_options: {}
1366
- )
1367
- end
1368
-
1344
+ ); end
1369
1345
  # This endpoint can be used to unschedule any pending plan changes on an existing
1370
- # subscription.
1346
+ # subscription.
1371
1347
  sig do
1372
1348
  params(
1373
1349
  subscription_id: String,
@@ -1375,23 +1351,22 @@ module Orb
1375
1351
  )
1376
1352
  .returns(Orb::Models::SubscriptionUnschedulePendingPlanChangesResponse)
1377
1353
  end
1378
- def unschedule_pending_plan_changes(subscription_id, request_options: {})
1379
- end
1354
+ def unschedule_pending_plan_changes(subscription_id, request_options: {}); end
1380
1355
 
1381
1356
  # This endpoint can be used to update the quantity for a fixed fee.
1382
1357
  #
1383
- # To be eligible, the subscription must currently be active and the price
1384
- # specified must be a fixed fee (not usage-based). This operation will immediately
1385
- # update the quantity for the fee, or if a `effective_date` is passed in, will
1386
- # update the quantity on the requested date at midnight in the customer's
1387
- # timezone.
1358
+ # To be eligible, the subscription must currently be active and the price
1359
+ # specified must be a fixed fee (not usage-based). This operation will immediately
1360
+ # update the quantity for the fee, or if a `effective_date` is passed in, will
1361
+ # update the quantity on the requested date at midnight in the customer's
1362
+ # timezone.
1388
1363
  #
1389
- # In order to change the fixed fee quantity as of the next draft invoice for this
1390
- # subscription, pass `change_option=upcoming_invoice` without an `effective_date`
1391
- # specified.
1364
+ # In order to change the fixed fee quantity as of the next draft invoice for this
1365
+ # subscription, pass `change_option=upcoming_invoice` without an `effective_date`
1366
+ # specified.
1392
1367
  #
1393
- # If the fee is an in-advance fixed fee, it will also issue an immediate invoice
1394
- # for the difference for the remainder of the billing period.
1368
+ # If the fee is an in-advance fixed fee, it will also issue an immediate invoice
1369
+ # for the difference for the remainder of the billing period.
1395
1370
  sig do
1396
1371
  params(
1397
1372
  subscription_id: String,
@@ -1410,39 +1385,37 @@ module Orb
1410
1385
  price_id:,
1411
1386
  quantity:,
1412
1387
  # If false, this request will fail if it would void an issued invoice or create a
1413
- # credit note. Consider using this as a safety mechanism if you do not expect
1414
- # existing invoices to be changed.
1388
+ # credit note. Consider using this as a safety mechanism if you do not expect
1389
+ # existing invoices to be changed.
1415
1390
  allow_invoice_credit_or_void: nil,
1416
1391
  # Determines when the change takes effect. Note that if `effective_date` is
1417
- # specified, this defaults to `effective_date`. Otherwise, this defaults to
1418
- # `immediate` unless it's explicitly set to `upcoming_invoice`.
1392
+ # specified, this defaults to `effective_date`. Otherwise, this defaults to
1393
+ # `immediate` unless it's explicitly set to `upcoming_invoice`.
1419
1394
  change_option: nil,
1420
1395
  # The date that the quantity change should take effect, localized to the
1421
- # customer's timezone. Ifthis parameter is not passed in, the quantity change is
1422
- # effective according to `change_option`.
1396
+ # customer's timezone. Ifthis parameter is not passed in, the quantity change is
1397
+ # effective according to `change_option`.
1423
1398
  effective_date: nil,
1424
1399
  request_options: {}
1425
- )
1426
- end
1427
-
1400
+ ); end
1428
1401
  # This endpoint is used to update the trial end date for a subscription. The new
1429
- # trial end date must be within the time range of the current plan (i.e. the new
1430
- # trial end date must be on or after the subscription's start date on the current
1431
- # plan, and on or before the subscription end date).
1432
- #
1433
- # In order to retroactively remove a trial completely, the end date can be set to
1434
- # the transition date of the subscription to this plan (or, if this is the first
1435
- # plan for this subscription, the subscription's start date). In order to end a
1436
- # trial immediately, the keyword `immediate` can be provided as the trial end
1437
- # date.
1438
- #
1439
- # By default, Orb will shift only the trial end date (and price intervals that
1440
- # start or end on the previous trial end date), and leave all other future price
1441
- # intervals untouched. If the `shift` parameter is set to `true`, Orb will shift
1442
- # all subsequent price and adjustment intervals by the same amount as the trial
1443
- # end date shift (so, e.g., if a plan change is scheduled or an add-on price was
1444
- # added, that change will be pushed back by the same amount of time the trial is
1445
- # extended).
1402
+ # trial end date must be within the time range of the current plan (i.e. the new
1403
+ # trial end date must be on or after the subscription's start date on the current
1404
+ # plan, and on or before the subscription end date).
1405
+ #
1406
+ # In order to retroactively remove a trial completely, the end date can be set to
1407
+ # the transition date of the subscription to this plan (or, if this is the first
1408
+ # plan for this subscription, the subscription's start date). In order to end a
1409
+ # trial immediately, the keyword `immediate` can be provided as the trial end
1410
+ # date.
1411
+ #
1412
+ # By default, Orb will shift only the trial end date (and price intervals that
1413
+ # start or end on the previous trial end date), and leave all other future price
1414
+ # intervals untouched. If the `shift` parameter is set to `true`, Orb will shift
1415
+ # all subsequent price and adjustment intervals by the same amount as the trial
1416
+ # end date shift (so, e.g., if a plan change is scheduled or an add-on price was
1417
+ # added, that change will be pushed back by the same amount of time the trial is
1418
+ # extended).
1446
1419
  sig do
1447
1420
  params(
1448
1421
  subscription_id: String,
@@ -1455,19 +1428,16 @@ module Orb
1455
1428
  def update_trial(
1456
1429
  subscription_id,
1457
1430
  # The new date that the trial should end, or the literal string `immediate` to end
1458
- # the trial immediately.
1431
+ # the trial immediately.
1459
1432
  trial_end_date:,
1460
1433
  # If true, shifts subsequent price and adjustment intervals (preserving their
1461
- # durations, but adjusting their absolute dates).
1434
+ # durations, but adjusting their absolute dates).
1462
1435
  shift: nil,
1463
1436
  request_options: {}
1464
- )
1465
- end
1466
-
1437
+ ); end
1467
1438
  # @api private
1468
1439
  sig { params(client: Orb::Client).returns(T.attached_class) }
1469
- def self.new(client:)
1470
- end
1440
+ def self.new(client:); end
1471
1441
  end
1472
1442
  end
1473
1443
  end