Skip to content

Commit 21cfdfc

Browse files
chore: use @!method instead of @!parse for virtual method type definitions
1 parent 3793346 commit 21cfdfc

181 files changed

Lines changed: 13561 additions & 29547 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.yardopts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
--type-name-tag generic:Generic
12
--markup markdown
23
--markup-provider redcarpet
34
--exclude /rbi

lib/orb/internal/page.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,9 @@ class PaginationMetadata < Orb::Internal::Type::BaseModel
101101
# @return [String, nil]
102102
required :next_cursor, String, nil?: true
103103

104-
# @!parse
105-
# # @param has_more [Boolean]
106-
# # @param next_cursor [String, nil]
107-
# #
108-
# def initialize(has_more:, next_cursor:, **) = super
109-
110-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
104+
# @!method initialize(has_more:, next_cursor:)
105+
# @param has_more [Boolean]
106+
# @param next_cursor [String, nil]
111107
end
112108
end
113109
end

lib/orb/internal/type/base_model.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ def deconstruct_keys(keys)
339339
end
340340

341341
class << self
342+
# @api private
343+
#
342344
# @param model [Orb::Internal::Type::BaseModel]
343345
#
344346
# @return [Hash{Symbol=>Object}]

lib/orb/internal/type/enum.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,7 @@ module Enum
4242
# All of the valid Symbol values for this enum.
4343
#
4444
# @return [Array<NilClass, Boolean, Integer, Float, Symbol>]
45-
def values = (@values ||= constants.map { const_get(_1) })
46-
47-
# @api private
48-
#
49-
# Guard against thread safety issues by instantiating `@values`.
50-
private def finalize! = values
45+
def values = constants.map { const_get(_1) }
5146

5247
# @param other [Object]
5348
#

lib/orb/models/alert.rb

Lines changed: 44 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -65,27 +65,23 @@ class Alert < Orb::Internal::Type::BaseModel
6565
# @return [Symbol, Orb::Models::Alert::Type]
6666
required :type, enum: -> { Orb::Models::Alert::Type }
6767

68-
# @!parse
69-
# # [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending,
70-
# # usage, or credit balance and trigger webhooks when a threshold is exceeded.
71-
# #
72-
# # Alerts created through the API can be scoped to either customers or
73-
# # subscriptions.
74-
# #
75-
# # @param id [String]
76-
# # @param created_at [Time]
77-
# # @param currency [String, nil]
78-
# # @param customer [Orb::Models::Alert::Customer, nil]
79-
# # @param enabled [Boolean]
80-
# # @param metric [Orb::Models::Alert::Metric, nil]
81-
# # @param plan [Orb::Models::Alert::Plan, nil]
82-
# # @param subscription [Orb::Models::Alert::Subscription, nil]
83-
# # @param thresholds [Array<Orb::Models::Alert::Threshold>, nil]
84-
# # @param type [Symbol, Orb::Models::Alert::Type]
85-
# #
86-
# def initialize(id:, created_at:, currency:, customer:, enabled:, metric:, plan:, subscription:, thresholds:, type:, **) = super
87-
88-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
68+
# @!method initialize(id:, created_at:, currency:, customer:, enabled:, metric:, plan:, subscription:, thresholds:, type:)
69+
# [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending,
70+
# usage, or credit balance and trigger webhooks when a threshold is exceeded.
71+
#
72+
# Alerts created through the API can be scoped to either customers or
73+
# subscriptions.
74+
#
75+
# @param id [String]
76+
# @param created_at [Time]
77+
# @param currency [String, nil]
78+
# @param customer [Orb::Models::Alert::Customer, nil]
79+
# @param enabled [Boolean]
80+
# @param metric [Orb::Models::Alert::Metric, nil]
81+
# @param plan [Orb::Models::Alert::Plan, nil]
82+
# @param subscription [Orb::Models::Alert::Subscription, nil]
83+
# @param thresholds [Array<Orb::Models::Alert::Threshold>, nil]
84+
# @param type [Symbol, Orb::Models::Alert::Type]
8985

9086
# @see Orb::Models::Alert#customer
9187
class Customer < Orb::Internal::Type::BaseModel
@@ -99,15 +95,11 @@ class Customer < Orb::Internal::Type::BaseModel
9995
# @return [String, nil]
10096
required :external_customer_id, String, nil?: true
10197

102-
# @!parse
103-
# # The customer the alert applies to.
104-
# #
105-
# # @param id [String]
106-
# # @param external_customer_id [String, nil]
107-
# #
108-
# def initialize(id:, external_customer_id:, **) = super
109-
110-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
98+
# @!method initialize(id:, external_customer_id:)
99+
# The customer the alert applies to.
100+
#
101+
# @param id [String]
102+
# @param external_customer_id [String, nil]
111103
end
112104

113105
# @see Orb::Models::Alert#metric
@@ -117,14 +109,10 @@ class Metric < Orb::Internal::Type::BaseModel
117109
# @return [String]
118110
required :id, String
119111

120-
# @!parse
121-
# # The metric the alert applies to.
122-
# #
123-
# # @param id [String]
124-
# #
125-
# def initialize(id:, **) = super
126-
127-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
112+
# @!method initialize(id:)
113+
# The metric the alert applies to.
114+
#
115+
# @param id [String]
128116
end
129117

130118
# @see Orb::Models::Alert#plan
@@ -152,17 +140,13 @@ class Plan < Orb::Internal::Type::BaseModel
152140
# @return [String]
153141
required :plan_version, String
154142

155-
# @!parse
156-
# # The plan the alert applies to.
157-
# #
158-
# # @param id [String, nil]
159-
# # @param external_plan_id [String, nil]
160-
# # @param name [String, nil]
161-
# # @param plan_version [String]
162-
# #
163-
# def initialize(id:, external_plan_id:, name:, plan_version:, **) = super
164-
165-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
143+
# @!method initialize(id:, external_plan_id:, name:, plan_version:)
144+
# The plan the alert applies to.
145+
#
146+
# @param id [String, nil]
147+
# @param external_plan_id [String, nil]
148+
# @param name [String, nil]
149+
# @param plan_version [String]
166150
end
167151

168152
# @see Orb::Models::Alert#subscription
@@ -172,14 +156,10 @@ class Subscription < Orb::Internal::Type::BaseModel
172156
# @return [String]
173157
required :id, String
174158

175-
# @!parse
176-
# # The subscription the alert applies to.
177-
# #
178-
# # @param id [String]
179-
# #
180-
# def initialize(id:, **) = super
181-
182-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
159+
# @!method initialize(id:)
160+
# The subscription the alert applies to.
161+
#
162+
# @param id [String]
183163
end
184164

185165
class Threshold < Orb::Internal::Type::BaseModel
@@ -191,15 +171,11 @@ class Threshold < Orb::Internal::Type::BaseModel
191171
# @return [Float]
192172
required :value, Float
193173

194-
# @!parse
195-
# # Thresholds are used to define the conditions under which an alert will be
196-
# # triggered.
197-
# #
198-
# # @param value [Float]
199-
# #
200-
# def initialize(value:, **) = super
201-
202-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
174+
# @!method initialize(value:)
175+
# Thresholds are used to define the conditions under which an alert will be
176+
# triggered.
177+
#
178+
# @param value [Float]
203179
end
204180

205181
# The type of alert. This must be a valid alert type.
@@ -214,11 +190,8 @@ module Type
214190
USAGE_EXCEEDED = :usage_exceeded
215191
COST_EXCEEDED = :cost_exceeded
216192

217-
finalize!
218-
219-
# @!parse
220-
# # @return [Array<Symbol>]
221-
# def self.values; end
193+
# @!method self.values
194+
# @return [Array<Symbol>]
222195
end
223196
end
224197
end

lib/orb/models/alert_create_for_customer_params.rb

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,11 @@ class AlertCreateForCustomerParams < Orb::Internal::Type::BaseModel
2828
-> { Orb::Internal::Type::ArrayOf[Orb::Models::AlertCreateForCustomerParams::Threshold] },
2929
nil?: true
3030

31-
# @!parse
32-
# # @param currency [String]
33-
# # @param type [Symbol, Orb::Models::AlertCreateForCustomerParams::Type]
34-
# # @param thresholds [Array<Orb::Models::AlertCreateForCustomerParams::Threshold>, nil]
35-
# # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
36-
# #
37-
# def initialize(currency:, type:, thresholds: nil, request_options: {}, **) = super
38-
39-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
31+
# @!method initialize(currency:, type:, thresholds: nil, request_options: {})
32+
# @param currency [String]
33+
# @param type [Symbol, Orb::Models::AlertCreateForCustomerParams::Type]
34+
# @param thresholds [Array<Orb::Models::AlertCreateForCustomerParams::Threshold>, nil]
35+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
4036

4137
# The type of alert to create. This must be a valid alert type.
4238
module Type
@@ -46,11 +42,8 @@ module Type
4642
CREDIT_BALANCE_DROPPED = :credit_balance_dropped
4743
CREDIT_BALANCE_RECOVERED = :credit_balance_recovered
4844

49-
finalize!
50-
51-
# @!parse
52-
# # @return [Array<Symbol>]
53-
# def self.values; end
45+
# @!method self.values
46+
# @return [Array<Symbol>]
5447
end
5548

5649
class Threshold < Orb::Internal::Type::BaseModel
@@ -62,15 +55,11 @@ class Threshold < Orb::Internal::Type::BaseModel
6255
# @return [Float]
6356
required :value, Float
6457

65-
# @!parse
66-
# # Thresholds are used to define the conditions under which an alert will be
67-
# # triggered.
68-
# #
69-
# # @param value [Float]
70-
# #
71-
# def initialize(value:, **) = super
72-
73-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
58+
# @!method initialize(value:)
59+
# Thresholds are used to define the conditions under which an alert will be
60+
# triggered.
61+
#
62+
# @param value [Float]
7463
end
7564
end
7665
end

lib/orb/models/alert_create_for_external_customer_params.rb

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,11 @@ class AlertCreateForExternalCustomerParams < Orb::Internal::Type::BaseModel
2828
-> { Orb::Internal::Type::ArrayOf[Orb::Models::AlertCreateForExternalCustomerParams::Threshold] },
2929
nil?: true
3030

31-
# @!parse
32-
# # @param currency [String]
33-
# # @param type [Symbol, Orb::Models::AlertCreateForExternalCustomerParams::Type]
34-
# # @param thresholds [Array<Orb::Models::AlertCreateForExternalCustomerParams::Threshold>, nil]
35-
# # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
36-
# #
37-
# def initialize(currency:, type:, thresholds: nil, request_options: {}, **) = super
38-
39-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
31+
# @!method initialize(currency:, type:, thresholds: nil, request_options: {})
32+
# @param currency [String]
33+
# @param type [Symbol, Orb::Models::AlertCreateForExternalCustomerParams::Type]
34+
# @param thresholds [Array<Orb::Models::AlertCreateForExternalCustomerParams::Threshold>, nil]
35+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
4036

4137
# The type of alert to create. This must be a valid alert type.
4238
module Type
@@ -46,11 +42,8 @@ module Type
4642
CREDIT_BALANCE_DROPPED = :credit_balance_dropped
4743
CREDIT_BALANCE_RECOVERED = :credit_balance_recovered
4844

49-
finalize!
50-
51-
# @!parse
52-
# # @return [Array<Symbol>]
53-
# def self.values; end
45+
# @!method self.values
46+
# @return [Array<Symbol>]
5447
end
5548

5649
class Threshold < Orb::Internal::Type::BaseModel
@@ -62,15 +55,11 @@ class Threshold < Orb::Internal::Type::BaseModel
6255
# @return [Float]
6356
required :value, Float
6457

65-
# @!parse
66-
# # Thresholds are used to define the conditions under which an alert will be
67-
# # triggered.
68-
# #
69-
# # @param value [Float]
70-
# #
71-
# def initialize(value:, **) = super
72-
73-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
58+
# @!method initialize(value:)
59+
# Thresholds are used to define the conditions under which an alert will be
60+
# triggered.
61+
#
62+
# @param value [Float]
7463
end
7564
end
7665
end

lib/orb/models/alert_create_for_subscription_params.rb

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,11 @@ class AlertCreateForSubscriptionParams < Orb::Internal::Type::BaseModel
2727
# @return [String, nil]
2828
optional :metric_id, String, nil?: true
2929

30-
# @!parse
31-
# # @param thresholds [Array<Orb::Models::AlertCreateForSubscriptionParams::Threshold>]
32-
# # @param type [Symbol, Orb::Models::AlertCreateForSubscriptionParams::Type]
33-
# # @param metric_id [String, nil]
34-
# # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
35-
# #
36-
# def initialize(thresholds:, type:, metric_id: nil, request_options: {}, **) = super
37-
38-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
30+
# @!method initialize(thresholds:, type:, metric_id: nil, request_options: {})
31+
# @param thresholds [Array<Orb::Models::AlertCreateForSubscriptionParams::Threshold>]
32+
# @param type [Symbol, Orb::Models::AlertCreateForSubscriptionParams::Type]
33+
# @param metric_id [String, nil]
34+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
3935

4036
class Threshold < Orb::Internal::Type::BaseModel
4137
# @!attribute value
@@ -46,15 +42,11 @@ class Threshold < Orb::Internal::Type::BaseModel
4642
# @return [Float]
4743
required :value, Float
4844

49-
# @!parse
50-
# # Thresholds are used to define the conditions under which an alert will be
51-
# # triggered.
52-
# #
53-
# # @param value [Float]
54-
# #
55-
# def initialize(value:, **) = super
56-
57-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
45+
# @!method initialize(value:)
46+
# Thresholds are used to define the conditions under which an alert will be
47+
# triggered.
48+
#
49+
# @param value [Float]
5850
end
5951

6052
# The type of alert to create. This must be a valid alert type.
@@ -64,11 +56,8 @@ module Type
6456
USAGE_EXCEEDED = :usage_exceeded
6557
COST_EXCEEDED = :cost_exceeded
6658

67-
finalize!
68-
69-
# @!parse
70-
# # @return [Array<Symbol>]
71-
# def self.values; end
59+
# @!method self.values
60+
# @return [Array<Symbol>]
7261
end
7362
end
7463
end

lib/orb/models/alert_disable_params.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ class AlertDisableParams < Orb::Internal::Type::BaseModel
1414
# @return [String, nil]
1515
optional :subscription_id, String, nil?: true
1616

17-
# @!parse
18-
# # @param subscription_id [String, nil]
19-
# # @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
20-
# #
21-
# def initialize(subscription_id: nil, request_options: {}, **) = super
22-
23-
# def initialize: (Hash | Orb::Internal::Type::BaseModel) -> void
17+
# @!method initialize(subscription_id: nil, request_options: {})
18+
# @param subscription_id [String, nil]
19+
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
2420
end
2521
end
2622
end

0 commit comments

Comments
 (0)