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
@@ -10,50 +10,50 @@ module Orb
10
10
  attr_reader :volume
11
11
 
12
12
  # This endpoint is used to amend a single usage event with a given `event_id`.
13
- # `event_id` refers to the `idempotency_key` passed in during ingestion. The event
14
- # will maintain its existing `event_id` after the amendment.
15
- #
16
- # This endpoint will mark the existing event as ignored, and Orb will only use the
17
- # new event passed in the body of this request as the source of truth for that
18
- # `event_id`. Note that a single event can be amended any number of times, so the
19
- # same event can be overwritten in subsequent calls to this endpoint. Only a
20
- # single event with a given `event_id` will be considered the source of truth at
21
- # any given time.
22
- #
23
- # This is a powerful and audit-safe mechanism to retroactively update a single
24
- # event in cases where you need to:
25
- #
26
- # - update an event with new metadata as you iterate on your pricing model
27
- # - update an event based on the result of an external API call (e.g. call to a
28
- # payment gateway succeeded or failed)
29
- #
30
- # This amendment API is always audit-safe. The process will still retain the
31
- # original event, though it will be ignored for billing calculations. For auditing
32
- # and data fidelity purposes, Orb never overwrites or permanently deletes ingested
33
- # usage data.
34
- #
35
- # ## Request validation
36
- #
37
- # - The `timestamp` of the new event must match the `timestamp` of the existing
38
- # event already ingested. As with ingestion, all timestamps must be sent in
39
- # ISO8601 format with UTC timezone offset.
40
- # - The `customer_id` or `external_customer_id` of the new event must match the
41
- # `customer_id` or `external_customer_id` of the existing event already
42
- # ingested. Exactly one of `customer_id` and `external_customer_id` should be
43
- # specified, and similar to ingestion, the ID must identify a Customer resource
44
- # within Orb. Unlike ingestion, for event amendment, we strictly enforce that
45
- # the Customer must be in the Orb system, even during the initial integration
46
- # period. We do not allow updating the `Customer` an event is associated with.
47
- # - Orb does not accept an `idempotency_key` with the event in this endpoint,
48
- # since this request is by design idempotent. On retryable errors, you should
49
- # retry the request and assume the amendment operation has not succeeded until
50
- # receipt of a 2xx.
51
- # - The event's `timestamp` must fall within the customer's current subscription's
52
- # billing period, or within the grace period of the customer's current
53
- # subscription's previous billing period.
54
- # - By default, no more than 100 events can be amended for a single customer in a
55
- # 100 day period. For higher volume updates, consider using the
56
- # [event backfill](create-backfill) endpoint.
13
+ # `event_id` refers to the `idempotency_key` passed in during ingestion. The event
14
+ # will maintain its existing `event_id` after the amendment.
15
+ #
16
+ # This endpoint will mark the existing event as ignored, and Orb will only use the
17
+ # new event passed in the body of this request as the source of truth for that
18
+ # `event_id`. Note that a single event can be amended any number of times, so the
19
+ # same event can be overwritten in subsequent calls to this endpoint. Only a
20
+ # single event with a given `event_id` will be considered the source of truth at
21
+ # any given time.
22
+ #
23
+ # This is a powerful and audit-safe mechanism to retroactively update a single
24
+ # event in cases where you need to:
25
+ #
26
+ # - update an event with new metadata as you iterate on your pricing model
27
+ # - update an event based on the result of an external API call (e.g. call to a
28
+ # payment gateway succeeded or failed)
29
+ #
30
+ # This amendment API is always audit-safe. The process will still retain the
31
+ # original event, though it will be ignored for billing calculations. For auditing
32
+ # and data fidelity purposes, Orb never overwrites or permanently deletes ingested
33
+ # usage data.
34
+ #
35
+ # ## Request validation
36
+ #
37
+ # - The `timestamp` of the new event must match the `timestamp` of the existing
38
+ # event already ingested. As with ingestion, all timestamps must be sent in
39
+ # ISO8601 format with UTC timezone offset.
40
+ # - The `customer_id` or `external_customer_id` of the new event must match the
41
+ # `customer_id` or `external_customer_id` of the existing event already
42
+ # ingested. Exactly one of `customer_id` and `external_customer_id` should be
43
+ # specified, and similar to ingestion, the ID must identify a Customer resource
44
+ # within Orb. Unlike ingestion, for event amendment, we strictly enforce that
45
+ # the Customer must be in the Orb system, even during the initial integration
46
+ # period. We do not allow updating the `Customer` an event is associated with.
47
+ # - Orb does not accept an `idempotency_key` with the event in this endpoint,
48
+ # since this request is by design idempotent. On retryable errors, you should
49
+ # retry the request and assume the amendment operation has not succeeded until
50
+ # receipt of a 2xx.
51
+ # - The event's `timestamp` must fall within the customer's current subscription's
52
+ # billing period, or within the grace period of the customer's current
53
+ # subscription's previous billing period.
54
+ # - By default, no more than 100 events can be amended for a single customer in a
55
+ # 100 day period. For higher volume updates, consider using the
56
+ # [event backfill](create-backfill) endpoint.
57
57
  sig do
58
58
  params(
59
59
  event_id: String,
@@ -71,61 +71,59 @@ module Orb
71
71
  # A name to meaningfully identify the action or event type.
72
72
  event_name:,
73
73
  # A dictionary of custom properties. Values in this dictionary must be numeric,
74
- # boolean, or strings. Nested dictionaries are disallowed.
74
+ # boolean, or strings. Nested dictionaries are disallowed.
75
75
  properties:,
76
76
  # An ISO 8601 format date with no timezone offset (i.e. UTC). This should
77
- # represent the time that usage was recorded, and is particularly important to
78
- # attribute usage to a given billing period.
77
+ # represent the time that usage was recorded, and is particularly important to
78
+ # attribute usage to a given billing period.
79
79
  timestamp:,
80
80
  # The Orb Customer identifier
81
81
  customer_id: nil,
82
82
  # An alias for the Orb customer, whose mapping is specified when creating the
83
- # customer
83
+ # customer
84
84
  external_customer_id: nil,
85
85
  request_options: {}
86
- )
87
- end
88
-
86
+ ); end
89
87
  # This endpoint is used to deprecate a single usage event with a given `event_id`.
90
- # `event_id` refers to the `idempotency_key` passed in during ingestion.
91
- #
92
- # This endpoint will mark the existing event as ignored. Note that if you attempt
93
- # to re-ingest an event with the same `event_id` as a deprecated event, Orb will
94
- # return an error.
95
- #
96
- # This is a powerful and audit-safe mechanism to retroactively deprecate a single
97
- # event in cases where you need to:
98
- #
99
- # - no longer bill for an event that was improperly reported
100
- # - no longer bill for an event based on the result of an external API call (e.g.
101
- # call to a payment gateway failed and the user should not be billed)
102
- #
103
- # If you want to only change specific properties of an event, but keep the event
104
- # as part of the billing calculation, use the [Amend event](amend-event) endpoint
105
- # instead.
106
- #
107
- # This API is always audit-safe. The process will still retain the deprecated
108
- # event, though it will be ignored for billing calculations. For auditing and data
109
- # fidelity purposes, Orb never overwrites or permanently deletes ingested usage
110
- # data.
111
- #
112
- # ## Request validation
113
- #
114
- # - Orb does not accept an `idempotency_key` with the event in this endpoint,
115
- # since this request is by design idempotent. On retryable errors, you should
116
- # retry the request and assume the deprecation operation has not succeeded until
117
- # receipt of a 2xx.
118
- # - The event's `timestamp` must fall within the customer's current subscription's
119
- # billing period, or within the grace period of the customer's current
120
- # subscription's previous billing period. Orb does not allow deprecating events
121
- # for billing periods that have already invoiced customers.
122
- # - The `customer_id` or the `external_customer_id` of the original event
123
- # ingestion request must identify a Customer resource within Orb, even if this
124
- # event was ingested during the initial integration period. We do not allow
125
- # deprecating events for customers not in the Orb system.
126
- # - By default, no more than 100 events can be deprecated for a single customer in
127
- # a 100 day period. For higher volume updates, consider using the
128
- # [event backfill](create-backfill) endpoint.
88
+ # `event_id` refers to the `idempotency_key` passed in during ingestion.
89
+ #
90
+ # This endpoint will mark the existing event as ignored. Note that if you attempt
91
+ # to re-ingest an event with the same `event_id` as a deprecated event, Orb will
92
+ # return an error.
93
+ #
94
+ # This is a powerful and audit-safe mechanism to retroactively deprecate a single
95
+ # event in cases where you need to:
96
+ #
97
+ # - no longer bill for an event that was improperly reported
98
+ # - no longer bill for an event based on the result of an external API call (e.g.
99
+ # call to a payment gateway failed and the user should not be billed)
100
+ #
101
+ # If you want to only change specific properties of an event, but keep the event
102
+ # as part of the billing calculation, use the [Amend event](amend-event) endpoint
103
+ # instead.
104
+ #
105
+ # This API is always audit-safe. The process will still retain the deprecated
106
+ # event, though it will be ignored for billing calculations. For auditing and data
107
+ # fidelity purposes, Orb never overwrites or permanently deletes ingested usage
108
+ # data.
109
+ #
110
+ # ## Request validation
111
+ #
112
+ # - Orb does not accept an `idempotency_key` with the event in this endpoint,
113
+ # since this request is by design idempotent. On retryable errors, you should
114
+ # retry the request and assume the deprecation operation has not succeeded until
115
+ # receipt of a 2xx.
116
+ # - The event's `timestamp` must fall within the customer's current subscription's
117
+ # billing period, or within the grace period of the customer's current
118
+ # subscription's previous billing period. Orb does not allow deprecating events
119
+ # for billing periods that have already invoiced customers.
120
+ # - The `customer_id` or the `external_customer_id` of the original event
121
+ # ingestion request must identify a Customer resource within Orb, even if this
122
+ # event was ingested during the initial integration period. We do not allow
123
+ # deprecating events for customers not in the Orb system.
124
+ # - By default, no more than 100 events can be deprecated for a single customer in
125
+ # a 100 day period. For higher volume updates, consider using the
126
+ # [event backfill](create-backfill) endpoint.
129
127
  sig do
130
128
  params(
131
129
  event_id: String,
@@ -133,213 +131,212 @@ module Orb
133
131
  )
134
132
  .returns(Orb::Models::EventDeprecateResponse)
135
133
  end
136
- def deprecate(event_id, request_options: {})
137
- end
134
+ def deprecate(event_id, request_options: {}); end
138
135
 
139
136
  # Orb's event ingestion model and API is designed around two core principles:
140
137
  #
141
- # 1. **Data fidelity**: The accuracy of your billing model depends on a robust
142
- # foundation of events. Orb's API protocol encourages usage patterns that
143
- # ensure that your data is consistently complete and correct.
144
- # 2. **Fast integration**: Sending events into Orb requires no tedious setup steps
145
- # or explicit field schema for your event shape, making it instant to start
146
- # streaming in usage in real-time.
147
- #
148
- # ## Event shape
149
- #
150
- # Events are the starting point for all usage calculations in the system, and are
151
- # simple at their core:
152
- #
153
- # ```ts
154
- # {
155
- # // customer_id and external_customer_id are used to
156
- # // attribute usage to a given Customer. Exactly one of these
157
- # // should be specified in a given ingestion event.
158
- #
159
- # // `customer_id` is the Orb generated identifier for the Customer,
160
- # // which is returned from the Create customer API call.
161
- # customer_id: string,
162
- #
163
- # // external_customer_id is an alternate identifier which is associated
164
- # // with a Customer at creation time. This is treated as an alias for
165
- # // customer_id, and is usually set to an identifier native to your system.
166
- # external_customer_id: string,
167
- #
168
- # // A string name identifying the event, usually a usage
169
- # // action. By convention, this should not contain any whitespace.
170
- # event_name: string,
171
- #
172
- # // An ISO 8601 format date with no timezone offset.
173
- # // This should represent the time that usage occurred
174
- # // and is important to attribute usage to a given
175
- # // billing period. See the notes below on determining the timestamp.
176
- # // e.g. 2020-12-09T16:09:53Z
177
- # timestamp: string,
178
- #
179
- # // A unique value, generated by the client, that is
180
- # // used to de-duplicate events.
181
- # // Exactly one event with a given
182
- # // idempotency key will be ingested, which allows for
183
- # // safe request retries.
184
- # idempotency_key: string
185
- #
186
- # // Optional custom metadata to attach to the event.
187
- # // This might include a numeric value used for aggregation,
188
- # // or a string/boolean value used for filtering.
189
- # // The schema of this dictionary need not be pre-declared, and
190
- # // properties can be added at any time.
191
- # properties: {
192
- # [key: string]?: string | number | boolean,
193
- # },
194
- # }
195
- # ```
196
- #
197
- # ## Required fields
198
- #
199
- # Because events streamed to Orb are meant to be as flexible as possible, there
200
- # are only a few required fields in every event.
201
- #
202
- # - We recommend that `idempotency_key` are unique strings that you generated with
203
- # V4 UUIDs, but only require that they uniquely identify an event (i.e. don’t
204
- # collide).
205
- # - The `timestamp` field in the event body will be used to determine which
206
- # billable period a given event falls into. For example, with a monthly billing
207
- # cycle starting from the first of December, Orb will calculate metrics based on
208
- # events that fall into the range
209
- # `12-01 00:00:00 <= timestamp < 01-01 00:00:00`.
210
- #
211
- # ## Logging metadata
212
- #
213
- # Orb allows tagging events with metadata using a flexible properties dictionary.
214
- # Since Orb does not enforce a rigid schema for this field-set, key-value pairs
215
- # can be added dynamically as your events evolve.
216
- #
217
- # This dictionary can be helpful for a wide variety of use cases:
218
- #
219
- # - Numeric properties on events like `compute_time_ms` can later be inputs to our
220
- # flexible query engine to determine usage.
221
- # - Logging a region or cluster with each event can help you provide customers
222
- # more granular visibility into their usage.
223
- # - If you are using matrix pricing and matching a matrix price key with a
224
- # property, you should ensure the value for that property is sent as a string.
225
- #
226
- # We encourage logging this metadata with an eye towards future use cases to
227
- # ensure full coverage for historical data. The datatype of the value in the
228
- # properties dictionary is important for metric creation from an event source.
229
- # Values that you wish to numerically aggregate should be of numeric type in the
230
- # event.
231
- #
232
- # ## Determining event timestamp
233
- #
234
- # For cases where usage is being reported in real time as it is occurring,
235
- # timestamp should correspond to the time that usage occurred.
236
- #
237
- # In cases where usage is reported in aggregate for a historical timeframe at a
238
- # regular interval, we recommend setting the event `timestamp` to the midpoint of
239
- # the interval. As an example, if you have an hourly reporter that sends data once
240
- # an hour for the previous hour of usage, setting the `timestamp` to the half-hour
241
- # mark will ensure that the usage is counted within the correct period.
242
- #
243
- # Note that other time-related fields (e.g. time elapsed) can be added to the
244
- # properties dictionary as necessary.
245
- #
246
- # In cases where usage is reported in aggregate for a historical timeframe, the
247
- # timestamp must be within the grace period set for your account. Events with
248
- # `timestamp < current_time - grace_period` will not be accepted as a valid event,
249
- # and will throw validation errors. Enforcing the grace period enables Orb to
250
- # accurately map usage to the correct billing cycle and ensure that all usage is
251
- # billed for in the corresponding billing period.
252
- #
253
- # In general, Orb does not expect events with future dated timestamps. In cases
254
- # where the timestamp is at least 24 hours ahead of the current time, the event
255
- # will not be accepted as a valid event, and will throw validation errors.
256
- #
257
- # ## Event validation
258
- #
259
- # Orb’s validation ensures that you recognize errors in your events as quickly as
260
- # possible, and the API provides informative error messages to help you fix
261
- # problems quickly.
262
- #
263
- # We validate the following:
264
- #
265
- # - Exactly one of `customer_id` and `external_customer_id` should be specified.
266
- # - If the `customer_id` is specified, the customer in Orb must exist.
267
- # - If the `external_customer_id` is specified, the customer in Orb does not need
268
- # to exist. Events will be attributed to any future customers with the
269
- # `external_customer_id` on subscription creation.
270
- # - `timestamp` must conform to ISO 8601 and represent a timestamp at most 1 hour
271
- # in the future. This timestamp should be sent in UTC timezone (no timezone
272
- # offset).
273
- #
274
- # ## Idempotency and retry semantics
275
- #
276
- # Orb's idempotency guarantees allow you to implement safe retry logic in the
277
- # event of network or machine failures, ensuring data fidelity. Each event in the
278
- # request payload is associated with an idempotency key, and Orb guarantees that a
279
- # single idempotency key will be successfully ingested at most once. Note that
280
- # when Orb encounters events with duplicate idempotency keys and differing event
281
- # bodies in a batch of events, the entire batch will be rejected.
282
- #
283
- # - Successful responses return a 200 HTTP status code. The response contains
284
- # information about previously processed events.
285
- # - Requests that return a `4xx` HTTP status code indicate a payload error and
286
- # contain at least one event with a validation failure. An event with a
287
- # validation failure can be re-sent to the ingestion endpoint (after the payload
288
- # is fixed) with the original idempotency key since that key is not marked as
289
- # processed.
290
- # - Requests that return a `5xx` HTTP status code indicate a server-side failure.
291
- # These requests should be retried in their entirety.
292
- #
293
- # ## API usage and limits
294
- #
295
- # The ingestion API is designed made for real-time streaming ingestion and
296
- # architected for high throughput. Even if events are later deemed unnecessary or
297
- # filtered out, we encourage you to log them to Orb if they may be relevant to
298
- # billing calculations in the future.
299
- #
300
- # To take advantage of the real-time features of the Orb platform and avoid any
301
- # chance of dropped events by producers, we recommend reporting events to Orb
302
- # frequently. Optionally, events can also be briefly aggregated at the source, as
303
- # this API accepts an array of event bodies.
304
- #
305
- # Orb does not currently enforce a hard rate-limit for API usage or a maximum
306
- # request payload size, but please give us a heads up if you’re changing either of
307
- # these factors by an order of magnitude from initial setup.
308
- #
309
- # ## Testing in debug mode
310
- #
311
- # The ingestion API supports a debug mode, which returns additional verbose output
312
- # to indicate which event idempotency keys were newly ingested or duplicates from
313
- # previous requests. To enable this mode, mark `debug=true` as a query parameter.
314
- #
315
- # If `debug=true` is not specified, the response will only contain
316
- # `validation_failed`. Orb will still honor the idempotency guarantees set
317
- # [here](/events-and-metrics/event-ingestion#event-volume-and-concurrency) in all
318
- # cases.
319
- #
320
- # We strongly recommend that you only use debug mode as part of testing your
321
- # initial Orb integration. Once you're ready to switch to production, disable
322
- # debug mode to take advantage of improved performance and maximal throughput.
323
- #
324
- # #### Example: ingestion response with `debug=true`
325
- #
326
- # ```json
327
- # {
328
- # "debug": {
329
- # "duplicate": [],
330
- # "ingested": ["B7E83HDMfJPAunXW", "SJs5DQJ3TnwSqEZE", "8SivfDsNKwCeAXim"]
331
- # },
332
- # "validation_failed": []
333
- # }
334
- # ```
335
- #
336
- # #### Example: ingestion response with `debug=false`
337
- #
338
- # ```json
339
- # {
340
- # "validation_failed": []
341
- # }
342
- # ```
138
+ # 1. **Data fidelity**: The accuracy of your billing model depends on a robust
139
+ # foundation of events. Orb's API protocol encourages usage patterns that
140
+ # ensure that your data is consistently complete and correct.
141
+ # 2. **Fast integration**: Sending events into Orb requires no tedious setup steps
142
+ # or explicit field schema for your event shape, making it instant to start
143
+ # streaming in usage in real-time.
144
+ #
145
+ # ## Event shape
146
+ #
147
+ # Events are the starting point for all usage calculations in the system, and are
148
+ # simple at their core:
149
+ #
150
+ # ```ts
151
+ # {
152
+ # // customer_id and external_customer_id are used to
153
+ # // attribute usage to a given Customer. Exactly one of these
154
+ # // should be specified in a given ingestion event.
155
+ #
156
+ # // `customer_id` is the Orb generated identifier for the Customer,
157
+ # // which is returned from the Create customer API call.
158
+ # customer_id: string,
159
+ #
160
+ # // external_customer_id is an alternate identifier which is associated
161
+ # // with a Customer at creation time. This is treated as an alias for
162
+ # // customer_id, and is usually set to an identifier native to your system.
163
+ # external_customer_id: string,
164
+ #
165
+ # // A string name identifying the event, usually a usage
166
+ # // action. By convention, this should not contain any whitespace.
167
+ # event_name: string,
168
+ #
169
+ # // An ISO 8601 format date with no timezone offset.
170
+ # // This should represent the time that usage occurred
171
+ # // and is important to attribute usage to a given
172
+ # // billing period. See the notes below on determining the timestamp.
173
+ # // e.g. 2020-12-09T16:09:53Z
174
+ # timestamp: string,
175
+ #
176
+ # // A unique value, generated by the client, that is
177
+ # // used to de-duplicate events.
178
+ # // Exactly one event with a given
179
+ # // idempotency key will be ingested, which allows for
180
+ # // safe request retries.
181
+ # idempotency_key: string
182
+ #
183
+ # // Optional custom metadata to attach to the event.
184
+ # // This might include a numeric value used for aggregation,
185
+ # // or a string/boolean value used for filtering.
186
+ # // The schema of this dictionary need not be pre-declared, and
187
+ # // properties can be added at any time.
188
+ # properties: {
189
+ # [key: string]?: string | number | boolean,
190
+ # },
191
+ # }
192
+ # ```
193
+ #
194
+ # ## Required fields
195
+ #
196
+ # Because events streamed to Orb are meant to be as flexible as possible, there
197
+ # are only a few required fields in every event.
198
+ #
199
+ # - We recommend that `idempotency_key` are unique strings that you generated with
200
+ # V4 UUIDs, but only require that they uniquely identify an event (i.e. don’t
201
+ # collide).
202
+ # - The `timestamp` field in the event body will be used to determine which
203
+ # billable period a given event falls into. For example, with a monthly billing
204
+ # cycle starting from the first of December, Orb will calculate metrics based on
205
+ # events that fall into the range
206
+ # `12-01 00:00:00 <= timestamp < 01-01 00:00:00`.
207
+ #
208
+ # ## Logging metadata
209
+ #
210
+ # Orb allows tagging events with metadata using a flexible properties dictionary.
211
+ # Since Orb does not enforce a rigid schema for this field-set, key-value pairs
212
+ # can be added dynamically as your events evolve.
213
+ #
214
+ # This dictionary can be helpful for a wide variety of use cases:
215
+ #
216
+ # - Numeric properties on events like `compute_time_ms` can later be inputs to our
217
+ # flexible query engine to determine usage.
218
+ # - Logging a region or cluster with each event can help you provide customers
219
+ # more granular visibility into their usage.
220
+ # - If you are using matrix pricing and matching a matrix price key with a
221
+ # property, you should ensure the value for that property is sent as a string.
222
+ #
223
+ # We encourage logging this metadata with an eye towards future use cases to
224
+ # ensure full coverage for historical data. The datatype of the value in the
225
+ # properties dictionary is important for metric creation from an event source.
226
+ # Values that you wish to numerically aggregate should be of numeric type in the
227
+ # event.
228
+ #
229
+ # ## Determining event timestamp
230
+ #
231
+ # For cases where usage is being reported in real time as it is occurring,
232
+ # timestamp should correspond to the time that usage occurred.
233
+ #
234
+ # In cases where usage is reported in aggregate for a historical timeframe at a
235
+ # regular interval, we recommend setting the event `timestamp` to the midpoint of
236
+ # the interval. As an example, if you have an hourly reporter that sends data once
237
+ # an hour for the previous hour of usage, setting the `timestamp` to the half-hour
238
+ # mark will ensure that the usage is counted within the correct period.
239
+ #
240
+ # Note that other time-related fields (e.g. time elapsed) can be added to the
241
+ # properties dictionary as necessary.
242
+ #
243
+ # In cases where usage is reported in aggregate for a historical timeframe, the
244
+ # timestamp must be within the grace period set for your account. Events with
245
+ # `timestamp < current_time - grace_period` will not be accepted as a valid event,
246
+ # and will throw validation errors. Enforcing the grace period enables Orb to
247
+ # accurately map usage to the correct billing cycle and ensure that all usage is
248
+ # billed for in the corresponding billing period.
249
+ #
250
+ # In general, Orb does not expect events with future dated timestamps. In cases
251
+ # where the timestamp is at least 24 hours ahead of the current time, the event
252
+ # will not be accepted as a valid event, and will throw validation errors.
253
+ #
254
+ # ## Event validation
255
+ #
256
+ # Orb’s validation ensures that you recognize errors in your events as quickly as
257
+ # possible, and the API provides informative error messages to help you fix
258
+ # problems quickly.
259
+ #
260
+ # We validate the following:
261
+ #
262
+ # - Exactly one of `customer_id` and `external_customer_id` should be specified.
263
+ # - If the `customer_id` is specified, the customer in Orb must exist.
264
+ # - If the `external_customer_id` is specified, the customer in Orb does not need
265
+ # to exist. Events will be attributed to any future customers with the
266
+ # `external_customer_id` on subscription creation.
267
+ # - `timestamp` must conform to ISO 8601 and represent a timestamp at most 1 hour
268
+ # in the future. This timestamp should be sent in UTC timezone (no timezone
269
+ # offset).
270
+ #
271
+ # ## Idempotency and retry semantics
272
+ #
273
+ # Orb's idempotency guarantees allow you to implement safe retry logic in the
274
+ # event of network or machine failures, ensuring data fidelity. Each event in the
275
+ # request payload is associated with an idempotency key, and Orb guarantees that a
276
+ # single idempotency key will be successfully ingested at most once. Note that
277
+ # when Orb encounters events with duplicate idempotency keys and differing event
278
+ # bodies in a batch of events, the entire batch will be rejected.
279
+ #
280
+ # - Successful responses return a 200 HTTP status code. The response contains
281
+ # information about previously processed events.
282
+ # - Requests that return a `4xx` HTTP status code indicate a payload error and
283
+ # contain at least one event with a validation failure. An event with a
284
+ # validation failure can be re-sent to the ingestion endpoint (after the payload
285
+ # is fixed) with the original idempotency key since that key is not marked as
286
+ # processed.
287
+ # - Requests that return a `5xx` HTTP status code indicate a server-side failure.
288
+ # These requests should be retried in their entirety.
289
+ #
290
+ # ## API usage and limits
291
+ #
292
+ # The ingestion API is designed made for real-time streaming ingestion and
293
+ # architected for high throughput. Even if events are later deemed unnecessary or
294
+ # filtered out, we encourage you to log them to Orb if they may be relevant to
295
+ # billing calculations in the future.
296
+ #
297
+ # To take advantage of the real-time features of the Orb platform and avoid any
298
+ # chance of dropped events by producers, we recommend reporting events to Orb
299
+ # frequently. Optionally, events can also be briefly aggregated at the source, as
300
+ # this API accepts an array of event bodies.
301
+ #
302
+ # Orb does not currently enforce a hard rate-limit for API usage or a maximum
303
+ # request payload size, but please give us a heads up if you’re changing either of
304
+ # these factors by an order of magnitude from initial setup.
305
+ #
306
+ # ## Testing in debug mode
307
+ #
308
+ # The ingestion API supports a debug mode, which returns additional verbose output
309
+ # to indicate which event idempotency keys were newly ingested or duplicates from
310
+ # previous requests. To enable this mode, mark `debug=true` as a query parameter.
311
+ #
312
+ # If `debug=true` is not specified, the response will only contain
313
+ # `validation_failed`. Orb will still honor the idempotency guarantees set
314
+ # [here](/events-and-metrics/event-ingestion#event-volume-and-concurrency) in all
315
+ # cases.
316
+ #
317
+ # We strongly recommend that you only use debug mode as part of testing your
318
+ # initial Orb integration. Once you're ready to switch to production, disable
319
+ # debug mode to take advantage of improved performance and maximal throughput.
320
+ #
321
+ # #### Example: ingestion response with `debug=true`
322
+ #
323
+ # ```json
324
+ # {
325
+ # "debug": {
326
+ # "duplicate": [],
327
+ # "ingested": ["B7E83HDMfJPAunXW", "SJs5DQJ3TnwSqEZE", "8SivfDsNKwCeAXim"]
328
+ # },
329
+ # "validation_failed": []
330
+ # }
331
+ # ```
332
+ #
333
+ # #### Example: ingestion response with `debug=false`
334
+ #
335
+ # ```json
336
+ # {
337
+ # "validation_failed": []
338
+ # }
339
+ # ```
343
340
  sig do
344
341
  params(
345
342
  events: T::Array[T.any(Orb::Models::EventIngestParams::Event, Orb::Internal::AnyHash)],
@@ -353,30 +350,28 @@ module Orb
353
350
  # Body param:
354
351
  events:,
355
352
  # Query param: If this ingestion request is part of a backfill, this parameter
356
- # ties the ingested events to the backfill
353
+ # ties the ingested events to the backfill
357
354
  backfill_id: nil,
358
355
  # Query param: Flag to enable additional debug information in the endpoint
359
- # response
356
+ # response
360
357
  debug: nil,
361
358
  request_options: {}
362
- )
363
- end
364
-
359
+ ); end
365
360
  # This endpoint returns a filtered set of events for an account in a
366
- # [paginated list format](/api-reference/pagination).
361
+ # [paginated list format](/api-reference/pagination).
367
362
  #
368
- # Note that this is a `POST` endpoint rather than a `GET` endpoint because it
369
- # employs a JSON body for search criteria rather than query parameters, allowing
370
- # for a more flexible search syntax.
363
+ # Note that this is a `POST` endpoint rather than a `GET` endpoint because it
364
+ # employs a JSON body for search criteria rather than query parameters, allowing
365
+ # for a more flexible search syntax.
371
366
  #
372
- # Note that a search criteria _must_ be specified. Currently, Orb supports the
373
- # following criteria:
367
+ # Note that a search criteria _must_ be specified. Currently, Orb supports the
368
+ # following criteria:
374
369
  #
375
- # - `event_ids`: This is an explicit array of IDs to filter by. Note that an
376
- # event's ID is the `idempotency_key` that was originally used for ingestion.
370
+ # - `event_ids`: This is an explicit array of IDs to filter by. Note that an
371
+ # event's ID is the `idempotency_key` that was originally used for ingestion.
377
372
  #
378
- # By default, Orb will not throw a `404` if no events matched, Orb will return an
379
- # empty array for `data` instead.
373
+ # By default, Orb will not throw a `404` if no events matched, Orb will return an
374
+ # empty array for `data` instead.
380
375
  sig do
381
376
  params(
382
377
  event_ids: T::Array[String],
@@ -388,24 +383,21 @@ module Orb
388
383
  end
389
384
  def search(
390
385
  # This is an explicit array of IDs to filter by. Note that an event's ID is the
391
- # idempotency_key that was originally used for ingestion, and this only supports
392
- # events that have not been amended. Values in this array will be treated case
393
- # sensitively.
386
+ # idempotency_key that was originally used for ingestion, and this only supports
387
+ # events that have not been amended. Values in this array will be treated case
388
+ # sensitively.
394
389
  event_ids:,
395
390
  # The end of the timeframe, exclusive, in which to search events. If not
396
- # specified, the current time is used.
391
+ # specified, the current time is used.
397
392
  timeframe_end: nil,
398
393
  # The start of the timeframe, inclusive, in which to search events. If not
399
- # specified, the one week ago is used.
394
+ # specified, the one week ago is used.
400
395
  timeframe_start: nil,
401
396
  request_options: {}
402
- )
403
- end
404
-
397
+ ); end
405
398
  # @api private
406
399
  sig { params(client: Orb::Client).returns(T.attached_class) }
407
- def self.new(client:)
408
- end
400
+ def self.new(client:); end
409
401
  end
410
402
  end
411
403
  end