orb-billing 0.1.0.pre.alpha.38 → 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 (390) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/orb/client.rb +4 -0
  4. data/lib/orb/internal/transport/base_client.rb +1 -1
  5. data/lib/orb/internal/transport/pooled_net_requester.rb +1 -1
  6. data/lib/orb/internal/type/base_model.rb +14 -17
  7. data/lib/orb/internal/type/converter.rb +20 -22
  8. data/lib/orb/internal/type/enum.rb +8 -8
  9. data/lib/orb/internal/util.rb +1 -5
  10. data/lib/orb/models/alert.rb +9 -9
  11. data/lib/orb/models/alert_create_for_customer_params.rb +3 -3
  12. data/lib/orb/models/alert_create_for_external_customer_params.rb +3 -3
  13. data/lib/orb/models/alert_create_for_subscription_params.rb +3 -3
  14. data/lib/orb/models/alert_list_params.rb +5 -5
  15. data/lib/orb/models/alert_update_params.rb +3 -3
  16. data/lib/orb/models/amount_discount.rb +1 -1
  17. data/lib/orb/models/billable_metric.rb +7 -7
  18. data/lib/orb/models/coupon.rb +7 -7
  19. data/lib/orb/models/coupon_create_params.rb +2 -2
  20. data/lib/orb/models/coupon_list_params.rb +2 -2
  21. data/lib/orb/models/coupons/subscription_list_params.rb +1 -1
  22. data/lib/orb/models/credit_note.rb +1 -1
  23. data/lib/orb/models/credit_note_list_params.rb +5 -5
  24. data/lib/orb/models/customer.rb +232 -232
  25. data/lib/orb/models/customer_create_params.rb +223 -223
  26. data/lib/orb/models/customer_list_params.rb +5 -5
  27. data/lib/orb/models/customer_update_by_external_id_params.rb +224 -224
  28. data/lib/orb/models/customer_update_params.rb +224 -224
  29. data/lib/orb/models/customers/balance_transaction_create_response.rb +2 -2
  30. data/lib/orb/models/customers/balance_transaction_list_params.rb +5 -5
  31. data/lib/orb/models/customers/balance_transaction_list_response.rb +2 -2
  32. data/lib/orb/models/customers/cost_list_by_external_id_params.rb +6 -6
  33. data/lib/orb/models/customers/cost_list_params.rb +6 -6
  34. data/lib/orb/models/customers/credit_list_by_external_id_params.rb +2 -2
  35. data/lib/orb/models/customers/credit_list_params.rb +2 -2
  36. data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb +20 -20
  37. data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rb +22 -22
  38. data/lib/orb/models/customers/credits/ledger_create_entry_params.rb +20 -20
  39. data/lib/orb/models/customers/credits/ledger_create_entry_response.rb +22 -22
  40. data/lib/orb/models/customers/credits/ledger_list_by_external_id_params.rb +5 -5
  41. data/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rb +22 -22
  42. data/lib/orb/models/customers/credits/ledger_list_params.rb +5 -5
  43. data/lib/orb/models/customers/credits/ledger_list_response.rb +22 -22
  44. data/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rb +8 -8
  45. data/lib/orb/models/customers/credits/top_up_create_by_external_id_response.rb +7 -7
  46. data/lib/orb/models/customers/credits/top_up_create_params.rb +8 -8
  47. data/lib/orb/models/customers/credits/top_up_create_response.rb +7 -7
  48. data/lib/orb/models/customers/credits/top_up_list_by_external_id_params.rb +1 -1
  49. data/lib/orb/models/customers/credits/top_up_list_by_external_id_response.rb +7 -7
  50. data/lib/orb/models/customers/credits/top_up_list_params.rb +1 -1
  51. data/lib/orb/models/customers/credits/top_up_list_response.rb +7 -7
  52. data/lib/orb/models/dimensional_price_group.rb +7 -7
  53. data/lib/orb/models/dimensional_price_group_create_params.rb +2 -2
  54. data/lib/orb/models/dimensional_price_group_list_params.rb +1 -1
  55. data/lib/orb/models/event_ingest_params.rb +7 -7
  56. data/lib/orb/models/event_ingest_response.rb +4 -4
  57. data/lib/orb/models/event_search_params.rb +5 -5
  58. data/lib/orb/models/event_search_response.rb +8 -8
  59. data/lib/orb/models/event_update_params.rb +4 -4
  60. data/lib/orb/models/events/backfill_close_response.rb +7 -7
  61. data/lib/orb/models/events/backfill_create_params.rb +11 -11
  62. data/lib/orb/models/events/backfill_create_response.rb +7 -7
  63. data/lib/orb/models/events/backfill_fetch_response.rb +7 -7
  64. data/lib/orb/models/events/backfill_list_params.rb +1 -1
  65. data/lib/orb/models/events/backfill_list_response.rb +7 -7
  66. data/lib/orb/models/events/backfill_revert_response.rb +7 -7
  67. data/lib/orb/models/events/event_volumes.rb +1 -1
  68. data/lib/orb/models/events/volume_list_params.rb +7 -7
  69. data/lib/orb/models/invoice.rb +270 -270
  70. data/lib/orb/models/invoice_create_params.rb +12 -11
  71. data/lib/orb/models/invoice_fetch_upcoming_response.rb +266 -266
  72. data/lib/orb/models/invoice_issue_params.rb +4 -4
  73. data/lib/orb/models/invoice_line_item_create_params.rb +1 -1
  74. data/lib/orb/models/invoice_line_item_create_response.rb +27 -27
  75. data/lib/orb/models/invoice_list_params.rb +12 -12
  76. data/lib/orb/models/invoice_update_params.rb +2 -2
  77. data/lib/orb/models/item.rb +2 -2
  78. data/lib/orb/models/item_list_params.rb +1 -1
  79. data/lib/orb/models/metric_create_params.rb +2 -2
  80. data/lib/orb/models/metric_list_params.rb +5 -5
  81. data/lib/orb/models/metric_update_params.rb +2 -2
  82. data/lib/orb/models/percentage_discount.rb +2 -2
  83. data/lib/orb/models/plan.rb +35 -35
  84. data/lib/orb/models/plan_create_params.rb +267 -267
  85. data/lib/orb/models/plan_list_params.rb +5 -5
  86. data/lib/orb/models/plan_update_params.rb +4 -4
  87. data/lib/orb/models/plans/external_plan_id_update_params.rb +4 -4
  88. data/lib/orb/models/price.rb +158 -158
  89. data/lib/orb/models/price_create_params.rb +20 -20
  90. data/lib/orb/models/price_evaluate_params.rb +4 -4
  91. data/lib/orb/models/price_list_params.rb +1 -1
  92. data/lib/orb/models/price_update_params.rb +2 -2
  93. data/lib/orb/models/prices/external_price_id_update_params.rb +2 -2
  94. data/lib/orb/models/subscription.rb +114 -87
  95. data/lib/orb/models/subscription_cancel_params.rb +3 -3
  96. data/lib/orb/models/subscription_cancel_response.rb +150 -72
  97. data/lib/orb/models/subscription_change_apply_params.rb +33 -0
  98. data/lib/orb/models/subscription_change_apply_response.rb +1372 -0
  99. data/lib/orb/models/subscription_change_cancel_params.rb +19 -0
  100. data/lib/orb/models/subscription_change_cancel_response.rb +1372 -0
  101. data/lib/orb/models/subscription_change_retrieve_params.rb +19 -0
  102. data/lib/orb/models/subscription_change_retrieve_response.rb +1372 -0
  103. data/lib/orb/models/subscription_create_params.rb +641 -641
  104. data/lib/orb/models/subscription_create_response.rb +150 -72
  105. data/lib/orb/models/subscription_fetch_costs_params.rb +6 -6
  106. data/lib/orb/models/subscription_fetch_schedule_params.rb +5 -5
  107. data/lib/orb/models/subscription_fetch_schedule_response.rb +2 -2
  108. data/lib/orb/models/subscription_fetch_usage_params.rb +8 -8
  109. data/lib/orb/models/subscription_list_params.rb +5 -5
  110. data/lib/orb/models/subscription_price_intervals_params.rb +323 -323
  111. data/lib/orb/models/subscription_price_intervals_response.rb +152 -72
  112. data/lib/orb/models/subscription_schedule_plan_change_params.rb +651 -651
  113. data/lib/orb/models/subscription_schedule_plan_change_response.rb +152 -72
  114. data/lib/orb/models/subscription_trigger_phase_params.rb +3 -3
  115. data/lib/orb/models/subscription_trigger_phase_response.rb +152 -72
  116. data/lib/orb/models/subscription_unschedule_cancellation_response.rb +152 -72
  117. data/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rb +153 -73
  118. data/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rb +152 -72
  119. data/lib/orb/models/subscription_update_fixed_fee_quantity_params.rb +8 -8
  120. data/lib/orb/models/subscription_update_fixed_fee_quantity_response.rb +152 -72
  121. data/lib/orb/models/subscription_update_params.rb +10 -10
  122. data/lib/orb/models/subscription_update_trial_params.rb +3 -3
  123. data/lib/orb/models/subscription_update_trial_response.rb +152 -72
  124. data/lib/orb/models/trial_discount.rb +1 -1
  125. data/lib/orb/models/usage_discount.rb +2 -2
  126. data/lib/orb/request_options.rb +7 -7
  127. data/lib/orb/resources/alerts.rb +38 -38
  128. data/lib/orb/resources/coupons/subscriptions.rb +3 -3
  129. data/lib/orb/resources/coupons.rb +9 -9
  130. data/lib/orb/resources/credit_notes.rb +8 -8
  131. data/lib/orb/resources/customers/balance_transactions.rb +26 -26
  132. data/lib/orb/resources/customers/costs.rb +232 -232
  133. data/lib/orb/resources/customers/credits/ledger.rb +344 -344
  134. data/lib/orb/resources/customers/credits/top_ups.rb +12 -12
  135. data/lib/orb/resources/customers/credits.rb +8 -8
  136. data/lib/orb/resources/customers.rb +59 -59
  137. data/lib/orb/resources/dimensional_price_groups.rb +6 -6
  138. data/lib/orb/resources/events/backfills.rb +49 -49
  139. data/lib/orb/resources/events/volume.rb +10 -10
  140. data/lib/orb/resources/events.rb +295 -295
  141. data/lib/orb/resources/invoice_line_items.rb +1 -1
  142. data/lib/orb/resources/invoices.rb +38 -38
  143. data/lib/orb/resources/items.rb +1 -1
  144. data/lib/orb/resources/metrics.rb +11 -11
  145. data/lib/orb/resources/plans/external_plan_id.rb +14 -14
  146. data/lib/orb/resources/plans.rb +22 -22
  147. data/lib/orb/resources/prices/external_price_id.rb +4 -4
  148. data/lib/orb/resources/prices.rb +30 -30
  149. data/lib/orb/resources/subscription_changes.rb +87 -0
  150. data/lib/orb/resources/subscriptions.rb +813 -813
  151. data/lib/orb/resources/top_level.rb +4 -4
  152. data/lib/orb/version.rb +1 -1
  153. data/lib/orb.rb +7 -0
  154. data/rbi/lib/orb/client.rbi +5 -4
  155. data/rbi/lib/orb/errors.rbi +3 -6
  156. data/rbi/lib/orb/internal/page.rbi +3 -6
  157. data/rbi/lib/orb/internal/transport/base_client.rbi +13 -27
  158. data/rbi/lib/orb/internal/transport/pooled_net_requester.rbi +7 -13
  159. data/rbi/lib/orb/internal/type/array_of.rbi +8 -16
  160. data/rbi/lib/orb/internal/type/base_model.rbi +45 -64
  161. data/rbi/lib/orb/internal/type/base_page.rbi +5 -10
  162. data/rbi/lib/orb/internal/type/boolean.rbi +4 -8
  163. data/rbi/lib/orb/internal/type/converter.rbi +25 -31
  164. data/rbi/lib/orb/internal/type/enum.rbi +14 -20
  165. data/rbi/lib/orb/internal/type/hash_of.rbi +8 -16
  166. data/rbi/lib/orb/internal/type/request_parameters.rbi +1 -2
  167. data/rbi/lib/orb/internal/type/union.rbi +10 -20
  168. data/rbi/lib/orb/internal/type/unknown.rbi +4 -8
  169. data/rbi/lib/orb/internal/util.rbi +34 -68
  170. data/rbi/lib/orb/internal.rbi +1 -1
  171. data/rbi/lib/orb/models/alert.rbi +21 -33
  172. data/rbi/lib/orb/models/alert_create_for_customer_params.rbi +8 -13
  173. data/rbi/lib/orb/models/alert_create_for_external_customer_params.rbi +8 -13
  174. data/rbi/lib/orb/models/alert_create_for_subscription_params.rbi +8 -13
  175. data/rbi/lib/orb/models/alert_disable_params.rbi +2 -4
  176. data/rbi/lib/orb/models/alert_enable_params.rbi +2 -4
  177. data/rbi/lib/orb/models/alert_list_params.rbi +3 -6
  178. data/rbi/lib/orb/models/alert_retrieve_params.rbi +2 -4
  179. data/rbi/lib/orb/models/alert_update_params.rbi +7 -11
  180. data/rbi/lib/orb/models/amount_discount.rbi +4 -7
  181. data/rbi/lib/orb/models/billable_metric.rbi +10 -13
  182. data/rbi/lib/orb/models/billing_cycle_relative_date.rbi +1 -2
  183. data/rbi/lib/orb/models/coupon.rbi +9 -11
  184. data/rbi/lib/orb/models/coupon_archive_params.rbi +2 -4
  185. data/rbi/lib/orb/models/coupon_create_params.rbi +8 -14
  186. data/rbi/lib/orb/models/coupon_fetch_params.rbi +2 -4
  187. data/rbi/lib/orb/models/coupon_list_params.rbi +3 -4
  188. data/rbi/lib/orb/models/coupons/subscription_list_params.rbi +3 -5
  189. data/rbi/lib/orb/models/credit_note.rbi +22 -45
  190. data/rbi/lib/orb/models/credit_note_create_params.rbi +5 -10
  191. data/rbi/lib/orb/models/credit_note_fetch_params.rbi +2 -4
  192. data/rbi/lib/orb/models/credit_note_list_params.rbi +3 -6
  193. data/rbi/lib/orb/models/customer.rbi +256 -281
  194. data/rbi/lib/orb/models/customer_create_params.rbi +251 -276
  195. data/rbi/lib/orb/models/customer_delete_params.rbi +2 -4
  196. data/rbi/lib/orb/models/customer_fetch_by_external_id_params.rbi +2 -4
  197. data/rbi/lib/orb/models/customer_fetch_params.rbi +2 -4
  198. data/rbi/lib/orb/models/customer_list_params.rbi +3 -6
  199. data/rbi/lib/orb/models/customer_sync_payment_methods_from_gateway_by_external_customer_id_params.rbi +2 -4
  200. data/rbi/lib/orb/models/customer_sync_payment_methods_from_gateway_params.rbi +2 -4
  201. data/rbi/lib/orb/models/customer_update_by_external_id_params.rbi +252 -277
  202. data/rbi/lib/orb/models/customer_update_params.rbi +252 -277
  203. data/rbi/lib/orb/models/customers/balance_transaction_create_params.rbi +3 -6
  204. data/rbi/lib/orb/models/customers/balance_transaction_create_response.rbi +10 -19
  205. data/rbi/lib/orb/models/customers/balance_transaction_list_params.rbi +3 -6
  206. data/rbi/lib/orb/models/customers/balance_transaction_list_response.rbi +10 -19
  207. data/rbi/lib/orb/models/customers/cost_list_by_external_id_params.rbi +8 -10
  208. data/rbi/lib/orb/models/customers/cost_list_by_external_id_response.rbi +6 -12
  209. data/rbi/lib/orb/models/customers/cost_list_params.rbi +8 -10
  210. data/rbi/lib/orb/models/customers/cost_list_response.rbi +6 -12
  211. data/rbi/lib/orb/models/customers/credit_list_by_external_id_params.rbi +3 -4
  212. data/rbi/lib/orb/models/customers/credit_list_by_external_id_response.rbi +2 -4
  213. data/rbi/lib/orb/models/customers/credit_list_params.rbi +3 -4
  214. data/rbi/lib/orb/models/customers/credit_list_response.rbi +2 -4
  215. data/rbi/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi +26 -33
  216. data/rbi/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_response.rbi +79 -136
  217. data/rbi/lib/orb/models/customers/credits/ledger_create_entry_params.rbi +26 -33
  218. data/rbi/lib/orb/models/customers/credits/ledger_create_entry_response.rbi +78 -135
  219. data/rbi/lib/orb/models/customers/credits/ledger_list_by_external_id_params.rbi +5 -10
  220. data/rbi/lib/orb/models/customers/credits/ledger_list_by_external_id_response.rbi +79 -136
  221. data/rbi/lib/orb/models/customers/credits/ledger_list_params.rbi +5 -10
  222. data/rbi/lib/orb/models/customers/credits/ledger_list_response.rbi +74 -131
  223. data/rbi/lib/orb/models/customers/credits/top_up_create_by_external_id_params.rbi +13 -19
  224. data/rbi/lib/orb/models/customers/credits/top_up_create_by_external_id_response.rbi +12 -18
  225. data/rbi/lib/orb/models/customers/credits/top_up_create_params.rbi +13 -19
  226. data/rbi/lib/orb/models/customers/credits/top_up_create_response.rbi +12 -18
  227. data/rbi/lib/orb/models/customers/credits/top_up_delete_by_external_id_params.rbi +2 -4
  228. data/rbi/lib/orb/models/customers/credits/top_up_delete_params.rbi +2 -4
  229. data/rbi/lib/orb/models/customers/credits/top_up_list_by_external_id_params.rbi +3 -5
  230. data/rbi/lib/orb/models/customers/credits/top_up_list_by_external_id_response.rbi +12 -18
  231. data/rbi/lib/orb/models/customers/credits/top_up_list_params.rbi +3 -5
  232. data/rbi/lib/orb/models/customers/credits/top_up_list_response.rbi +12 -18
  233. data/rbi/lib/orb/models/dimensional_price_group.rbi +8 -9
  234. data/rbi/lib/orb/models/dimensional_price_group_create_params.rbi +4 -7
  235. data/rbi/lib/orb/models/dimensional_price_group_list_params.rbi +3 -5
  236. data/rbi/lib/orb/models/dimensional_price_group_retrieve_params.rbi +2 -4
  237. data/rbi/lib/orb/models/dimensional_price_groups/external_dimensional_price_group_id_retrieve_params.rbi +2 -4
  238. data/rbi/lib/orb/models/dimensional_price_groups.rbi +2 -4
  239. data/rbi/lib/orb/models/discount.rbi +1 -2
  240. data/rbi/lib/orb/models/evaluate_price_group.rbi +3 -6
  241. data/rbi/lib/orb/models/event_deprecate_params.rbi +2 -4
  242. data/rbi/lib/orb/models/event_deprecate_response.rbi +2 -4
  243. data/rbi/lib/orb/models/event_ingest_params.rbi +10 -13
  244. data/rbi/lib/orb/models/event_ingest_response.rbi +10 -16
  245. data/rbi/lib/orb/models/event_search_params.rbi +7 -9
  246. data/rbi/lib/orb/models/event_search_response.rbi +11 -14
  247. data/rbi/lib/orb/models/event_update_params.rbi +5 -6
  248. data/rbi/lib/orb/models/event_update_response.rbi +2 -4
  249. data/rbi/lib/orb/models/events/backfill_close_params.rbi +2 -4
  250. data/rbi/lib/orb/models/events/backfill_close_response.rbi +10 -14
  251. data/rbi/lib/orb/models/events/backfill_create_params.rbi +13 -16
  252. data/rbi/lib/orb/models/events/backfill_create_response.rbi +10 -14
  253. data/rbi/lib/orb/models/events/backfill_fetch_params.rbi +2 -4
  254. data/rbi/lib/orb/models/events/backfill_fetch_response.rbi +10 -14
  255. data/rbi/lib/orb/models/events/backfill_list_params.rbi +3 -5
  256. data/rbi/lib/orb/models/events/backfill_list_response.rbi +10 -14
  257. data/rbi/lib/orb/models/events/backfill_revert_params.rbi +2 -4
  258. data/rbi/lib/orb/models/events/backfill_revert_response.rbi +10 -14
  259. data/rbi/lib/orb/models/events/event_volumes.rbi +5 -9
  260. data/rbi/lib/orb/models/events/volume_list_params.rbi +9 -11
  261. data/rbi/lib/orb/models/invoice.rbi +388 -465
  262. data/rbi/lib/orb/models/invoice_create_params.rbi +19 -26
  263. data/rbi/lib/orb/models/invoice_fetch_params.rbi +2 -4
  264. data/rbi/lib/orb/models/invoice_fetch_upcoming_params.rbi +2 -4
  265. data/rbi/lib/orb/models/invoice_fetch_upcoming_response.rbi +381 -460
  266. data/rbi/lib/orb/models/invoice_issue_params.rbi +6 -8
  267. data/rbi/lib/orb/models/invoice_level_discount.rbi +1 -2
  268. data/rbi/lib/orb/models/invoice_line_item_create_params.rbi +3 -5
  269. data/rbi/lib/orb/models/invoice_line_item_create_response.rbi +101 -143
  270. data/rbi/lib/orb/models/invoice_list_params.rbi +8 -13
  271. data/rbi/lib/orb/models/invoice_mark_paid_params.rbi +2 -4
  272. data/rbi/lib/orb/models/invoice_pay_params.rbi +2 -4
  273. data/rbi/lib/orb/models/invoice_update_params.rbi +4 -6
  274. data/rbi/lib/orb/models/invoice_void_params.rbi +2 -4
  275. data/rbi/lib/orb/models/item.rbi +7 -12
  276. data/rbi/lib/orb/models/item_create_params.rbi +2 -4
  277. data/rbi/lib/orb/models/item_fetch_params.rbi +2 -4
  278. data/rbi/lib/orb/models/item_list_params.rbi +3 -5
  279. data/rbi/lib/orb/models/item_update_params.rbi +5 -10
  280. data/rbi/lib/orb/models/metric_create_params.rbi +4 -6
  281. data/rbi/lib/orb/models/metric_fetch_params.rbi +2 -4
  282. data/rbi/lib/orb/models/metric_list_params.rbi +3 -6
  283. data/rbi/lib/orb/models/metric_update_params.rbi +4 -6
  284. data/rbi/lib/orb/models/pagination_metadata.rbi +2 -4
  285. data/rbi/lib/orb/models/percentage_discount.rbi +5 -8
  286. data/rbi/lib/orb/models/plan.rbi +180 -219
  287. data/rbi/lib/orb/models/plan_create_params.rbi +670 -951
  288. data/rbi/lib/orb/models/plan_fetch_params.rbi +2 -4
  289. data/rbi/lib/orb/models/plan_list_params.rbi +4 -8
  290. data/rbi/lib/orb/models/plan_update_params.rbi +6 -8
  291. data/rbi/lib/orb/models/plans/external_plan_id_fetch_params.rbi +2 -4
  292. data/rbi/lib/orb/models/plans/external_plan_id_update_params.rbi +6 -8
  293. data/rbi/lib/orb/models/price.rbi +827 -1494
  294. data/rbi/lib/orb/models/price_create_params.rbi +60 -101
  295. data/rbi/lib/orb/models/price_evaluate_params.rbi +6 -9
  296. data/rbi/lib/orb/models/price_evaluate_response.rbi +2 -4
  297. data/rbi/lib/orb/models/price_fetch_params.rbi +2 -4
  298. data/rbi/lib/orb/models/price_list_params.rbi +3 -5
  299. data/rbi/lib/orb/models/price_update_params.rbi +4 -6
  300. data/rbi/lib/orb/models/prices/external_price_id_fetch_params.rbi +2 -4
  301. data/rbi/lib/orb/models/prices/external_price_id_update_params.rbi +4 -6
  302. data/rbi/lib/orb/models/subscription.rbi +167 -187
  303. data/rbi/lib/orb/models/subscription_cancel_params.rbi +5 -7
  304. data/rbi/lib/orb/models/subscription_cancel_response.rbi +224 -178
  305. data/rbi/lib/orb/models/subscription_change_apply_params.rbi +40 -0
  306. data/rbi/lib/orb/models/subscription_change_apply_response.rbi +1554 -0
  307. data/rbi/lib/orb/models/subscription_change_cancel_params.rbi +18 -0
  308. data/rbi/lib/orb/models/subscription_change_cancel_response.rbi +1565 -0
  309. data/rbi/lib/orb/models/subscription_change_retrieve_params.rbi +18 -0
  310. data/rbi/lib/orb/models/subscription_change_retrieve_response.rbi +1581 -0
  311. data/rbi/lib/orb/models/subscription_create_params.rbi +1372 -1968
  312. data/rbi/lib/orb/models/subscription_create_response.rbi +224 -178
  313. data/rbi/lib/orb/models/subscription_fetch_costs_params.rbi +8 -10
  314. data/rbi/lib/orb/models/subscription_fetch_costs_response.rbi +6 -12
  315. data/rbi/lib/orb/models/subscription_fetch_params.rbi +2 -4
  316. data/rbi/lib/orb/models/subscription_fetch_schedule_params.rbi +3 -6
  317. data/rbi/lib/orb/models/subscription_fetch_schedule_response.rbi +6 -10
  318. data/rbi/lib/orb/models/subscription_fetch_usage_params.rbi +12 -17
  319. data/rbi/lib/orb/models/subscription_list_params.rbi +4 -8
  320. data/rbi/lib/orb/models/subscription_price_intervals_params.rbi +772 -1124
  321. data/rbi/lib/orb/models/subscription_price_intervals_response.rbi +228 -178
  322. data/rbi/lib/orb/models/subscription_schedule_plan_change_params.rbi +1396 -1993
  323. data/rbi/lib/orb/models/subscription_schedule_plan_change_response.rbi +238 -182
  324. data/rbi/lib/orb/models/subscription_trigger_phase_params.rbi +5 -7
  325. data/rbi/lib/orb/models/subscription_trigger_phase_response.rbi +224 -178
  326. data/rbi/lib/orb/models/subscription_unschedule_cancellation_params.rbi +2 -4
  327. data/rbi/lib/orb/models/subscription_unschedule_cancellation_response.rbi +238 -182
  328. data/rbi/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_params.rbi +2 -4
  329. data/rbi/lib/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbi +265 -199
  330. data/rbi/lib/orb/models/subscription_unschedule_pending_plan_changes_params.rbi +2 -4
  331. data/rbi/lib/orb/models/subscription_unschedule_pending_plan_changes_response.rbi +264 -198
  332. data/rbi/lib/orb/models/subscription_update_fixed_fee_quantity_params.rbi +11 -15
  333. data/rbi/lib/orb/models/subscription_update_fixed_fee_quantity_response.rbi +238 -182
  334. data/rbi/lib/orb/models/subscription_update_params.rbi +12 -15
  335. data/rbi/lib/orb/models/subscription_update_trial_params.rbi +6 -9
  336. data/rbi/lib/orb/models/subscription_update_trial_response.rbi +224 -178
  337. data/rbi/lib/orb/models/subscription_usage.rbi +24 -43
  338. data/rbi/lib/orb/models/subscriptions.rbi +2 -4
  339. data/rbi/lib/orb/models/top_level_ping_params.rbi +2 -4
  340. data/rbi/lib/orb/models/top_level_ping_response.rbi +2 -4
  341. data/rbi/lib/orb/models/trial_discount.rbi +4 -8
  342. data/rbi/lib/orb/models/usage_discount.rbi +5 -8
  343. data/rbi/lib/orb/request_options.rbi +9 -11
  344. data/rbi/lib/orb/resources/alerts.rbi +44 -60
  345. data/rbi/lib/orb/resources/coupons/subscriptions.rbi +6 -9
  346. data/rbi/lib/orb/resources/coupons.rbi +18 -25
  347. data/rbi/lib/orb/resources/credit_notes.rbi +9 -15
  348. data/rbi/lib/orb/resources/customers/balance_transactions.rbi +26 -31
  349. data/rbi/lib/orb/resources/customers/costs.rbi +241 -246
  350. data/rbi/lib/orb/resources/customers/credits/ledger.rbi +387 -396
  351. data/rbi/lib/orb/resources/customers/credits/top_ups.rbi +29 -40
  352. data/rbi/lib/orb/resources/customers/credits.rbi +15 -20
  353. data/rbi/lib/orb/resources/customers.rbi +407 -417
  354. data/rbi/lib/orb/resources/dimensional_price_groups/external_dimensional_price_group_id.rbi +2 -4
  355. data/rbi/lib/orb/resources/dimensional_price_groups.rbi +13 -19
  356. data/rbi/lib/orb/resources/events/backfills.rbi +61 -69
  357. data/rbi/lib/orb/resources/events/volume.rbi +19 -22
  358. data/rbi/lib/orb/resources/events.rbi +311 -319
  359. data/rbi/lib/orb/resources/invoice_line_items.rbi +4 -7
  360. data/rbi/lib/orb/resources/invoices.rbi +62 -76
  361. data/rbi/lib/orb/resources/items.rbi +7 -14
  362. data/rbi/lib/orb/resources/metrics.rbi +17 -25
  363. data/rbi/lib/orb/resources/plans/external_plan_id.rbi +21 -25
  364. data/rbi/lib/orb/resources/plans.rbi +63 -71
  365. data/rbi/lib/orb/resources/prices/external_price_id.rbi +9 -13
  366. data/rbi/lib/orb/resources/prices.rbi +77 -87
  367. data/rbi/lib/orb/resources/subscription_changes.rbi +61 -0
  368. data/rbi/lib/orb/resources/subscriptions.rbi +933 -963
  369. data/rbi/lib/orb/resources/top_level.rbi +6 -8
  370. data/sig/orb/client.rbs +2 -0
  371. data/sig/orb/models/subscription.rbs +14 -0
  372. data/sig/orb/models/subscription_cancel_response.rbs +47 -2
  373. data/sig/orb/models/subscription_change_apply_params.rbs +24 -0
  374. data/sig/orb/models/subscription_change_apply_response.rbs +784 -0
  375. data/sig/orb/models/subscription_change_cancel_params.rbs +15 -0
  376. data/sig/orb/models/subscription_change_cancel_response.rbs +784 -0
  377. data/sig/orb/models/subscription_change_retrieve_params.rbs +15 -0
  378. data/sig/orb/models/subscription_change_retrieve_response.rbs +784 -0
  379. data/sig/orb/models/subscription_create_response.rbs +47 -2
  380. data/sig/orb/models/subscription_price_intervals_response.rbs +47 -2
  381. data/sig/orb/models/subscription_schedule_plan_change_response.rbs +47 -2
  382. data/sig/orb/models/subscription_trigger_phase_response.rbs +47 -2
  383. data/sig/orb/models/subscription_unschedule_cancellation_response.rbs +47 -2
  384. data/sig/orb/models/subscription_unschedule_fixed_fee_quantity_updates_response.rbs +47 -2
  385. data/sig/orb/models/subscription_unschedule_pending_plan_changes_response.rbs +47 -2
  386. data/sig/orb/models/subscription_update_fixed_fee_quantity_response.rbs +47 -2
  387. data/sig/orb/models/subscription_update_trial_response.rbs +47 -2
  388. data/sig/orb/resources/customers.rbs +2 -2
  389. data/sig/orb/resources/subscription_changes.rbs +24 -0
  390. metadata +23 -2
@@ -5,122 +5,122 @@ module Orb
5
5
  class Customers
6
6
  class Costs
7
7
  # This endpoint is used to fetch a day-by-day snapshot of a customer's costs in
8
- # Orb, calculated by applying pricing information to the underlying usage (see the
9
- # [subscription usage endpoint](/api-reference/subscription/fetch-subscription-usage)
10
- # to fetch usage per metric, in usage units rather than a currency).
11
- #
12
- # This endpoint can be leveraged for internal tooling and to provide a more
13
- # transparent billing experience for your end users:
14
- #
15
- # 1. Understand the cost breakdown per line item historically and in real-time for
16
- # the current billing period.
17
- # 2. Provide customer visibility into how different services are contributing to
18
- # the overall invoice with a per-day timeseries (as compared to the
19
- # [upcoming invoice](/api-reference/invoice/fetch-upcoming-invoice) resource,
20
- # which represents a snapshot for the current period).
21
- # 3. Assess how minimums and discounts affect your customers by teasing apart
22
- # costs directly as a result of usage, as opposed to minimums and discounts at
23
- # the plan and price level.
24
- # 4. Gain insight into key customer health metrics, such as the percent
25
- # utilization of the minimum committed spend.
26
- #
27
- # ## Fetching subscriptions
28
- #
29
- # By default, this endpoint fetches the currently active subscription for the
30
- # customer, and returns cost information for the subscription's current billing
31
- # period, broken down by each participating price. If there are no currently
32
- # active subscriptions, this will instead default to the most recently active
33
- # subscription or return an empty series if none are found. For example, if your
34
- # plan charges for compute hours, job runs, and data syncs, then this endpoint
35
- # would provide a daily breakdown of your customer's cost for each of those axes.
36
- #
37
- # If timeframe bounds are specified, Orb fetches all subscriptions that were
38
- # active in that timeframe. If two subscriptions overlap on a single day, costs
39
- # from each price will be summed, and prices for both subscriptions will be
40
- # included in the breakdown.
41
- #
42
- # ## Prepaid plans
43
- #
44
- # For plans that include prices which deduct credits rather than accrue in-arrears
45
- # charges in a billable currency, this endpoint will return the total deduction
46
- # amount, in credits, for the specified timeframe.
47
- #
48
- # ## Cumulative subtotals and totals
49
- #
50
- # Since the subtotal and total must factor in any billing-period level discounts
51
- # and minimums, it's most meaningful to consider costs relative to the start of
52
- # the subscription's billing period. As a result, by default this endpoint returns
53
- # cumulative totals since the beginning of the billing period. In particular, the
54
- # `timeframe_start` of a returned timeframe window is _always_ the beginning of
55
- # the billing period and `timeframe_end` is incremented one day at a time to build
56
- # the result.
57
- #
58
- # A customer that uses a few API calls a day but has a minimum commitment might
59
- # exhibit the following pattern for their subtotal and total in the first few days
60
- # of the month. Here, we assume that each API call is $2.50, the customer's plan
61
- # has a monthly minimum of $50 for this price, and that the subscription's billing
62
- # period bounds are aligned to the first of the month:
63
- #
64
- # | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
65
- # | --------------- | ------------- | ---------------- | -------- | ------------------------ |
66
- # | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
67
- # | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
68
- # | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
69
- # | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
70
- # | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
71
- #
72
- # ### Periodic values
73
- #
74
- # When the query parameter `view_mode=periodic` is specified, Orb will return an
75
- # incremental day-by-day view of costs. In this case, there will always be a
76
- # one-day difference between `timeframe_start` and `timeframe_end` for the
77
- # timeframes returned. This is a transform on top of the cumulative costs,
78
- # calculated by taking the difference of each timeframe with the last. Note that
79
- # in the above example, the `Total` value would be 0 for the second two data
80
- # points, since the minimum commitment has not yet been hit and each day is not
81
- # contributing anything to the total cost.
82
- #
83
- # ## Timeframe bounds
84
- #
85
- # For an active subscription, both timeframes should be specified in the request.
86
- # If a subscription starts or ends within the timeframe, the response will only
87
- # include windows where the subscription is active. If a subscription has ended,
88
- # no timeframe bounds need to be specified and the response will default to the
89
- # billing period when the subscription was last active.
90
- #
91
- # As noted above, `timeframe_start` for a given cumulative datapoint is always the
92
- # beginning of the billing period, and `timeframe_end` is incremented one day at a
93
- # time to construct the response. When a timeframe is passed in that is not
94
- # aligned to the current subscription's billing period, the response will contain
95
- # cumulative totals from multiple billing periods.
96
- #
97
- # Suppose the queried customer has a subscription aligned to the 15th of every
98
- # month. If this endpoint is queried with the date range `2023-06-01` -
99
- # `2023-07-01`, the first data point will represent about half a billing period's
100
- # worth of costs, accounting for accruals from the start of the billing period and
101
- # inclusive of the first day of the timeframe
102
- # (`timeframe_start = 2023-05-15 00:00:00`, `timeframe_end = 2023-06-02 00:00:00`)
103
- #
104
- # | datapoint index | timeframe_start | timeframe_end |
105
- # | --------------- | --------------- | ------------- |
106
- # | 0 | 2023-05-15 | 2023-06-02 |
107
- # | 1 | 2023-05-15 | 2023-06-03 |
108
- # | 2 | ... | ... |
109
- # | 3 | 2023-05-15 | 2023-06-14 |
110
- # | 4 | 2023-06-15 | 2023-06-16 |
111
- # | 5 | 2023-06-15 | 2023-06-17 |
112
- # | 6 | ... | ... |
113
- # | 7 | 2023-06-15 | 2023-07-01 |
114
- #
115
- # You can see this sliced timeframe visualized
116
- # [here](https://i.imgur.com/TXhYgme.png).
117
- #
118
- # ### Matrix prices
119
- #
120
- # When a price uses matrix pricing, it's important to view costs grouped by those
121
- # matrix dimensions. Orb will return `price_groups` with the `grouping_key` and
122
- # `secondary_grouping_key` based on the matrix price definition, for each
123
- # `grouping_value` and `secondary_grouping_value` available.
8
+ # Orb, calculated by applying pricing information to the underlying usage (see the
9
+ # [subscription usage endpoint](/api-reference/subscription/fetch-subscription-usage)
10
+ # to fetch usage per metric, in usage units rather than a currency).
11
+ #
12
+ # This endpoint can be leveraged for internal tooling and to provide a more
13
+ # transparent billing experience for your end users:
14
+ #
15
+ # 1. Understand the cost breakdown per line item historically and in real-time for
16
+ # the current billing period.
17
+ # 2. Provide customer visibility into how different services are contributing to
18
+ # the overall invoice with a per-day timeseries (as compared to the
19
+ # [upcoming invoice](/api-reference/invoice/fetch-upcoming-invoice) resource,
20
+ # which represents a snapshot for the current period).
21
+ # 3. Assess how minimums and discounts affect your customers by teasing apart
22
+ # costs directly as a result of usage, as opposed to minimums and discounts at
23
+ # the plan and price level.
24
+ # 4. Gain insight into key customer health metrics, such as the percent
25
+ # utilization of the minimum committed spend.
26
+ #
27
+ # ## Fetching subscriptions
28
+ #
29
+ # By default, this endpoint fetches the currently active subscription for the
30
+ # customer, and returns cost information for the subscription's current billing
31
+ # period, broken down by each participating price. If there are no currently
32
+ # active subscriptions, this will instead default to the most recently active
33
+ # subscription or return an empty series if none are found. For example, if your
34
+ # plan charges for compute hours, job runs, and data syncs, then this endpoint
35
+ # would provide a daily breakdown of your customer's cost for each of those axes.
36
+ #
37
+ # If timeframe bounds are specified, Orb fetches all subscriptions that were
38
+ # active in that timeframe. If two subscriptions overlap on a single day, costs
39
+ # from each price will be summed, and prices for both subscriptions will be
40
+ # included in the breakdown.
41
+ #
42
+ # ## Prepaid plans
43
+ #
44
+ # For plans that include prices which deduct credits rather than accrue in-arrears
45
+ # charges in a billable currency, this endpoint will return the total deduction
46
+ # amount, in credits, for the specified timeframe.
47
+ #
48
+ # ## Cumulative subtotals and totals
49
+ #
50
+ # Since the subtotal and total must factor in any billing-period level discounts
51
+ # and minimums, it's most meaningful to consider costs relative to the start of
52
+ # the subscription's billing period. As a result, by default this endpoint returns
53
+ # cumulative totals since the beginning of the billing period. In particular, the
54
+ # `timeframe_start` of a returned timeframe window is _always_ the beginning of
55
+ # the billing period and `timeframe_end` is incremented one day at a time to build
56
+ # the result.
57
+ #
58
+ # A customer that uses a few API calls a day but has a minimum commitment might
59
+ # exhibit the following pattern for their subtotal and total in the first few days
60
+ # of the month. Here, we assume that each API call is $2.50, the customer's plan
61
+ # has a monthly minimum of $50 for this price, and that the subscription's billing
62
+ # period bounds are aligned to the first of the month:
63
+ #
64
+ # | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
65
+ # | --------------- | ------------- | ---------------- | -------- | ------------------------ |
66
+ # | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
67
+ # | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
68
+ # | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
69
+ # | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
70
+ # | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
71
+ #
72
+ # ### Periodic values
73
+ #
74
+ # When the query parameter `view_mode=periodic` is specified, Orb will return an
75
+ # incremental day-by-day view of costs. In this case, there will always be a
76
+ # one-day difference between `timeframe_start` and `timeframe_end` for the
77
+ # timeframes returned. This is a transform on top of the cumulative costs,
78
+ # calculated by taking the difference of each timeframe with the last. Note that
79
+ # in the above example, the `Total` value would be 0 for the second two data
80
+ # points, since the minimum commitment has not yet been hit and each day is not
81
+ # contributing anything to the total cost.
82
+ #
83
+ # ## Timeframe bounds
84
+ #
85
+ # For an active subscription, both timeframes should be specified in the request.
86
+ # If a subscription starts or ends within the timeframe, the response will only
87
+ # include windows where the subscription is active. If a subscription has ended,
88
+ # no timeframe bounds need to be specified and the response will default to the
89
+ # billing period when the subscription was last active.
90
+ #
91
+ # As noted above, `timeframe_start` for a given cumulative datapoint is always the
92
+ # beginning of the billing period, and `timeframe_end` is incremented one day at a
93
+ # time to construct the response. When a timeframe is passed in that is not
94
+ # aligned to the current subscription's billing period, the response will contain
95
+ # cumulative totals from multiple billing periods.
96
+ #
97
+ # Suppose the queried customer has a subscription aligned to the 15th of every
98
+ # month. If this endpoint is queried with the date range `2023-06-01` -
99
+ # `2023-07-01`, the first data point will represent about half a billing period's
100
+ # worth of costs, accounting for accruals from the start of the billing period and
101
+ # inclusive of the first day of the timeframe
102
+ # (`timeframe_start = 2023-05-15 00:00:00`, `timeframe_end = 2023-06-02 00:00:00`)
103
+ #
104
+ # | datapoint index | timeframe_start | timeframe_end |
105
+ # | --------------- | --------------- | ------------- |
106
+ # | 0 | 2023-05-15 | 2023-06-02 |
107
+ # | 1 | 2023-05-15 | 2023-06-03 |
108
+ # | 2 | ... | ... |
109
+ # | 3 | 2023-05-15 | 2023-06-14 |
110
+ # | 4 | 2023-06-15 | 2023-06-16 |
111
+ # | 5 | 2023-06-15 | 2023-06-17 |
112
+ # | 6 | ... | ... |
113
+ # | 7 | 2023-06-15 | 2023-07-01 |
114
+ #
115
+ # You can see this sliced timeframe visualized
116
+ # [here](https://i.imgur.com/TXhYgme.png).
117
+ #
118
+ # ### Matrix prices
119
+ #
120
+ # When a price uses matrix pricing, it's important to view costs grouped by those
121
+ # matrix dimensions. Orb will return `price_groups` with the `grouping_key` and
122
+ # `secondary_grouping_key` based on the matrix price definition, for each
123
+ # `grouping_value` and `secondary_grouping_value` available.
124
124
  sig do
125
125
  params(
126
126
  customer_id: String,
@@ -141,131 +141,129 @@ module Orb
141
141
  # Costs returned are inclusive of `timeframe_start`.
142
142
  timeframe_start: nil,
143
143
  # Controls whether Orb returns cumulative costs since the start of the billing
144
- # period, or incremental day-by-day costs. If your customer has minimums or
145
- # discounts, it's strongly recommended that you use the default cumulative
146
- # behavior.
144
+ # period, or incremental day-by-day costs. If your customer has minimums or
145
+ # discounts, it's strongly recommended that you use the default cumulative
146
+ # behavior.
147
147
  view_mode: nil,
148
148
  request_options: {}
149
- )
150
- end
151
-
149
+ ); end
152
150
  # This endpoint is used to fetch a day-by-day snapshot of a customer's costs in
153
- # Orb, calculated by applying pricing information to the underlying usage (see the
154
- # [subscription usage endpoint](/api-reference/subscription/fetch-subscription-usage)
155
- # to fetch usage per metric, in usage units rather than a currency).
156
- #
157
- # This endpoint can be leveraged for internal tooling and to provide a more
158
- # transparent billing experience for your end users:
159
- #
160
- # 1. Understand the cost breakdown per line item historically and in real-time for
161
- # the current billing period.
162
- # 2. Provide customer visibility into how different services are contributing to
163
- # the overall invoice with a per-day timeseries (as compared to the
164
- # [upcoming invoice](/api-reference/invoice/fetch-upcoming-invoice) resource,
165
- # which represents a snapshot for the current period).
166
- # 3. Assess how minimums and discounts affect your customers by teasing apart
167
- # costs directly as a result of usage, as opposed to minimums and discounts at
168
- # the plan and price level.
169
- # 4. Gain insight into key customer health metrics, such as the percent
170
- # utilization of the minimum committed spend.
171
- #
172
- # ## Fetching subscriptions
173
- #
174
- # By default, this endpoint fetches the currently active subscription for the
175
- # customer, and returns cost information for the subscription's current billing
176
- # period, broken down by each participating price. If there are no currently
177
- # active subscriptions, this will instead default to the most recently active
178
- # subscription or return an empty series if none are found. For example, if your
179
- # plan charges for compute hours, job runs, and data syncs, then this endpoint
180
- # would provide a daily breakdown of your customer's cost for each of those axes.
181
- #
182
- # If timeframe bounds are specified, Orb fetches all subscriptions that were
183
- # active in that timeframe. If two subscriptions overlap on a single day, costs
184
- # from each price will be summed, and prices for both subscriptions will be
185
- # included in the breakdown.
186
- #
187
- # ## Prepaid plans
188
- #
189
- # For plans that include prices which deduct credits rather than accrue in-arrears
190
- # charges in a billable currency, this endpoint will return the total deduction
191
- # amount, in credits, for the specified timeframe.
192
- #
193
- # ## Cumulative subtotals and totals
194
- #
195
- # Since the subtotal and total must factor in any billing-period level discounts
196
- # and minimums, it's most meaningful to consider costs relative to the start of
197
- # the subscription's billing period. As a result, by default this endpoint returns
198
- # cumulative totals since the beginning of the billing period. In particular, the
199
- # `timeframe_start` of a returned timeframe window is _always_ the beginning of
200
- # the billing period and `timeframe_end` is incremented one day at a time to build
201
- # the result.
202
- #
203
- # A customer that uses a few API calls a day but has a minimum commitment might
204
- # exhibit the following pattern for their subtotal and total in the first few days
205
- # of the month. Here, we assume that each API call is $2.50, the customer's plan
206
- # has a monthly minimum of $50 for this price, and that the subscription's billing
207
- # period bounds are aligned to the first of the month:
208
- #
209
- # | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
210
- # | --------------- | ------------- | ---------------- | -------- | ------------------------ |
211
- # | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
212
- # | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
213
- # | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
214
- # | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
215
- # | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
216
- #
217
- # ### Periodic values
218
- #
219
- # When the query parameter `view_mode=periodic` is specified, Orb will return an
220
- # incremental day-by-day view of costs. In this case, there will always be a
221
- # one-day difference between `timeframe_start` and `timeframe_end` for the
222
- # timeframes returned. This is a transform on top of the cumulative costs,
223
- # calculated by taking the difference of each timeframe with the last. Note that
224
- # in the above example, the `Total` value would be 0 for the second two data
225
- # points, since the minimum commitment has not yet been hit and each day is not
226
- # contributing anything to the total cost.
227
- #
228
- # ## Timeframe bounds
229
- #
230
- # For an active subscription, both timeframes should be specified in the request.
231
- # If a subscription starts or ends within the timeframe, the response will only
232
- # include windows where the subscription is active. If a subscription has ended,
233
- # no timeframe bounds need to be specified and the response will default to the
234
- # billing period when the subscription was last active.
235
- #
236
- # As noted above, `timeframe_start` for a given cumulative datapoint is always the
237
- # beginning of the billing period, and `timeframe_end` is incremented one day at a
238
- # time to construct the response. When a timeframe is passed in that is not
239
- # aligned to the current subscription's billing period, the response will contain
240
- # cumulative totals from multiple billing periods.
241
- #
242
- # Suppose the queried customer has a subscription aligned to the 15th of every
243
- # month. If this endpoint is queried with the date range `2023-06-01` -
244
- # `2023-07-01`, the first data point will represent about half a billing period's
245
- # worth of costs, accounting for accruals from the start of the billing period and
246
- # inclusive of the first day of the timeframe
247
- # (`timeframe_start = 2023-05-15 00:00:00`, `timeframe_end = 2023-06-02 00:00:00`)
248
- #
249
- # | datapoint index | timeframe_start | timeframe_end |
250
- # | --------------- | --------------- | ------------- |
251
- # | 0 | 2023-05-15 | 2023-06-02 |
252
- # | 1 | 2023-05-15 | 2023-06-03 |
253
- # | 2 | ... | ... |
254
- # | 3 | 2023-05-15 | 2023-06-14 |
255
- # | 4 | 2023-06-15 | 2023-06-16 |
256
- # | 5 | 2023-06-15 | 2023-06-17 |
257
- # | 6 | ... | ... |
258
- # | 7 | 2023-06-15 | 2023-07-01 |
259
- #
260
- # You can see this sliced timeframe visualized
261
- # [here](https://i.imgur.com/TXhYgme.png).
262
- #
263
- # ### Matrix prices
264
- #
265
- # When a price uses matrix pricing, it's important to view costs grouped by those
266
- # matrix dimensions. Orb will return `price_groups` with the `grouping_key` and
267
- # `secondary_grouping_key` based on the matrix price definition, for each
268
- # `grouping_value` and `secondary_grouping_value` available.
151
+ # Orb, calculated by applying pricing information to the underlying usage (see the
152
+ # [subscription usage endpoint](/api-reference/subscription/fetch-subscription-usage)
153
+ # to fetch usage per metric, in usage units rather than a currency).
154
+ #
155
+ # This endpoint can be leveraged for internal tooling and to provide a more
156
+ # transparent billing experience for your end users:
157
+ #
158
+ # 1. Understand the cost breakdown per line item historically and in real-time for
159
+ # the current billing period.
160
+ # 2. Provide customer visibility into how different services are contributing to
161
+ # the overall invoice with a per-day timeseries (as compared to the
162
+ # [upcoming invoice](/api-reference/invoice/fetch-upcoming-invoice) resource,
163
+ # which represents a snapshot for the current period).
164
+ # 3. Assess how minimums and discounts affect your customers by teasing apart
165
+ # costs directly as a result of usage, as opposed to minimums and discounts at
166
+ # the plan and price level.
167
+ # 4. Gain insight into key customer health metrics, such as the percent
168
+ # utilization of the minimum committed spend.
169
+ #
170
+ # ## Fetching subscriptions
171
+ #
172
+ # By default, this endpoint fetches the currently active subscription for the
173
+ # customer, and returns cost information for the subscription's current billing
174
+ # period, broken down by each participating price. If there are no currently
175
+ # active subscriptions, this will instead default to the most recently active
176
+ # subscription or return an empty series if none are found. For example, if your
177
+ # plan charges for compute hours, job runs, and data syncs, then this endpoint
178
+ # would provide a daily breakdown of your customer's cost for each of those axes.
179
+ #
180
+ # If timeframe bounds are specified, Orb fetches all subscriptions that were
181
+ # active in that timeframe. If two subscriptions overlap on a single day, costs
182
+ # from each price will be summed, and prices for both subscriptions will be
183
+ # included in the breakdown.
184
+ #
185
+ # ## Prepaid plans
186
+ #
187
+ # For plans that include prices which deduct credits rather than accrue in-arrears
188
+ # charges in a billable currency, this endpoint will return the total deduction
189
+ # amount, in credits, for the specified timeframe.
190
+ #
191
+ # ## Cumulative subtotals and totals
192
+ #
193
+ # Since the subtotal and total must factor in any billing-period level discounts
194
+ # and minimums, it's most meaningful to consider costs relative to the start of
195
+ # the subscription's billing period. As a result, by default this endpoint returns
196
+ # cumulative totals since the beginning of the billing period. In particular, the
197
+ # `timeframe_start` of a returned timeframe window is _always_ the beginning of
198
+ # the billing period and `timeframe_end` is incremented one day at a time to build
199
+ # the result.
200
+ #
201
+ # A customer that uses a few API calls a day but has a minimum commitment might
202
+ # exhibit the following pattern for their subtotal and total in the first few days
203
+ # of the month. Here, we assume that each API call is $2.50, the customer's plan
204
+ # has a monthly minimum of $50 for this price, and that the subscription's billing
205
+ # period bounds are aligned to the first of the month:
206
+ #
207
+ # | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) |
208
+ # | --------------- | ------------- | ---------------- | -------- | ------------------------ |
209
+ # | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 |
210
+ # | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 |
211
+ # | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 |
212
+ # | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 |
213
+ # | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 |
214
+ #
215
+ # ### Periodic values
216
+ #
217
+ # When the query parameter `view_mode=periodic` is specified, Orb will return an
218
+ # incremental day-by-day view of costs. In this case, there will always be a
219
+ # one-day difference between `timeframe_start` and `timeframe_end` for the
220
+ # timeframes returned. This is a transform on top of the cumulative costs,
221
+ # calculated by taking the difference of each timeframe with the last. Note that
222
+ # in the above example, the `Total` value would be 0 for the second two data
223
+ # points, since the minimum commitment has not yet been hit and each day is not
224
+ # contributing anything to the total cost.
225
+ #
226
+ # ## Timeframe bounds
227
+ #
228
+ # For an active subscription, both timeframes should be specified in the request.
229
+ # If a subscription starts or ends within the timeframe, the response will only
230
+ # include windows where the subscription is active. If a subscription has ended,
231
+ # no timeframe bounds need to be specified and the response will default to the
232
+ # billing period when the subscription was last active.
233
+ #
234
+ # As noted above, `timeframe_start` for a given cumulative datapoint is always the
235
+ # beginning of the billing period, and `timeframe_end` is incremented one day at a
236
+ # time to construct the response. When a timeframe is passed in that is not
237
+ # aligned to the current subscription's billing period, the response will contain
238
+ # cumulative totals from multiple billing periods.
239
+ #
240
+ # Suppose the queried customer has a subscription aligned to the 15th of every
241
+ # month. If this endpoint is queried with the date range `2023-06-01` -
242
+ # `2023-07-01`, the first data point will represent about half a billing period's
243
+ # worth of costs, accounting for accruals from the start of the billing period and
244
+ # inclusive of the first day of the timeframe
245
+ # (`timeframe_start = 2023-05-15 00:00:00`, `timeframe_end = 2023-06-02 00:00:00`)
246
+ #
247
+ # | datapoint index | timeframe_start | timeframe_end |
248
+ # | --------------- | --------------- | ------------- |
249
+ # | 0 | 2023-05-15 | 2023-06-02 |
250
+ # | 1 | 2023-05-15 | 2023-06-03 |
251
+ # | 2 | ... | ... |
252
+ # | 3 | 2023-05-15 | 2023-06-14 |
253
+ # | 4 | 2023-06-15 | 2023-06-16 |
254
+ # | 5 | 2023-06-15 | 2023-06-17 |
255
+ # | 6 | ... | ... |
256
+ # | 7 | 2023-06-15 | 2023-07-01 |
257
+ #
258
+ # You can see this sliced timeframe visualized
259
+ # [here](https://i.imgur.com/TXhYgme.png).
260
+ #
261
+ # ### Matrix prices
262
+ #
263
+ # When a price uses matrix pricing, it's important to view costs grouped by those
264
+ # matrix dimensions. Orb will return `price_groups` with the `grouping_key` and
265
+ # `secondary_grouping_key` based on the matrix price definition, for each
266
+ # `grouping_value` and `secondary_grouping_value` available.
269
267
  sig do
270
268
  params(
271
269
  external_customer_id: String,
@@ -286,18 +284,15 @@ module Orb
286
284
  # Costs returned are inclusive of `timeframe_start`.
287
285
  timeframe_start: nil,
288
286
  # Controls whether Orb returns cumulative costs since the start of the billing
289
- # period, or incremental day-by-day costs. If your customer has minimums or
290
- # discounts, it's strongly recommended that you use the default cumulative
291
- # behavior.
287
+ # period, or incremental day-by-day costs. If your customer has minimums or
288
+ # discounts, it's strongly recommended that you use the default cumulative
289
+ # behavior.
292
290
  view_mode: nil,
293
291
  request_options: {}
294
- )
295
- end
296
-
292
+ ); end
297
293
  # @api private
298
294
  sig { params(client: Orb::Client).returns(T.attached_class) }
299
- def self.new(client:)
300
- end
295
+ def self.new(client:); end
301
296
  end
302
297
  end
303
298
  end