Skip to content

Commit afa2343

Browse files
chore: improve documentation (#144)
1 parent 1e20ed1 commit afa2343

15 files changed

+6131
-6134
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ customer = orb.customers.create(email: "example-customer@withorb.com", name: "My
4343
puts(customer.id)
4444
```
4545

46-
## Pagination
46+
### Pagination
4747

4848
List methods in the Orb API are paginated.
4949

lib/orb/base_page.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ module Orb
55
#
66
# @abstract
77
#
8+
# @example
9+
# ```ruby
10+
# if page.has_next?
11+
# page = page.next_page
12+
# end
13+
# ```
14+
#
15+
# @example
16+
# ```ruby
17+
# page.auto_paging_each do |top_level|
18+
# puts(top_level)
19+
# end
20+
# ```
21+
#
22+
# @example
23+
# ```ruby
24+
# top_levels = page.to_enum.take(2)
25+
#
26+
# top_levels => Array
27+
# ```
828
module BasePage
929
# @return [Boolean]
1030
#

lib/orb/page.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ module Orb
1010
#
1111
# @example
1212
# ```ruby
13-
# page.auto_paging_each do |item|
14-
# # item ...
13+
# page.auto_paging_each do |coupon|
14+
# puts(coupon)
1515
# end
1616
# ```
1717
#
1818
# @example
1919
# ```ruby
20-
# items = page.to_enum.take(2)
20+
# coupons = page.to_enum.take(2)
2121
#
22-
# items => Array
22+
# coupons => Array
2323
# ```
2424
class Page
2525
include Orb::BasePage

rbi/lib/orb/models/subscription_create_params.rbi

Lines changed: 2022 additions & 2036 deletions
Large diffs are not rendered by default.

rbi/lib/orb/models/subscription_create_response.rbi

Lines changed: 252 additions & 258 deletions
Large diffs are not rendered by default.

rbi/lib/orb/models/subscription_fetch_costs_params.rbi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ module Orb
4040

4141
sig do
4242
params(
43-
currency: T.nilable(String),
44-
timeframe_end: T.nilable(Time),
45-
timeframe_start: T.nilable(Time),
46-
view_mode: T.nilable(Symbol),
47-
request_options: T.any(Orb::RequestOptions, T::Hash[Symbol, T.anything])
48-
)
43+
currency: T.nilable(String),
44+
timeframe_end: T.nilable(Time),
45+
timeframe_start: T.nilable(Time),
46+
view_mode: T.nilable(Symbol),
47+
request_options: T.any(Orb::RequestOptions, T::Hash[Symbol, T.anything])
48+
)
4949
.returns(T.attached_class)
5050
end
5151
def self.new(currency: nil, timeframe_end: nil, timeframe_start: nil, view_mode: nil, request_options: {})

rbi/lib/orb/models/subscription_fetch_costs_response.rbi

Lines changed: 101 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ module Orb
6868

6969
sig do
7070
params(
71-
per_price_costs: T::Array[Orb::Models::SubscriptionFetchCostsResponse::Data::PerPriceCost],
72-
subtotal: String,
73-
timeframe_end: Time,
74-
timeframe_start: Time,
75-
total: String
76-
)
71+
per_price_costs: T::Array[Orb::Models::SubscriptionFetchCostsResponse::Data::PerPriceCost],
72+
subtotal: String,
73+
timeframe_end: Time,
74+
timeframe_start: Time,
75+
total: String
76+
)
7777
.returns(T.attached_class)
7878
end
7979
def self.new(per_price_costs:, subtotal:, timeframe_end:, timeframe_start:, total:)
@@ -97,74 +97,74 @@ module Orb
9797
class PerPriceCost < Orb::BaseModel
9898
sig do
9999
returns(
100-
T.any(
101-
Orb::Models::Price::UnitPrice,
102-
Orb::Models::Price::PackagePrice,
103-
Orb::Models::Price::MatrixPrice,
104-
Orb::Models::Price::TieredPrice,
105-
Orb::Models::Price::TieredBpsPrice,
106-
Orb::Models::Price::BpsPrice,
107-
Orb::Models::Price::BulkBpsPrice,
108-
Orb::Models::Price::BulkPrice,
109-
Orb::Models::Price::ThresholdTotalAmountPrice,
110-
Orb::Models::Price::TieredPackagePrice,
111-
Orb::Models::Price::GroupedTieredPrice,
112-
Orb::Models::Price::TieredWithMinimumPrice,
113-
Orb::Models::Price::TieredPackageWithMinimumPrice,
114-
Orb::Models::Price::PackageWithAllocationPrice,
115-
Orb::Models::Price::UnitWithPercentPrice,
116-
Orb::Models::Price::MatrixWithAllocationPrice,
117-
Orb::Models::Price::TieredWithProrationPrice,
118-
Orb::Models::Price::UnitWithProrationPrice,
119-
Orb::Models::Price::GroupedAllocationPrice,
120-
Orb::Models::Price::GroupedWithProratedMinimumPrice,
121-
Orb::Models::Price::GroupedWithMeteredMinimumPrice,
122-
Orb::Models::Price::MatrixWithDisplayNamePrice,
123-
Orb::Models::Price::BulkWithProrationPrice,
124-
Orb::Models::Price::GroupedTieredPackagePrice,
125-
Orb::Models::Price::MaxGroupTieredPackagePrice,
126-
Orb::Models::Price::ScalableMatrixWithUnitPricingPrice,
127-
Orb::Models::Price::ScalableMatrixWithTieredPricingPrice,
128-
Orb::Models::Price::CumulativeGroupedBulkPrice
100+
T.any(
101+
Orb::Models::Price::UnitPrice,
102+
Orb::Models::Price::PackagePrice,
103+
Orb::Models::Price::MatrixPrice,
104+
Orb::Models::Price::TieredPrice,
105+
Orb::Models::Price::TieredBpsPrice,
106+
Orb::Models::Price::BpsPrice,
107+
Orb::Models::Price::BulkBpsPrice,
108+
Orb::Models::Price::BulkPrice,
109+
Orb::Models::Price::ThresholdTotalAmountPrice,
110+
Orb::Models::Price::TieredPackagePrice,
111+
Orb::Models::Price::GroupedTieredPrice,
112+
Orb::Models::Price::TieredWithMinimumPrice,
113+
Orb::Models::Price::TieredPackageWithMinimumPrice,
114+
Orb::Models::Price::PackageWithAllocationPrice,
115+
Orb::Models::Price::UnitWithPercentPrice,
116+
Orb::Models::Price::MatrixWithAllocationPrice,
117+
Orb::Models::Price::TieredWithProrationPrice,
118+
Orb::Models::Price::UnitWithProrationPrice,
119+
Orb::Models::Price::GroupedAllocationPrice,
120+
Orb::Models::Price::GroupedWithProratedMinimumPrice,
121+
Orb::Models::Price::GroupedWithMeteredMinimumPrice,
122+
Orb::Models::Price::MatrixWithDisplayNamePrice,
123+
Orb::Models::Price::BulkWithProrationPrice,
124+
Orb::Models::Price::GroupedTieredPackagePrice,
125+
Orb::Models::Price::MaxGroupTieredPackagePrice,
126+
Orb::Models::Price::ScalableMatrixWithUnitPricingPrice,
127+
Orb::Models::Price::ScalableMatrixWithTieredPricingPrice,
128+
Orb::Models::Price::CumulativeGroupedBulkPrice
129+
)
129130
)
130-
)
131131
end
132132
def price
133133
end
134134

135135
sig do
136136
params(
137-
_: T.any(
138-
Orb::Models::Price::UnitPrice,
139-
Orb::Models::Price::PackagePrice,
140-
Orb::Models::Price::MatrixPrice,
141-
Orb::Models::Price::TieredPrice,
142-
Orb::Models::Price::TieredBpsPrice,
143-
Orb::Models::Price::BpsPrice,
144-
Orb::Models::Price::BulkBpsPrice,
145-
Orb::Models::Price::BulkPrice,
146-
Orb::Models::Price::ThresholdTotalAmountPrice,
147-
Orb::Models::Price::TieredPackagePrice,
148-
Orb::Models::Price::GroupedTieredPrice,
149-
Orb::Models::Price::TieredWithMinimumPrice,
150-
Orb::Models::Price::TieredPackageWithMinimumPrice,
151-
Orb::Models::Price::PackageWithAllocationPrice,
152-
Orb::Models::Price::UnitWithPercentPrice,
153-
Orb::Models::Price::MatrixWithAllocationPrice,
154-
Orb::Models::Price::TieredWithProrationPrice,
155-
Orb::Models::Price::UnitWithProrationPrice,
156-
Orb::Models::Price::GroupedAllocationPrice,
157-
Orb::Models::Price::GroupedWithProratedMinimumPrice,
158-
Orb::Models::Price::GroupedWithMeteredMinimumPrice,
159-
Orb::Models::Price::MatrixWithDisplayNamePrice,
160-
Orb::Models::Price::BulkWithProrationPrice,
161-
Orb::Models::Price::GroupedTieredPackagePrice,
162-
Orb::Models::Price::MaxGroupTieredPackagePrice,
163-
Orb::Models::Price::ScalableMatrixWithUnitPricingPrice,
164-
Orb::Models::Price::ScalableMatrixWithTieredPricingPrice,
165-
Orb::Models::Price::CumulativeGroupedBulkPrice
137+
_: T.any(
138+
Orb::Models::Price::UnitPrice,
139+
Orb::Models::Price::PackagePrice,
140+
Orb::Models::Price::MatrixPrice,
141+
Orb::Models::Price::TieredPrice,
142+
Orb::Models::Price::TieredBpsPrice,
143+
Orb::Models::Price::BpsPrice,
144+
Orb::Models::Price::BulkBpsPrice,
145+
Orb::Models::Price::BulkPrice,
146+
Orb::Models::Price::ThresholdTotalAmountPrice,
147+
Orb::Models::Price::TieredPackagePrice,
148+
Orb::Models::Price::GroupedTieredPrice,
149+
Orb::Models::Price::TieredWithMinimumPrice,
150+
Orb::Models::Price::TieredPackageWithMinimumPrice,
151+
Orb::Models::Price::PackageWithAllocationPrice,
152+
Orb::Models::Price::UnitWithPercentPrice,
153+
Orb::Models::Price::MatrixWithAllocationPrice,
154+
Orb::Models::Price::TieredWithProrationPrice,
155+
Orb::Models::Price::UnitWithProrationPrice,
156+
Orb::Models::Price::GroupedAllocationPrice,
157+
Orb::Models::Price::GroupedWithProratedMinimumPrice,
158+
Orb::Models::Price::GroupedWithMeteredMinimumPrice,
159+
Orb::Models::Price::MatrixWithDisplayNamePrice,
160+
Orb::Models::Price::BulkWithProrationPrice,
161+
Orb::Models::Price::GroupedTieredPackagePrice,
162+
Orb::Models::Price::MaxGroupTieredPackagePrice,
163+
Orb::Models::Price::ScalableMatrixWithUnitPricingPrice,
164+
Orb::Models::Price::ScalableMatrixWithTieredPricingPrice,
165+
Orb::Models::Price::CumulativeGroupedBulkPrice
166+
)
166167
)
167-
)
168168
.returns(
169169
T.any(
170170
Orb::Models::Price::UnitPrice,
@@ -235,41 +235,41 @@ module Orb
235235

236236
sig do
237237
params(
238-
price: T.any(
239-
Orb::Models::Price::UnitPrice,
240-
Orb::Models::Price::PackagePrice,
241-
Orb::Models::Price::MatrixPrice,
242-
Orb::Models::Price::TieredPrice,
243-
Orb::Models::Price::TieredBpsPrice,
244-
Orb::Models::Price::BpsPrice,
245-
Orb::Models::Price::BulkBpsPrice,
246-
Orb::Models::Price::BulkPrice,
247-
Orb::Models::Price::ThresholdTotalAmountPrice,
248-
Orb::Models::Price::TieredPackagePrice,
249-
Orb::Models::Price::GroupedTieredPrice,
250-
Orb::Models::Price::TieredWithMinimumPrice,
251-
Orb::Models::Price::TieredPackageWithMinimumPrice,
252-
Orb::Models::Price::PackageWithAllocationPrice,
253-
Orb::Models::Price::UnitWithPercentPrice,
254-
Orb::Models::Price::MatrixWithAllocationPrice,
255-
Orb::Models::Price::TieredWithProrationPrice,
256-
Orb::Models::Price::UnitWithProrationPrice,
257-
Orb::Models::Price::GroupedAllocationPrice,
258-
Orb::Models::Price::GroupedWithProratedMinimumPrice,
259-
Orb::Models::Price::GroupedWithMeteredMinimumPrice,
260-
Orb::Models::Price::MatrixWithDisplayNamePrice,
261-
Orb::Models::Price::BulkWithProrationPrice,
262-
Orb::Models::Price::GroupedTieredPackagePrice,
263-
Orb::Models::Price::MaxGroupTieredPackagePrice,
264-
Orb::Models::Price::ScalableMatrixWithUnitPricingPrice,
265-
Orb::Models::Price::ScalableMatrixWithTieredPricingPrice,
266-
Orb::Models::Price::CumulativeGroupedBulkPrice
267-
),
268-
price_id: String,
269-
subtotal: String,
270-
total: String,
271-
quantity: T.nilable(Float)
272-
)
238+
price: T.any(
239+
Orb::Models::Price::UnitPrice,
240+
Orb::Models::Price::PackagePrice,
241+
Orb::Models::Price::MatrixPrice,
242+
Orb::Models::Price::TieredPrice,
243+
Orb::Models::Price::TieredBpsPrice,
244+
Orb::Models::Price::BpsPrice,
245+
Orb::Models::Price::BulkBpsPrice,
246+
Orb::Models::Price::BulkPrice,
247+
Orb::Models::Price::ThresholdTotalAmountPrice,
248+
Orb::Models::Price::TieredPackagePrice,
249+
Orb::Models::Price::GroupedTieredPrice,
250+
Orb::Models::Price::TieredWithMinimumPrice,
251+
Orb::Models::Price::TieredPackageWithMinimumPrice,
252+
Orb::Models::Price::PackageWithAllocationPrice,
253+
Orb::Models::Price::UnitWithPercentPrice,
254+
Orb::Models::Price::MatrixWithAllocationPrice,
255+
Orb::Models::Price::TieredWithProrationPrice,
256+
Orb::Models::Price::UnitWithProrationPrice,
257+
Orb::Models::Price::GroupedAllocationPrice,
258+
Orb::Models::Price::GroupedWithProratedMinimumPrice,
259+
Orb::Models::Price::GroupedWithMeteredMinimumPrice,
260+
Orb::Models::Price::MatrixWithDisplayNamePrice,
261+
Orb::Models::Price::BulkWithProrationPrice,
262+
Orb::Models::Price::GroupedTieredPackagePrice,
263+
Orb::Models::Price::MaxGroupTieredPackagePrice,
264+
Orb::Models::Price::ScalableMatrixWithUnitPricingPrice,
265+
Orb::Models::Price::ScalableMatrixWithTieredPricingPrice,
266+
Orb::Models::Price::CumulativeGroupedBulkPrice
267+
),
268+
price_id: String,
269+
subtotal: String,
270+
total: String,
271+
quantity: T.nilable(Float)
272+
)
273273
.returns(T.attached_class)
274274
end
275275
def self.new(price:, price_id:, subtotal:, total:, quantity: nil)

rbi/lib/orb/models/subscription_fetch_params.rbi

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,7 @@ module Orb
66
extend Orb::RequestParameters::Converter
77
include Orb::RequestParameters
88

9-
sig do
10-
params(
11-
request_options: T.any(
12-
Orb::RequestOptions,
13-
T::Hash[Symbol, T.anything]
14-
)
15-
).returns(T.attached_class)
16-
end
9+
sig { params(request_options: T.any(Orb::RequestOptions, T::Hash[Symbol, T.anything])).returns(T.attached_class) }
1710
def self.new(request_options: {})
1811
end
1912

rbi/lib/orb/models/subscription_fetch_schedule_params.rbi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ module Orb
5656

5757
sig do
5858
params(
59-
cursor: T.nilable(String),
60-
limit: Integer,
61-
start_date_gt: T.nilable(Time),
62-
start_date_gte: T.nilable(Time),
63-
start_date_lt: T.nilable(Time),
64-
start_date_lte: T.nilable(Time),
65-
request_options: T.any(Orb::RequestOptions, T::Hash[Symbol, T.anything])
66-
)
59+
cursor: T.nilable(String),
60+
limit: Integer,
61+
start_date_gt: T.nilable(Time),
62+
start_date_gte: T.nilable(Time),
63+
start_date_lt: T.nilable(Time),
64+
start_date_lte: T.nilable(Time),
65+
request_options: T.any(Orb::RequestOptions, T::Hash[Symbol, T.anything])
66+
)
6767
.returns(T.attached_class)
6868
end
6969
def self.new(

rbi/lib/orb/models/subscription_fetch_schedule_response.rbi

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ module Orb
4040

4141
sig do
4242
params(
43-
created_at: Time,
44-
end_date: T.nilable(Time),
45-
plan: Orb::Models::SubscriptionFetchScheduleResponse::Plan,
46-
start_date: Time
47-
)
43+
created_at: Time,
44+
end_date: T.nilable(Time),
45+
plan: Orb::Models::SubscriptionFetchScheduleResponse::Plan,
46+
start_date: Time
47+
)
4848
.returns(T.attached_class)
4949
end
5050
def self.new(created_at:, end_date:, plan:, start_date:)
@@ -96,15 +96,7 @@ module Orb
9696
def self.new(id:, external_plan_id:, name:)
9797
end
9898

99-
sig do
100-
override.returns(
101-
{
102-
id: T.nilable(String),
103-
external_plan_id: T.nilable(String),
104-
name: T.nilable(String)
105-
}
106-
)
107-
end
99+
sig { override.returns({id: T.nilable(String), external_plan_id: T.nilable(String), name: T.nilable(String)}) }
108100
def to_hash
109101
end
110102
end

0 commit comments

Comments
 (0)