orb-billing 1.57.0 → 1.59.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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/orb/client.rb +0 -8
  5. data/lib/orb/models/invoice_list_params.rb +12 -11
  6. data/lib/orb/models/invoice_list_summary_params.rb +12 -11
  7. data/lib/orb/models/invoice_status_filter.rb +18 -0
  8. data/lib/orb/models/migration_create_params.rb +10 -1
  9. data/lib/orb/models/{beta_create_plan_version_params.rb → plan_create_plan_version_params.rb} +430 -430
  10. data/lib/orb/models/{beta_fetch_plan_version_params.rb → plan_fetch_plan_version_params.rb} +2 -2
  11. data/lib/orb/models/{beta_set_default_plan_version_params.rb → plan_set_default_plan_version_params.rb} +2 -2
  12. data/lib/orb/models/plan_version.rb +1 -1
  13. data/lib/orb/models/plans/draft_discard_params.rb +22 -0
  14. data/lib/orb/models/plans/draft_fetch_params.rb +22 -0
  15. data/lib/orb/models/plans/draft_publish_params.rb +31 -0
  16. data/lib/orb/models/plans/draft_save_params.rb +7522 -0
  17. data/lib/orb/models/plans/external_plan_id/draft_discard_params.rb +24 -0
  18. data/lib/orb/models/plans/external_plan_id/draft_fetch_params.rb +24 -0
  19. data/lib/orb/models/plans/external_plan_id/draft_publish_params.rb +33 -0
  20. data/lib/orb/models/plans/external_plan_id/draft_save_params.rb +7595 -0
  21. data/lib/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rb +430 -430
  22. data/lib/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rb +2 -2
  23. data/lib/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rb +2 -2
  24. data/lib/orb/models/plans/plan_version_draft.rb +279 -0
  25. data/lib/orb/models/subscription_list_params.rb +52 -15
  26. data/lib/orb/models/subscription_list_summary_params.rb +50 -15
  27. data/lib/orb/models/subscription_status_filter.rb +16 -0
  28. data/lib/orb/models.rb +10 -8
  29. data/lib/orb/resources/customers/credits/ledger.rb +56 -0
  30. data/lib/orb/resources/invoices.rb +16 -2
  31. data/lib/orb/resources/migrations.rb +3 -1
  32. data/lib/orb/resources/plans/draft.rb +124 -0
  33. data/lib/orb/resources/plans/external_plan_id/draft.rb +126 -0
  34. data/lib/orb/resources/plans/external_plan_id.rb +96 -0
  35. data/lib/orb/resources/plans.rb +96 -0
  36. data/lib/orb/resources/subscriptions.rb +6 -6
  37. data/lib/orb/version.rb +1 -1
  38. data/lib/orb.rb +19 -8
  39. data/rbi/orb/client.rbi +0 -7
  40. data/rbi/orb/models/invoice_list_params.rbi +37 -17
  41. data/rbi/orb/models/invoice_list_summary_params.rbi +38 -18
  42. data/rbi/orb/models/invoice_status_filter.rbi +22 -0
  43. data/rbi/orb/models/migration_create_params.rbi +13 -0
  44. data/rbi/orb/models/{beta_create_plan_version_params.rbi → plan_create_plan_version_params.rbi} +744 -744
  45. data/rbi/orb/models/{beta_fetch_plan_version_params.rbi → plan_fetch_plan_version_params.rbi} +2 -2
  46. data/rbi/orb/models/{beta_set_default_plan_version_params.rbi → plan_set_default_plan_version_params.rbi} +2 -2
  47. data/rbi/orb/models/plans/draft_discard_params.rbi +37 -0
  48. data/rbi/orb/models/plans/draft_fetch_params.rbi +37 -0
  49. data/rbi/orb/models/plans/draft_publish_params.rbi +54 -0
  50. data/rbi/orb/models/plans/draft_save_params.rbi +13143 -0
  51. data/rbi/orb/models/plans/external_plan_id/draft_discard_params.rbi +42 -0
  52. data/rbi/orb/models/plans/external_plan_id/draft_fetch_params.rbi +42 -0
  53. data/rbi/orb/models/plans/external_plan_id/draft_publish_params.rbi +59 -0
  54. data/rbi/orb/models/plans/external_plan_id/draft_save_params.rbi +13256 -0
  55. data/rbi/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rbi +744 -744
  56. data/rbi/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rbi +2 -2
  57. data/rbi/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rbi +2 -2
  58. data/rbi/orb/models/plans/plan_version_draft.rbi +502 -0
  59. data/rbi/orb/models/subscription_list_params.rbi +100 -21
  60. data/rbi/orb/models/subscription_list_summary_params.rbi +99 -28
  61. data/rbi/orb/models/subscription_status_filter.rbi +23 -0
  62. data/rbi/orb/models.rbi +10 -8
  63. data/rbi/orb/resources/customers/credits/ledger.rbi +56 -0
  64. data/rbi/orb/resources/invoices.rbi +28 -2
  65. data/rbi/orb/resources/migrations.rbi +4 -0
  66. data/rbi/orb/resources/{beta/external_plan_id.rbi → plans/draft.rbi} +58 -59
  67. data/rbi/orb/resources/plans/external_plan_id/draft.rbi +126 -0
  68. data/rbi/orb/resources/plans/external_plan_id.rbi +102 -0
  69. data/rbi/orb/resources/plans.rbi +94 -0
  70. data/rbi/orb/resources/subscriptions.rbi +25 -6
  71. data/sig/orb/client.rbs +0 -2
  72. data/sig/orb/models/invoice_list_params.rbs +10 -12
  73. data/sig/orb/models/invoice_list_summary_params.rbs +6 -8
  74. data/sig/orb/models/invoice_status_filter.rbs +17 -0
  75. data/sig/orb/models/migration_create_params.rbs +7 -0
  76. data/sig/orb/models/{beta_create_plan_version_params.rbs → plan_create_plan_version_params.rbs} +448 -448
  77. data/sig/orb/models/{beta_fetch_plan_version_params.rbs → plan_fetch_plan_version_params.rbs} +2 -2
  78. data/sig/orb/models/{beta_set_default_plan_version_params.rbs → plan_set_default_plan_version_params.rbs} +2 -2
  79. data/sig/orb/models/plans/draft_discard_params.rbs +25 -0
  80. data/sig/orb/models/plans/draft_fetch_params.rbs +25 -0
  81. data/sig/orb/models/plans/draft_publish_params.rbs +32 -0
  82. data/sig/orb/models/plans/draft_save_params.rbs +5210 -0
  83. data/sig/orb/models/plans/external_plan_id/draft_discard_params.rbs +27 -0
  84. data/sig/orb/models/plans/external_plan_id/draft_fetch_params.rbs +27 -0
  85. data/sig/orb/models/plans/external_plan_id/draft_publish_params.rbs +34 -0
  86. data/sig/orb/models/plans/external_plan_id/draft_save_params.rbs +5215 -0
  87. data/sig/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rbs +447 -447
  88. data/sig/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rbs +1 -1
  89. data/sig/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rbs +1 -1
  90. data/sig/orb/models/plans/plan_version_draft.rbs +205 -0
  91. data/sig/orb/models/subscription_list_params.rbs +34 -14
  92. data/sig/orb/models/subscription_list_summary_params.rbs +34 -14
  93. data/sig/orb/models/subscription_status_filter.rbs +15 -0
  94. data/sig/orb/models.rbs +10 -8
  95. data/sig/orb/resources/invoices.rbs +1 -1
  96. data/sig/orb/resources/migrations.rbs +1 -0
  97. data/sig/orb/resources/plans/draft.rbs +37 -0
  98. data/sig/orb/resources/plans/external_plan_id/draft.rbs +39 -0
  99. data/sig/orb/resources/plans/external_plan_id.rbs +27 -0
  100. data/sig/orb/resources/plans.rbs +27 -0
  101. data/sig/orb/resources/subscriptions.rbs +4 -4
  102. metadata +2044 -2005
  103. data/lib/orb/resources/beta/external_plan_id.rb +0 -108
  104. data/lib/orb/resources/beta.rb +0 -114
  105. data/rbi/orb/resources/beta.rbi +0 -110
  106. data/sig/orb/resources/beta/external_plan_id.rbs +0 -34
  107. data/sig/orb/resources/beta.rbs +0 -34
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Orb
4
4
  module Models
5
- module Beta
6
- # @see Orb::Resources::Beta::ExternalPlanID#fetch_plan_version
5
+ module Plans
6
+ # @see Orb::Resources::Plans::ExternalPlanID#fetch_plan_version
7
7
  class ExternalPlanIDFetchPlanVersionParams < Orb::Internal::Type::BaseModel
8
8
  extend Orb::Internal::Type::RequestParameters::Converter
9
9
  include Orb::Internal::Type::RequestParameters
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Orb
4
4
  module Models
5
- module Beta
6
- # @see Orb::Resources::Beta::ExternalPlanID#set_default_plan_version
5
+ module Plans
6
+ # @see Orb::Resources::Plans::ExternalPlanID#set_default_plan_version
7
7
  class ExternalPlanIDSetDefaultPlanVersionParams < Orb::Internal::Type::BaseModel
8
8
  extend Orb::Internal::Type::RequestParameters::Converter
9
9
  include Orb::Internal::Type::RequestParameters
@@ -0,0 +1,279 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orb
4
+ module Models
5
+ module Plans
6
+ # @see Orb::Resources::Plans::Draft#fetch
7
+ class PlanVersionDraft < Orb::Internal::Type::BaseModel
8
+ # @!attribute adjustments
9
+ # Adjustments on the draft. If the plan has phases, this includes adjustments
10
+ # across all phases of the plan.
11
+ #
12
+ # @return [Array<Orb::Models::PlanPhaseUsageDiscountAdjustment, Orb::Models::PlanPhaseAmountDiscountAdjustment, Orb::Models::PlanPhasePercentageDiscountAdjustment, Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount, Orb::Models::PlanPhaseMinimumAdjustment, Orb::Models::PlanPhaseMaximumAdjustment>]
13
+ required :adjustments,
14
+ -> { Orb::Internal::Type::ArrayOf[union: Orb::Plans::PlanVersionDraft::Adjustment] }
15
+
16
+ # @!attribute base_version
17
+ # The published version the draft is built on, the latest at read time.
18
+ #
19
+ # @return [Integer]
20
+ required :base_version, Integer
21
+
22
+ # @!attribute created_at
23
+ #
24
+ # @return [Time]
25
+ required :created_at, Time
26
+
27
+ # @!attribute description
28
+ # Optional description of what changes in this draft
29
+ #
30
+ # @return [String, nil]
31
+ required :description, String, nil?: true
32
+
33
+ # @!attribute plan_id
34
+ #
35
+ # @return [String]
36
+ required :plan_id, String
37
+
38
+ # @!attribute plan_phases
39
+ #
40
+ # @return [Array<Orb::Models::PlanVersionPhase>, nil]
41
+ required :plan_phases, -> { Orb::Internal::Type::ArrayOf[Orb::PlanVersionPhase] }, nil?: true
42
+
43
+ # @!attribute prices
44
+ # Prices on the draft. If the plan has phases, this includes prices across all
45
+ # phases of the plan.
46
+ #
47
+ # @return [Array<Orb::Models::Price::Unit, Orb::Models::Price::Tiered, Orb::Models::Price::Bulk, Orb::Models::Price::BulkWithFilters, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::GroupedTiered, Orb::Models::Price::GroupedTieredMatrix, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredMatrixWithAllocation, Orb::Models::Price::MatrixWithThresholdDiscounts, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::GroupedWithMinMaxThresholds, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk, Orb::Models::Price::CumulativeGroupedAllocation, Orb::Models::Price::DailyCreditAllowance, Orb::Models::Price::MeteredAllowance, Orb::Models::Price::MinimumComposite, Orb::Models::Price::Percent, Orb::Models::Price::EventOutput, Orb::Models::Price::UnitWithMultiplier>]
48
+ required :prices, -> { Orb::Internal::Type::ArrayOf[union: Orb::Price] }
49
+
50
+ # @!method initialize(adjustments:, base_version:, created_at:, description:, plan_id:, plan_phases:, prices:)
51
+ # Some parameter documentations has been truncated, see
52
+ # {Orb::Models::Plans::PlanVersionDraft} for more details.
53
+ #
54
+ # The PlanVersionDraft resource represents a plan's unpublished next version: the
55
+ # prices and adjustments it will have once published, built on top of
56
+ # `base_version`.
57
+ #
58
+ # @param adjustments [Array<Orb::Models::PlanPhaseUsageDiscountAdjustment, Orb::Models::PlanPhaseAmountDiscountAdjustment, Orb::Models::PlanPhasePercentageDiscountAdjustment, Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount, Orb::Models::PlanPhaseMinimumAdjustment, Orb::Models::PlanPhaseMaximumAdjustment>] Adjustments on the draft. If the plan has phases, this includes adjustments acro
59
+ #
60
+ # @param base_version [Integer] The published version the draft is built on, the latest at read time.
61
+ #
62
+ # @param created_at [Time]
63
+ #
64
+ # @param description [String, nil] Optional description of what changes in this draft
65
+ #
66
+ # @param plan_id [String]
67
+ #
68
+ # @param plan_phases [Array<Orb::Models::PlanVersionPhase>, nil]
69
+ #
70
+ # @param prices [Array<Orb::Models::Price::Unit, Orb::Models::Price::Tiered, Orb::Models::Price::Bulk, Orb::Models::Price::BulkWithFilters, Orb::Models::Price::Package, Orb::Models::Price::Matrix, Orb::Models::Price::ThresholdTotalAmount, Orb::Models::Price::TieredPackage, Orb::Models::Price::TieredWithMinimum, Orb::Models::Price::GroupedTiered, Orb::Models::Price::GroupedTieredMatrix, Orb::Models::Price::TieredPackageWithMinimum, Orb::Models::Price::PackageWithAllocation, Orb::Models::Price::UnitWithPercent, Orb::Models::Price::MatrixWithAllocation, Orb::Models::Price::TieredMatrixWithAllocation, Orb::Models::Price::MatrixWithThresholdDiscounts, Orb::Models::Price::TieredWithProration, Orb::Models::Price::UnitWithProration, Orb::Models::Price::GroupedAllocation, Orb::Models::Price::BulkWithProration, Orb::Models::Price::GroupedWithProratedMinimum, Orb::Models::Price::GroupedWithMeteredMinimum, Orb::Models::Price::GroupedWithMinMaxThresholds, Orb::Models::Price::MatrixWithDisplayName, Orb::Models::Price::GroupedTieredPackage, Orb::Models::Price::MaxGroupTieredPackage, Orb::Models::Price::ScalableMatrixWithUnitPricing, Orb::Models::Price::ScalableMatrixWithTieredPricing, Orb::Models::Price::CumulativeGroupedBulk, Orb::Models::Price::CumulativeGroupedAllocation, Orb::Models::Price::DailyCreditAllowance, Orb::Models::Price::MeteredAllowance, Orb::Models::Price::MinimumComposite, Orb::Models::Price::Percent, Orb::Models::Price::EventOutput, Orb::Models::Price::UnitWithMultiplier>] Prices on the draft. If the plan has phases, this includes prices across all pha
71
+
72
+ module Adjustment
73
+ extend Orb::Internal::Type::Union
74
+
75
+ discriminator :adjustment_type
76
+
77
+ variant :usage_discount, -> { Orb::PlanPhaseUsageDiscountAdjustment }
78
+
79
+ variant :amount_discount, -> { Orb::PlanPhaseAmountDiscountAdjustment }
80
+
81
+ variant :percentage_discount, -> { Orb::PlanPhasePercentageDiscountAdjustment }
82
+
83
+ variant :tiered_percentage_discount,
84
+ -> { Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount }
85
+
86
+ variant :minimum, -> { Orb::PlanPhaseMinimumAdjustment }
87
+
88
+ variant :maximum, -> { Orb::PlanPhaseMaximumAdjustment }
89
+
90
+ class TieredPercentageDiscount < Orb::Internal::Type::BaseModel
91
+ # @!attribute id
92
+ #
93
+ # @return [String]
94
+ required :id, String
95
+
96
+ # @!attribute adjustment_type
97
+ #
98
+ # @return [Symbol, :tiered_percentage_discount]
99
+ required :adjustment_type, const: :tiered_percentage_discount
100
+
101
+ # @!attribute applies_to_price_ids
102
+ # @deprecated
103
+ #
104
+ # The price IDs that this adjustment applies to.
105
+ #
106
+ # @return [Array<String>]
107
+ required :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String]
108
+
109
+ # @!attribute filters
110
+ # The filters that determine which prices to apply this adjustment to.
111
+ #
112
+ # @return [Array<Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter>]
113
+ required :filters,
114
+ -> { Orb::Internal::Type::ArrayOf[Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter] }
115
+
116
+ # @!attribute is_invoice_level
117
+ # True for adjustments that apply to an entire invoice, false for adjustments that
118
+ # apply to only one price.
119
+ #
120
+ # @return [Boolean]
121
+ required :is_invoice_level, Orb::Internal::Type::Boolean
122
+
123
+ # @!attribute plan_phase_order
124
+ # The plan phase in which this adjustment is active.
125
+ #
126
+ # @return [Integer, nil]
127
+ required :plan_phase_order, Integer, nil?: true
128
+
129
+ # @!attribute reason
130
+ # The reason for the adjustment.
131
+ #
132
+ # @return [String, nil]
133
+ required :reason, String, nil?: true
134
+
135
+ # @!attribute replaces_adjustment_id
136
+ # The adjustment id this adjustment replaces. This adjustment will take the place
137
+ # of the replaced adjustment in plan version migrations.
138
+ #
139
+ # @return [String, nil]
140
+ required :replaces_adjustment_id, String, nil?: true
141
+
142
+ # @!attribute tiers
143
+ # The ordered, contiguous bands of cumulative eligible spend, each discounted at
144
+ # its own percentage (progressive fill-a-tier), applied to the prices this
145
+ # adjustment covers in a given billing period.
146
+ #
147
+ # @return [Array<Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Tier>]
148
+ required :tiers,
149
+ -> { Orb::Internal::Type::ArrayOf[Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Tier] }
150
+
151
+ # @!method initialize(id:, applies_to_price_ids:, filters:, is_invoice_level:, plan_phase_order:, reason:, replaces_adjustment_id:, tiers:, adjustment_type: :tiered_percentage_discount)
152
+ # Some parameter documentations has been truncated, see
153
+ # {Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount} for
154
+ # more details.
155
+ #
156
+ # @param id [String]
157
+ #
158
+ # @param applies_to_price_ids [Array<String>] The price IDs that this adjustment applies to.
159
+ #
160
+ # @param filters [Array<Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter>] The filters that determine which prices to apply this adjustment to.
161
+ #
162
+ # @param is_invoice_level [Boolean] True for adjustments that apply to an entire invoice, false for adjustments that
163
+ #
164
+ # @param plan_phase_order [Integer, nil] The plan phase in which this adjustment is active.
165
+ #
166
+ # @param reason [String, nil] The reason for the adjustment.
167
+ #
168
+ # @param replaces_adjustment_id [String, nil] The adjustment id this adjustment replaces. This adjustment will take the place
169
+ #
170
+ # @param tiers [Array<Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Tier>] The ordered, contiguous bands of cumulative eligible spend, each discounted at i
171
+ #
172
+ # @param adjustment_type [Symbol, :tiered_percentage_discount]
173
+
174
+ class Filter < Orb::Internal::Type::BaseModel
175
+ # @!attribute field
176
+ # The property of the price to filter on.
177
+ #
178
+ # @return [Symbol, Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field]
179
+ required :field,
180
+ enum: -> { Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field }
181
+
182
+ # @!attribute operator
183
+ # Should prices that match the filter be included or excluded.
184
+ #
185
+ # @return [Symbol, Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Operator]
186
+ required :operator,
187
+ enum: -> { Orb::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Operator }
188
+
189
+ # @!attribute values
190
+ # The IDs or values that match this filter.
191
+ #
192
+ # @return [Array<String>]
193
+ required :values, Orb::Internal::Type::ArrayOf[String]
194
+
195
+ # @!method initialize(field:, operator:, values:)
196
+ # @param field [Symbol, Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Field] The property of the price to filter on.
197
+ #
198
+ # @param operator [Symbol, Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter::Operator] Should prices that match the filter be included or excluded.
199
+ #
200
+ # @param values [Array<String>] The IDs or values that match this filter.
201
+
202
+ # The property of the price to filter on.
203
+ #
204
+ # @see Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter#field
205
+ module Field
206
+ extend Orb::Internal::Type::Enum
207
+
208
+ PRICE_ID = :price_id
209
+ ITEM_ID = :item_id
210
+ PRICE_TYPE = :price_type
211
+ CURRENCY = :currency
212
+ PRICING_UNIT_ID = :pricing_unit_id
213
+
214
+ # @!method self.values
215
+ # @return [Array<Symbol>]
216
+ end
217
+
218
+ # Should prices that match the filter be included or excluded.
219
+ #
220
+ # @see Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Filter#operator
221
+ module Operator
222
+ extend Orb::Internal::Type::Enum
223
+
224
+ INCLUDES = :includes
225
+ EXCLUDES = :excludes
226
+
227
+ # @!method self.values
228
+ # @return [Array<Symbol>]
229
+ end
230
+ end
231
+
232
+ class Tier < Orb::Internal::Type::BaseModel
233
+ # @!attribute lower_bound
234
+ # Exclusive lower bound of cumulative spend for this tier.
235
+ #
236
+ # @return [Float]
237
+ required :lower_bound, Float
238
+
239
+ # @!attribute percentage
240
+ # The percentage (between 0 and 1) discounted from spend that falls within this
241
+ # tier.
242
+ #
243
+ # @return [Float]
244
+ required :percentage, Float
245
+
246
+ # @!attribute upper_bound
247
+ # Inclusive upper bound of cumulative spend for this tier; null for the final
248
+ # open-ended tier.
249
+ #
250
+ # @return [Float, nil]
251
+ optional :upper_bound, Float, nil?: true
252
+
253
+ # @!method initialize(lower_bound:, percentage:, upper_bound: nil)
254
+ # Some parameter documentations has been truncated, see
255
+ # {Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount::Tier}
256
+ # for more details.
257
+ #
258
+ # One band of a tiered percentage discount. Bounds are denominated in the
259
+ # discount's currency. `lower_bound` is the exclusive start of the band and
260
+ # `upper_bound` is the inclusive end; `upper_bound` is null only for the
261
+ # open-ended final tier.
262
+ #
263
+ # @param lower_bound [Float] Exclusive lower bound of cumulative spend for this tier.
264
+ #
265
+ # @param percentage [Float] The percentage (between 0 and 1) discounted from spend that falls within this ti
266
+ #
267
+ # @param upper_bound [Float, nil] Inclusive upper bound of cumulative spend for this tier; null for the final open
268
+ end
269
+ end
270
+
271
+ # @!method self.variants
272
+ # @return [Array(Orb::Models::PlanPhaseUsageDiscountAdjustment, Orb::Models::PlanPhaseAmountDiscountAdjustment, Orb::Models::PlanPhasePercentageDiscountAdjustment, Orb::Models::Plans::PlanVersionDraft::Adjustment::TieredPercentageDiscount, Orb::Models::PlanPhaseMinimumAdjustment, Orb::Models::PlanPhaseMaximumAdjustment)]
273
+ end
274
+ end
275
+ end
276
+
277
+ PlanVersionDraft = Plans::PlanVersionDraft
278
+ end
279
+ end
@@ -36,13 +36,17 @@ module Orb
36
36
 
37
37
  # @!attribute customer_id
38
38
  #
39
- # @return [Array<String>, nil]
40
- optional :customer_id, Orb::Internal::Type::ArrayOf[String], nil?: true
39
+ # @return [String, Array<String>, nil]
40
+ optional :customer_id, union: -> { Orb::SubscriptionListParams::CustomerID }, nil?: true
41
41
 
42
42
  # @!attribute external_customer_id
43
43
  #
44
- # @return [Array<String>, nil]
45
- optional :external_customer_id, Orb::Internal::Type::ArrayOf[String], nil?: true
44
+ # @return [String, Array<String>, nil]
45
+ optional :external_customer_id,
46
+ union: -> {
47
+ Orb::SubscriptionListParams::ExternalCustomerID
48
+ },
49
+ nil?: true
46
50
 
47
51
  # @!attribute external_plan_id
48
52
  #
@@ -62,8 +66,8 @@ module Orb
62
66
 
63
67
  # @!attribute status
64
68
  #
65
- # @return [Symbol, Orb::Models::SubscriptionListParams::Status, nil]
66
- optional :status, enum: -> { Orb::SubscriptionListParams::Status }, nil?: true
69
+ # @return [Symbol, Orb::Models::SubscriptionStatusFilter, Array<Symbol, Orb::Models::SubscriptionStatusFilter>, nil]
70
+ optional :status, union: -> { Orb::SubscriptionListParams::Status }, nil?: true
67
71
 
68
72
  # @!method initialize(created_at_gt: nil, created_at_gte: nil, created_at_lt: nil, created_at_lte: nil, cursor: nil, customer_id: nil, external_customer_id: nil, external_plan_id: nil, limit: nil, plan_id: nil, status: nil, request_options: {})
69
73
  # Some parameter documentations has been truncated, see
@@ -79,9 +83,9 @@ module Orb
79
83
  #
80
84
  # @param cursor [String, nil] Cursor for pagination. This can be populated by the `next_cursor` value returned
81
85
  #
82
- # @param customer_id [Array<String>, nil]
86
+ # @param customer_id [String, Array<String>, nil]
83
87
  #
84
- # @param external_customer_id [Array<String>, nil]
88
+ # @param external_customer_id [String, Array<String>, nil]
85
89
  #
86
90
  # @param external_plan_id [String, nil]
87
91
  #
@@ -89,19 +93,52 @@ module Orb
89
93
  #
90
94
  # @param plan_id [String, nil]
91
95
  #
92
- # @param status [Symbol, Orb::Models::SubscriptionListParams::Status, nil]
96
+ # @param status [Symbol, Orb::Models::SubscriptionStatusFilter, Array<Symbol, Orb::Models::SubscriptionStatusFilter>, nil]
93
97
  #
94
98
  # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
95
99
 
100
+ module CustomerID
101
+ extend Orb::Internal::Type::Union
102
+
103
+ variant String
104
+
105
+ variant -> { Orb::Models::SubscriptionListParams::CustomerID::StringArray }
106
+
107
+ # @!method self.variants
108
+ # @return [Array(String, Array<String>)]
109
+
110
+ # @type [Orb::Internal::Type::Converter]
111
+ StringArray = Orb::Internal::Type::ArrayOf[String]
112
+ end
113
+
114
+ module ExternalCustomerID
115
+ extend Orb::Internal::Type::Union
116
+
117
+ variant String
118
+
119
+ variant -> { Orb::Models::SubscriptionListParams::ExternalCustomerID::StringArray }
120
+
121
+ # @!method self.variants
122
+ # @return [Array(String, Array<String>)]
123
+
124
+ # @type [Orb::Internal::Type::Converter]
125
+ StringArray = Orb::Internal::Type::ArrayOf[String]
126
+ end
127
+
96
128
  module Status
97
- extend Orb::Internal::Type::Enum
129
+ extend Orb::Internal::Type::Union
130
+
131
+ variant enum: -> { Orb::SubscriptionStatusFilter }
132
+
133
+ variant -> { Orb::Models::SubscriptionListParams::Status::SubscriptionStatusFilterArray }
98
134
 
99
- ACTIVE = :active
100
- ENDED = :ended
101
- UPCOMING = :upcoming
135
+ # @!method self.variants
136
+ # @return [Array(Symbol, Orb::Models::SubscriptionStatusFilter, Array<Symbol, Orb::Models::SubscriptionStatusFilter>)]
102
137
 
103
- # @!method self.values
104
- # @return [Array<Symbol>]
138
+ # @type [Orb::Internal::Type::Converter]
139
+ SubscriptionStatusFilterArray = Orb::Internal::Type::ArrayOf[enum: -> {
140
+ Orb::SubscriptionStatusFilter
141
+ }]
105
142
  end
106
143
  end
107
144
  end
@@ -36,13 +36,15 @@ module Orb
36
36
 
37
37
  # @!attribute customer_id
38
38
  #
39
- # @return [String, nil]
40
- optional :customer_id, String, nil?: true
39
+ # @return [String, Array<String>, nil]
40
+ optional :customer_id, union: -> { Orb::SubscriptionListSummaryParams::CustomerID }, nil?: true
41
41
 
42
42
  # @!attribute external_customer_id
43
43
  #
44
- # @return [String, nil]
45
- optional :external_customer_id, String, nil?: true
44
+ # @return [String, Array<String>, nil]
45
+ optional :external_customer_id,
46
+ union: -> { Orb::SubscriptionListSummaryParams::ExternalCustomerID },
47
+ nil?: true
46
48
 
47
49
  # @!attribute external_plan_id
48
50
  #
@@ -62,8 +64,8 @@ module Orb
62
64
 
63
65
  # @!attribute status
64
66
  #
65
- # @return [Symbol, Orb::Models::SubscriptionListSummaryParams::Status, nil]
66
- optional :status, enum: -> { Orb::SubscriptionListSummaryParams::Status }, nil?: true
67
+ # @return [Symbol, Orb::Models::SubscriptionStatusFilter, Array<Symbol, Orb::Models::SubscriptionStatusFilter>, nil]
68
+ optional :status, union: -> { Orb::SubscriptionListSummaryParams::Status }, nil?: true
67
69
 
68
70
  # @!method initialize(created_at_gt: nil, created_at_gte: nil, created_at_lt: nil, created_at_lte: nil, cursor: nil, customer_id: nil, external_customer_id: nil, external_plan_id: nil, limit: nil, plan_id: nil, status: nil, request_options: {})
69
71
  # Some parameter documentations has been truncated, see
@@ -79,9 +81,9 @@ module Orb
79
81
  #
80
82
  # @param cursor [String, nil] Cursor for pagination. This can be populated by the `next_cursor` value returned
81
83
  #
82
- # @param customer_id [String, nil]
84
+ # @param customer_id [String, Array<String>, nil]
83
85
  #
84
- # @param external_customer_id [String, nil]
86
+ # @param external_customer_id [String, Array<String>, nil]
85
87
  #
86
88
  # @param external_plan_id [String, nil]
87
89
  #
@@ -89,19 +91,52 @@ module Orb
89
91
  #
90
92
  # @param plan_id [String, nil]
91
93
  #
92
- # @param status [Symbol, Orb::Models::SubscriptionListSummaryParams::Status, nil]
94
+ # @param status [Symbol, Orb::Models::SubscriptionStatusFilter, Array<Symbol, Orb::Models::SubscriptionStatusFilter>, nil]
93
95
  #
94
96
  # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
95
97
 
98
+ module CustomerID
99
+ extend Orb::Internal::Type::Union
100
+
101
+ variant String
102
+
103
+ variant -> { Orb::Models::SubscriptionListSummaryParams::CustomerID::StringArray }
104
+
105
+ # @!method self.variants
106
+ # @return [Array(String, Array<String>)]
107
+
108
+ # @type [Orb::Internal::Type::Converter]
109
+ StringArray = Orb::Internal::Type::ArrayOf[String]
110
+ end
111
+
112
+ module ExternalCustomerID
113
+ extend Orb::Internal::Type::Union
114
+
115
+ variant String
116
+
117
+ variant -> { Orb::Models::SubscriptionListSummaryParams::ExternalCustomerID::StringArray }
118
+
119
+ # @!method self.variants
120
+ # @return [Array(String, Array<String>)]
121
+
122
+ # @type [Orb::Internal::Type::Converter]
123
+ StringArray = Orb::Internal::Type::ArrayOf[String]
124
+ end
125
+
96
126
  module Status
97
- extend Orb::Internal::Type::Enum
127
+ extend Orb::Internal::Type::Union
128
+
129
+ variant enum: -> { Orb::SubscriptionStatusFilter }
130
+
131
+ variant -> { Orb::Models::SubscriptionListSummaryParams::Status::SubscriptionStatusFilterArray }
98
132
 
99
- ACTIVE = :active
100
- ENDED = :ended
101
- UPCOMING = :upcoming
133
+ # @!method self.variants
134
+ # @return [Array(Symbol, Orb::Models::SubscriptionStatusFilter, Array<Symbol, Orb::Models::SubscriptionStatusFilter>)]
102
135
 
103
- # @!method self.values
104
- # @return [Array<Symbol>]
136
+ # @type [Orb::Internal::Type::Converter]
137
+ SubscriptionStatusFilterArray = Orb::Internal::Type::ArrayOf[enum: -> {
138
+ Orb::SubscriptionStatusFilter
139
+ }]
105
140
  end
106
141
  end
107
142
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orb
4
+ module Models
5
+ module SubscriptionStatusFilter
6
+ extend Orb::Internal::Type::Enum
7
+
8
+ ACTIVE = :active
9
+ ENDED = :ended
10
+ UPCOMING = :upcoming
11
+
12
+ # @!method self.values
13
+ # @return [Array<Symbol>]
14
+ end
15
+ end
16
+ end
data/lib/orb/models.rb CHANGED
@@ -81,14 +81,6 @@ module Orb
81
81
 
82
82
  BackfillRevertedWebhookEvent = Orb::Models::BackfillRevertedWebhookEvent
83
83
 
84
- Beta = Orb::Models::Beta
85
-
86
- BetaCreatePlanVersionParams = Orb::Models::BetaCreatePlanVersionParams
87
-
88
- BetaFetchPlanVersionParams = Orb::Models::BetaFetchPlanVersionParams
89
-
90
- BetaSetDefaultPlanVersionParams = Orb::Models::BetaSetDefaultPlanVersionParams
91
-
92
84
  BillableMetric = Orb::Models::BillableMetric
93
85
 
94
86
  BillableMetricEditedWebhookEvent = Orb::Models::BillableMetricEditedWebhookEvent
@@ -337,6 +329,8 @@ module Orb
337
329
 
338
330
  InvoiceRegenerateReceiptPdfParams = Orb::Models::InvoiceRegenerateReceiptPdfParams
339
331
 
332
+ InvoiceStatusFilter = Orb::Models::InvoiceStatusFilter
333
+
340
334
  InvoiceSyncFailedWebhookEvent = Orb::Models::InvoiceSyncFailedWebhookEvent
341
335
 
342
336
  InvoiceSyncSucceededWebhookEvent = Orb::Models::InvoiceSyncSucceededWebhookEvent
@@ -643,12 +637,16 @@ module Orb
643
637
 
644
638
  PlanCreateParams = Orb::Models::PlanCreateParams
645
639
 
640
+ PlanCreatePlanVersionParams = Orb::Models::PlanCreatePlanVersionParams
641
+
646
642
  PlanDefaultVersionSetWebhookEvent = Orb::Models::PlanDefaultVersionSetWebhookEvent
647
643
 
648
644
  PlanEditedWebhookEvent = Orb::Models::PlanEditedWebhookEvent
649
645
 
650
646
  PlanFetchParams = Orb::Models::PlanFetchParams
651
647
 
648
+ PlanFetchPlanVersionParams = Orb::Models::PlanFetchPlanVersionParams
649
+
652
650
  PlanListParams = Orb::Models::PlanListParams
653
651
 
654
652
  PlanPhaseAmountDiscountAdjustment = Orb::Models::PlanPhaseAmountDiscountAdjustment
@@ -663,6 +661,8 @@ module Orb
663
661
 
664
662
  Plans = Orb::Models::Plans
665
663
 
664
+ PlanSetDefaultPlanVersionParams = Orb::Models::PlanSetDefaultPlanVersionParams
665
+
666
666
  PlanUpdateParams = Orb::Models::PlanUpdateParams
667
667
 
668
668
  PlanVersion = Orb::Models::PlanVersion
@@ -790,6 +790,8 @@ module Orb
790
790
 
791
791
  SubscriptionStartedWebhookEvent = Orb::Models::SubscriptionStartedWebhookEvent
792
792
 
793
+ SubscriptionStatusFilter = Orb::Models::SubscriptionStatusFilter
794
+
793
795
  SubscriptionTrialEndedWebhookEvent = Orb::Models::SubscriptionTrialEndedWebhookEvent
794
796
 
795
797
  SubscriptionTrialInfo = Orb::Models::SubscriptionTrialInfo
@@ -155,6 +155,17 @@ module Orb
155
155
  # 3. If `invoice_settings` is specified, an invoice will be created that reflects
156
156
  # the cost of the credits (based on `amount` and `per_unit_cost_basis`).
157
157
  #
158
+ # ## Currency
159
+ #
160
+ # `currency` sets which currency or custom pricing unit ledger the entry applies
161
+ # to. It is optional: if it is omitted, Orb uses the customer's default ledger
162
+ # pricing unit, which may not be the one you intend. We recommend passing
163
+ # `currency` explicitly on every ledger entry.
164
+ #
165
+ # For entries that act on an existing block (`void`, `amendment`, and
166
+ # `expiration_change`), `currency` must match the block's pricing unit. Otherwise
167
+ # the request fails with a currency mismatch error.
168
+ #
158
169
  # ## Adding credits
159
170
  #
160
171
  # Adding credits is done by creating an entry of type `increment`. This requires
@@ -255,6 +266,23 @@ module Orb
255
266
  # how many credits to void, up to the block's initial balance. Pass in a
256
267
  # `void_reason` of `refund` if the void is due to a refund.
257
268
  #
269
+ # Pass `currency` set to the block's currency or custom pricing unit. If it is
270
+ # omitted and the block is not in the customer's default ledger pricing unit, the
271
+ # request fails with a currency mismatch error.
272
+ #
273
+ # The following snippet illustrates a sample request body to void 50 credits from
274
+ # a block that uses a custom pricing unit named `tokens`:
275
+ #
276
+ # ```json
277
+ # {
278
+ # "entry_type": "void",
279
+ # "block_id": "UiUhFWeLHPrBY4Ad",
280
+ # "amount": 50,
281
+ # "currency": "tokens",
282
+ # "void_reason": "refund"
283
+ # }
284
+ # ```
285
+ #
258
286
  # ## Amendment
259
287
  #
260
288
  # If you'd like to undo a decrement on a credit block, create a ledger entry of
@@ -300,6 +328,17 @@ module Orb
300
328
  # 3. If `invoice_settings` is specified, an invoice will be created that reflects
301
329
  # the cost of the credits (based on `amount` and `per_unit_cost_basis`).
302
330
  #
331
+ # ## Currency
332
+ #
333
+ # `currency` sets which currency or custom pricing unit ledger the entry applies
334
+ # to. It is optional: if it is omitted, Orb uses the customer's default ledger
335
+ # pricing unit, which may not be the one you intend. We recommend passing
336
+ # `currency` explicitly on every ledger entry.
337
+ #
338
+ # For entries that act on an existing block (`void`, `amendment`, and
339
+ # `expiration_change`), `currency` must match the block's pricing unit. Otherwise
340
+ # the request fails with a currency mismatch error.
341
+ #
303
342
  # ## Adding credits
304
343
  #
305
344
  # Adding credits is done by creating an entry of type `increment`. This requires
@@ -400,6 +439,23 @@ module Orb
400
439
  # how many credits to void, up to the block's initial balance. Pass in a
401
440
  # `void_reason` of `refund` if the void is due to a refund.
402
441
  #
442
+ # Pass `currency` set to the block's currency or custom pricing unit. If it is
443
+ # omitted and the block is not in the customer's default ledger pricing unit, the
444
+ # request fails with a currency mismatch error.
445
+ #
446
+ # The following snippet illustrates a sample request body to void 50 credits from
447
+ # a block that uses a custom pricing unit named `tokens`:
448
+ #
449
+ # ```json
450
+ # {
451
+ # "entry_type": "void",
452
+ # "block_id": "UiUhFWeLHPrBY4Ad",
453
+ # "amount": 50,
454
+ # "currency": "tokens",
455
+ # "void_reason": "refund"
456
+ # }
457
+ # ```
458
+ #
403
459
  # ## Amendment
404
460
  #
405
461
  # If you'd like to undo a decrement on a credit block, create a ledger entry of