dodopayments 1.18.0 → 1.18.1
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/file_part.rb +55 -0
- data/lib/dodopayments/internal/transport/base_client.rb +3 -3
- data/lib/dodopayments/internal/transport/pooled_net_requester.rb +1 -1
- data/lib/dodopayments/internal/type/converter.rb +1 -1
- data/lib/dodopayments/internal/type/{io_like.rb → file_input.rb} +8 -4
- data/lib/dodopayments/internal/util.rb +69 -61
- data/lib/dodopayments/models/billing_address.rb +9 -5
- data/lib/dodopayments/models/create_new_customer.rb +8 -1
- data/lib/dodopayments/models/customer_limited_details.rb +5 -3
- data/lib/dodopayments/models/customer_list_params.rb +4 -2
- data/lib/dodopayments/models/customers/customer_portal_create_params.rb +2 -1
- data/lib/dodopayments/models/discount.rb +23 -10
- data/lib/dodopayments/models/discount_create_params.rb +15 -5
- data/lib/dodopayments/models/discount_list_params.rb +4 -2
- data/lib/dodopayments/models/discount_update_params.rb +13 -3
- data/lib/dodopayments/models/dispute.rb +17 -6
- data/lib/dodopayments/models/dispute_list_params.rb +14 -7
- data/lib/dodopayments/models/license_key.rb +26 -11
- data/lib/dodopayments/models/license_key_instance_list_params.rb +6 -3
- data/lib/dodopayments/models/license_key_list_params.rb +10 -5
- data/lib/dodopayments/models/license_key_update_params.rb +9 -3
- data/lib/dodopayments/models/one_time_product_cart_item.rb +7 -1
- data/lib/dodopayments/models/payment.rb +41 -16
- data/lib/dodopayments/models/payment_create_params.rb +22 -7
- data/lib/dodopayments/models/payment_create_response.rb +16 -6
- data/lib/dodopayments/models/payment_list_params.rb +14 -7
- data/lib/dodopayments/models/payout_list_params.rb +4 -2
- data/lib/dodopayments/models/payout_list_response.rb +27 -13
- data/lib/dodopayments/models/price.rb +38 -13
- data/lib/dodopayments/models/product.rb +31 -13
- data/lib/dodopayments/models/product_create_params.rb +20 -7
- data/lib/dodopayments/models/product_list_params.rb +11 -4
- data/lib/dodopayments/models/product_list_response.rb +27 -11
- data/lib/dodopayments/models/product_update_params.rb +22 -8
- data/lib/dodopayments/models/refund.rb +13 -6
- data/lib/dodopayments/models/refund_create_params.rb +4 -2
- data/lib/dodopayments/models/refund_list_params.rb +12 -6
- data/lib/dodopayments/models/subscription.rb +37 -13
- data/lib/dodopayments/models/subscription_change_plan_params.rb +5 -2
- data/lib/dodopayments/models/subscription_charge_params.rb +6 -1
- data/lib/dodopayments/models/subscription_create_params.rb +34 -11
- data/lib/dodopayments/models/subscription_create_response.rb +15 -5
- data/lib/dodopayments/models/subscription_list_params.rb +12 -6
- data/lib/dodopayments/models/webhook_event_list_params.rb +16 -6
- data/lib/dodopayments/resources/customers/customer_portal.rb +4 -2
- data/lib/dodopayments/resources/customers.rb +10 -4
- data/lib/dodopayments/resources/discounts.rb +38 -13
- data/lib/dodopayments/resources/disputes.rb +16 -8
- data/lib/dodopayments/resources/license_key_instances.rb +11 -5
- data/lib/dodopayments/resources/license_keys.rb +23 -10
- data/lib/dodopayments/resources/payments.rb +38 -15
- data/lib/dodopayments/resources/payouts.rb +4 -2
- data/lib/dodopayments/resources/products/images.rb +3 -1
- data/lib/dodopayments/resources/products.rb +56 -20
- data/lib/dodopayments/resources/refunds.rb +18 -9
- data/lib/dodopayments/resources/subscriptions.rb +62 -22
- data/lib/dodopayments/resources/webhook_events.rb +16 -6
- data/lib/dodopayments/version.rb +1 -1
- data/lib/dodopayments.rb +2 -1
- data/rbi/lib/dodopayments/file_part.rbi +34 -0
- data/rbi/lib/dodopayments/internal/transport/base_client.rbi +17 -3
- data/rbi/lib/dodopayments/internal/type/{io_like.rbi → file_input.rbi} +6 -2
- data/rbi/lib/dodopayments/internal/util.rbi +24 -19
- data/rbi/lib/dodopayments/models/billing_address.rbi +12 -2
- data/rbi/lib/dodopayments/models/create_new_customer.rbi +9 -2
- data/rbi/lib/dodopayments/models/customer_limited_details.rbi +8 -2
- data/rbi/lib/dodopayments/models/customer_list_params.rbi +7 -2
- data/rbi/lib/dodopayments/models/customers/customer_portal_create_params.rbi +5 -2
- data/rbi/lib/dodopayments/models/discount.rbi +14 -0
- data/rbi/lib/dodopayments/models/discount_create_params.rbi +15 -0
- data/rbi/lib/dodopayments/models/discount_list_params.rbi +7 -2
- data/rbi/lib/dodopayments/models/discount_update_params.rbi +10 -0
- data/rbi/lib/dodopayments/models/dispute.rbi +8 -3
- data/rbi/lib/dodopayments/models/dispute_list_params.rbi +7 -0
- data/rbi/lib/dodopayments/models/license_key.rbi +12 -0
- data/rbi/lib/dodopayments/models/license_key_instance_list_params.rbi +9 -2
- data/rbi/lib/dodopayments/models/license_key_list_params.rbi +6 -3
- data/rbi/lib/dodopayments/models/license_key_update_params.rbi +12 -2
- data/rbi/lib/dodopayments/models/one_time_product_cart_item.rbi +8 -2
- data/rbi/lib/dodopayments/models/payment.rbi +19 -0
- data/rbi/lib/dodopayments/models/payment_create_params.rbi +14 -0
- data/rbi/lib/dodopayments/models/payment_create_response.rbi +7 -0
- data/rbi/lib/dodopayments/models/payment_list_params.rbi +7 -0
- data/rbi/lib/dodopayments/models/payout_list_params.rbi +7 -2
- data/rbi/lib/dodopayments/models/payout_list_response.rbi +13 -0
- data/rbi/lib/dodopayments/models/price.rbi +25 -0
- data/rbi/lib/dodopayments/models/product.rbi +14 -0
- data/rbi/lib/dodopayments/models/product_create_params.rbi +8 -0
- data/rbi/lib/dodopayments/models/product_list_params.rbi +15 -2
- data/rbi/lib/dodopayments/models/product_list_response.rbi +21 -0
- data/rbi/lib/dodopayments/models/product_update_params.rbi +18 -0
- data/rbi/lib/dodopayments/models/refund.rbi +7 -3
- data/rbi/lib/dodopayments/models/refund_create_params.rbi +7 -2
- data/rbi/lib/dodopayments/models/refund_list_params.rbi +6 -0
- data/rbi/lib/dodopayments/models/subscription.rbi +15 -0
- data/rbi/lib/dodopayments/models/subscription_change_plan_params.rbi +8 -2
- data/rbi/lib/dodopayments/models/subscription_charge_params.rbi +6 -2
- data/rbi/lib/dodopayments/models/subscription_create_params.rbi +25 -2
- data/rbi/lib/dodopayments/models/subscription_create_response.rbi +7 -0
- data/rbi/lib/dodopayments/models/subscription_list_params.rbi +6 -0
- data/rbi/lib/dodopayments/models/webhook_event_list_params.rbi +6 -0
- data/sig/dodopayments/file_part.rbs +21 -0
- data/sig/dodopayments/internal/transport/base_client.rbs +9 -3
- data/sig/dodopayments/internal/type/{io_like.rbs → file_input.rbs} +1 -1
- data/sig/dodopayments/internal/util.rbs +14 -12
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faa49e494933cd4c99fe0aabf206b9265ef8f78ad00bb290d8bfbfb17479c055
|
4
|
+
data.tar.gz: 655d18ea3f74079e16381502bad83a559e9febab0b309b513b1d5d21b463cdce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6ae05ae801c276d4ddf672bde0c31e0101cbf0dcca5378b2147cf3b8bba6635e1eb46073e672d957ecaa4f5ea576a6d10deb1c78b70da6ee1c20811c8a9e03e
|
7
|
+
data.tar.gz: f30f1c50f072dc1af5ad05cb3248c4958139f514e9abc83d8fbd9e1746a66b26e3943c0311d54edf7e2ce9550a40a3302445d16094aa33f92a69f1095db66090
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.18.1 (2025-04-25)
|
4
|
+
|
5
|
+
Full Changelog: [v1.18.0...v1.18.1](https://github.com/dodopayments/dodopayments-ruby/compare/v1.18.0...v1.18.1)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* support specifying content-type with FilePart class ([05ee21c](https://github.com/dodopayments/dodopayments-ruby/commit/05ee21c08e27593808a49a31d8a06b2aa9fdf1a9))
|
10
|
+
* support webmock for testing ([aff42ca](https://github.com/dodopayments/dodopayments-ruby/commit/aff42ca9a2c889dadb9eb375948d36302d3504b0))
|
11
|
+
|
12
|
+
|
13
|
+
### Chores
|
14
|
+
|
15
|
+
* broadly detect json family of content-type headers ([826d222](https://github.com/dodopayments/dodopayments-ruby/commit/826d222ddeb13f2778a39d55534248e13be8f409))
|
16
|
+
* **ci:** only use depot for staging repos ([bb8e176](https://github.com/dodopayments/dodopayments-ruby/commit/bb8e17605af188705dccc623554128e933180811))
|
17
|
+
* **internal:** codegen related update ([e449407](https://github.com/dodopayments/dodopayments-ruby/commit/e4494070a75a27e9cc85bacc312c816fff999541))
|
18
|
+
* **internal:** improve response envelope unwrap functionality ([6e7675c](https://github.com/dodopayments/dodopayments-ruby/commit/6e7675c0fb1ad1618fd2d1a2e44e0e7e67c56456))
|
19
|
+
* show truncated parameter docs in yard ([904002a](https://github.com/dodopayments/dodopayments-ruby/commit/904002ac59c8008068ad27dd17c43e433f8d1a32))
|
20
|
+
|
3
21
|
## 1.18.0 (2025-04-23)
|
4
22
|
|
5
23
|
Full Changelog: [v1.17.0...v1.18.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.17.0...v1.18.0)
|
data/README.md
CHANGED
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
class FilePart
|
5
|
+
# @return [Pathname, StringIO, IO, String]
|
6
|
+
attr_reader :content
|
7
|
+
|
8
|
+
# @return [String, nil]
|
9
|
+
attr_reader :content_type
|
10
|
+
|
11
|
+
# @return [String, nil]
|
12
|
+
attr_reader :filename
|
13
|
+
|
14
|
+
# @api private
|
15
|
+
#
|
16
|
+
# @return [String]
|
17
|
+
private def read
|
18
|
+
case contents
|
19
|
+
in Pathname
|
20
|
+
contents.read(binmode: true)
|
21
|
+
in StringIO
|
22
|
+
contents.string
|
23
|
+
in IO
|
24
|
+
contents.read
|
25
|
+
in String
|
26
|
+
contents
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# @param a [Object]
|
31
|
+
#
|
32
|
+
# @return [String]
|
33
|
+
def to_json(*a) = read.to_json(*a)
|
34
|
+
|
35
|
+
# @param a [Object]
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
def to_yaml(*a) = read.to_yaml(*a)
|
39
|
+
|
40
|
+
# @param content [Pathname, StringIO, IO, String]
|
41
|
+
# @param filename [String, nil]
|
42
|
+
# @param content_type [String, nil]
|
43
|
+
def initialize(content, filename: nil, content_type: nil)
|
44
|
+
@content = content
|
45
|
+
@filename =
|
46
|
+
case content
|
47
|
+
in Pathname
|
48
|
+
filename.nil? ? content.basename.to_path : File.basename(filename)
|
49
|
+
else
|
50
|
+
filename.nil? ? nil : File.basename(filename)
|
51
|
+
end
|
52
|
+
@content_type = content_type
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -153,7 +153,7 @@ module Dodopayments
|
|
153
153
|
|
154
154
|
# @api private
|
155
155
|
# @return [Dodopayments::Internal::Transport::PooledNetRequester]
|
156
|
-
|
156
|
+
attr_reader :requester
|
157
157
|
|
158
158
|
# @api private
|
159
159
|
#
|
@@ -214,7 +214,7 @@ module Dodopayments
|
|
214
214
|
#
|
215
215
|
# @option req [Object, nil] :body
|
216
216
|
#
|
217
|
-
# @option req [Symbol, nil] :unwrap
|
217
|
+
# @option req [Symbol, Integer, Array<Symbol, Integer>, Proc, nil] :unwrap
|
218
218
|
#
|
219
219
|
# @option req [Class<Dodopayments::Internal::Type::BasePage>, nil] :page
|
220
220
|
#
|
@@ -418,7 +418,7 @@ module Dodopayments
|
|
418
418
|
#
|
419
419
|
# @param body [Object, nil]
|
420
420
|
#
|
421
|
-
# @param unwrap [Symbol, nil]
|
421
|
+
# @param unwrap [Symbol, Integer, Array<Symbol, Integer>, Proc, nil]
|
422
422
|
#
|
423
423
|
# @param page [Class<Dodopayments::Internal::Type::BasePage>, nil]
|
424
424
|
#
|
@@ -7,8 +7,12 @@ module Dodopayments
|
|
7
7
|
#
|
8
8
|
# @abstract
|
9
9
|
#
|
10
|
-
# Either `Pathname` or `StringIO
|
11
|
-
|
10
|
+
# Either `Pathname` or `StringIO`, or `IO`, or
|
11
|
+
# `Dodopayments::Internal::Type::FileInput`.
|
12
|
+
#
|
13
|
+
# Note: when `IO` is used, all retries are disabled, since many IO` streams are
|
14
|
+
# not rewindable.
|
15
|
+
class FileInput
|
12
16
|
extend Dodopayments::Internal::Type::Converter
|
13
17
|
|
14
18
|
private_class_method :new
|
@@ -20,7 +24,7 @@ module Dodopayments
|
|
20
24
|
# @return [Boolean]
|
21
25
|
def self.===(other)
|
22
26
|
case other
|
23
|
-
in StringIO |
|
27
|
+
in Pathname | StringIO | IO | String | Dodopayments::FilePart
|
24
28
|
true
|
25
29
|
else
|
26
30
|
false
|
@@ -32,7 +36,7 @@ module Dodopayments
|
|
32
36
|
# @param other [Object]
|
33
37
|
#
|
34
38
|
# @return [Boolean]
|
35
|
-
def self.==(other) = other.is_a?(Class) && other <= Dodopayments::Internal::Type::
|
39
|
+
def self.==(other) = other.is_a?(Class) && other <= Dodopayments::Internal::Type::FileInput
|
36
40
|
|
37
41
|
class << self
|
38
42
|
# @api private
|
@@ -175,18 +175,17 @@ module Dodopayments
|
|
175
175
|
# @api private
|
176
176
|
#
|
177
177
|
# @param data [Hash{Symbol=>Object}, Array<Object>, Object]
|
178
|
-
# @param pick [Symbol, Integer, Array<Symbol, Integer>, nil]
|
179
|
-
# @param sentinel [Object, nil]
|
178
|
+
# @param pick [Symbol, Integer, Array<Symbol, Integer>, Proc, nil]
|
180
179
|
# @param blk [Proc, nil]
|
181
180
|
#
|
182
181
|
# @return [Object, nil]
|
183
|
-
def dig(data, pick,
|
184
|
-
case [data, pick
|
185
|
-
in [_, nil
|
182
|
+
def dig(data, pick, &blk)
|
183
|
+
case [data, pick]
|
184
|
+
in [_, nil]
|
186
185
|
data
|
187
|
-
in [Hash, Symbol
|
188
|
-
|
189
|
-
in [Hash | Array, Array
|
186
|
+
in [Hash, Symbol] | [Array, Integer]
|
187
|
+
data.fetch(pick) { blk&.call }
|
188
|
+
in [Hash | Array, Array]
|
190
189
|
pick.reduce(data) do |acc, key|
|
191
190
|
case acc
|
192
191
|
in Hash if acc.key?(key)
|
@@ -194,11 +193,13 @@ module Dodopayments
|
|
194
193
|
in Array if key.is_a?(Integer) && key < acc.length
|
195
194
|
acc[key]
|
196
195
|
else
|
197
|
-
return blk
|
196
|
+
return blk&.call
|
198
197
|
end
|
199
198
|
end
|
200
|
-
in _
|
201
|
-
|
199
|
+
in [_, Proc]
|
200
|
+
pick.call(data)
|
201
|
+
else
|
202
|
+
blk&.call
|
202
203
|
end
|
203
204
|
end
|
204
205
|
end
|
@@ -348,27 +349,6 @@ module Dodopayments
|
|
348
349
|
end
|
349
350
|
end
|
350
351
|
|
351
|
-
# @api private
|
352
|
-
class SerializationAdapter
|
353
|
-
# @return [Pathname, IO]
|
354
|
-
attr_reader :inner
|
355
|
-
|
356
|
-
# @param a [Object]
|
357
|
-
#
|
358
|
-
# @return [String]
|
359
|
-
def to_json(*a) = (inner.is_a?(IO) ? inner.read : inner.read(binmode: true)).to_json(*a)
|
360
|
-
|
361
|
-
# @param a [Object]
|
362
|
-
#
|
363
|
-
# @return [String]
|
364
|
-
def to_yaml(*a) = (inner.is_a?(IO) ? inner.read : inner.read(binmode: true)).to_yaml(*a)
|
365
|
-
|
366
|
-
# @api private
|
367
|
-
#
|
368
|
-
# @param inner [Pathname, IO]
|
369
|
-
def initialize(inner) = @inner = inner
|
370
|
-
end
|
371
|
-
|
372
352
|
# @api private
|
373
353
|
#
|
374
354
|
# An adapter that satisfies the IO interface required by `::IO.copy_stream`
|
@@ -471,46 +451,44 @@ module Dodopayments
|
|
471
451
|
end
|
472
452
|
end
|
473
453
|
|
454
|
+
# @type [Regexp]
|
455
|
+
JSON_CONTENT = %r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}
|
456
|
+
# @type [Regexp]
|
457
|
+
JSONL_CONTENT = %r{^application/(?:x-)?jsonl}
|
458
|
+
|
474
459
|
class << self
|
475
460
|
# @api private
|
476
461
|
#
|
477
462
|
# @param y [Enumerator::Yielder]
|
478
|
-
# @param boundary [String]
|
479
|
-
# @param key [Symbol, String]
|
480
463
|
# @param val [Object]
|
481
464
|
# @param closing [Array<Proc>]
|
482
|
-
|
483
|
-
|
465
|
+
# @param content_type [String, nil]
|
466
|
+
private def write_multipart_content(y, val:, closing:, content_type: nil)
|
467
|
+
content_type ||= "application/octet-stream"
|
484
468
|
|
485
|
-
y << "--#{boundary}\r\n"
|
486
|
-
y << "Content-Disposition: form-data"
|
487
|
-
unless key.nil?
|
488
|
-
name = ERB::Util.url_encode(key.to_s)
|
489
|
-
y << "; name=\"#{name}\""
|
490
|
-
end
|
491
|
-
case val
|
492
|
-
in Pathname | IO
|
493
|
-
filename = ERB::Util.url_encode(File.basename(val.to_path))
|
494
|
-
y << "; filename=\"#{filename}\""
|
495
|
-
else
|
496
|
-
end
|
497
|
-
y << "\r\n"
|
498
469
|
case val
|
470
|
+
in Dodopayments::FilePart
|
471
|
+
return write_multipart_content(
|
472
|
+
y,
|
473
|
+
val: val.content,
|
474
|
+
closing: closing,
|
475
|
+
content_type: val.content_type
|
476
|
+
)
|
499
477
|
in Pathname
|
500
|
-
y << "Content-Type:
|
478
|
+
y << "Content-Type: #{content_type}\r\n\r\n"
|
501
479
|
io = val.open(binmode: true)
|
502
480
|
closing << io.method(:close)
|
503
481
|
IO.copy_stream(io, y)
|
504
482
|
in IO
|
505
|
-
y << "Content-Type:
|
483
|
+
y << "Content-Type: #{content_type}\r\n\r\n"
|
506
484
|
IO.copy_stream(val, y)
|
507
485
|
in StringIO
|
508
|
-
y << "Content-Type:
|
486
|
+
y << "Content-Type: #{content_type}\r\n\r\n"
|
509
487
|
y << val.string
|
510
488
|
in String
|
511
|
-
y << "Content-Type:
|
489
|
+
y << "Content-Type: #{content_type}\r\n\r\n"
|
512
490
|
y << val.to_s
|
513
|
-
in
|
491
|
+
in -> { primitive?(_1) }
|
514
492
|
y << "Content-Type: text/plain\r\n\r\n"
|
515
493
|
y << val.to_s
|
516
494
|
else
|
@@ -520,6 +498,36 @@ module Dodopayments
|
|
520
498
|
y << "\r\n"
|
521
499
|
end
|
522
500
|
|
501
|
+
# @api private
|
502
|
+
#
|
503
|
+
# @param y [Enumerator::Yielder]
|
504
|
+
# @param boundary [String]
|
505
|
+
# @param key [Symbol, String]
|
506
|
+
# @param val [Object]
|
507
|
+
# @param closing [Array<Proc>]
|
508
|
+
private def write_multipart_chunk(y, boundary:, key:, val:, closing:)
|
509
|
+
y << "--#{boundary}\r\n"
|
510
|
+
y << "Content-Disposition: form-data"
|
511
|
+
|
512
|
+
unless key.nil?
|
513
|
+
name = ERB::Util.url_encode(key.to_s)
|
514
|
+
y << "; name=\"#{name}\""
|
515
|
+
end
|
516
|
+
|
517
|
+
case val
|
518
|
+
in Dodopayments::FilePart unless val.filename.nil?
|
519
|
+
filename = ERB::Util.url_encode(val.filename)
|
520
|
+
y << "; filename=\"#{filename}\""
|
521
|
+
in Pathname | IO
|
522
|
+
filename = ERB::Util.url_encode(File.basename(val.to_path))
|
523
|
+
y << "; filename=\"#{filename}\""
|
524
|
+
else
|
525
|
+
end
|
526
|
+
y << "\r\n"
|
527
|
+
|
528
|
+
write_multipart_content(y, val: val, closing: closing)
|
529
|
+
end
|
530
|
+
|
523
531
|
# @api private
|
524
532
|
#
|
525
533
|
# @param body [Object]
|
@@ -560,14 +568,12 @@ module Dodopayments
|
|
560
568
|
# @return [Object]
|
561
569
|
def encode_content(headers, body)
|
562
570
|
content_type = headers["content-type"]
|
563
|
-
body = body.inner if body.is_a?(Dodopayments::Internal::Util::SerializationAdapter)
|
564
|
-
|
565
571
|
case [content_type, body]
|
566
|
-
in [
|
572
|
+
in [Dodopayments::Internal::Util::JSON_CONTENT, Hash | Array | -> { primitive?(_1) }]
|
567
573
|
[headers, JSON.fast_generate(body)]
|
568
|
-
in [
|
574
|
+
in [Dodopayments::Internal::Util::JSONL_CONTENT, Enumerable] unless body.is_a?(Dodopayments::Internal::Type::FileInput)
|
569
575
|
[headers, body.lazy.map { JSON.fast_generate(_1) }]
|
570
|
-
in [%r{^multipart/form-data}, Hash |
|
576
|
+
in [%r{^multipart/form-data}, Hash | Dodopayments::Internal::Type::FileInput]
|
571
577
|
boundary, strio = encode_multipart_streaming(body)
|
572
578
|
headers = {**headers, "content-type" => "#{content_type}; boundary=#{boundary}"}
|
573
579
|
[headers, strio]
|
@@ -575,6 +581,8 @@ module Dodopayments
|
|
575
581
|
[headers, body.to_s]
|
576
582
|
in [_, StringIO]
|
577
583
|
[headers, body.string]
|
584
|
+
in [_, Dodopayments::FilePart]
|
585
|
+
[headers, body.content]
|
578
586
|
else
|
579
587
|
[headers, body]
|
580
588
|
end
|
@@ -611,7 +619,7 @@ module Dodopayments
|
|
611
619
|
# @return [Object]
|
612
620
|
def decode_content(headers, stream:, suppress_error: false)
|
613
621
|
case (content_type = headers["content-type"])
|
614
|
-
in
|
622
|
+
in Dodopayments::Internal::Util::JSON_CONTENT
|
615
623
|
json = stream.to_a.join
|
616
624
|
begin
|
617
625
|
JSON.parse(json, symbolize_names: true)
|
@@ -619,7 +627,7 @@ module Dodopayments
|
|
619
627
|
raise e unless suppress_error
|
620
628
|
json
|
621
629
|
end
|
622
|
-
in
|
630
|
+
in Dodopayments::Internal::Util::JSONL_CONTENT
|
623
631
|
lines = decode_lines(stream)
|
624
632
|
chain_fused(lines) do |y|
|
625
633
|
lines.each { y << JSON.parse(_1, symbolize_names: true) }
|
@@ -34,11 +34,15 @@ module Dodopayments
|
|
34
34
|
required :zipcode, String
|
35
35
|
|
36
36
|
# @!method initialize(city:, country:, state:, street:, zipcode:)
|
37
|
-
# @param city [String]
|
38
|
-
#
|
39
|
-
# @param
|
40
|
-
#
|
41
|
-
# @param
|
37
|
+
# @param city [String] City name
|
38
|
+
#
|
39
|
+
# @param country [Symbol, Dodopayments::Models::CountryCode] ISO country code alpha2 variant
|
40
|
+
#
|
41
|
+
# @param state [String] State or province name
|
42
|
+
#
|
43
|
+
# @param street [String] Street address including house number and unit/apartment if applicable
|
44
|
+
#
|
45
|
+
# @param zipcode [String] Postal code or ZIP code
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
@@ -27,9 +27,16 @@ module Dodopayments
|
|
27
27
|
optional :phone_number, String, nil?: true
|
28
28
|
|
29
29
|
# @!method initialize(email:, name:, create_new_customer: nil, phone_number: nil)
|
30
|
+
# Some parameter documentations has been truncated, see
|
31
|
+
# {Dodopayments::Models::CreateNewCustomer} for more details.
|
32
|
+
#
|
30
33
|
# @param email [String]
|
34
|
+
#
|
31
35
|
# @param name [String]
|
32
|
-
#
|
36
|
+
#
|
37
|
+
# @param create_new_customer [Boolean] When false, the most recently created customer object with the given email is us
|
38
|
+
# ...
|
39
|
+
#
|
33
40
|
# @param phone_number [String, nil]
|
34
41
|
end
|
35
42
|
end
|
@@ -22,9 +22,11 @@ module Dodopayments
|
|
22
22
|
required :name, String
|
23
23
|
|
24
24
|
# @!method initialize(customer_id:, email:, name:)
|
25
|
-
# @param customer_id [String]
|
26
|
-
#
|
27
|
-
# @param
|
25
|
+
# @param customer_id [String] Unique identifier for the customer
|
26
|
+
#
|
27
|
+
# @param email [String] Email address of the customer
|
28
|
+
#
|
29
|
+
# @param name [String] Full name of the customer
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|
@@ -20,8 +20,10 @@ module Dodopayments
|
|
20
20
|
optional :page_size, Integer, nil?: true
|
21
21
|
|
22
22
|
# @!method initialize(page_number: nil, page_size: nil, request_options: {})
|
23
|
-
# @param page_number [Integer, nil]
|
24
|
-
#
|
23
|
+
# @param page_number [Integer, nil] Page number default is 0
|
24
|
+
#
|
25
|
+
# @param page_size [Integer, nil] Page size default is 10 max is 100
|
26
|
+
#
|
25
27
|
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
26
28
|
end
|
27
29
|
end
|
@@ -15,7 +15,8 @@ module Dodopayments
|
|
15
15
|
optional :send_email, Dodopayments::Internal::Type::Boolean, nil?: true
|
16
16
|
|
17
17
|
# @!method initialize(send_email: nil, request_options: {})
|
18
|
-
# @param send_email [Boolean, nil]
|
18
|
+
# @param send_email [Boolean, nil] If true, will send link to user.
|
19
|
+
#
|
19
20
|
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
20
21
|
end
|
21
22
|
end
|
@@ -74,17 +74,30 @@ module Dodopayments
|
|
74
74
|
optional :usage_limit, Integer, nil?: true
|
75
75
|
|
76
76
|
# @!method initialize(amount:, business_id:, code:, created_at:, discount_id:, restricted_to:, times_used:, type:, expires_at: nil, name: nil, usage_limit: nil)
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
# @param
|
81
|
-
#
|
82
|
-
# @param
|
83
|
-
#
|
77
|
+
# Some parameter documentations has been truncated, see
|
78
|
+
# {Dodopayments::Models::Discount} for more details.
|
79
|
+
#
|
80
|
+
# @param amount [Integer] The discount amount. ...
|
81
|
+
#
|
82
|
+
# @param business_id [String] The business this discount belongs to.
|
83
|
+
#
|
84
|
+
# @param code [String] The discount code (up to 16 chars).
|
85
|
+
#
|
86
|
+
# @param created_at [Time] Timestamp when the discount is created
|
87
|
+
#
|
88
|
+
# @param discount_id [String] The unique discount ID
|
89
|
+
#
|
90
|
+
# @param restricted_to [Array<String>] List of product IDs to which this discount is restricted.
|
91
|
+
#
|
92
|
+
# @param times_used [Integer] How many times this discount has been used.
|
93
|
+
#
|
84
94
|
# @param type [Symbol, Dodopayments::Models::DiscountType]
|
85
|
-
#
|
86
|
-
# @param
|
87
|
-
#
|
95
|
+
#
|
96
|
+
# @param expires_at [Time, nil] Optional date/time after which discount is expired.
|
97
|
+
#
|
98
|
+
# @param name [String, nil] Name for the Discount
|
99
|
+
#
|
100
|
+
# @param usage_limit [Integer, nil] Usage limit for this discount, if any.
|
88
101
|
end
|
89
102
|
end
|
90
103
|
end
|
@@ -58,13 +58,23 @@ module Dodopayments
|
|
58
58
|
optional :usage_limit, Integer, nil?: true
|
59
59
|
|
60
60
|
# @!method initialize(amount:, type:, code: nil, expires_at: nil, name: nil, restricted_to: nil, usage_limit: nil, request_options: {})
|
61
|
-
#
|
61
|
+
# Some parameter documentations has been truncated, see
|
62
|
+
# {Dodopayments::Models::DiscountCreateParams} for more details.
|
63
|
+
#
|
64
|
+
# @param amount [Integer] The discount amount. ...
|
65
|
+
#
|
62
66
|
# @param type [Symbol, Dodopayments::Models::DiscountType]
|
63
|
-
#
|
64
|
-
# @param
|
67
|
+
#
|
68
|
+
# @param code [String, nil] Optionally supply a code (will be uppercased). ...
|
69
|
+
#
|
70
|
+
# @param expires_at [Time, nil] When the discount expires, if ever.
|
71
|
+
#
|
65
72
|
# @param name [String, nil]
|
66
|
-
#
|
67
|
-
# @param
|
73
|
+
#
|
74
|
+
# @param restricted_to [Array<String>, nil] List of product IDs to restrict usage (if any).
|
75
|
+
#
|
76
|
+
# @param usage_limit [Integer, nil] How many times this discount can be used (if any). ...
|
77
|
+
#
|
68
78
|
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
69
79
|
end
|
70
80
|
end
|
@@ -20,8 +20,10 @@ module Dodopayments
|
|
20
20
|
optional :page_size, Integer, nil?: true
|
21
21
|
|
22
22
|
# @!method initialize(page_number: nil, page_size: nil, request_options: {})
|
23
|
-
# @param page_number [Integer, nil]
|
24
|
-
#
|
23
|
+
# @param page_number [Integer, nil] Page number (default = 0).
|
24
|
+
#
|
25
|
+
# @param page_size [Integer, nil] Page size (default = 10, max = 100).
|
26
|
+
#
|
25
27
|
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
26
28
|
end
|
27
29
|
end
|
@@ -53,13 +53,23 @@ module Dodopayments
|
|
53
53
|
optional :usage_limit, Integer, nil?: true
|
54
54
|
|
55
55
|
# @!method initialize(amount: nil, code: nil, expires_at: nil, name: nil, restricted_to: nil, type: nil, usage_limit: nil, request_options: {})
|
56
|
-
#
|
57
|
-
#
|
56
|
+
# Some parameter documentations has been truncated, see
|
57
|
+
# {Dodopayments::Models::DiscountUpdateParams} for more details.
|
58
|
+
#
|
59
|
+
# @param amount [Integer, nil] If present, update the discount amount: ...
|
60
|
+
#
|
61
|
+
# @param code [String, nil] If present, update the discount code (uppercase).
|
62
|
+
#
|
58
63
|
# @param expires_at [Time, nil]
|
64
|
+
#
|
59
65
|
# @param name [String, nil]
|
60
|
-
#
|
66
|
+
#
|
67
|
+
# @param restricted_to [Array<String>, nil] If present, replaces all restricted product IDs with this new set. ...
|
68
|
+
#
|
61
69
|
# @param type [Symbol, Dodopayments::Models::DiscountType, nil]
|
70
|
+
#
|
62
71
|
# @param usage_limit [Integer, nil]
|
72
|
+
#
|
63
73
|
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
64
74
|
end
|
65
75
|
end
|
@@ -52,14 +52,25 @@ module Dodopayments
|
|
52
52
|
required :payment_id, String
|
53
53
|
|
54
54
|
# @!method initialize(amount:, business_id:, created_at:, currency:, dispute_id:, dispute_stage:, dispute_status:, payment_id:)
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
# @param
|
59
|
-
#
|
55
|
+
# Some parameter documentations has been truncated, see
|
56
|
+
# {Dodopayments::Models::Dispute} for more details.
|
57
|
+
#
|
58
|
+
# @param amount [String] The amount involved in the dispute, represented as a string to accommodate preci
|
59
|
+
# ...
|
60
|
+
#
|
61
|
+
# @param business_id [String] The unique identifier of the business involved in the dispute.
|
62
|
+
#
|
63
|
+
# @param created_at [Time] The timestamp of when the dispute was created, in UTC.
|
64
|
+
#
|
65
|
+
# @param currency [String] The currency of the disputed amount, represented as an ISO 4217 currency code.
|
66
|
+
#
|
67
|
+
# @param dispute_id [String] The unique identifier of the dispute.
|
68
|
+
#
|
60
69
|
# @param dispute_stage [Symbol, Dodopayments::Models::DisputeStage]
|
70
|
+
#
|
61
71
|
# @param dispute_status [Symbol, Dodopayments::Models::DisputeStatus]
|
62
|
-
#
|
72
|
+
#
|
73
|
+
# @param payment_id [String] The unique identifier of the payment associated with the dispute.
|
63
74
|
end
|
64
75
|
end
|
65
76
|
end
|
@@ -50,13 +50,20 @@ module Dodopayments
|
|
50
50
|
optional :page_size, Integer, nil?: true
|
51
51
|
|
52
52
|
# @!method initialize(created_at_gte: nil, created_at_lte: nil, customer_id: nil, dispute_stage: nil, dispute_status: nil, page_number: nil, page_size: nil, request_options: {})
|
53
|
-
# @param created_at_gte [Time, nil]
|
54
|
-
#
|
55
|
-
# @param
|
56
|
-
#
|
57
|
-
# @param
|
58
|
-
#
|
59
|
-
# @param
|
53
|
+
# @param created_at_gte [Time, nil] Get events after this created time
|
54
|
+
#
|
55
|
+
# @param created_at_lte [Time, nil] Get events created before this time
|
56
|
+
#
|
57
|
+
# @param customer_id [String, nil] Filter by customer_id
|
58
|
+
#
|
59
|
+
# @param dispute_stage [Symbol, Dodopayments::Models::DisputeStage, nil] Filter by dispute stage
|
60
|
+
#
|
61
|
+
# @param dispute_status [Symbol, Dodopayments::Models::DisputeStatus, nil] Filter by dispute status
|
62
|
+
#
|
63
|
+
# @param page_number [Integer, nil] Page number default is 0
|
64
|
+
#
|
65
|
+
# @param page_size [Integer, nil] Page size default is 10 max is 100
|
66
|
+
#
|
60
67
|
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
61
68
|
end
|
62
69
|
end
|