orb-billing 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +1 -1
  4. data/lib/orb/errors.rb +22 -0
  5. data/lib/orb/internal/type/array_of.rb +6 -1
  6. data/lib/orb/internal/type/base_model.rb +79 -25
  7. data/lib/orb/internal/type/boolean.rb +7 -1
  8. data/lib/orb/internal/type/converter.rb +42 -34
  9. data/lib/orb/internal/type/enum.rb +10 -2
  10. data/lib/orb/internal/type/file_input.rb +6 -1
  11. data/lib/orb/internal/type/hash_of.rb +6 -1
  12. data/lib/orb/internal/type/union.rb +12 -7
  13. data/lib/orb/internal/type/unknown.rb +7 -1
  14. data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb +4 -4
  15. data/lib/orb/models/customers/credits/ledger_create_entry_params.rb +4 -4
  16. data/lib/orb/models/invoice.rb +4 -1
  17. data/lib/orb/models/invoice_fetch_upcoming_response.rb +4 -1
  18. data/lib/orb/models/invoice_line_item_create_response.rb +4 -1
  19. data/lib/orb/models/monetary_amount_discount_adjustment.rb +10 -1
  20. data/lib/orb/models/monetary_maximum_adjustment.rb +10 -1
  21. data/lib/orb/models/monetary_minimum_adjustment.rb +10 -1
  22. data/lib/orb/models/monetary_percentage_discount_adjustment.rb +10 -1
  23. data/lib/orb/models/monetary_usage_discount_adjustment.rb +10 -1
  24. data/lib/orb/models/new_plan_bps_price.rb +10 -1
  25. data/lib/orb/models/new_plan_bulk_bps_price.rb +10 -1
  26. data/lib/orb/models/new_plan_bulk_price.rb +10 -1
  27. data/lib/orb/models/new_plan_bulk_with_proration_price.rb +10 -1
  28. data/lib/orb/models/new_plan_cumulative_grouped_bulk_price.rb +10 -1
  29. data/lib/orb/models/new_plan_grouped_allocation_price.rb +10 -1
  30. data/lib/orb/models/new_plan_grouped_tiered_package_price.rb +10 -1
  31. data/lib/orb/models/new_plan_grouped_tiered_price.rb +10 -1
  32. data/lib/orb/models/new_plan_grouped_with_metered_minimum_price.rb +10 -1
  33. data/lib/orb/models/new_plan_grouped_with_prorated_minimum_price.rb +10 -1
  34. data/lib/orb/models/new_plan_matrix_price.rb +10 -1
  35. data/lib/orb/models/new_plan_matrix_with_allocation_price.rb +10 -1
  36. data/lib/orb/models/new_plan_matrix_with_display_name_price.rb +10 -1
  37. data/lib/orb/models/new_plan_max_group_tiered_package_price.rb +10 -1
  38. data/lib/orb/models/new_plan_package_price.rb +10 -1
  39. data/lib/orb/models/new_plan_package_with_allocation_price.rb +10 -1
  40. data/lib/orb/models/new_plan_scalable_matrix_with_tiered_pricing_price.rb +10 -1
  41. data/lib/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rb +10 -1
  42. data/lib/orb/models/new_plan_threshold_total_amount_price.rb +10 -1
  43. data/lib/orb/models/new_plan_tier_with_proration_price.rb +10 -1
  44. data/lib/orb/models/new_plan_tiered_bps_price.rb +10 -1
  45. data/lib/orb/models/new_plan_tiered_package_price.rb +10 -1
  46. data/lib/orb/models/new_plan_tiered_package_with_minimum_price.rb +10 -1
  47. data/lib/orb/models/new_plan_tiered_price.rb +10 -1
  48. data/lib/orb/models/new_plan_tiered_with_minimum_price.rb +10 -1
  49. data/lib/orb/models/new_plan_unit_price.rb +10 -1
  50. data/lib/orb/models/new_plan_unit_with_percent_price.rb +10 -1
  51. data/lib/orb/models/new_plan_unit_with_proration_price.rb +10 -1
  52. data/lib/orb/models/plan_create_params.rb +185 -37
  53. data/lib/orb/models/plan_phase_amount_discount_adjustment.rb +10 -1
  54. data/lib/orb/models/plan_phase_maximum_adjustment.rb +10 -1
  55. data/lib/orb/models/plan_phase_minimum_adjustment.rb +10 -1
  56. data/lib/orb/models/plan_phase_percentage_discount_adjustment.rb +10 -1
  57. data/lib/orb/models/plan_phase_usage_discount_adjustment.rb +10 -1
  58. data/lib/orb/models/price.rb +280 -28
  59. data/lib/orb/resources/customers/credits/ledger.rb +6 -6
  60. data/lib/orb/resources/plans.rb +6 -2
  61. data/lib/orb/version.rb +1 -1
  62. data/rbi/orb/errors.rbi +16 -0
  63. data/rbi/orb/internal/type/boolean.rbi +2 -0
  64. data/rbi/orb/internal/type/converter.rbi +15 -15
  65. data/rbi/orb/internal/type/union.rbi +5 -0
  66. data/rbi/orb/internal/type/unknown.rbi +2 -0
  67. data/rbi/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi +3 -3
  68. data/rbi/orb/models/customers/credits/ledger_create_entry_params.rbi +3 -3
  69. data/rbi/orb/models/invoice.rbi +2 -0
  70. data/rbi/orb/models/invoice_fetch_upcoming_response.rbi +2 -0
  71. data/rbi/orb/models/invoice_line_item_create_response.rbi +2 -0
  72. data/rbi/orb/models/monetary_amount_discount_adjustment.rbi +13 -3
  73. data/rbi/orb/models/monetary_maximum_adjustment.rbi +13 -3
  74. data/rbi/orb/models/monetary_minimum_adjustment.rbi +13 -3
  75. data/rbi/orb/models/monetary_percentage_discount_adjustment.rbi +13 -3
  76. data/rbi/orb/models/monetary_usage_discount_adjustment.rbi +10 -0
  77. data/rbi/orb/models/new_plan_bps_price.rbi +13 -3
  78. data/rbi/orb/models/new_plan_bulk_bps_price.rbi +13 -3
  79. data/rbi/orb/models/new_plan_bulk_price.rbi +13 -3
  80. data/rbi/orb/models/new_plan_bulk_with_proration_price.rbi +13 -3
  81. data/rbi/orb/models/new_plan_cumulative_grouped_bulk_price.rbi +13 -3
  82. data/rbi/orb/models/new_plan_grouped_allocation_price.rbi +13 -3
  83. data/rbi/orb/models/new_plan_grouped_tiered_package_price.rbi +13 -3
  84. data/rbi/orb/models/new_plan_grouped_tiered_price.rbi +13 -3
  85. data/rbi/orb/models/new_plan_grouped_with_metered_minimum_price.rbi +13 -3
  86. data/rbi/orb/models/new_plan_grouped_with_prorated_minimum_price.rbi +13 -3
  87. data/rbi/orb/models/new_plan_matrix_price.rbi +13 -3
  88. data/rbi/orb/models/new_plan_matrix_with_allocation_price.rbi +13 -3
  89. data/rbi/orb/models/new_plan_matrix_with_display_name_price.rbi +13 -3
  90. data/rbi/orb/models/new_plan_max_group_tiered_package_price.rbi +13 -3
  91. data/rbi/orb/models/new_plan_package_price.rbi +13 -3
  92. data/rbi/orb/models/new_plan_package_with_allocation_price.rbi +13 -3
  93. data/rbi/orb/models/new_plan_scalable_matrix_with_tiered_pricing_price.rbi +13 -3
  94. data/rbi/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbi +13 -3
  95. data/rbi/orb/models/new_plan_threshold_total_amount_price.rbi +13 -3
  96. data/rbi/orb/models/new_plan_tier_with_proration_price.rbi +13 -3
  97. data/rbi/orb/models/new_plan_tiered_bps_price.rbi +13 -3
  98. data/rbi/orb/models/new_plan_tiered_package_price.rbi +13 -3
  99. data/rbi/orb/models/new_plan_tiered_package_with_minimum_price.rbi +13 -3
  100. data/rbi/orb/models/new_plan_tiered_price.rbi +13 -3
  101. data/rbi/orb/models/new_plan_tiered_with_minimum_price.rbi +13 -3
  102. data/rbi/orb/models/new_plan_unit_price.rbi +13 -3
  103. data/rbi/orb/models/new_plan_unit_with_percent_price.rbi +13 -3
  104. data/rbi/orb/models/new_plan_unit_with_proration_price.rbi +13 -3
  105. data/rbi/orb/models/plan_create_params.rbi +415 -135
  106. data/rbi/orb/models/plan_phase_amount_discount_adjustment.rbi +13 -3
  107. data/rbi/orb/models/plan_phase_maximum_adjustment.rbi +13 -3
  108. data/rbi/orb/models/plan_phase_minimum_adjustment.rbi +13 -3
  109. data/rbi/orb/models/plan_phase_percentage_discount_adjustment.rbi +13 -3
  110. data/rbi/orb/models/plan_phase_usage_discount_adjustment.rbi +10 -0
  111. data/rbi/orb/models/price.rbi +280 -0
  112. data/rbi/orb/resources/customers/credits/ledger.rbi +6 -6
  113. data/rbi/orb/resources/plans.rbi +11 -33
  114. data/sig/orb/errors.rbs +9 -0
  115. data/sig/orb/internal/type/converter.rbs +7 -1
  116. data/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbs +1 -1
  117. data/sig/orb/models/customers/credits/ledger_create_entry_params.rbs +1 -1
  118. data/sig/orb/models/monetary_amount_discount_adjustment.rbs +8 -3
  119. data/sig/orb/models/monetary_maximum_adjustment.rbs +8 -3
  120. data/sig/orb/models/monetary_minimum_adjustment.rbs +8 -3
  121. data/sig/orb/models/monetary_percentage_discount_adjustment.rbs +8 -3
  122. data/sig/orb/models/monetary_usage_discount_adjustment.rbs +5 -0
  123. data/sig/orb/models/new_plan_bps_price.rbs +8 -3
  124. data/sig/orb/models/new_plan_bulk_bps_price.rbs +8 -3
  125. data/sig/orb/models/new_plan_bulk_price.rbs +8 -3
  126. data/sig/orb/models/new_plan_bulk_with_proration_price.rbs +8 -3
  127. data/sig/orb/models/new_plan_cumulative_grouped_bulk_price.rbs +8 -3
  128. data/sig/orb/models/new_plan_grouped_allocation_price.rbs +8 -3
  129. data/sig/orb/models/new_plan_grouped_tiered_package_price.rbs +8 -3
  130. data/sig/orb/models/new_plan_grouped_tiered_price.rbs +8 -3
  131. data/sig/orb/models/new_plan_grouped_with_metered_minimum_price.rbs +8 -3
  132. data/sig/orb/models/new_plan_grouped_with_prorated_minimum_price.rbs +8 -3
  133. data/sig/orb/models/new_plan_matrix_price.rbs +8 -3
  134. data/sig/orb/models/new_plan_matrix_with_allocation_price.rbs +8 -3
  135. data/sig/orb/models/new_plan_matrix_with_display_name_price.rbs +8 -3
  136. data/sig/orb/models/new_plan_max_group_tiered_package_price.rbs +8 -3
  137. data/sig/orb/models/new_plan_package_price.rbs +8 -3
  138. data/sig/orb/models/new_plan_package_with_allocation_price.rbs +8 -3
  139. data/sig/orb/models/new_plan_scalable_matrix_with_tiered_pricing_price.rbs +8 -3
  140. data/sig/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbs +8 -3
  141. data/sig/orb/models/new_plan_threshold_total_amount_price.rbs +8 -3
  142. data/sig/orb/models/new_plan_tier_with_proration_price.rbs +8 -3
  143. data/sig/orb/models/new_plan_tiered_bps_price.rbs +8 -3
  144. data/sig/orb/models/new_plan_tiered_package_price.rbs +8 -3
  145. data/sig/orb/models/new_plan_tiered_package_with_minimum_price.rbs +8 -3
  146. data/sig/orb/models/new_plan_tiered_price.rbs +8 -3
  147. data/sig/orb/models/new_plan_tiered_with_minimum_price.rbs +8 -3
  148. data/sig/orb/models/new_plan_unit_price.rbs +8 -3
  149. data/sig/orb/models/new_plan_unit_with_percent_price.rbs +8 -3
  150. data/sig/orb/models/new_plan_unit_with_proration_price.rbs +8 -3
  151. data/sig/orb/models/plan_create_params.rbs +156 -37
  152. data/sig/orb/models/plan_phase_amount_discount_adjustment.rbs +8 -3
  153. data/sig/orb/models/plan_phase_maximum_adjustment.rbs +8 -3
  154. data/sig/orb/models/plan_phase_minimum_adjustment.rbs +8 -3
  155. data/sig/orb/models/plan_phase_percentage_discount_adjustment.rbs +8 -3
  156. data/sig/orb/models/plan_phase_usage_discount_adjustment.rbs +5 -0
  157. data/sig/orb/models/price.rbs +140 -0
  158. data/sig/orb/resources/customers/credits/ledger.rbs +2 -2
  159. data/sig/orb/resources/plans.rbs +3 -1
  160. metadata +2 -2
@@ -250,7 +250,7 @@ module Orb
250
250
  # that was originally decremented from, and `amount` indicates how many credits to
251
251
  # return to the customer, up to the block's initial balance.
252
252
  #
253
- # @overload create_entry(customer_id, amount:, entry_type:, expiry_date:, target_expiry_date:, block_id:, currency: nil, description: nil, effective_date: nil, invoice_settings: nil, metadata: nil, per_unit_cost_basis: nil, void_reason: nil, request_options: {})
253
+ # @overload create_entry(customer_id, amount:, entry_type:, target_expiry_date:, block_id:, currency: nil, description: nil, effective_date: nil, expiry_date: nil, invoice_settings: nil, metadata: nil, per_unit_cost_basis: nil, void_reason: nil, request_options: {})
254
254
  #
255
255
  # @param customer_id [String]
256
256
  #
@@ -258,8 +258,6 @@ module Orb
258
258
  #
259
259
  # @param entry_type [Symbol, Orb::Models::Customers::Credits::LedgerCreateEntryParams::EntryType]
260
260
  #
261
- # @param expiry_date [Time, nil] An ISO 8601 format date that identifies the origination credit block to expire
262
- #
263
261
  # @param target_expiry_date [Date] A future date (specified in YYYY-MM-DD format) used for expiration change, denot
264
262
  #
265
263
  # @param block_id [String] The ID of the block to reverse a decrement from.
@@ -270,6 +268,8 @@ module Orb
270
268
  #
271
269
  # @param effective_date [Time, nil] An ISO 8601 format date that denotes when this credit balance should become avai
272
270
  #
271
+ # @param expiry_date [Time, nil] An ISO 8601 format date that identifies the origination credit block to expire
272
+ #
273
273
  # @param invoice_settings [Orb::Models::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings, nil] Passing `invoice_settings` automatically generates an invoice for the newly adde
274
274
  #
275
275
  # @param metadata [Hash{Symbol=>String, nil}, nil] User-specified key/value pairs for the resource. Individual keys can be removed
@@ -409,7 +409,7 @@ module Orb
409
409
  # that was originally decremented from, and `amount` indicates how many credits to
410
410
  # return to the customer, up to the block's initial balance.
411
411
  #
412
- # @overload create_entry_by_external_id(external_customer_id, amount:, entry_type:, expiry_date:, target_expiry_date:, block_id:, currency: nil, description: nil, effective_date: nil, invoice_settings: nil, metadata: nil, per_unit_cost_basis: nil, void_reason: nil, request_options: {})
412
+ # @overload create_entry_by_external_id(external_customer_id, amount:, entry_type:, target_expiry_date:, block_id:, currency: nil, description: nil, effective_date: nil, expiry_date: nil, invoice_settings: nil, metadata: nil, per_unit_cost_basis: nil, void_reason: nil, request_options: {})
413
413
  #
414
414
  # @param external_customer_id [String]
415
415
  #
@@ -417,8 +417,6 @@ module Orb
417
417
  #
418
418
  # @param entry_type [Symbol, Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDParams::EntryType]
419
419
  #
420
- # @param expiry_date [Time, nil] An ISO 8601 format date that identifies the origination credit block to expire
421
- #
422
420
  # @param target_expiry_date [Date] A future date (specified in YYYY-MM-DD format) used for expiration change, denot
423
421
  #
424
422
  # @param block_id [String] The ID of the block to reverse a decrement from.
@@ -429,6 +427,8 @@ module Orb
429
427
  #
430
428
  # @param effective_date [Time, nil] An ISO 8601 format date that denotes when this credit balance should become avai
431
429
  #
430
+ # @param expiry_date [Time, nil] An ISO 8601 format date that identifies the origination credit block to expire
431
+ #
432
432
  # @param invoice_settings [Orb::Models::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings, nil] Passing `invoice_settings` automatically generates an invoice for the newly adde
433
433
  #
434
434
  # @param metadata [Hash{Symbol=>String, nil}, nil] User-specified key/value pairs for the resource. Individual keys can be removed
@@ -11,13 +11,15 @@ module Orb
11
11
  #
12
12
  # This endpoint allows creation of plans including their prices.
13
13
  #
14
- # @overload create(currency:, name:, prices:, default_invoice_memo: nil, external_plan_id: nil, metadata: nil, net_terms: nil, status: nil, request_options: {})
14
+ # @overload create(currency:, name:, prices:, adjustments: nil, default_invoice_memo: nil, external_plan_id: nil, metadata: nil, net_terms: nil, plan_phases: nil, status: nil, request_options: {})
15
15
  #
16
16
  # @param currency [String] An ISO 4217 currency string for invoices generated by subscriptions on this plan
17
17
  #
18
18
  # @param name [String]
19
19
  #
20
- # @param prices [Array<Orb::Models::NewPlanUnitPrice, Orb::Models::NewPlanPackagePrice, Orb::Models::NewPlanMatrixPrice, Orb::Models::NewPlanTieredPrice, Orb::Models::NewPlanTieredBPSPrice, Orb::Models::NewPlanBPSPrice, Orb::Models::NewPlanBulkBPSPrice, Orb::Models::NewPlanBulkPrice, Orb::Models::NewPlanThresholdTotalAmountPrice, Orb::Models::NewPlanTieredPackagePrice, Orb::Models::NewPlanTieredWithMinimumPrice, Orb::Models::NewPlanUnitWithPercentPrice, Orb::Models::NewPlanPackageWithAllocationPrice, Orb::Models::NewPlanTierWithProrationPrice, Orb::Models::NewPlanUnitWithProrationPrice, Orb::Models::NewPlanGroupedAllocationPrice, Orb::Models::NewPlanGroupedWithProratedMinimumPrice, Orb::Models::NewPlanGroupedWithMeteredMinimumPrice, Orb::Models::NewPlanMatrixWithDisplayNamePrice, Orb::Models::NewPlanBulkWithProrationPrice, Orb::Models::NewPlanGroupedTieredPackagePrice, Orb::Models::NewPlanMaxGroupTieredPackagePrice, Orb::Models::NewPlanScalableMatrixWithUnitPricingPrice, Orb::Models::NewPlanScalableMatrixWithTieredPricingPrice, Orb::Models::NewPlanCumulativeGroupedBulkPrice, Orb::Models::NewPlanTieredPackageWithMinimumPrice, Orb::Models::NewPlanMatrixWithAllocationPrice, Orb::Models::NewPlanGroupedTieredPrice>] Prices for this plan. If the plan has phases, this includes prices across all ph
20
+ # @param prices [Array<Orb::Models::PlanCreateParams::Price>] Prices for this plan. If the plan has phases, this includes prices across all ph
21
+ #
22
+ # @param adjustments [Array<Orb::Models::PlanCreateParams::Adjustment>, nil] Adjustments for this plan. If the plan has phases, this includes adjustments acr
21
23
  #
22
24
  # @param default_invoice_memo [String, nil] Free-form text which is available on the invoice PDF and the Orb invoice portal.
23
25
  #
@@ -27,6 +29,8 @@ module Orb
27
29
  #
28
30
  # @param net_terms [Integer, nil] The net terms determines the difference between the invoice date and the issue d
29
31
  #
32
+ # @param plan_phases [Array<Orb::Models::PlanCreateParams::PlanPhase>, nil] Configuration of pre-defined phases, each with their own prices and adjustments.
33
+ #
30
34
  # @param status [Symbol, Orb::Models::PlanCreateParams::Status] The status of the plan to create (either active or draft). If not specified, thi
31
35
  #
32
36
  # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
data/lib/orb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orb
4
- VERSION = "1.0.1"
4
+ VERSION = "1.2.0"
5
5
  end
data/rbi/orb/errors.rbi CHANGED
@@ -8,6 +8,22 @@ module Orb
8
8
  end
9
9
 
10
10
  class ConversionError < Orb::Errors::Error
11
+ sig { returns(T.nilable(StandardError)) }
12
+ def cause
13
+ end
14
+
15
+ # @api private
16
+ sig do
17
+ params(
18
+ on: T::Class[StandardError],
19
+ method: Symbol,
20
+ target: T.anything,
21
+ value: T.anything,
22
+ cause: T.nilable(StandardError)
23
+ ).returns(T.attached_class)
24
+ end
25
+ def self.new(on:, method:, target:, value:, cause: nil)
26
+ end
11
27
  end
12
28
 
13
29
  class APIError < Orb::Errors::Error
@@ -22,6 +22,8 @@ module Orb
22
22
 
23
23
  class << self
24
24
  # @api private
25
+ #
26
+ # Coerce value to Boolean if possible, otherwise return the original value.
25
27
  sig do
26
28
  override
27
29
  .params(
@@ -15,12 +15,14 @@ module Orb
15
15
  CoerceState =
16
16
  T.type_alias do
17
17
  {
18
- strictness: T.any(T::Boolean, Symbol),
18
+ translate_names: T::Boolean,
19
+ strictness: T::Boolean,
19
20
  exactness: {
20
21
  yes: Integer,
21
22
  no: Integer,
22
23
  maybe: Integer
23
24
  },
25
+ error: T::Class[StandardError],
24
26
  branched: Integer
25
27
  }
26
28
  end
@@ -84,6 +86,15 @@ module Orb
84
86
  def self.type_info(spec)
85
87
  end
86
88
 
89
+ # @api private
90
+ sig do
91
+ params(translate_names: T::Boolean).returns(
92
+ Orb::Internal::Type::Converter::CoerceState
93
+ )
94
+ end
95
+ def self.new_coerce_state(translate_names: true)
96
+ end
97
+
87
98
  # @api private
88
99
  #
89
100
  # Based on `target`, transform `value` into `target`, to the extent possible:
@@ -105,14 +116,11 @@ module Orb
105
116
  def self.coerce(
106
117
  target,
107
118
  value,
108
- # The `strictness` is one of `true`, `false`, or `:strong`. This informs the
109
- # coercion strategy when we have to decide between multiple possible conversion
110
- # targets:
119
+ # The `strictness` is one of `true`, `false`. This informs the coercion strategy
120
+ # when we have to decide between multiple possible conversion targets:
111
121
  #
112
122
  # - `true`: the conversion must be exact, with minimum coercion.
113
123
  # - `false`: the conversion can be approximate, with some coercion.
114
- # - `:strong`: the conversion must be exact, with no coercion, and raise an error
115
- # if not possible.
116
124
  #
117
125
  # The `exactness` is `Hash` with keys being one of `yes`, `no`, or `maybe`. For
118
126
  # any given conversion attempt, the exactness will be updated based on how closely
@@ -124,15 +132,7 @@ module Orb
124
132
  # - `no`: the value cannot be converted to the target type.
125
133
  #
126
134
  # See implementation below for more details.
127
- state: {
128
- strictness: true,
129
- exactness: {
130
- yes: 0,
131
- no: 0,
132
- maybe: 0
133
- },
134
- branched: 0
135
- }
135
+ state: Orb::Internal::Type::Converter.new_coerce_state
136
136
  )
137
137
  end
138
138
 
@@ -78,6 +78,11 @@ module Orb
78
78
  end
79
79
 
80
80
  # @api private
81
+ #
82
+ # Tries to efficiently coerce the given value to one of the known variants.
83
+ #
84
+ # If the value cannot match any of the known variants, the coercion is considered
85
+ # non-viable and returns the original value.
81
86
  sig do
82
87
  override
83
88
  .params(
@@ -22,6 +22,8 @@ module Orb
22
22
 
23
23
  class << self
24
24
  # @api private
25
+ #
26
+ # No coercion needed for Unknown type.
25
27
  sig do
26
28
  override
27
29
  .params(
@@ -107,12 +107,12 @@ module Orb
107
107
  amount: Float,
108
108
  entry_type:
109
109
  Orb::Customers::Credits::LedgerCreateEntryByExternalIDParams::EntryType::OrSymbol,
110
- expiry_date: T.nilable(Time),
111
110
  target_expiry_date: Date,
112
111
  block_id: String,
113
112
  currency: T.nilable(String),
114
113
  description: T.nilable(String),
115
114
  effective_date: T.nilable(Time),
115
+ expiry_date: T.nilable(Time),
116
116
  invoice_settings:
117
117
  T.nilable(
118
118
  Orb::Customers::Credits::LedgerCreateEntryByExternalIDParams::InvoiceSettings::OrHash
@@ -131,8 +131,6 @@ module Orb
131
131
  # decrement or void operations.
132
132
  amount:,
133
133
  entry_type:,
134
- # An ISO 8601 format date that identifies the origination credit block to expire
135
- expiry_date:,
136
134
  # A future date (specified in YYYY-MM-DD format) used for expiration change,
137
135
  # denoting when credits transferred (as part of a partial block expiration) should
138
136
  # expire.
@@ -149,6 +147,8 @@ module Orb
149
147
  # An ISO 8601 format date that denotes when this credit balance should become
150
148
  # available for use.
151
149
  effective_date: nil,
150
+ # An ISO 8601 format date that identifies the origination credit block to expire
151
+ expiry_date: nil,
152
152
  # Passing `invoice_settings` automatically generates an invoice for the newly
153
153
  # added credits. If `invoice_settings` is passed, you must specify
154
154
  # per_unit_cost_basis, as the calculation of the invoice total is done on that
@@ -107,12 +107,12 @@ module Orb
107
107
  amount: Float,
108
108
  entry_type:
109
109
  Orb::Customers::Credits::LedgerCreateEntryParams::EntryType::OrSymbol,
110
- expiry_date: T.nilable(Time),
111
110
  target_expiry_date: Date,
112
111
  block_id: String,
113
112
  currency: T.nilable(String),
114
113
  description: T.nilable(String),
115
114
  effective_date: T.nilable(Time),
115
+ expiry_date: T.nilable(Time),
116
116
  invoice_settings:
117
117
  T.nilable(
118
118
  Orb::Customers::Credits::LedgerCreateEntryParams::InvoiceSettings::OrHash
@@ -131,8 +131,6 @@ module Orb
131
131
  # decrement or void operations.
132
132
  amount:,
133
133
  entry_type:,
134
- # An ISO 8601 format date that identifies the origination credit block to expire
135
- expiry_date:,
136
134
  # A future date (specified in YYYY-MM-DD format) used for expiration change,
137
135
  # denoting when credits transferred (as part of a partial block expiration) should
138
136
  # expire.
@@ -149,6 +147,8 @@ module Orb
149
147
  # An ISO 8601 format date that denotes when this credit balance should become
150
148
  # available for use.
151
149
  effective_date: nil,
150
+ # An ISO 8601 format date that identifies the origination credit block to expire
151
+ expiry_date: nil,
152
152
  # Passing `invoice_settings` automatically generates an invoice for the newly
153
153
  # added credits. If `invoice_settings` is passed, you must specify
154
154
  # per_unit_cost_basis, as the calculation of the invoice total is done on that
@@ -1020,6 +1020,7 @@ module Orb
1020
1020
  sig { returns(String) }
1021
1021
  attr_accessor :credits_applied
1022
1022
 
1023
+ # This field is deprecated in favor of `adjustments`
1023
1024
  sig { returns(T.nilable(Orb::Discount::Variants)) }
1024
1025
  attr_accessor :discount
1025
1026
 
@@ -1201,6 +1202,7 @@ module Orb
1201
1202
  amount:,
1202
1203
  # The number of prepaid credits applied.
1203
1204
  credits_applied:,
1205
+ # This field is deprecated in favor of `adjustments`
1204
1206
  discount:,
1205
1207
  # The end date of the range of time applied for this line item's price.
1206
1208
  end_date:,
@@ -1117,6 +1117,7 @@ module Orb
1117
1117
  sig { returns(String) }
1118
1118
  attr_accessor :credits_applied
1119
1119
 
1120
+ # This field is deprecated in favor of `adjustments`
1120
1121
  sig { returns(T.nilable(Orb::Discount::Variants)) }
1121
1122
  attr_accessor :discount
1122
1123
 
@@ -1304,6 +1305,7 @@ module Orb
1304
1305
  amount:,
1305
1306
  # The number of prepaid credits applied.
1306
1307
  credits_applied:,
1308
+ # This field is deprecated in favor of `adjustments`
1307
1309
  discount:,
1308
1310
  # The end date of the range of time applied for this line item's price.
1309
1311
  end_date:,
@@ -41,6 +41,7 @@ module Orb
41
41
  sig { returns(String) }
42
42
  attr_accessor :credits_applied
43
43
 
44
+ # This field is deprecated in favor of `adjustments`
44
45
  sig { returns(T.nilable(Orb::Discount::Variants)) }
45
46
  attr_accessor :discount
46
47
 
@@ -228,6 +229,7 @@ module Orb
228
229
  amount:,
229
230
  # The number of prepaid credits applied.
230
231
  credits_applied:,
232
+ # This field is deprecated in favor of `adjustments`
231
233
  discount:,
232
234
  # The end date of the range of time applied for this line item's price.
233
235
  end_date:,
@@ -44,6 +44,11 @@ module Orb
44
44
  sig { returns(T.nilable(String)) }
45
45
  attr_accessor :reason
46
46
 
47
+ # The adjustment id this adjustment replaces. This adjustment will take the place
48
+ # of the replaced adjustment in plan version migrations.
49
+ sig { returns(T.nilable(String)) }
50
+ attr_accessor :replaces_adjustment_id
51
+
47
52
  sig do
48
53
  params(
49
54
  id: String,
@@ -54,7 +59,8 @@ module Orb
54
59
  applies_to_price_ids: T::Array[String],
55
60
  filters: T::Array[Orb::TransformPriceFilter::OrHash],
56
61
  is_invoice_level: T::Boolean,
57
- reason: T.nilable(String)
62
+ reason: T.nilable(String),
63
+ replaces_adjustment_id: T.nilable(String)
58
64
  ).returns(T.attached_class)
59
65
  end
60
66
  def self.new(
@@ -73,7 +79,10 @@ module Orb
73
79
  # that apply to only one price.
74
80
  is_invoice_level:,
75
81
  # The reason for the adjustment.
76
- reason:
82
+ reason:,
83
+ # The adjustment id this adjustment replaces. This adjustment will take the place
84
+ # of the replaced adjustment in plan version migrations.
85
+ replaces_adjustment_id:
77
86
  )
78
87
  end
79
88
 
@@ -88,7 +97,8 @@ module Orb
88
97
  applies_to_price_ids: T::Array[String],
89
98
  filters: T::Array[Orb::TransformPriceFilter],
90
99
  is_invoice_level: T::Boolean,
91
- reason: T.nilable(String)
100
+ reason: T.nilable(String),
101
+ replaces_adjustment_id: T.nilable(String)
92
102
  }
93
103
  )
94
104
  end
@@ -42,6 +42,11 @@ module Orb
42
42
  sig { returns(T.nilable(String)) }
43
43
  attr_accessor :reason
44
44
 
45
+ # The adjustment id this adjustment replaces. This adjustment will take the place
46
+ # of the replaced adjustment in plan version migrations.
47
+ sig { returns(T.nilable(String)) }
48
+ attr_accessor :replaces_adjustment_id
49
+
45
50
  sig do
46
51
  params(
47
52
  id: String,
@@ -52,7 +57,8 @@ module Orb
52
57
  filters: T::Array[Orb::TransformPriceFilter::OrHash],
53
58
  is_invoice_level: T::Boolean,
54
59
  maximum_amount: String,
55
- reason: T.nilable(String)
60
+ reason: T.nilable(String),
61
+ replaces_adjustment_id: T.nilable(String)
56
62
  ).returns(T.attached_class)
57
63
  end
58
64
  def self.new(
@@ -71,7 +77,10 @@ module Orb
71
77
  # adjustment applies to.
72
78
  maximum_amount:,
73
79
  # The reason for the adjustment.
74
- reason:
80
+ reason:,
81
+ # The adjustment id this adjustment replaces. This adjustment will take the place
82
+ # of the replaced adjustment in plan version migrations.
83
+ replaces_adjustment_id:
75
84
  )
76
85
  end
77
86
 
@@ -86,7 +95,8 @@ module Orb
86
95
  filters: T::Array[Orb::TransformPriceFilter],
87
96
  is_invoice_level: T::Boolean,
88
97
  maximum_amount: String,
89
- reason: T.nilable(String)
98
+ reason: T.nilable(String),
99
+ replaces_adjustment_id: T.nilable(String)
90
100
  }
91
101
  )
92
102
  end
@@ -46,6 +46,11 @@ module Orb
46
46
  sig { returns(T.nilable(String)) }
47
47
  attr_accessor :reason
48
48
 
49
+ # The adjustment id this adjustment replaces. This adjustment will take the place
50
+ # of the replaced adjustment in plan version migrations.
51
+ sig { returns(T.nilable(String)) }
52
+ attr_accessor :replaces_adjustment_id
53
+
49
54
  sig do
50
55
  params(
51
56
  id: String,
@@ -57,7 +62,8 @@ module Orb
57
62
  is_invoice_level: T::Boolean,
58
63
  item_id: String,
59
64
  minimum_amount: String,
60
- reason: T.nilable(String)
65
+ reason: T.nilable(String),
66
+ replaces_adjustment_id: T.nilable(String)
61
67
  ).returns(T.attached_class)
62
68
  end
63
69
  def self.new(
@@ -78,7 +84,10 @@ module Orb
78
84
  # adjustment applies to.
79
85
  minimum_amount:,
80
86
  # The reason for the adjustment.
81
- reason:
87
+ reason:,
88
+ # The adjustment id this adjustment replaces. This adjustment will take the place
89
+ # of the replaced adjustment in plan version migrations.
90
+ replaces_adjustment_id:
82
91
  )
83
92
  end
84
93
 
@@ -94,7 +103,8 @@ module Orb
94
103
  is_invoice_level: T::Boolean,
95
104
  item_id: String,
96
105
  minimum_amount: String,
97
- reason: T.nilable(String)
106
+ reason: T.nilable(String),
107
+ replaces_adjustment_id: T.nilable(String)
98
108
  }
99
109
  )
100
110
  end
@@ -47,6 +47,11 @@ module Orb
47
47
  sig { returns(T.nilable(String)) }
48
48
  attr_accessor :reason
49
49
 
50
+ # The adjustment id this adjustment replaces. This adjustment will take the place
51
+ # of the replaced adjustment in plan version migrations.
52
+ sig { returns(T.nilable(String)) }
53
+ attr_accessor :replaces_adjustment_id
54
+
50
55
  sig do
51
56
  params(
52
57
  id: String,
@@ -57,7 +62,8 @@ module Orb
57
62
  filters: T::Array[Orb::TransformPriceFilter::OrHash],
58
63
  is_invoice_level: T::Boolean,
59
64
  percentage_discount: Float,
60
- reason: T.nilable(String)
65
+ reason: T.nilable(String),
66
+ replaces_adjustment_id: T.nilable(String)
61
67
  ).returns(T.attached_class)
62
68
  end
63
69
  def self.new(
@@ -76,7 +82,10 @@ module Orb
76
82
  # intervals this adjustment applies to in a given billing period.
77
83
  percentage_discount:,
78
84
  # The reason for the adjustment.
79
- reason:
85
+ reason:,
86
+ # The adjustment id this adjustment replaces. This adjustment will take the place
87
+ # of the replaced adjustment in plan version migrations.
88
+ replaces_adjustment_id:
80
89
  )
81
90
  end
82
91
 
@@ -91,7 +100,8 @@ module Orb
91
100
  filters: T::Array[Orb::TransformPriceFilter],
92
101
  is_invoice_level: T::Boolean,
93
102
  percentage_discount: Float,
94
- reason: T.nilable(String)
103
+ reason: T.nilable(String),
104
+ replaces_adjustment_id: T.nilable(String)
95
105
  }
96
106
  )
97
107
  end
@@ -39,6 +39,11 @@ module Orb
39
39
  sig { returns(T.nilable(String)) }
40
40
  attr_accessor :reason
41
41
 
42
+ # The adjustment id this adjustment replaces. This adjustment will take the place
43
+ # of the replaced adjustment in plan version migrations.
44
+ sig { returns(T.nilable(String)) }
45
+ attr_accessor :replaces_adjustment_id
46
+
42
47
  # The number of usage units by which to discount the price this adjustment applies
43
48
  # to in a given billing period.
44
49
  sig { returns(Float) }
@@ -54,6 +59,7 @@ module Orb
54
59
  filters: T::Array[Orb::TransformPriceFilter::OrHash],
55
60
  is_invoice_level: T::Boolean,
56
61
  reason: T.nilable(String),
62
+ replaces_adjustment_id: T.nilable(String),
57
63
  usage_discount: Float
58
64
  ).returns(T.attached_class)
59
65
  end
@@ -71,6 +77,9 @@ module Orb
71
77
  is_invoice_level:,
72
78
  # The reason for the adjustment.
73
79
  reason:,
80
+ # The adjustment id this adjustment replaces. This adjustment will take the place
81
+ # of the replaced adjustment in plan version migrations.
82
+ replaces_adjustment_id:,
74
83
  # The number of usage units by which to discount the price this adjustment applies
75
84
  # to in a given billing period.
76
85
  usage_discount:
@@ -88,6 +97,7 @@ module Orb
88
97
  filters: T::Array[Orb::TransformPriceFilter],
89
98
  is_invoice_level: T::Boolean,
90
99
  reason: T.nilable(String),
100
+ replaces_adjustment_id: T.nilable(String),
91
101
  usage_discount: Float
92
102
  }
93
103
  )
@@ -116,6 +116,11 @@ module Orb
116
116
  sig { returns(T.nilable(T::Hash[Symbol, T.nilable(String)])) }
117
117
  attr_accessor :metadata
118
118
 
119
+ # A transient ID that can be used to reference this price when adding adjustments
120
+ # in the same API call.
121
+ sig { returns(T.nilable(String)) }
122
+ attr_accessor :reference_id
123
+
119
124
  sig do
120
125
  params(
121
126
  bps_config: Orb::BPSConfig::OrHash,
@@ -143,7 +148,8 @@ module Orb
143
148
  invoice_grouping_key: T.nilable(String),
144
149
  invoicing_cycle_configuration:
145
150
  T.nilable(Orb::NewBillingCycleConfiguration::OrHash),
146
- metadata: T.nilable(T::Hash[Symbol, T.nilable(String)])
151
+ metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
152
+ reference_id: T.nilable(String)
147
153
  ).returns(T.attached_class)
148
154
  end
149
155
  def self.new(
@@ -186,7 +192,10 @@ module Orb
186
192
  # User-specified key/value pairs for the resource. Individual keys can be removed
187
193
  # by setting the value to `null`, and the entire metadata mapping can be cleared
188
194
  # by setting `metadata` to `null`.
189
- metadata: nil
195
+ metadata: nil,
196
+ # A transient ID that can be used to reference this price when adding adjustments
197
+ # in the same API call.
198
+ reference_id: nil
190
199
  )
191
200
  end
192
201
 
@@ -218,7 +227,8 @@ module Orb
218
227
  invoice_grouping_key: T.nilable(String),
219
228
  invoicing_cycle_configuration:
220
229
  T.nilable(Orb::NewBillingCycleConfiguration),
221
- metadata: T.nilable(T::Hash[Symbol, T.nilable(String)])
230
+ metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
231
+ reference_id: T.nilable(String)
222
232
  }
223
233
  )
224
234
  end
@@ -116,6 +116,11 @@ module Orb
116
116
  sig { returns(T.nilable(T::Hash[Symbol, T.nilable(String)])) }
117
117
  attr_accessor :metadata
118
118
 
119
+ # A transient ID that can be used to reference this price when adding adjustments
120
+ # in the same API call.
121
+ sig { returns(T.nilable(String)) }
122
+ attr_accessor :reference_id
123
+
119
124
  sig do
120
125
  params(
121
126
  bulk_bps_config: Orb::BulkBPSConfig::OrHash,
@@ -143,7 +148,8 @@ module Orb
143
148
  invoice_grouping_key: T.nilable(String),
144
149
  invoicing_cycle_configuration:
145
150
  T.nilable(Orb::NewBillingCycleConfiguration::OrHash),
146
- metadata: T.nilable(T::Hash[Symbol, T.nilable(String)])
151
+ metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
152
+ reference_id: T.nilable(String)
147
153
  ).returns(T.attached_class)
148
154
  end
149
155
  def self.new(
@@ -186,7 +192,10 @@ module Orb
186
192
  # User-specified key/value pairs for the resource. Individual keys can be removed
187
193
  # by setting the value to `null`, and the entire metadata mapping can be cleared
188
194
  # by setting `metadata` to `null`.
189
- metadata: nil
195
+ metadata: nil,
196
+ # A transient ID that can be used to reference this price when adding adjustments
197
+ # in the same API call.
198
+ reference_id: nil
190
199
  )
191
200
  end
192
201
 
@@ -218,7 +227,8 @@ module Orb
218
227
  invoice_grouping_key: T.nilable(String),
219
228
  invoicing_cycle_configuration:
220
229
  T.nilable(Orb::NewBillingCycleConfiguration),
221
- metadata: T.nilable(T::Hash[Symbol, T.nilable(String)])
230
+ metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
231
+ reference_id: T.nilable(String)
222
232
  }
223
233
  )
224
234
  end
@@ -116,6 +116,11 @@ module Orb
116
116
  sig { returns(T.nilable(T::Hash[Symbol, T.nilable(String)])) }
117
117
  attr_accessor :metadata
118
118
 
119
+ # A transient ID that can be used to reference this price when adding adjustments
120
+ # in the same API call.
121
+ sig { returns(T.nilable(String)) }
122
+ attr_accessor :reference_id
123
+
119
124
  sig do
120
125
  params(
121
126
  bulk_config: Orb::BulkConfig::OrHash,
@@ -143,7 +148,8 @@ module Orb
143
148
  invoice_grouping_key: T.nilable(String),
144
149
  invoicing_cycle_configuration:
145
150
  T.nilable(Orb::NewBillingCycleConfiguration::OrHash),
146
- metadata: T.nilable(T::Hash[Symbol, T.nilable(String)])
151
+ metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
152
+ reference_id: T.nilable(String)
147
153
  ).returns(T.attached_class)
148
154
  end
149
155
  def self.new(
@@ -186,7 +192,10 @@ module Orb
186
192
  # User-specified key/value pairs for the resource. Individual keys can be removed
187
193
  # by setting the value to `null`, and the entire metadata mapping can be cleared
188
194
  # by setting `metadata` to `null`.
189
- metadata: nil
195
+ metadata: nil,
196
+ # A transient ID that can be used to reference this price when adding adjustments
197
+ # in the same API call.
198
+ reference_id: nil
190
199
  )
191
200
  end
192
201
 
@@ -218,7 +227,8 @@ module Orb
218
227
  invoice_grouping_key: T.nilable(String),
219
228
  invoicing_cycle_configuration:
220
229
  T.nilable(Orb::NewBillingCycleConfiguration),
221
- metadata: T.nilable(T::Hash[Symbol, T.nilable(String)])
230
+ metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
231
+ reference_id: T.nilable(String)
222
232
  }
223
233
  )
224
234
  end