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
@@ -12,6 +12,9 @@ module Dodopayments
|
|
12
12
|
# Recurring price details.
|
13
13
|
variant -> { Dodopayments::Price::RecurringPrice }
|
14
14
|
|
15
|
+
# Usage Based price details.
|
16
|
+
variant -> { Dodopayments::Price::UsageBasedPrice }
|
17
|
+
|
15
18
|
class OneTimePrice < Dodopayments::Internal::Type::BaseModel
|
16
19
|
# @!attribute currency
|
17
20
|
# The currency in which the payment is made.
|
@@ -22,8 +25,8 @@ module Dodopayments
|
|
22
25
|
# @!attribute discount
|
23
26
|
# Discount applied to the price, represented as a percentage (0 to 100).
|
24
27
|
#
|
25
|
-
# @return [
|
26
|
-
required :discount,
|
28
|
+
# @return [Integer]
|
29
|
+
required :discount, Integer
|
27
30
|
|
28
31
|
# @!attribute price
|
29
32
|
# The payment amount, in the smallest denomination of the currency (e.g., cents
|
@@ -76,7 +79,7 @@ module Dodopayments
|
|
76
79
|
#
|
77
80
|
# @param currency [Symbol, Dodopayments::Models::Currency] The currency in which the payment is made.
|
78
81
|
#
|
79
|
-
# @param discount [
|
82
|
+
# @param discount [Integer] Discount applied to the price, represented as a percentage (0 to 100).
|
80
83
|
#
|
81
84
|
# @param price [Integer] The payment amount, in the smallest denomination of the currency (e.g., cents fo
|
82
85
|
#
|
@@ -111,8 +114,8 @@ module Dodopayments
|
|
111
114
|
# @!attribute discount
|
112
115
|
# Discount applied to the price, represented as a percentage (0 to 100).
|
113
116
|
#
|
114
|
-
# @return [
|
115
|
-
required :discount,
|
117
|
+
# @return [Integer]
|
118
|
+
required :discount, Integer
|
116
119
|
|
117
120
|
# @!attribute payment_frequency_count
|
118
121
|
# Number of units for the payment frequency. For example, a value of `1` with a
|
@@ -179,7 +182,7 @@ module Dodopayments
|
|
179
182
|
#
|
180
183
|
# @param currency [Symbol, Dodopayments::Models::Currency] The currency in which the payment is made.
|
181
184
|
#
|
182
|
-
# @param discount [
|
185
|
+
# @param discount [Integer] Discount applied to the price, represented as a percentage (0 to 100).
|
183
186
|
#
|
184
187
|
# @param payment_frequency_count [Integer] Number of units for the payment frequency.
|
185
188
|
#
|
@@ -210,8 +213,120 @@ module Dodopayments
|
|
210
213
|
end
|
211
214
|
end
|
212
215
|
|
216
|
+
class UsageBasedPrice < Dodopayments::Internal::Type::BaseModel
|
217
|
+
# @!attribute currency
|
218
|
+
# The currency in which the payment is made.
|
219
|
+
#
|
220
|
+
# @return [Symbol, Dodopayments::Models::Currency]
|
221
|
+
required :currency, enum: -> { Dodopayments::Currency }
|
222
|
+
|
223
|
+
# @!attribute discount
|
224
|
+
# Discount applied to the price, represented as a percentage (0 to 100).
|
225
|
+
#
|
226
|
+
# @return [Integer]
|
227
|
+
required :discount, Integer
|
228
|
+
|
229
|
+
# @!attribute fixed_price
|
230
|
+
# The fixed payment amount. Represented in the lowest denomination of the currency
|
231
|
+
# (e.g., cents for USD). For example, to charge $1.00, pass `100`.
|
232
|
+
#
|
233
|
+
# @return [Integer]
|
234
|
+
required :fixed_price, Integer
|
235
|
+
|
236
|
+
# @!attribute payment_frequency_count
|
237
|
+
# Number of units for the payment frequency. For example, a value of `1` with a
|
238
|
+
# `payment_frequency_interval` of `month` represents monthly payments.
|
239
|
+
#
|
240
|
+
# @return [Integer]
|
241
|
+
required :payment_frequency_count, Integer
|
242
|
+
|
243
|
+
# @!attribute payment_frequency_interval
|
244
|
+
# The time interval for the payment frequency (e.g., day, month, year).
|
245
|
+
#
|
246
|
+
# @return [Symbol, Dodopayments::Models::TimeInterval]
|
247
|
+
required :payment_frequency_interval, enum: -> { Dodopayments::TimeInterval }
|
248
|
+
|
249
|
+
# @!attribute purchasing_power_parity
|
250
|
+
# Indicates if purchasing power parity adjustments are applied to the price.
|
251
|
+
# Purchasing power parity feature is not available as of now
|
252
|
+
#
|
253
|
+
# @return [Boolean]
|
254
|
+
required :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
|
255
|
+
|
256
|
+
# @!attribute subscription_period_count
|
257
|
+
# Number of units for the subscription period. For example, a value of `12` with a
|
258
|
+
# `subscription_period_interval` of `month` represents a one-year subscription.
|
259
|
+
#
|
260
|
+
# @return [Integer]
|
261
|
+
required :subscription_period_count, Integer
|
262
|
+
|
263
|
+
# @!attribute subscription_period_interval
|
264
|
+
# The time interval for the subscription period (e.g., day, month, year).
|
265
|
+
#
|
266
|
+
# @return [Symbol, Dodopayments::Models::TimeInterval]
|
267
|
+
required :subscription_period_interval, enum: -> { Dodopayments::TimeInterval }
|
268
|
+
|
269
|
+
# @!attribute type
|
270
|
+
#
|
271
|
+
# @return [Symbol, Dodopayments::Models::Price::UsageBasedPrice::Type]
|
272
|
+
required :type, enum: -> { Dodopayments::Price::UsageBasedPrice::Type }
|
273
|
+
|
274
|
+
# @!attribute meters
|
275
|
+
#
|
276
|
+
# @return [Array<Dodopayments::Models::AddMeterToPrice>, nil]
|
277
|
+
optional :meters,
|
278
|
+
-> {
|
279
|
+
Dodopayments::Internal::Type::ArrayOf[Dodopayments::AddMeterToPrice]
|
280
|
+
},
|
281
|
+
nil?: true
|
282
|
+
|
283
|
+
# @!attribute tax_inclusive
|
284
|
+
# Indicates if the price is tax inclusive
|
285
|
+
#
|
286
|
+
# @return [Boolean, nil]
|
287
|
+
optional :tax_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
|
288
|
+
|
289
|
+
# @!method initialize(currency:, discount:, fixed_price:, payment_frequency_count:, payment_frequency_interval:, purchasing_power_parity:, subscription_period_count:, subscription_period_interval:, type:, meters: nil, tax_inclusive: nil)
|
290
|
+
# Some parameter documentations has been truncated, see
|
291
|
+
# {Dodopayments::Models::Price::UsageBasedPrice} for more details.
|
292
|
+
#
|
293
|
+
# Usage Based price details.
|
294
|
+
#
|
295
|
+
# @param currency [Symbol, Dodopayments::Models::Currency] The currency in which the payment is made.
|
296
|
+
#
|
297
|
+
# @param discount [Integer] Discount applied to the price, represented as a percentage (0 to 100).
|
298
|
+
#
|
299
|
+
# @param fixed_price [Integer] The fixed payment amount. Represented in the lowest denomination of the currency
|
300
|
+
#
|
301
|
+
# @param payment_frequency_count [Integer] Number of units for the payment frequency.
|
302
|
+
#
|
303
|
+
# @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the payment frequency (e.g., day, month, year).
|
304
|
+
#
|
305
|
+
# @param purchasing_power_parity [Boolean] Indicates if purchasing power parity adjustments are applied to the price.
|
306
|
+
#
|
307
|
+
# @param subscription_period_count [Integer] Number of units for the subscription period.
|
308
|
+
#
|
309
|
+
# @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
|
310
|
+
#
|
311
|
+
# @param type [Symbol, Dodopayments::Models::Price::UsageBasedPrice::Type]
|
312
|
+
#
|
313
|
+
# @param meters [Array<Dodopayments::Models::AddMeterToPrice>, nil]
|
314
|
+
#
|
315
|
+
# @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive
|
316
|
+
|
317
|
+
# @see Dodopayments::Models::Price::UsageBasedPrice#type
|
318
|
+
module Type
|
319
|
+
extend Dodopayments::Internal::Type::Enum
|
320
|
+
|
321
|
+
USAGE_BASED_PRICE = :usage_based_price
|
322
|
+
|
323
|
+
# @!method self.values
|
324
|
+
# @return [Array<Symbol>]
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
213
328
|
# @!method self.variants
|
214
|
-
# @return [Array(Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice)]
|
329
|
+
# @return [Array(Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, Dodopayments::Models::Price::UsageBasedPrice)]
|
215
330
|
end
|
216
331
|
end
|
217
332
|
end
|
@@ -42,7 +42,7 @@ module Dodopayments
|
|
42
42
|
# @!attribute price
|
43
43
|
# Pricing information for the product.
|
44
44
|
#
|
45
|
-
# @return [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice]
|
45
|
+
# @return [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, Dodopayments::Models::Price::UsageBasedPrice]
|
46
46
|
required :price, union: -> { Dodopayments::Price }
|
47
47
|
|
48
48
|
# @!attribute product_id
|
@@ -123,7 +123,7 @@ module Dodopayments
|
|
123
123
|
#
|
124
124
|
# @param metadata [Hash{Symbol=>String}] Additional custom data associated with the product
|
125
125
|
#
|
126
|
-
# @param price [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice] Pricing information for the product.
|
126
|
+
# @param price [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, Dodopayments::Models::Price::UsageBasedPrice] Pricing information for the product.
|
127
127
|
#
|
128
128
|
# @param product_id [String] Unique identifier for the product.
|
129
129
|
#
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
# @see Dodopayments::Resources::Products#archive
|
6
|
+
class ProductArchiveParams < Dodopayments::Internal::Type::BaseModel
|
7
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
8
|
+
include Dodopayments::Internal::Type::RequestParameters
|
9
|
+
|
10
|
+
# @!method initialize(request_options: {})
|
11
|
+
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -10,7 +10,7 @@ module Dodopayments
|
|
10
10
|
# @!attribute price
|
11
11
|
# Price configuration for the product
|
12
12
|
#
|
13
|
-
# @return [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice]
|
13
|
+
# @return [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, Dodopayments::Models::Price::UsageBasedPrice]
|
14
14
|
required :price, union: -> { Dodopayments::Price }
|
15
15
|
|
16
16
|
# @!attribute tax_category
|
@@ -87,7 +87,7 @@ module Dodopayments
|
|
87
87
|
# Some parameter documentations has been truncated, see
|
88
88
|
# {Dodopayments::Models::ProductCreateParams} for more details.
|
89
89
|
#
|
90
|
-
# @param price [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice] Price configuration for the product
|
90
|
+
# @param price [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, Dodopayments::Models::Price::UsageBasedPrice] Price configuration for the product
|
91
91
|
#
|
92
92
|
# @param tax_category [Symbol, Dodopayments::Models::TaxCategory] Tax category applied to this product
|
93
93
|
#
|
@@ -88,7 +88,7 @@ module Dodopayments
|
|
88
88
|
# @!attribute price_detail
|
89
89
|
# Details of the price
|
90
90
|
#
|
91
|
-
# @return [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, nil]
|
91
|
+
# @return [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, Dodopayments::Models::Price::UsageBasedPrice, nil]
|
92
92
|
optional :price_detail, union: -> { Dodopayments::Price }, nil?: true
|
93
93
|
|
94
94
|
# @!attribute tax_inclusive
|
@@ -125,7 +125,7 @@ module Dodopayments
|
|
125
125
|
#
|
126
126
|
# @param price [Integer, nil] Price of the product, optional.
|
127
127
|
#
|
128
|
-
# @param price_detail [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, nil] Details of the price
|
128
|
+
# @param price_detail [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, Dodopayments::Models::Price::UsageBasedPrice, nil] Details of the price
|
129
129
|
#
|
130
130
|
# @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive
|
131
131
|
end
|
@@ -89,7 +89,7 @@ module Dodopayments
|
|
89
89
|
# @!attribute price
|
90
90
|
# Price details of the product.
|
91
91
|
#
|
92
|
-
# @return [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, nil]
|
92
|
+
# @return [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, Dodopayments::Models::Price::UsageBasedPrice, nil]
|
93
93
|
optional :price, union: -> { Dodopayments::Price }, nil?: true
|
94
94
|
|
95
95
|
# @!attribute tax_category
|
@@ -124,7 +124,7 @@ module Dodopayments
|
|
124
124
|
#
|
125
125
|
# @param name [String, nil] Name of the product, optional and must be at most 100 characters.
|
126
126
|
#
|
127
|
-
# @param price [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, nil] Price details of the product.
|
127
|
+
# @param price [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, Dodopayments::Models::Price::UsageBasedPrice, nil] Price details of the product.
|
128
128
|
#
|
129
129
|
# @param tax_category [Symbol, Dodopayments::Models::TaxCategory, nil] Tax category of the product.
|
130
130
|
#
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
# @see Dodopayments::Resources::Subscriptions#retrieve_usage_history
|
6
|
+
class SubscriptionRetrieveUsageHistoryParams < Dodopayments::Internal::Type::BaseModel
|
7
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
8
|
+
include Dodopayments::Internal::Type::RequestParameters
|
9
|
+
|
10
|
+
# @!attribute end_date
|
11
|
+
# Filter by end date (inclusive)
|
12
|
+
#
|
13
|
+
# @return [Time, nil]
|
14
|
+
optional :end_date, Time, nil?: true
|
15
|
+
|
16
|
+
# @!attribute meter_id
|
17
|
+
# Filter by specific meter ID
|
18
|
+
#
|
19
|
+
# @return [String, nil]
|
20
|
+
optional :meter_id, String, nil?: true
|
21
|
+
|
22
|
+
# @!attribute page_number
|
23
|
+
# Page number (default: 0)
|
24
|
+
#
|
25
|
+
# @return [Integer, nil]
|
26
|
+
optional :page_number, Integer, nil?: true
|
27
|
+
|
28
|
+
# @!attribute page_size
|
29
|
+
# Page size (default: 10, max: 100)
|
30
|
+
#
|
31
|
+
# @return [Integer, nil]
|
32
|
+
optional :page_size, Integer, nil?: true
|
33
|
+
|
34
|
+
# @!attribute start_date
|
35
|
+
# Filter by start date (inclusive)
|
36
|
+
#
|
37
|
+
# @return [Time, nil]
|
38
|
+
optional :start_date, Time, nil?: true
|
39
|
+
|
40
|
+
# @!method initialize(end_date: nil, meter_id: nil, page_number: nil, page_size: nil, start_date: nil, request_options: {})
|
41
|
+
# @param end_date [Time, nil] Filter by end date (inclusive)
|
42
|
+
#
|
43
|
+
# @param meter_id [String, nil] Filter by specific meter ID
|
44
|
+
#
|
45
|
+
# @param page_number [Integer, nil] Page number (default: 0)
|
46
|
+
#
|
47
|
+
# @param page_size [Integer, nil] Page size (default: 10, max: 100)
|
48
|
+
#
|
49
|
+
# @param start_date [Time, nil] Filter by start date (inclusive)
|
50
|
+
#
|
51
|
+
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
# @see Dodopayments::Resources::Subscriptions#retrieve_usage_history
|
6
|
+
class SubscriptionRetrieveUsageHistoryResponse < Dodopayments::Internal::Type::BaseModel
|
7
|
+
# @!attribute end_date
|
8
|
+
# End date of the billing period
|
9
|
+
#
|
10
|
+
# @return [Time]
|
11
|
+
required :end_date, Time
|
12
|
+
|
13
|
+
# @!attribute meters
|
14
|
+
# List of meters and their usage for this billing period
|
15
|
+
#
|
16
|
+
# @return [Array<Dodopayments::Models::SubscriptionRetrieveUsageHistoryResponse::Meter>]
|
17
|
+
required :meters,
|
18
|
+
-> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Models::SubscriptionRetrieveUsageHistoryResponse::Meter] }
|
19
|
+
|
20
|
+
# @!attribute start_date
|
21
|
+
# Start date of the billing period
|
22
|
+
#
|
23
|
+
# @return [Time]
|
24
|
+
required :start_date, Time
|
25
|
+
|
26
|
+
# @!method initialize(end_date:, meters:, start_date:)
|
27
|
+
# @param end_date [Time] End date of the billing period
|
28
|
+
#
|
29
|
+
# @param meters [Array<Dodopayments::Models::SubscriptionRetrieveUsageHistoryResponse::Meter>] List of meters and their usage for this billing period
|
30
|
+
#
|
31
|
+
# @param start_date [Time] Start date of the billing period
|
32
|
+
|
33
|
+
class Meter < Dodopayments::Internal::Type::BaseModel
|
34
|
+
# @!attribute id
|
35
|
+
# Meter identifier
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
required :id, String
|
39
|
+
|
40
|
+
# @!attribute chargeable_units
|
41
|
+
# Chargeable units (after free threshold) as string for precision
|
42
|
+
#
|
43
|
+
# @return [String]
|
44
|
+
required :chargeable_units, String
|
45
|
+
|
46
|
+
# @!attribute consumed_units
|
47
|
+
# Total units consumed as string for precision
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
required :consumed_units, String
|
51
|
+
|
52
|
+
# @!attribute currency
|
53
|
+
# Currency for the price per unit
|
54
|
+
#
|
55
|
+
# @return [Symbol, Dodopayments::Models::Currency]
|
56
|
+
required :currency, enum: -> { Dodopayments::Currency }
|
57
|
+
|
58
|
+
# @!attribute free_threshold
|
59
|
+
# Free threshold units for this meter
|
60
|
+
#
|
61
|
+
# @return [Integer]
|
62
|
+
required :free_threshold, Integer
|
63
|
+
|
64
|
+
# @!attribute name
|
65
|
+
# Meter name
|
66
|
+
#
|
67
|
+
# @return [String]
|
68
|
+
required :name, String
|
69
|
+
|
70
|
+
# @!attribute price_per_unit
|
71
|
+
# Price per unit in string format for precision
|
72
|
+
#
|
73
|
+
# @return [String]
|
74
|
+
required :price_per_unit, String
|
75
|
+
|
76
|
+
# @!attribute total_price
|
77
|
+
# Total price charged for this meter in smallest currency unit (cents)
|
78
|
+
#
|
79
|
+
# @return [Integer]
|
80
|
+
required :total_price, Integer
|
81
|
+
|
82
|
+
# @!method initialize(id:, chargeable_units:, consumed_units:, currency:, free_threshold:, name:, price_per_unit:, total_price:)
|
83
|
+
# @param id [String] Meter identifier
|
84
|
+
#
|
85
|
+
# @param chargeable_units [String] Chargeable units (after free threshold) as string for precision
|
86
|
+
#
|
87
|
+
# @param consumed_units [String] Total units consumed as string for precision
|
88
|
+
#
|
89
|
+
# @param currency [Symbol, Dodopayments::Models::Currency] Currency for the price per unit
|
90
|
+
#
|
91
|
+
# @param free_threshold [Integer] Free threshold units for this meter
|
92
|
+
#
|
93
|
+
# @param name [String] Meter name
|
94
|
+
#
|
95
|
+
# @param price_per_unit [String] Price per unit in string format for precision
|
96
|
+
#
|
97
|
+
# @param total_price [Integer] Total price charged for this meter in smallest currency unit (cents)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
# @see Dodopayments::Resources::UsageEvents#ingest
|
6
|
+
class UsageEventIngestParams < Dodopayments::Internal::Type::BaseModel
|
7
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
8
|
+
include Dodopayments::Internal::Type::RequestParameters
|
9
|
+
|
10
|
+
# @!attribute events
|
11
|
+
# List of events to be pushed
|
12
|
+
#
|
13
|
+
# @return [Array<Dodopayments::Models::EventInput>]
|
14
|
+
required :events, -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::EventInput] }
|
15
|
+
|
16
|
+
# @!method initialize(events:, request_options: {})
|
17
|
+
# @param events [Array<Dodopayments::Models::EventInput>] List of events to be pushed
|
18
|
+
#
|
19
|
+
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
# @see Dodopayments::Resources::UsageEvents#ingest
|
6
|
+
class UsageEventIngestResponse < Dodopayments::Internal::Type::BaseModel
|
7
|
+
# @!attribute ingested_count
|
8
|
+
#
|
9
|
+
# @return [Integer]
|
10
|
+
required :ingested_count, Integer
|
11
|
+
|
12
|
+
# @!method initialize(ingested_count:)
|
13
|
+
# @param ingested_count [Integer]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
# @see Dodopayments::Resources::UsageEvents#list
|
6
|
+
class UsageEventListParams < Dodopayments::Internal::Type::BaseModel
|
7
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
8
|
+
include Dodopayments::Internal::Type::RequestParameters
|
9
|
+
|
10
|
+
# @!attribute customer_id
|
11
|
+
# Filter events by customer ID
|
12
|
+
#
|
13
|
+
# @return [String, nil]
|
14
|
+
optional :customer_id, String
|
15
|
+
|
16
|
+
# @!attribute end_
|
17
|
+
# Filter events created before this timestamp
|
18
|
+
#
|
19
|
+
# @return [Time, nil]
|
20
|
+
optional :end_, Time
|
21
|
+
|
22
|
+
# @!attribute event_name
|
23
|
+
# Filter events by event name. If both event_name and meter_id are provided, they
|
24
|
+
# must match the meter's configured event_name
|
25
|
+
#
|
26
|
+
# @return [String, nil]
|
27
|
+
optional :event_name, String
|
28
|
+
|
29
|
+
# @!attribute meter_id
|
30
|
+
# Filter events by meter ID. When provided, only events that match the meter's
|
31
|
+
# event_name and filter criteria will be returned
|
32
|
+
#
|
33
|
+
# @return [String, nil]
|
34
|
+
optional :meter_id, String
|
35
|
+
|
36
|
+
# @!attribute page_number
|
37
|
+
# Page number (0-based, default: 0)
|
38
|
+
#
|
39
|
+
# @return [Integer, nil]
|
40
|
+
optional :page_number, Integer
|
41
|
+
|
42
|
+
# @!attribute page_size
|
43
|
+
# Number of events to return per page (default: 10)
|
44
|
+
#
|
45
|
+
# @return [Integer, nil]
|
46
|
+
optional :page_size, Integer
|
47
|
+
|
48
|
+
# @!attribute start
|
49
|
+
# Filter events created after this timestamp
|
50
|
+
#
|
51
|
+
# @return [Time, nil]
|
52
|
+
optional :start, Time
|
53
|
+
|
54
|
+
# @!method initialize(customer_id: nil, end_: nil, event_name: nil, meter_id: nil, page_number: nil, page_size: nil, start: nil, request_options: {})
|
55
|
+
# Some parameter documentations has been truncated, see
|
56
|
+
# {Dodopayments::Models::UsageEventListParams} for more details.
|
57
|
+
#
|
58
|
+
# @param customer_id [String] Filter events by customer ID
|
59
|
+
#
|
60
|
+
# @param end_ [Time] Filter events created before this timestamp
|
61
|
+
#
|
62
|
+
# @param event_name [String] Filter events by event name. If both event_name and meter_id are provided, they
|
63
|
+
#
|
64
|
+
# @param meter_id [String] Filter events by meter ID. When provided, only events that match the meter's eve
|
65
|
+
#
|
66
|
+
# @param page_number [Integer] Page number (0-based, default: 0)
|
67
|
+
#
|
68
|
+
# @param page_size [Integer] Number of events to return per page (default: 10)
|
69
|
+
#
|
70
|
+
# @param start [Time] Filter events created after this timestamp
|
71
|
+
#
|
72
|
+
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
# @see Dodopayments::Resources::UsageEvents#retrieve
|
6
|
+
class UsageEventRetrieveParams < Dodopayments::Internal::Type::BaseModel
|
7
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
8
|
+
include Dodopayments::Internal::Type::RequestParameters
|
9
|
+
|
10
|
+
# @!method initialize(request_options: {})
|
11
|
+
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/dodopayments/models.rb
CHANGED
@@ -39,6 +39,8 @@ module Dodopayments
|
|
39
39
|
mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
|
40
40
|
end
|
41
41
|
|
42
|
+
AddMeterToPrice = Dodopayments::Models::AddMeterToPrice
|
43
|
+
|
42
44
|
AddonCartResponseItem = Dodopayments::Models::AddonCartResponseItem
|
43
45
|
|
44
46
|
AddonCreateParams = Dodopayments::Models::AddonCreateParams
|
@@ -125,6 +127,10 @@ module Dodopayments
|
|
125
127
|
|
126
128
|
DisputeStatus = Dodopayments::Models::DisputeStatus
|
127
129
|
|
130
|
+
Event = Dodopayments::Models::Event
|
131
|
+
|
132
|
+
EventInput = Dodopayments::Models::EventInput
|
133
|
+
|
128
134
|
GetDispute = Dodopayments::Models::GetDispute
|
129
135
|
|
130
136
|
IntentStatus = Dodopayments::Models::IntentStatus
|
@@ -157,6 +163,22 @@ module Dodopayments
|
|
157
163
|
|
158
164
|
LicenseValidateParams = Dodopayments::Models::LicenseValidateParams
|
159
165
|
|
166
|
+
Meter = Dodopayments::Models::Meter
|
167
|
+
|
168
|
+
MeterAggregation = Dodopayments::Models::MeterAggregation
|
169
|
+
|
170
|
+
MeterArchiveParams = Dodopayments::Models::MeterArchiveParams
|
171
|
+
|
172
|
+
MeterCreateParams = Dodopayments::Models::MeterCreateParams
|
173
|
+
|
174
|
+
MeterFilter = Dodopayments::Models::MeterFilter
|
175
|
+
|
176
|
+
MeterListParams = Dodopayments::Models::MeterListParams
|
177
|
+
|
178
|
+
MeterRetrieveParams = Dodopayments::Models::MeterRetrieveParams
|
179
|
+
|
180
|
+
MeterUnarchiveParams = Dodopayments::Models::MeterUnarchiveParams
|
181
|
+
|
160
182
|
MiscListSupportedCountriesParams = Dodopayments::Models::MiscListSupportedCountriesParams
|
161
183
|
|
162
184
|
NewCustomer = Dodopayments::Models::NewCustomer
|
@@ -183,9 +205,9 @@ module Dodopayments
|
|
183
205
|
|
184
206
|
Product = Dodopayments::Models::Product
|
185
207
|
|
186
|
-
|
208
|
+
ProductArchiveParams = Dodopayments::Models::ProductArchiveParams
|
187
209
|
|
188
|
-
|
210
|
+
ProductCreateParams = Dodopayments::Models::ProductCreateParams
|
189
211
|
|
190
212
|
ProductListParams = Dodopayments::Models::ProductListParams
|
191
213
|
|
@@ -221,6 +243,8 @@ module Dodopayments
|
|
221
243
|
|
222
244
|
SubscriptionRetrieveParams = Dodopayments::Models::SubscriptionRetrieveParams
|
223
245
|
|
246
|
+
SubscriptionRetrieveUsageHistoryParams = Dodopayments::Models::SubscriptionRetrieveUsageHistoryParams
|
247
|
+
|
224
248
|
SubscriptionStatus = Dodopayments::Models::SubscriptionStatus
|
225
249
|
|
226
250
|
SubscriptionUpdateParams = Dodopayments::Models::SubscriptionUpdateParams
|
@@ -229,6 +253,12 @@ module Dodopayments
|
|
229
253
|
|
230
254
|
TimeInterval = Dodopayments::Models::TimeInterval
|
231
255
|
|
256
|
+
UsageEventIngestParams = Dodopayments::Models::UsageEventIngestParams
|
257
|
+
|
258
|
+
UsageEventListParams = Dodopayments::Models::UsageEventListParams
|
259
|
+
|
260
|
+
UsageEventRetrieveParams = Dodopayments::Models::UsageEventRetrieveParams
|
261
|
+
|
232
262
|
WebhookCreateParams = Dodopayments::Models::WebhookCreateParams
|
233
263
|
|
234
264
|
WebhookDeleteParams = Dodopayments::Models::WebhookDeleteParams
|
@@ -22,6 +22,24 @@ module Dodopayments
|
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
25
|
+
# @overload retrieve_refund(refund_id, request_options: {})
|
26
|
+
#
|
27
|
+
# @param refund_id [String]
|
28
|
+
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
|
29
|
+
#
|
30
|
+
# @return [StringIO]
|
31
|
+
#
|
32
|
+
# @see Dodopayments::Models::Invoices::PaymentRetrieveRefundParams
|
33
|
+
def retrieve_refund(refund_id, params = {})
|
34
|
+
@client.request(
|
35
|
+
method: :get,
|
36
|
+
path: ["invoices/refunds/%1$s", refund_id],
|
37
|
+
headers: {"accept" => "application/pdf"},
|
38
|
+
model: StringIO,
|
39
|
+
options: params[:request_options]
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
25
43
|
# @api private
|
26
44
|
#
|
27
45
|
# @param client [Dodopayments::Client]
|