dodopayments 1.51.0 → 1.52.4
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 +18 -0
- data/README.md +1 -1
- data/lib/dodopayments/client.rb +8 -0
- data/lib/dodopayments/models/add_meter_to_price.rb +58 -0
- data/lib/dodopayments/models/event.rb +71 -0
- data/lib/dodopayments/models/event_input.rb +70 -0
- data/lib/dodopayments/models/invoices/payment_retrieve_refund_params.rb +16 -0
- data/lib/dodopayments/models/meter.rb +88 -0
- data/lib/dodopayments/models/meter_aggregation.rb +40 -0
- data/lib/dodopayments/models/meter_archive_params.rb +14 -0
- data/lib/dodopayments/models/meter_create_params.rb +62 -0
- data/lib/dodopayments/models/meter_filter.rb +482 -0
- data/lib/dodopayments/models/meter_list_params.rb +38 -0
- data/lib/dodopayments/models/{product_delete_params.rb → meter_retrieve_params.rb} +2 -2
- data/lib/dodopayments/models/meter_unarchive_params.rb +14 -0
- data/lib/dodopayments/models/price.rb +122 -7
- data/lib/dodopayments/models/product.rb +2 -2
- data/lib/dodopayments/models/product_archive_params.rb +14 -0
- data/lib/dodopayments/models/product_create_params.rb +2 -2
- data/lib/dodopayments/models/product_list_response.rb +2 -2
- data/lib/dodopayments/models/product_update_params.rb +2 -2
- data/lib/dodopayments/models/subscription_retrieve_usage_history_params.rb +54 -0
- data/lib/dodopayments/models/subscription_retrieve_usage_history_response.rb +101 -0
- data/lib/dodopayments/models/usage_event_ingest_params.rb +22 -0
- data/lib/dodopayments/models/usage_event_ingest_response.rb +16 -0
- data/lib/dodopayments/models/usage_event_list_params.rb +75 -0
- data/lib/dodopayments/models/usage_event_retrieve_params.rb +14 -0
- data/lib/dodopayments/models.rb +32 -2
- data/lib/dodopayments/resources/invoices/payments.rb +18 -0
- data/lib/dodopayments/resources/meters.rb +123 -0
- data/lib/dodopayments/resources/products.rb +5 -5
- data/lib/dodopayments/resources/subscriptions.rb +74 -0
- data/lib/dodopayments/resources/usage_events.rb +193 -0
- data/lib/dodopayments/version.rb +1 -1
- data/lib/dodopayments.rb +21 -1
- data/rbi/dodopayments/client.rbi +6 -0
- data/rbi/dodopayments/models/add_meter_to_price.rbi +75 -0
- data/rbi/dodopayments/models/event.rbi +88 -0
- data/rbi/dodopayments/models/event_input.rbi +102 -0
- data/rbi/dodopayments/models/invoices/payment_retrieve_refund_params.rbi +34 -0
- data/rbi/dodopayments/models/meter.rbi +107 -0
- data/rbi/dodopayments/models/meter_aggregation.rbi +73 -0
- data/rbi/dodopayments/models/meter_archive_params.rbi +32 -0
- data/rbi/dodopayments/models/meter_create_params.rbi +92 -0
- data/rbi/dodopayments/models/meter_filter.rbi +1042 -0
- data/rbi/dodopayments/models/meter_list_params.rbi +68 -0
- data/rbi/dodopayments/models/{product_delete_params.rbi → meter_retrieve_params.rbi} +2 -2
- data/rbi/dodopayments/models/meter_unarchive_params.rbi +32 -0
- data/rbi/dodopayments/models/price.rbi +153 -7
- data/rbi/dodopayments/models/product.rbi +2 -1
- data/rbi/dodopayments/models/product_archive_params.rbi +32 -0
- data/rbi/dodopayments/models/product_create_params.rbi +6 -3
- data/rbi/dodopayments/models/product_list_response.rbi +2 -1
- data/rbi/dodopayments/models/product_update_params.rbi +6 -3
- data/rbi/dodopayments/models/subscription_retrieve_usage_history_params.rbi +78 -0
- data/rbi/dodopayments/models/subscription_retrieve_usage_history_response.rbi +159 -0
- data/rbi/dodopayments/models/usage_event_ingest_params.rbi +46 -0
- data/rbi/dodopayments/models/usage_event_ingest_response.rbi +26 -0
- data/rbi/dodopayments/models/usage_event_list_params.rbi +119 -0
- data/rbi/dodopayments/models/usage_event_retrieve_params.rbi +32 -0
- data/rbi/dodopayments/models.rbi +33 -2
- data/rbi/dodopayments/resources/invoices/payments.rbi +9 -0
- data/rbi/dodopayments/resources/meters.rbi +102 -0
- data/rbi/dodopayments/resources/products.rbi +5 -3
- data/rbi/dodopayments/resources/subscriptions.rbi +74 -0
- data/rbi/dodopayments/resources/usage_events.rbi +175 -0
- data/sig/dodopayments/client.rbs +4 -0
- data/sig/dodopayments/models/add_meter_to_price.rbs +45 -0
- data/sig/dodopayments/models/event.rbs +53 -0
- data/sig/dodopayments/models/event_input.rbs +48 -0
- data/sig/dodopayments/models/invoices/payment_retrieve_refund_params.rbs +17 -0
- data/sig/dodopayments/models/meter.rbs +65 -0
- data/sig/dodopayments/models/meter_aggregation.rbs +36 -0
- data/sig/dodopayments/models/meter_archive_params.rbs +15 -0
- data/sig/dodopayments/models/meter_create_params.rbs +51 -0
- data/sig/dodopayments/models/meter_filter.rbs +417 -0
- data/sig/dodopayments/models/meter_list_params.rbs +38 -0
- data/sig/dodopayments/models/{product_delete_params.rbs → meter_retrieve_params.rbs} +2 -2
- data/sig/dodopayments/models/meter_unarchive_params.rbs +15 -0
- data/sig/dodopayments/models/price.rbs +88 -9
- data/sig/dodopayments/models/product_archive_params.rbs +15 -0
- data/sig/dodopayments/models/subscription_retrieve_usage_history_params.rbs +46 -0
- data/sig/dodopayments/models/subscription_retrieve_usage_history_response.rbs +82 -0
- data/sig/dodopayments/models/usage_event_ingest_params.rbs +24 -0
- data/sig/dodopayments/models/usage_event_ingest_response.rbs +13 -0
- data/sig/dodopayments/models/usage_event_list_params.rbs +70 -0
- data/sig/dodopayments/models/usage_event_retrieve_params.rbs +15 -0
- data/sig/dodopayments/models.rbs +32 -2
- data/sig/dodopayments/resources/invoices/payments.rbs +5 -0
- data/sig/dodopayments/resources/meters.rbs +39 -0
- data/sig/dodopayments/resources/products.rbs +1 -1
- data/sig/dodopayments/resources/subscriptions.rbs +10 -0
- data/sig/dodopayments/resources/usage_events.rbs +28 -0
- metadata +65 -5
@@ -0,0 +1,68 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
class MeterListParams < Dodopayments::Internal::Type::BaseModel
|
6
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
7
|
+
include Dodopayments::Internal::Type::RequestParameters
|
8
|
+
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(Dodopayments::MeterListParams, Dodopayments::Internal::AnyHash)
|
12
|
+
end
|
13
|
+
|
14
|
+
# List archived meters
|
15
|
+
sig { returns(T.nilable(T::Boolean)) }
|
16
|
+
attr_reader :archived
|
17
|
+
|
18
|
+
sig { params(archived: T::Boolean).void }
|
19
|
+
attr_writer :archived
|
20
|
+
|
21
|
+
# Page number default is 0
|
22
|
+
sig { returns(T.nilable(Integer)) }
|
23
|
+
attr_reader :page_number
|
24
|
+
|
25
|
+
sig { params(page_number: Integer).void }
|
26
|
+
attr_writer :page_number
|
27
|
+
|
28
|
+
# Page size default is 10 max is 100
|
29
|
+
sig { returns(T.nilable(Integer)) }
|
30
|
+
attr_reader :page_size
|
31
|
+
|
32
|
+
sig { params(page_size: Integer).void }
|
33
|
+
attr_writer :page_size
|
34
|
+
|
35
|
+
sig do
|
36
|
+
params(
|
37
|
+
archived: T::Boolean,
|
38
|
+
page_number: Integer,
|
39
|
+
page_size: Integer,
|
40
|
+
request_options: Dodopayments::RequestOptions::OrHash
|
41
|
+
).returns(T.attached_class)
|
42
|
+
end
|
43
|
+
def self.new(
|
44
|
+
# List archived meters
|
45
|
+
archived: nil,
|
46
|
+
# Page number default is 0
|
47
|
+
page_number: nil,
|
48
|
+
# Page size default is 10 max is 100
|
49
|
+
page_size: nil,
|
50
|
+
request_options: {}
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
sig do
|
55
|
+
override.returns(
|
56
|
+
{
|
57
|
+
archived: T::Boolean,
|
58
|
+
page_number: Integer,
|
59
|
+
page_size: Integer,
|
60
|
+
request_options: Dodopayments::RequestOptions
|
61
|
+
}
|
62
|
+
)
|
63
|
+
end
|
64
|
+
def to_hash
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
module Dodopayments
|
4
4
|
module Models
|
5
|
-
class
|
5
|
+
class MeterRetrieveParams < Dodopayments::Internal::Type::BaseModel
|
6
6
|
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
7
7
|
include Dodopayments::Internal::Type::RequestParameters
|
8
8
|
|
9
9
|
OrHash =
|
10
10
|
T.type_alias do
|
11
11
|
T.any(
|
12
|
-
Dodopayments::
|
12
|
+
Dodopayments::MeterRetrieveParams,
|
13
13
|
Dodopayments::Internal::AnyHash
|
14
14
|
)
|
15
15
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
class MeterUnarchiveParams < Dodopayments::Internal::Type::BaseModel
|
6
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
7
|
+
include Dodopayments::Internal::Type::RequestParameters
|
8
|
+
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(
|
12
|
+
Dodopayments::MeterUnarchiveParams,
|
13
|
+
Dodopayments::Internal::AnyHash
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
sig do
|
18
|
+
params(request_options: Dodopayments::RequestOptions::OrHash).returns(
|
19
|
+
T.attached_class
|
20
|
+
)
|
21
|
+
end
|
22
|
+
def self.new(request_options: {})
|
23
|
+
end
|
24
|
+
|
25
|
+
sig do
|
26
|
+
override.returns({ request_options: Dodopayments::RequestOptions })
|
27
|
+
end
|
28
|
+
def to_hash
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -10,7 +10,8 @@ module Dodopayments
|
|
10
10
|
T.type_alias do
|
11
11
|
T.any(
|
12
12
|
Dodopayments::Price::OneTimePrice,
|
13
|
-
Dodopayments::Price::RecurringPrice
|
13
|
+
Dodopayments::Price::RecurringPrice,
|
14
|
+
Dodopayments::Price::UsageBasedPrice
|
14
15
|
)
|
15
16
|
end
|
16
17
|
|
@@ -28,7 +29,7 @@ module Dodopayments
|
|
28
29
|
attr_accessor :currency
|
29
30
|
|
30
31
|
# Discount applied to the price, represented as a percentage (0 to 100).
|
31
|
-
sig { returns(
|
32
|
+
sig { returns(Integer) }
|
32
33
|
attr_accessor :discount
|
33
34
|
|
34
35
|
# The payment amount, in the smallest denomination of the currency (e.g., cents
|
@@ -69,7 +70,7 @@ module Dodopayments
|
|
69
70
|
sig do
|
70
71
|
params(
|
71
72
|
currency: Dodopayments::Currency::OrSymbol,
|
72
|
-
discount:
|
73
|
+
discount: Integer,
|
73
74
|
price: Integer,
|
74
75
|
purchasing_power_parity: T::Boolean,
|
75
76
|
type: Dodopayments::Price::OneTimePrice::Type::OrSymbol,
|
@@ -109,7 +110,7 @@ module Dodopayments
|
|
109
110
|
override.returns(
|
110
111
|
{
|
111
112
|
currency: Dodopayments::Currency::OrSymbol,
|
112
|
-
discount:
|
113
|
+
discount: Integer,
|
113
114
|
price: Integer,
|
114
115
|
purchasing_power_parity: T::Boolean,
|
115
116
|
type: Dodopayments::Price::OneTimePrice::Type::OrSymbol,
|
@@ -161,7 +162,7 @@ module Dodopayments
|
|
161
162
|
attr_accessor :currency
|
162
163
|
|
163
164
|
# Discount applied to the price, represented as a percentage (0 to 100).
|
164
|
-
sig { returns(
|
165
|
+
sig { returns(Integer) }
|
165
166
|
attr_accessor :discount
|
166
167
|
|
167
168
|
# Number of units for the payment frequency. For example, a value of `1` with a
|
@@ -210,7 +211,7 @@ module Dodopayments
|
|
210
211
|
sig do
|
211
212
|
params(
|
212
213
|
currency: Dodopayments::Currency::OrSymbol,
|
213
|
-
discount:
|
214
|
+
discount: Integer,
|
214
215
|
payment_frequency_count: Integer,
|
215
216
|
payment_frequency_interval: Dodopayments::TimeInterval::OrSymbol,
|
216
217
|
price: Integer,
|
@@ -255,7 +256,7 @@ module Dodopayments
|
|
255
256
|
override.returns(
|
256
257
|
{
|
257
258
|
currency: Dodopayments::Currency::OrSymbol,
|
258
|
-
discount:
|
259
|
+
discount: Integer,
|
259
260
|
payment_frequency_count: Integer,
|
260
261
|
payment_frequency_interval: Dodopayments::TimeInterval::OrSymbol,
|
261
262
|
price: Integer,
|
@@ -297,6 +298,151 @@ module Dodopayments
|
|
297
298
|
end
|
298
299
|
end
|
299
300
|
|
301
|
+
class UsageBasedPrice < Dodopayments::Internal::Type::BaseModel
|
302
|
+
OrHash =
|
303
|
+
T.type_alias do
|
304
|
+
T.any(
|
305
|
+
Dodopayments::Price::UsageBasedPrice,
|
306
|
+
Dodopayments::Internal::AnyHash
|
307
|
+
)
|
308
|
+
end
|
309
|
+
|
310
|
+
# The currency in which the payment is made.
|
311
|
+
sig { returns(Dodopayments::Currency::OrSymbol) }
|
312
|
+
attr_accessor :currency
|
313
|
+
|
314
|
+
# Discount applied to the price, represented as a percentage (0 to 100).
|
315
|
+
sig { returns(Integer) }
|
316
|
+
attr_accessor :discount
|
317
|
+
|
318
|
+
# The fixed payment amount. Represented in the lowest denomination of the currency
|
319
|
+
# (e.g., cents for USD). For example, to charge $1.00, pass `100`.
|
320
|
+
sig { returns(Integer) }
|
321
|
+
attr_accessor :fixed_price
|
322
|
+
|
323
|
+
# Number of units for the payment frequency. For example, a value of `1` with a
|
324
|
+
# `payment_frequency_interval` of `month` represents monthly payments.
|
325
|
+
sig { returns(Integer) }
|
326
|
+
attr_accessor :payment_frequency_count
|
327
|
+
|
328
|
+
# The time interval for the payment frequency (e.g., day, month, year).
|
329
|
+
sig { returns(Dodopayments::TimeInterval::OrSymbol) }
|
330
|
+
attr_accessor :payment_frequency_interval
|
331
|
+
|
332
|
+
# Indicates if purchasing power parity adjustments are applied to the price.
|
333
|
+
# Purchasing power parity feature is not available as of now
|
334
|
+
sig { returns(T::Boolean) }
|
335
|
+
attr_accessor :purchasing_power_parity
|
336
|
+
|
337
|
+
# Number of units for the subscription period. For example, a value of `12` with a
|
338
|
+
# `subscription_period_interval` of `month` represents a one-year subscription.
|
339
|
+
sig { returns(Integer) }
|
340
|
+
attr_accessor :subscription_period_count
|
341
|
+
|
342
|
+
# The time interval for the subscription period (e.g., day, month, year).
|
343
|
+
sig { returns(Dodopayments::TimeInterval::OrSymbol) }
|
344
|
+
attr_accessor :subscription_period_interval
|
345
|
+
|
346
|
+
sig { returns(Dodopayments::Price::UsageBasedPrice::Type::OrSymbol) }
|
347
|
+
attr_accessor :type
|
348
|
+
|
349
|
+
sig { returns(T.nilable(T::Array[Dodopayments::AddMeterToPrice])) }
|
350
|
+
attr_accessor :meters
|
351
|
+
|
352
|
+
# Indicates if the price is tax inclusive
|
353
|
+
sig { returns(T.nilable(T::Boolean)) }
|
354
|
+
attr_accessor :tax_inclusive
|
355
|
+
|
356
|
+
# Usage Based price details.
|
357
|
+
sig do
|
358
|
+
params(
|
359
|
+
currency: Dodopayments::Currency::OrSymbol,
|
360
|
+
discount: Integer,
|
361
|
+
fixed_price: Integer,
|
362
|
+
payment_frequency_count: Integer,
|
363
|
+
payment_frequency_interval: Dodopayments::TimeInterval::OrSymbol,
|
364
|
+
purchasing_power_parity: T::Boolean,
|
365
|
+
subscription_period_count: Integer,
|
366
|
+
subscription_period_interval: Dodopayments::TimeInterval::OrSymbol,
|
367
|
+
type: Dodopayments::Price::UsageBasedPrice::Type::OrSymbol,
|
368
|
+
meters: T.nilable(T::Array[Dodopayments::AddMeterToPrice::OrHash]),
|
369
|
+
tax_inclusive: T.nilable(T::Boolean)
|
370
|
+
).returns(T.attached_class)
|
371
|
+
end
|
372
|
+
def self.new(
|
373
|
+
# The currency in which the payment is made.
|
374
|
+
currency:,
|
375
|
+
# Discount applied to the price, represented as a percentage (0 to 100).
|
376
|
+
discount:,
|
377
|
+
# The fixed payment amount. Represented in the lowest denomination of the currency
|
378
|
+
# (e.g., cents for USD). For example, to charge $1.00, pass `100`.
|
379
|
+
fixed_price:,
|
380
|
+
# Number of units for the payment frequency. For example, a value of `1` with a
|
381
|
+
# `payment_frequency_interval` of `month` represents monthly payments.
|
382
|
+
payment_frequency_count:,
|
383
|
+
# The time interval for the payment frequency (e.g., day, month, year).
|
384
|
+
payment_frequency_interval:,
|
385
|
+
# Indicates if purchasing power parity adjustments are applied to the price.
|
386
|
+
# Purchasing power parity feature is not available as of now
|
387
|
+
purchasing_power_parity:,
|
388
|
+
# Number of units for the subscription period. For example, a value of `12` with a
|
389
|
+
# `subscription_period_interval` of `month` represents a one-year subscription.
|
390
|
+
subscription_period_count:,
|
391
|
+
# The time interval for the subscription period (e.g., day, month, year).
|
392
|
+
subscription_period_interval:,
|
393
|
+
type:,
|
394
|
+
meters: nil,
|
395
|
+
# Indicates if the price is tax inclusive
|
396
|
+
tax_inclusive: nil
|
397
|
+
)
|
398
|
+
end
|
399
|
+
|
400
|
+
sig do
|
401
|
+
override.returns(
|
402
|
+
{
|
403
|
+
currency: Dodopayments::Currency::OrSymbol,
|
404
|
+
discount: Integer,
|
405
|
+
fixed_price: Integer,
|
406
|
+
payment_frequency_count: Integer,
|
407
|
+
payment_frequency_interval: Dodopayments::TimeInterval::OrSymbol,
|
408
|
+
purchasing_power_parity: T::Boolean,
|
409
|
+
subscription_period_count: Integer,
|
410
|
+
subscription_period_interval:
|
411
|
+
Dodopayments::TimeInterval::OrSymbol,
|
412
|
+
type: Dodopayments::Price::UsageBasedPrice::Type::OrSymbol,
|
413
|
+
meters: T.nilable(T::Array[Dodopayments::AddMeterToPrice]),
|
414
|
+
tax_inclusive: T.nilable(T::Boolean)
|
415
|
+
}
|
416
|
+
)
|
417
|
+
end
|
418
|
+
def to_hash
|
419
|
+
end
|
420
|
+
|
421
|
+
module Type
|
422
|
+
extend Dodopayments::Internal::Type::Enum
|
423
|
+
|
424
|
+
TaggedSymbol =
|
425
|
+
T.type_alias do
|
426
|
+
T.all(Symbol, Dodopayments::Price::UsageBasedPrice::Type)
|
427
|
+
end
|
428
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
429
|
+
|
430
|
+
USAGE_BASED_PRICE =
|
431
|
+
T.let(
|
432
|
+
:usage_based_price,
|
433
|
+
Dodopayments::Price::UsageBasedPrice::Type::TaggedSymbol
|
434
|
+
)
|
435
|
+
|
436
|
+
sig do
|
437
|
+
override.returns(
|
438
|
+
T::Array[Dodopayments::Price::UsageBasedPrice::Type::TaggedSymbol]
|
439
|
+
)
|
440
|
+
end
|
441
|
+
def self.values
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
|
300
446
|
sig { override.returns(T::Array[Dodopayments::Price::Variants]) }
|
301
447
|
def self.variants
|
302
448
|
end
|
@@ -105,7 +105,8 @@ module Dodopayments
|
|
105
105
|
price:
|
106
106
|
T.any(
|
107
107
|
Dodopayments::Price::OneTimePrice::OrHash,
|
108
|
-
Dodopayments::Price::RecurringPrice::OrHash
|
108
|
+
Dodopayments::Price::RecurringPrice::OrHash,
|
109
|
+
Dodopayments::Price::UsageBasedPrice::OrHash
|
109
110
|
),
|
110
111
|
product_id: String,
|
111
112
|
tax_category: Dodopayments::TaxCategory::OrSymbol,
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
class ProductArchiveParams < Dodopayments::Internal::Type::BaseModel
|
6
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
7
|
+
include Dodopayments::Internal::Type::RequestParameters
|
8
|
+
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(
|
12
|
+
Dodopayments::ProductArchiveParams,
|
13
|
+
Dodopayments::Internal::AnyHash
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
sig do
|
18
|
+
params(request_options: Dodopayments::RequestOptions::OrHash).returns(
|
19
|
+
T.attached_class
|
20
|
+
)
|
21
|
+
end
|
22
|
+
def self.new(request_options: {})
|
23
|
+
end
|
24
|
+
|
25
|
+
sig do
|
26
|
+
override.returns({ request_options: Dodopayments::RequestOptions })
|
27
|
+
end
|
28
|
+
def to_hash
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -19,7 +19,8 @@ module Dodopayments
|
|
19
19
|
returns(
|
20
20
|
T.any(
|
21
21
|
Dodopayments::Price::OneTimePrice,
|
22
|
-
Dodopayments::Price::RecurringPrice
|
22
|
+
Dodopayments::Price::RecurringPrice,
|
23
|
+
Dodopayments::Price::UsageBasedPrice
|
23
24
|
)
|
24
25
|
)
|
25
26
|
end
|
@@ -101,7 +102,8 @@ module Dodopayments
|
|
101
102
|
price:
|
102
103
|
T.any(
|
103
104
|
Dodopayments::Price::OneTimePrice::OrHash,
|
104
|
-
Dodopayments::Price::RecurringPrice::OrHash
|
105
|
+
Dodopayments::Price::RecurringPrice::OrHash,
|
106
|
+
Dodopayments::Price::UsageBasedPrice::OrHash
|
105
107
|
),
|
106
108
|
tax_category: Dodopayments::TaxCategory::OrSymbol,
|
107
109
|
addons: T.nilable(T::Array[String]),
|
@@ -158,7 +160,8 @@ module Dodopayments
|
|
158
160
|
price:
|
159
161
|
T.any(
|
160
162
|
Dodopayments::Price::OneTimePrice,
|
161
|
-
Dodopayments::Price::RecurringPrice
|
163
|
+
Dodopayments::Price::RecurringPrice,
|
164
|
+
Dodopayments::Price::UsageBasedPrice
|
162
165
|
),
|
163
166
|
tax_category: Dodopayments::TaxCategory::OrSymbol,
|
164
167
|
addons: T.nilable(T::Array[String]),
|
@@ -94,7 +94,8 @@ module Dodopayments
|
|
94
94
|
T.nilable(
|
95
95
|
T.any(
|
96
96
|
Dodopayments::Price::OneTimePrice::OrHash,
|
97
|
-
Dodopayments::Price::RecurringPrice::OrHash
|
97
|
+
Dodopayments::Price::RecurringPrice::OrHash,
|
98
|
+
Dodopayments::Price::UsageBasedPrice::OrHash
|
98
99
|
)
|
99
100
|
),
|
100
101
|
tax_inclusive: T.nilable(T::Boolean)
|
@@ -97,7 +97,8 @@ module Dodopayments
|
|
97
97
|
T.nilable(
|
98
98
|
T.any(
|
99
99
|
Dodopayments::Price::OneTimePrice,
|
100
|
-
Dodopayments::Price::RecurringPrice
|
100
|
+
Dodopayments::Price::RecurringPrice,
|
101
|
+
Dodopayments::Price::UsageBasedPrice
|
101
102
|
)
|
102
103
|
)
|
103
104
|
)
|
@@ -129,7 +130,8 @@ module Dodopayments
|
|
129
130
|
T.nilable(
|
130
131
|
T.any(
|
131
132
|
Dodopayments::Price::OneTimePrice::OrHash,
|
132
|
-
Dodopayments::Price::RecurringPrice::OrHash
|
133
|
+
Dodopayments::Price::RecurringPrice::OrHash,
|
134
|
+
Dodopayments::Price::UsageBasedPrice::OrHash
|
133
135
|
)
|
134
136
|
),
|
135
137
|
tax_category: T.nilable(Dodopayments::TaxCategory::OrSymbol),
|
@@ -199,7 +201,8 @@ module Dodopayments
|
|
199
201
|
T.nilable(
|
200
202
|
T.any(
|
201
203
|
Dodopayments::Price::OneTimePrice,
|
202
|
-
Dodopayments::Price::RecurringPrice
|
204
|
+
Dodopayments::Price::RecurringPrice,
|
205
|
+
Dodopayments::Price::UsageBasedPrice
|
203
206
|
)
|
204
207
|
),
|
205
208
|
tax_category: T.nilable(Dodopayments::TaxCategory::OrSymbol),
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
class SubscriptionRetrieveUsageHistoryParams < Dodopayments::Internal::Type::BaseModel
|
6
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
7
|
+
include Dodopayments::Internal::Type::RequestParameters
|
8
|
+
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(
|
12
|
+
Dodopayments::SubscriptionRetrieveUsageHistoryParams,
|
13
|
+
Dodopayments::Internal::AnyHash
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Filter by end date (inclusive)
|
18
|
+
sig { returns(T.nilable(Time)) }
|
19
|
+
attr_accessor :end_date
|
20
|
+
|
21
|
+
# Filter by specific meter ID
|
22
|
+
sig { returns(T.nilable(String)) }
|
23
|
+
attr_accessor :meter_id
|
24
|
+
|
25
|
+
# Page number (default: 0)
|
26
|
+
sig { returns(T.nilable(Integer)) }
|
27
|
+
attr_accessor :page_number
|
28
|
+
|
29
|
+
# Page size (default: 10, max: 100)
|
30
|
+
sig { returns(T.nilable(Integer)) }
|
31
|
+
attr_accessor :page_size
|
32
|
+
|
33
|
+
# Filter by start date (inclusive)
|
34
|
+
sig { returns(T.nilable(Time)) }
|
35
|
+
attr_accessor :start_date
|
36
|
+
|
37
|
+
sig do
|
38
|
+
params(
|
39
|
+
end_date: T.nilable(Time),
|
40
|
+
meter_id: T.nilable(String),
|
41
|
+
page_number: T.nilable(Integer),
|
42
|
+
page_size: T.nilable(Integer),
|
43
|
+
start_date: T.nilable(Time),
|
44
|
+
request_options: Dodopayments::RequestOptions::OrHash
|
45
|
+
).returns(T.attached_class)
|
46
|
+
end
|
47
|
+
def self.new(
|
48
|
+
# Filter by end date (inclusive)
|
49
|
+
end_date: nil,
|
50
|
+
# Filter by specific meter ID
|
51
|
+
meter_id: nil,
|
52
|
+
# Page number (default: 0)
|
53
|
+
page_number: nil,
|
54
|
+
# Page size (default: 10, max: 100)
|
55
|
+
page_size: nil,
|
56
|
+
# Filter by start date (inclusive)
|
57
|
+
start_date: nil,
|
58
|
+
request_options: {}
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
sig do
|
63
|
+
override.returns(
|
64
|
+
{
|
65
|
+
end_date: T.nilable(Time),
|
66
|
+
meter_id: T.nilable(String),
|
67
|
+
page_number: T.nilable(Integer),
|
68
|
+
page_size: T.nilable(Integer),
|
69
|
+
start_date: T.nilable(Time),
|
70
|
+
request_options: Dodopayments::RequestOptions
|
71
|
+
}
|
72
|
+
)
|
73
|
+
end
|
74
|
+
def to_hash
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
class SubscriptionRetrieveUsageHistoryResponse < Dodopayments::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(
|
9
|
+
Dodopayments::Models::SubscriptionRetrieveUsageHistoryResponse,
|
10
|
+
Dodopayments::Internal::AnyHash
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
# End date of the billing period
|
15
|
+
sig { returns(Time) }
|
16
|
+
attr_accessor :end_date
|
17
|
+
|
18
|
+
# List of meters and their usage for this billing period
|
19
|
+
sig do
|
20
|
+
returns(
|
21
|
+
T::Array[
|
22
|
+
Dodopayments::Models::SubscriptionRetrieveUsageHistoryResponse::Meter
|
23
|
+
]
|
24
|
+
)
|
25
|
+
end
|
26
|
+
attr_accessor :meters
|
27
|
+
|
28
|
+
# Start date of the billing period
|
29
|
+
sig { returns(Time) }
|
30
|
+
attr_accessor :start_date
|
31
|
+
|
32
|
+
sig do
|
33
|
+
params(
|
34
|
+
end_date: Time,
|
35
|
+
meters:
|
36
|
+
T::Array[
|
37
|
+
Dodopayments::Models::SubscriptionRetrieveUsageHistoryResponse::Meter::OrHash
|
38
|
+
],
|
39
|
+
start_date: Time
|
40
|
+
).returns(T.attached_class)
|
41
|
+
end
|
42
|
+
def self.new(
|
43
|
+
# End date of the billing period
|
44
|
+
end_date:,
|
45
|
+
# List of meters and their usage for this billing period
|
46
|
+
meters:,
|
47
|
+
# Start date of the billing period
|
48
|
+
start_date:
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
sig do
|
53
|
+
override.returns(
|
54
|
+
{
|
55
|
+
end_date: Time,
|
56
|
+
meters:
|
57
|
+
T::Array[
|
58
|
+
Dodopayments::Models::SubscriptionRetrieveUsageHistoryResponse::Meter
|
59
|
+
],
|
60
|
+
start_date: Time
|
61
|
+
}
|
62
|
+
)
|
63
|
+
end
|
64
|
+
def to_hash
|
65
|
+
end
|
66
|
+
|
67
|
+
class Meter < Dodopayments::Internal::Type::BaseModel
|
68
|
+
OrHash =
|
69
|
+
T.type_alias do
|
70
|
+
T.any(
|
71
|
+
Dodopayments::Models::SubscriptionRetrieveUsageHistoryResponse::Meter,
|
72
|
+
Dodopayments::Internal::AnyHash
|
73
|
+
)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Meter identifier
|
77
|
+
sig { returns(String) }
|
78
|
+
attr_accessor :id
|
79
|
+
|
80
|
+
# Chargeable units (after free threshold) as string for precision
|
81
|
+
sig { returns(String) }
|
82
|
+
attr_accessor :chargeable_units
|
83
|
+
|
84
|
+
# Total units consumed as string for precision
|
85
|
+
sig { returns(String) }
|
86
|
+
attr_accessor :consumed_units
|
87
|
+
|
88
|
+
# Currency for the price per unit
|
89
|
+
sig { returns(Dodopayments::Currency::TaggedSymbol) }
|
90
|
+
attr_accessor :currency
|
91
|
+
|
92
|
+
# Free threshold units for this meter
|
93
|
+
sig { returns(Integer) }
|
94
|
+
attr_accessor :free_threshold
|
95
|
+
|
96
|
+
# Meter name
|
97
|
+
sig { returns(String) }
|
98
|
+
attr_accessor :name
|
99
|
+
|
100
|
+
# Price per unit in string format for precision
|
101
|
+
sig { returns(String) }
|
102
|
+
attr_accessor :price_per_unit
|
103
|
+
|
104
|
+
# Total price charged for this meter in smallest currency unit (cents)
|
105
|
+
sig { returns(Integer) }
|
106
|
+
attr_accessor :total_price
|
107
|
+
|
108
|
+
sig do
|
109
|
+
params(
|
110
|
+
id: String,
|
111
|
+
chargeable_units: String,
|
112
|
+
consumed_units: String,
|
113
|
+
currency: Dodopayments::Currency::OrSymbol,
|
114
|
+
free_threshold: Integer,
|
115
|
+
name: String,
|
116
|
+
price_per_unit: String,
|
117
|
+
total_price: Integer
|
118
|
+
).returns(T.attached_class)
|
119
|
+
end
|
120
|
+
def self.new(
|
121
|
+
# Meter identifier
|
122
|
+
id:,
|
123
|
+
# Chargeable units (after free threshold) as string for precision
|
124
|
+
chargeable_units:,
|
125
|
+
# Total units consumed as string for precision
|
126
|
+
consumed_units:,
|
127
|
+
# Currency for the price per unit
|
128
|
+
currency:,
|
129
|
+
# Free threshold units for this meter
|
130
|
+
free_threshold:,
|
131
|
+
# Meter name
|
132
|
+
name:,
|
133
|
+
# Price per unit in string format for precision
|
134
|
+
price_per_unit:,
|
135
|
+
# Total price charged for this meter in smallest currency unit (cents)
|
136
|
+
total_price:
|
137
|
+
)
|
138
|
+
end
|
139
|
+
|
140
|
+
sig do
|
141
|
+
override.returns(
|
142
|
+
{
|
143
|
+
id: String,
|
144
|
+
chargeable_units: String,
|
145
|
+
consumed_units: String,
|
146
|
+
currency: Dodopayments::Currency::TaggedSymbol,
|
147
|
+
free_threshold: Integer,
|
148
|
+
name: String,
|
149
|
+
price_per_unit: String,
|
150
|
+
total_price: Integer
|
151
|
+
}
|
152
|
+
)
|
153
|
+
end
|
154
|
+
def to_hash
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|