orb-billing 1.56.0 → 1.58.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +1 -1
- data/lib/orb/client.rb +0 -8
- data/lib/orb/models/migration_create_params.rb +10 -1
- data/lib/orb/models/plan.rb +9 -1
- data/lib/orb/models/{beta_create_plan_version_params.rb → plan_create_plan_version_params.rb} +430 -430
- data/lib/orb/models/{beta_fetch_plan_version_params.rb → plan_fetch_plan_version_params.rb} +2 -2
- data/lib/orb/models/{beta_set_default_plan_version_params.rb → plan_set_default_plan_version_params.rb} +2 -2
- data/lib/orb/models/plan_version.rb +1 -1
- data/lib/orb/models/plans/draft_discard_params.rb +22 -0
- data/lib/orb/models/plans/draft_fetch_params.rb +22 -0
- data/lib/orb/models/plans/draft_publish_params.rb +31 -0
- data/lib/orb/models/plans/draft_save_params.rb +7522 -0
- data/lib/orb/models/plans/external_plan_id/draft_discard_params.rb +24 -0
- data/lib/orb/models/plans/external_plan_id/draft_fetch_params.rb +24 -0
- data/lib/orb/models/plans/external_plan_id/draft_publish_params.rb +33 -0
- data/lib/orb/models/plans/external_plan_id/draft_save_params.rb +7595 -0
- data/lib/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rb +430 -430
- data/lib/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rb +2 -2
- data/lib/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rb +2 -2
- data/lib/orb/models/plans/plan_version_draft.rb +279 -0
- data/lib/orb/models.rb +6 -8
- data/lib/orb/resources/migrations.rb +3 -1
- data/lib/orb/resources/plans/draft.rb +124 -0
- data/lib/orb/resources/plans/external_plan_id/draft.rb +126 -0
- data/lib/orb/resources/plans/external_plan_id.rb +96 -0
- data/lib/orb/resources/plans.rb +96 -0
- data/lib/orb/version.rb +1 -1
- data/lib/orb.rb +17 -8
- data/rbi/orb/client.rbi +0 -7
- data/rbi/orb/models/migration_create_params.rbi +13 -0
- data/rbi/orb/models/plan.rbi +8 -0
- data/rbi/orb/models/{beta_create_plan_version_params.rbi → plan_create_plan_version_params.rbi} +744 -744
- data/rbi/orb/models/{beta_fetch_plan_version_params.rbi → plan_fetch_plan_version_params.rbi} +2 -2
- data/rbi/orb/models/{beta_set_default_plan_version_params.rbi → plan_set_default_plan_version_params.rbi} +2 -2
- data/rbi/orb/models/plans/draft_discard_params.rbi +37 -0
- data/rbi/orb/models/plans/draft_fetch_params.rbi +37 -0
- data/rbi/orb/models/plans/draft_publish_params.rbi +54 -0
- data/rbi/orb/models/plans/draft_save_params.rbi +13143 -0
- data/rbi/orb/models/plans/external_plan_id/draft_discard_params.rbi +42 -0
- data/rbi/orb/models/plans/external_plan_id/draft_fetch_params.rbi +42 -0
- data/rbi/orb/models/plans/external_plan_id/draft_publish_params.rbi +59 -0
- data/rbi/orb/models/plans/external_plan_id/draft_save_params.rbi +13256 -0
- data/rbi/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rbi +744 -744
- data/rbi/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rbi +2 -2
- data/rbi/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rbi +2 -2
- data/rbi/orb/models/plans/plan_version_draft.rbi +502 -0
- data/rbi/orb/models.rbi +6 -8
- data/rbi/orb/resources/migrations.rbi +4 -0
- data/rbi/orb/resources/{beta/external_plan_id.rbi → plans/draft.rbi} +58 -59
- data/rbi/orb/resources/plans/external_plan_id/draft.rbi +126 -0
- data/rbi/orb/resources/plans/external_plan_id.rbi +102 -0
- data/rbi/orb/resources/plans.rbi +94 -0
- data/sig/orb/client.rbs +0 -2
- data/sig/orb/models/migration_create_params.rbs +7 -0
- data/sig/orb/models/plan.rbs +5 -0
- data/sig/orb/models/{beta_create_plan_version_params.rbs → plan_create_plan_version_params.rbs} +448 -448
- data/sig/orb/models/{beta_fetch_plan_version_params.rbs → plan_fetch_plan_version_params.rbs} +2 -2
- data/sig/orb/models/{beta_set_default_plan_version_params.rbs → plan_set_default_plan_version_params.rbs} +2 -2
- data/sig/orb/models/plans/draft_discard_params.rbs +25 -0
- data/sig/orb/models/plans/draft_fetch_params.rbs +25 -0
- data/sig/orb/models/plans/draft_publish_params.rbs +32 -0
- data/sig/orb/models/plans/draft_save_params.rbs +5210 -0
- data/sig/orb/models/plans/external_plan_id/draft_discard_params.rbs +27 -0
- data/sig/orb/models/plans/external_plan_id/draft_fetch_params.rbs +27 -0
- data/sig/orb/models/plans/external_plan_id/draft_publish_params.rbs +34 -0
- data/sig/orb/models/plans/external_plan_id/draft_save_params.rbs +5215 -0
- data/sig/orb/models/{beta → plans}/external_plan_id_create_plan_version_params.rbs +447 -447
- data/sig/orb/models/{beta → plans}/external_plan_id_fetch_plan_version_params.rbs +1 -1
- data/sig/orb/models/{beta → plans}/external_plan_id_set_default_plan_version_params.rbs +1 -1
- data/sig/orb/models/plans/plan_version_draft.rbs +205 -0
- data/sig/orb/models.rbs +6 -8
- data/sig/orb/resources/migrations.rbs +1 -0
- data/sig/orb/resources/plans/draft.rbs +37 -0
- data/sig/orb/resources/plans/external_plan_id/draft.rbs +39 -0
- data/sig/orb/resources/plans/external_plan_id.rbs +27 -0
- data/sig/orb/resources/plans.rbs +27 -0
- metadata +2038 -2005
- data/lib/orb/resources/beta/external_plan_id.rb +0 -108
- data/lib/orb/resources/beta.rb +0 -114
- data/rbi/orb/resources/beta.rbi +0 -110
- data/sig/orb/resources/beta/external_plan_id.rbs +0 -34
- data/sig/orb/resources/beta.rbs +0 -34
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Models
|
|
5
|
-
module
|
|
6
|
-
# @see Orb::Resources::
|
|
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
|
|
6
|
-
# @see Orb::Resources::
|
|
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
|
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
|
|
@@ -643,12 +635,16 @@ module Orb
|
|
|
643
635
|
|
|
644
636
|
PlanCreateParams = Orb::Models::PlanCreateParams
|
|
645
637
|
|
|
638
|
+
PlanCreatePlanVersionParams = Orb::Models::PlanCreatePlanVersionParams
|
|
639
|
+
|
|
646
640
|
PlanDefaultVersionSetWebhookEvent = Orb::Models::PlanDefaultVersionSetWebhookEvent
|
|
647
641
|
|
|
648
642
|
PlanEditedWebhookEvent = Orb::Models::PlanEditedWebhookEvent
|
|
649
643
|
|
|
650
644
|
PlanFetchParams = Orb::Models::PlanFetchParams
|
|
651
645
|
|
|
646
|
+
PlanFetchPlanVersionParams = Orb::Models::PlanFetchPlanVersionParams
|
|
647
|
+
|
|
652
648
|
PlanListParams = Orb::Models::PlanListParams
|
|
653
649
|
|
|
654
650
|
PlanPhaseAmountDiscountAdjustment = Orb::Models::PlanPhaseAmountDiscountAdjustment
|
|
@@ -663,6 +659,8 @@ module Orb
|
|
|
663
659
|
|
|
664
660
|
Plans = Orb::Models::Plans
|
|
665
661
|
|
|
662
|
+
PlanSetDefaultPlanVersionParams = Orb::Models::PlanSetDefaultPlanVersionParams
|
|
663
|
+
|
|
666
664
|
PlanUpdateParams = Orb::Models::PlanUpdateParams
|
|
667
665
|
|
|
668
666
|
PlanVersion = Orb::Models::PlanVersion
|
|
@@ -21,7 +21,7 @@ module Orb
|
|
|
21
21
|
# filters. Each subscription is migrated asynchronously; fetch the migration to
|
|
22
22
|
# follow its status.
|
|
23
23
|
#
|
|
24
|
-
# @overload create(effective_time:, target_plan_version_number:, allow_invoice_credit_or_void: nil, can_defer_billing: nil, effective_date: nil, excluded_subscription_ids: nil, external_plan_id: nil, in_trial: nil, included_subscription_ids: nil, plan_id: nil, plan_version_numbers: nil, reason: nil, statuses: nil, request_options: {})
|
|
24
|
+
# @overload create(effective_time:, target_plan_version_number:, allow_invoice_credit_or_void: nil, can_defer_billing: nil, effective_date: nil, excluded_subscription_ids: nil, external_plan_id: nil, in_trial: nil, included_subscription_ids: nil, plan_id: nil, plan_version_numbers: nil, reason: nil, skip_grace_period: nil, statuses: nil, request_options: {})
|
|
25
25
|
#
|
|
26
26
|
# @param effective_time [Symbol, Orb::Models::MigrationCreateParams::EffectiveTime] When the migration takes effect: 'immediately', 'requested_date' on `effective_d
|
|
27
27
|
#
|
|
@@ -48,6 +48,8 @@ module Orb
|
|
|
48
48
|
#
|
|
49
49
|
# @param reason [String, nil] Why the migration was created.
|
|
50
50
|
#
|
|
51
|
+
# @param skip_grace_period [Boolean] A new migration waits 5 minutes before it changes any subscriptions, so it can b
|
|
52
|
+
#
|
|
51
53
|
# @param statuses [Array<Symbol, Orb::Models::MigrationCreateParams::Status>] Migrate subscriptions with these statuses. Defaults to active subscriptions.
|
|
52
54
|
#
|
|
53
55
|
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Orb
|
|
4
|
+
module Resources
|
|
5
|
+
class Plans
|
|
6
|
+
# The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
|
|
7
|
+
# subscribed to by a customer. Plans define the billing behavior of the
|
|
8
|
+
# subscription. You can see more about how to configure prices in the
|
|
9
|
+
# [Price resource](/reference/price).
|
|
10
|
+
class Draft
|
|
11
|
+
# This endpoint discards the plan's draft version. Prices and adjustments the
|
|
12
|
+
# draft created stay in the Pricebook.
|
|
13
|
+
#
|
|
14
|
+
# @overload discard(plan_id, request_options: {})
|
|
15
|
+
#
|
|
16
|
+
# @param plan_id [String]
|
|
17
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
18
|
+
#
|
|
19
|
+
# @return [nil]
|
|
20
|
+
#
|
|
21
|
+
# @see Orb::Models::Plans::DraftDiscardParams
|
|
22
|
+
def discard(plan_id, params = {})
|
|
23
|
+
@client.request(
|
|
24
|
+
method: :delete,
|
|
25
|
+
path: ["plans/%1$s/draft", plan_id],
|
|
26
|
+
model: NilClass,
|
|
27
|
+
options: params[:request_options]
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# This endpoint returns the plan's unpublished draft version, with its changes
|
|
32
|
+
# applied on top of the latest published version. It returns a 404 if the plan has
|
|
33
|
+
# no draft.
|
|
34
|
+
#
|
|
35
|
+
# @overload fetch(plan_id, request_options: {})
|
|
36
|
+
#
|
|
37
|
+
# @param plan_id [String]
|
|
38
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
39
|
+
#
|
|
40
|
+
# @return [Orb::Models::Plans::PlanVersionDraft]
|
|
41
|
+
#
|
|
42
|
+
# @see Orb::Models::Plans::DraftFetchParams
|
|
43
|
+
def fetch(plan_id, params = {})
|
|
44
|
+
@client.request(
|
|
45
|
+
method: :get,
|
|
46
|
+
path: ["plans/%1$s/draft", plan_id],
|
|
47
|
+
model: Orb::Plans::PlanVersionDraft,
|
|
48
|
+
options: params[:request_options]
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# This endpoint publishes the plan's draft as the next numbered version. A draft
|
|
53
|
+
# that fails plan version validation is a 400 and is left as it was.
|
|
54
|
+
#
|
|
55
|
+
# @overload publish(plan_id, set_as_default: nil, request_options: {})
|
|
56
|
+
#
|
|
57
|
+
# @param plan_id [String]
|
|
58
|
+
#
|
|
59
|
+
# @param set_as_default [Boolean] Also make the new version the plan's default.
|
|
60
|
+
#
|
|
61
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
62
|
+
#
|
|
63
|
+
# @return [Orb::Models::PlanVersion]
|
|
64
|
+
#
|
|
65
|
+
# @see Orb::Models::Plans::DraftPublishParams
|
|
66
|
+
def publish(plan_id, params = {})
|
|
67
|
+
parsed, options = Orb::Plans::DraftPublishParams.dump_request(params)
|
|
68
|
+
@client.request(
|
|
69
|
+
method: :post,
|
|
70
|
+
path: ["plans/%1$s/draft/publish", plan_id],
|
|
71
|
+
body: parsed,
|
|
72
|
+
model: Orb::PlanVersion,
|
|
73
|
+
options: options
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# This endpoint creates the plan's draft version or fully replaces its changes.
|
|
78
|
+
# The changes are always relative to the latest published version. A save replaces
|
|
79
|
+
# the draft; last write wins.
|
|
80
|
+
#
|
|
81
|
+
# @overload save(plan_id, add_adjustments: nil, add_prices: nil, description: nil, remove_adjustments: nil, remove_prices: nil, replace_adjustments: nil, replace_prices: nil, request_options: {})
|
|
82
|
+
#
|
|
83
|
+
# @param plan_id [String]
|
|
84
|
+
#
|
|
85
|
+
# @param add_adjustments [Array<Orb::Models::Plans::DraftSaveParams::AddAdjustment>, nil] Additional adjustments to be added to the plan.
|
|
86
|
+
#
|
|
87
|
+
# @param add_prices [Array<Orb::Models::Plans::DraftSaveParams::AddPrice>, nil] Additional prices to be added to the plan.
|
|
88
|
+
#
|
|
89
|
+
# @param description [String, nil] Optional description of what changes in this draft
|
|
90
|
+
#
|
|
91
|
+
# @param remove_adjustments [Array<Orb::Models::Plans::DraftSaveParams::RemoveAdjustment>, nil] Adjustments to be removed from the plan.
|
|
92
|
+
#
|
|
93
|
+
# @param remove_prices [Array<Orb::Models::Plans::DraftSaveParams::RemovePrice>, nil] Prices to be removed from the plan.
|
|
94
|
+
#
|
|
95
|
+
# @param replace_adjustments [Array<Orb::Models::Plans::DraftSaveParams::ReplaceAdjustment>, nil] Adjustments to be replaced with additional adjustments on the plan.
|
|
96
|
+
#
|
|
97
|
+
# @param replace_prices [Array<Orb::Models::Plans::DraftSaveParams::ReplacePrice>, nil] Prices to be replaced with additional prices on the plan.
|
|
98
|
+
#
|
|
99
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
100
|
+
#
|
|
101
|
+
# @return [Orb::Models::Plans::PlanVersionDraft]
|
|
102
|
+
#
|
|
103
|
+
# @see Orb::Models::Plans::DraftSaveParams
|
|
104
|
+
def save(plan_id, params = {})
|
|
105
|
+
parsed, options = Orb::Plans::DraftSaveParams.dump_request(params)
|
|
106
|
+
@client.request(
|
|
107
|
+
method: :put,
|
|
108
|
+
path: ["plans/%1$s/draft", plan_id],
|
|
109
|
+
body: parsed,
|
|
110
|
+
model: Orb::Plans::PlanVersionDraft,
|
|
111
|
+
options: options
|
|
112
|
+
)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# @api private
|
|
116
|
+
#
|
|
117
|
+
# @param client [Orb::Client]
|
|
118
|
+
def initialize(client:)
|
|
119
|
+
@client = client
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Orb
|
|
4
|
+
module Resources
|
|
5
|
+
class Plans
|
|
6
|
+
class ExternalPlanID
|
|
7
|
+
# The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
|
|
8
|
+
# subscribed to by a customer. Plans define the billing behavior of the
|
|
9
|
+
# subscription. You can see more about how to configure prices in the
|
|
10
|
+
# [Price resource](/reference/price).
|
|
11
|
+
class Draft
|
|
12
|
+
# This endpoint discards the plan's draft version. Prices and adjustments the
|
|
13
|
+
# draft created stay in the Pricebook.
|
|
14
|
+
#
|
|
15
|
+
# @overload discard(external_plan_id, request_options: {})
|
|
16
|
+
#
|
|
17
|
+
# @param external_plan_id [String]
|
|
18
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
19
|
+
#
|
|
20
|
+
# @return [nil]
|
|
21
|
+
#
|
|
22
|
+
# @see Orb::Models::Plans::ExternalPlanID::DraftDiscardParams
|
|
23
|
+
def discard(external_plan_id, params = {})
|
|
24
|
+
@client.request(
|
|
25
|
+
method: :delete,
|
|
26
|
+
path: ["plans/external_plan_id/%1$s/draft", external_plan_id],
|
|
27
|
+
model: NilClass,
|
|
28
|
+
options: params[:request_options]
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# This endpoint returns the plan's unpublished draft version, with its changes
|
|
33
|
+
# applied on top of the latest published version. It returns a 404 if the plan has
|
|
34
|
+
# no draft.
|
|
35
|
+
#
|
|
36
|
+
# @overload fetch(external_plan_id, request_options: {})
|
|
37
|
+
#
|
|
38
|
+
# @param external_plan_id [String]
|
|
39
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
40
|
+
#
|
|
41
|
+
# @return [Orb::Models::Plans::PlanVersionDraft]
|
|
42
|
+
#
|
|
43
|
+
# @see Orb::Models::Plans::ExternalPlanID::DraftFetchParams
|
|
44
|
+
def fetch(external_plan_id, params = {})
|
|
45
|
+
@client.request(
|
|
46
|
+
method: :get,
|
|
47
|
+
path: ["plans/external_plan_id/%1$s/draft", external_plan_id],
|
|
48
|
+
model: Orb::Plans::PlanVersionDraft,
|
|
49
|
+
options: params[:request_options]
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# This endpoint publishes the plan's draft as the next numbered version. A draft
|
|
54
|
+
# that fails plan version validation is a 400 and is left as it was.
|
|
55
|
+
#
|
|
56
|
+
# @overload publish(external_plan_id, set_as_default: nil, request_options: {})
|
|
57
|
+
#
|
|
58
|
+
# @param external_plan_id [String]
|
|
59
|
+
#
|
|
60
|
+
# @param set_as_default [Boolean] Also make the new version the plan's default.
|
|
61
|
+
#
|
|
62
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
63
|
+
#
|
|
64
|
+
# @return [Orb::Models::PlanVersion]
|
|
65
|
+
#
|
|
66
|
+
# @see Orb::Models::Plans::ExternalPlanID::DraftPublishParams
|
|
67
|
+
def publish(external_plan_id, params = {})
|
|
68
|
+
parsed, options = Orb::Plans::ExternalPlanID::DraftPublishParams.dump_request(params)
|
|
69
|
+
@client.request(
|
|
70
|
+
method: :post,
|
|
71
|
+
path: ["plans/external_plan_id/%1$s/draft/publish", external_plan_id],
|
|
72
|
+
body: parsed,
|
|
73
|
+
model: Orb::PlanVersion,
|
|
74
|
+
options: options
|
|
75
|
+
)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# This endpoint creates the plan's draft version or fully replaces its changes.
|
|
79
|
+
# The changes are always relative to the latest published version. A save replaces
|
|
80
|
+
# the draft; last write wins.
|
|
81
|
+
#
|
|
82
|
+
# @overload save(external_plan_id, add_adjustments: nil, add_prices: nil, description: nil, remove_adjustments: nil, remove_prices: nil, replace_adjustments: nil, replace_prices: nil, request_options: {})
|
|
83
|
+
#
|
|
84
|
+
# @param external_plan_id [String]
|
|
85
|
+
#
|
|
86
|
+
# @param add_adjustments [Array<Orb::Models::Plans::ExternalPlanID::DraftSaveParams::AddAdjustment>, nil] Additional adjustments to be added to the plan.
|
|
87
|
+
#
|
|
88
|
+
# @param add_prices [Array<Orb::Models::Plans::ExternalPlanID::DraftSaveParams::AddPrice>, nil] Additional prices to be added to the plan.
|
|
89
|
+
#
|
|
90
|
+
# @param description [String, nil] Optional description of what changes in this draft
|
|
91
|
+
#
|
|
92
|
+
# @param remove_adjustments [Array<Orb::Models::Plans::ExternalPlanID::DraftSaveParams::RemoveAdjustment>, nil] Adjustments to be removed from the plan.
|
|
93
|
+
#
|
|
94
|
+
# @param remove_prices [Array<Orb::Models::Plans::ExternalPlanID::DraftSaveParams::RemovePrice>, nil] Prices to be removed from the plan.
|
|
95
|
+
#
|
|
96
|
+
# @param replace_adjustments [Array<Orb::Models::Plans::ExternalPlanID::DraftSaveParams::ReplaceAdjustment>, nil] Adjustments to be replaced with additional adjustments on the plan.
|
|
97
|
+
#
|
|
98
|
+
# @param replace_prices [Array<Orb::Models::Plans::ExternalPlanID::DraftSaveParams::ReplacePrice>, nil] Prices to be replaced with additional prices on the plan.
|
|
99
|
+
#
|
|
100
|
+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
101
|
+
#
|
|
102
|
+
# @return [Orb::Models::Plans::PlanVersionDraft]
|
|
103
|
+
#
|
|
104
|
+
# @see Orb::Models::Plans::ExternalPlanID::DraftSaveParams
|
|
105
|
+
def save(external_plan_id, params = {})
|
|
106
|
+
parsed, options = Orb::Plans::ExternalPlanID::DraftSaveParams.dump_request(params)
|
|
107
|
+
@client.request(
|
|
108
|
+
method: :put,
|
|
109
|
+
path: ["plans/external_plan_id/%1$s/draft", external_plan_id],
|
|
110
|
+
body: parsed,
|
|
111
|
+
model: Orb::Plans::PlanVersionDraft,
|
|
112
|
+
options: options
|
|
113
|
+
)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# @api private
|
|
117
|
+
#
|
|
118
|
+
# @param client [Orb::Client]
|
|
119
|
+
def initialize(client:)
|
|
120
|
+
@client = client
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|