dodopayments 1.19.0 → 1.22.0

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.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -0
  3. data/README.md +5 -5
  4. data/lib/dodopayments/client.rb +4 -0
  5. data/lib/dodopayments/internal/default_page_number_pagination.rb +2 -2
  6. data/lib/dodopayments/internal/transport/base_client.rb +3 -3
  7. data/lib/dodopayments/internal/type/base_model.rb +1 -9
  8. data/lib/dodopayments/internal/type/request_parameters.rb +2 -8
  9. data/lib/dodopayments/internal/util.rb +20 -4
  10. data/lib/dodopayments/models/addon_cart_response_item.rb +23 -0
  11. data/lib/dodopayments/models/addon_create_params.rb +58 -0
  12. data/lib/dodopayments/models/addon_list_params.rb +30 -0
  13. data/lib/dodopayments/models/addon_response.rb +93 -0
  14. data/lib/dodopayments/models/addon_retrieve_params.rb +14 -0
  15. data/lib/dodopayments/models/addon_update_images_params.rb +14 -0
  16. data/lib/dodopayments/models/addon_update_images_response.rb +22 -0
  17. data/lib/dodopayments/models/addon_update_params.rb +66 -0
  18. data/lib/dodopayments/models/currency.rb +158 -0
  19. data/lib/dodopayments/models/dispute.rb +9 -2
  20. data/lib/dodopayments/models/dispute_list_response.rb +76 -0
  21. data/lib/dodopayments/models/dispute_retrieve_response.rb +99 -0
  22. data/lib/dodopayments/models/payment.rb +46 -315
  23. data/lib/dodopayments/models/payment_create_params.rb +3 -158
  24. data/lib/dodopayments/models/payment_list_response.rb +3 -157
  25. data/lib/dodopayments/models/payout_list_response.rb +3 -157
  26. data/lib/dodopayments/models/price.rb +6 -314
  27. data/lib/dodopayments/models/product.rb +3 -19
  28. data/lib/dodopayments/models/product_create_params.rb +3 -17
  29. data/lib/dodopayments/models/product_list_response.rb +6 -176
  30. data/lib/dodopayments/models/product_update_params.rb +3 -17
  31. data/lib/dodopayments/models/refund.rb +3 -157
  32. data/lib/dodopayments/models/subscription.rb +21 -158
  33. data/lib/dodopayments/models/subscription_change_plan_params.rb +31 -1
  34. data/lib/dodopayments/models/subscription_create_params.rb +30 -159
  35. data/lib/dodopayments/models/subscription_create_response.rb +10 -1
  36. data/lib/dodopayments/models/subscription_list_response.rb +179 -0
  37. data/lib/dodopayments/models/subscription_update_params.rb +19 -1
  38. data/lib/dodopayments/models/tax_category.rb +19 -0
  39. data/lib/dodopayments/models.rb +167 -0
  40. data/lib/dodopayments/resources/addons.rb +141 -0
  41. data/lib/dodopayments/resources/disputes.rb +4 -4
  42. data/lib/dodopayments/resources/invoices/payments.rb +3 -2
  43. data/lib/dodopayments/resources/payments.rb +1 -1
  44. data/lib/dodopayments/resources/products.rb +2 -2
  45. data/lib/dodopayments/resources/subscriptions.rb +15 -6
  46. data/lib/dodopayments/version.rb +1 -1
  47. data/lib/dodopayments.rb +14 -0
  48. data/rbi/dodopayments/client.rbi +3 -0
  49. data/rbi/dodopayments/errors.rbi +1 -1
  50. data/rbi/dodopayments/internal/util.rbi +5 -1
  51. data/rbi/dodopayments/models/addon_cart_response_item.rbi +20 -0
  52. data/rbi/dodopayments/models/addon_create_params.rbi +69 -0
  53. data/rbi/dodopayments/models/addon_list_params.rbi +45 -0
  54. data/rbi/dodopayments/models/addon_response.rbi +103 -0
  55. data/rbi/dodopayments/models/addon_retrieve_params.rbi +19 -0
  56. data/rbi/dodopayments/models/addon_update_images_params.rbi +19 -0
  57. data/rbi/dodopayments/models/addon_update_images_response.rbi +19 -0
  58. data/rbi/dodopayments/models/addon_update_params.rbi +77 -0
  59. data/rbi/dodopayments/models/currency.rbi +161 -0
  60. data/rbi/dodopayments/models/dispute.rbi +11 -3
  61. data/rbi/dodopayments/models/dispute_list_response.rbi +85 -0
  62. data/rbi/dodopayments/models/dispute_retrieve_response.rbi +112 -0
  63. data/rbi/dodopayments/models/payment.rbi +47 -318
  64. data/rbi/dodopayments/models/payment_create_params.rbi +3 -159
  65. data/rbi/dodopayments/models/payment_list_response.rbi +3 -159
  66. data/rbi/dodopayments/models/payout_list_response.rbi +3 -159
  67. data/rbi/dodopayments/models/price.rbi +6 -318
  68. data/rbi/dodopayments/models/product.rbi +3 -20
  69. data/rbi/dodopayments/models/product_create_params.rbi +3 -21
  70. data/rbi/dodopayments/models/product_list_response.rbi +6 -180
  71. data/rbi/dodopayments/models/product_update_params.rbi +3 -21
  72. data/rbi/dodopayments/models/refund.rbi +3 -159
  73. data/rbi/dodopayments/models/subscription.rbi +19 -159
  74. data/rbi/dodopayments/models/subscription_change_plan_params.rbi +26 -0
  75. data/rbi/dodopayments/models/subscription_create_params.rbi +27 -160
  76. data/rbi/dodopayments/models/subscription_create_response.rbi +8 -0
  77. data/rbi/dodopayments/models/subscription_list_response.rbi +190 -0
  78. data/rbi/dodopayments/models/subscription_update_params.rbi +37 -1
  79. data/rbi/dodopayments/models/tax_category.rbi +22 -0
  80. data/rbi/dodopayments/models.rbi +167 -0
  81. data/rbi/dodopayments/resources/addons.rbi +97 -0
  82. data/rbi/dodopayments/resources/disputes.rbi +2 -2
  83. data/rbi/dodopayments/resources/invoices/payments.rbi +1 -1
  84. data/rbi/dodopayments/resources/payments.rbi +1 -1
  85. data/rbi/dodopayments/resources/products.rbi +2 -2
  86. data/rbi/dodopayments/resources/subscriptions.rbi +19 -2
  87. data/sig/dodopayments/client.rbs +2 -0
  88. data/sig/dodopayments/internal/util.rbs +2 -0
  89. data/sig/dodopayments/models/addon_cart_response_item.rbs +15 -0
  90. data/sig/dodopayments/models/addon_create_params.rbs +39 -0
  91. data/sig/dodopayments/models/addon_list_params.rbs +24 -0
  92. data/sig/dodopayments/models/addon_response.rbs +54 -0
  93. data/sig/dodopayments/models/addon_retrieve_params.rbs +15 -0
  94. data/sig/dodopayments/models/addon_update_images_params.rbs +15 -0
  95. data/sig/dodopayments/models/addon_update_images_response.rbs +15 -0
  96. data/sig/dodopayments/models/addon_update_params.rbs +43 -0
  97. data/sig/dodopayments/models/currency.rbs +302 -0
  98. data/sig/dodopayments/models/dispute.rbs +6 -2
  99. data/sig/dodopayments/models/dispute_list_response.rbs +46 -0
  100. data/sig/dodopayments/models/dispute_retrieve_response.rbs +58 -0
  101. data/sig/dodopayments/models/payment.rbs +26 -604
  102. data/sig/dodopayments/models/payment_create_params.rbs +3 -302
  103. data/sig/dodopayments/models/payment_list_response.rbs +3 -302
  104. data/sig/dodopayments/models/payout_list_response.rbs +3 -302
  105. data/sig/dodopayments/models/price.rbs +6 -604
  106. data/sig/dodopayments/models/product.rbs +3 -16
  107. data/sig/dodopayments/models/product_create_params.rbs +3 -16
  108. data/sig/dodopayments/models/product_list_response.rbs +6 -318
  109. data/sig/dodopayments/models/product_update_params.rbs +3 -16
  110. data/sig/dodopayments/models/refund.rbs +3 -302
  111. data/sig/dodopayments/models/subscription.rbs +11 -302
  112. data/sig/dodopayments/models/subscription_change_plan_params.rbs +17 -1
  113. data/sig/dodopayments/models/subscription_create_params.rbs +19 -302
  114. data/sig/dodopayments/models/subscription_create_response.rbs +4 -0
  115. data/sig/dodopayments/models/subscription_list_response.rbs +98 -0
  116. data/sig/dodopayments/models/subscription_update_params.rbs +14 -0
  117. data/sig/dodopayments/models/tax_category.rbs +16 -0
  118. data/sig/dodopayments/models.rbs +165 -0
  119. data/sig/dodopayments/resources/addons.rbs +43 -0
  120. data/sig/dodopayments/resources/disputes.rbs +2 -2
  121. data/sig/dodopayments/resources/invoices/payments.rbs +1 -1
  122. data/sig/dodopayments/resources/payments.rbs +1 -1
  123. data/sig/dodopayments/resources/products.rbs +2 -2
  124. data/sig/dodopayments/resources/subscriptions.rbs +5 -2
  125. metadata +49 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d1a48e653837160bb439d4e35d801a8de5fe88751cd32d8a9147663e7251381
4
- data.tar.gz: 03f679fa0bdc29f57ae09a458b1c31ce1c175926bbe521d5042da2a8939a5cb3
3
+ metadata.gz: f0db8ac6abab224124982361204de2655bd917a370eba199ce6c6ee668296f06
4
+ data.tar.gz: 268aa11f3fb3430ac18eb2c483ca6fc1d49d1df9801aa6f706b9233f330840f0
5
5
  SHA512:
6
- metadata.gz: 401099541db5886408eb47a0f75329cc9f740b0bbf0bb4dee999897a0c496f9b880b1d6d3231904d95e05f4b5e11c8f8252d23db34f26dd640731753c1617106
7
- data.tar.gz: 0b5331df7152b042e06005799a64c3ad6d39f21d199885e671464d3f6039ede3f46fa0c5ae72e523e6405e634422bd4337d99aebf4f10a26f7e7f8b7d2526638
6
+ metadata.gz: 38271ef5ae9db50f038f12341d8ab2153eb7683a96f8e0b1ace1a229287099acdaf9a2e0aa0cc9cf4d3cb5a9ceb76c792b6683ccdb9ea02e09a54bcef431831d
7
+ data.tar.gz: fa6f3f577a1a045311e8525fc720148981c4f0db35f7b1899c1e40467c47fff43c36d2531c1a3b5f6a949148d50cc9606586b9da656a6a98a5deee13968a49ef
data/CHANGELOG.md CHANGED
@@ -1,5 +1,62 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.22.0 (2025-05-09)
4
+
5
+ Full Changelog: [v1.20.0...v1.22.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.20.0...v1.22.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** fixed api key schema to bearer ([06d3549](https://github.com/dodopayments/dodopayments-ruby/commit/06d354910a3eb15c036d35f68cfb5393c5a20c62))
10
+ * **api:** manual updates ([eae9353](https://github.com/dodopayments/dodopayments-ruby/commit/eae935376b239dc03bc8ad8ed201e9ca9c2eeaa4))
11
+ * **api:** updated openapi spec ([c369261](https://github.com/dodopayments/dodopayments-ruby/commit/c369261442be58e8b31890f0362fba1536bb9593))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **internal:** fix formatting script for macos ([8abfc9c](https://github.com/dodopayments/dodopayments-ruby/commit/8abfc9c2b3921e5fb3e5903612111e02a87e92d1))
17
+
18
+
19
+ ### Chores
20
+
21
+ * accept all nd-json mimetype variants ([b0dd5d6](https://github.com/dodopayments/dodopayments-ruby/commit/b0dd5d644ce5ebbcd0259dca5f9113befa548b54))
22
+ * always check if current page is empty in `next_page?` ([45b817d](https://github.com/dodopayments/dodopayments-ruby/commit/45b817d504e3c4cbc17b328c53ab9a310d038b22))
23
+ * **internal:** codegen related update ([e3ce1b3](https://github.com/dodopayments/dodopayments-ruby/commit/e3ce1b36a1ea8dba0fbd2915a6deadc01820d280))
24
+ * **internal:** codegen related update ([2cd0f3e](https://github.com/dodopayments/dodopayments-ruby/commit/2cd0f3e089a67097c26e9abef90b55cecfaa014c))
25
+ * re-export top level models under library namespace ([bbc82df](https://github.com/dodopayments/dodopayments-ruby/commit/bbc82df831d64038e9169ff0912401d2e333082b))
26
+ * remove Gemfile.lock during bootstrap ([a484914](https://github.com/dodopayments/dodopayments-ruby/commit/a48491445f25a274883dd8068913efcd9e68c32d))
27
+ * revert ignoring Gemfile.lock ([8ba5e6a](https://github.com/dodopayments/dodopayments-ruby/commit/8ba5e6a4f876f0823b33eb92443ebd5d97c2139f))
28
+ * validate request option coercion correctness ([1ac286c](https://github.com/dodopayments/dodopayments-ruby/commit/1ac286ccf79b674d312bf50fa29bb8a1f7e37176))
29
+
30
+
31
+ ### Documentation
32
+
33
+ * illustrate environmental defaults for auth variables ([520d6cf](https://github.com/dodopayments/dodopayments-ruby/commit/520d6cf3692d5aeaf3faee980160521d81bd3867))
34
+
35
+ ## 1.20.0 (2025-05-01)
36
+
37
+ Full Changelog: [v1.19.0...v1.20.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.19.0...v1.20.0)
38
+
39
+ ### Features
40
+
41
+ * **api:** added addons ([b7ab9df](https://github.com/dodopayments/dodopayments-ruby/commit/b7ab9dfcffc9113bb89668fac0870241e68ec1f8))
42
+ * **api:** updated readme example ([7ab77ac](https://github.com/dodopayments/dodopayments-ruby/commit/7ab77ac6b2f2349a0876996b2740d4baeca97f3f))
43
+ * **api:** updated readme example ([9646785](https://github.com/dodopayments/dodopayments-ruby/commit/964678539575be673521723ef0b41c5b5af85f97))
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * re-exported array and map models should typecheck in steep ([443c685](https://github.com/dodopayments/dodopayments-ruby/commit/443c685afdddc50872c8eddbf7acf37d1bf65402))
49
+
50
+
51
+ ### Chores
52
+
53
+ * migrate away from deprecated `JSON#fast_generate` ([11a01cc](https://github.com/dodopayments/dodopayments-ruby/commit/11a01ccc3ab39f47c6b13ff359bf4ec99378c40b))
54
+
55
+
56
+ ### Documentation
57
+
58
+ * **readme:** fix typo ([32dda82](https://github.com/dodopayments/dodopayments-ruby/commit/32dda82d2b0fd01b6bc1c4b19a62a39ecc3f96c1))
59
+
3
60
  ## 1.19.0 (2025-04-30)
4
61
 
5
62
  Full Changelog: [v1.18.3...v1.19.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.18.3...v1.19.0)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Dodo Payments Ruby API library
2
2
 
3
- The Dodo Payments Ruby library provides convenient access to the Dodo Payments REST API from any Ruby 3.1.0+ application.
3
+ The Dodo Payments Ruby library provides convenient access to the Dodo Payments REST API from any Ruby 3.2.0+ application.
4
4
 
5
5
  It is generated with [Stainless](https://www.stainless.com/).
6
6
 
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "dodopayments", "~> 1.19.0"
20
+ gem "dodopayments", "~> 1.22.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -29,7 +29,7 @@ require "bundler/setup"
29
29
  require "dodopayments"
30
30
 
31
31
  dodo_payments = Dodopayments::Client.new(
32
- bearer_token: "My Bearer Token", # defaults to ENV["DODO_PAYMENTS_API_KEY"]
32
+ bearer_token: ENV["DODO_PAYMENTS_API_KEY"], # This is the default and can be omitted
33
33
  environment: "test_mode" # defaults to "live_mode"
34
34
  )
35
35
 
@@ -79,7 +79,7 @@ rescue Dodopayments::Errors::APIError => e
79
79
  end
80
80
  ```
81
81
 
82
- Error codes are as followed:
82
+ Error codes are as follows:
83
83
 
84
84
  | Cause | Error Type |
85
85
  | ---------------- | -------------------------- |
@@ -217,7 +217,7 @@ This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` typ
217
217
 
218
218
  ## Requirements
219
219
 
220
- Ruby 3.1.0 or higher.
220
+ Ruby 3.2.0 or higher.
221
221
 
222
222
  ## Contributing
223
223
 
@@ -66,6 +66,9 @@ module Dodopayments
66
66
  # @return [Dodopayments::Resources::Discounts]
67
67
  attr_reader :discounts
68
68
 
69
+ # @return [Dodopayments::Resources::Addons]
70
+ attr_reader :addons
71
+
69
72
  # @api private
70
73
  #
71
74
  # @return [Hash{String=>String}]
@@ -138,6 +141,7 @@ module Dodopayments
138
141
  @products = Dodopayments::Resources::Products.new(client: self)
139
142
  @misc = Dodopayments::Resources::Misc.new(client: self)
140
143
  @discounts = Dodopayments::Resources::Discounts.new(client: self)
144
+ @addons = Dodopayments::Resources::Addons.new(client: self)
141
145
  end
142
146
  end
143
147
  end
@@ -72,8 +72,8 @@ module Dodopayments
72
72
  super
73
73
 
74
74
  case page_data
75
- in {items: Array | nil => items}
76
- @items = items&.map { Dodopayments::Internal::Type::Converter.coerce(@model, _1) }
75
+ in {items: Array => items}
76
+ @items = items.map { Dodopayments::Internal::Type::Converter.coerce(@model, _1) }
77
77
  else
78
78
  end
79
79
  end
@@ -261,7 +261,7 @@ module Dodopayments
261
261
  headers["x-stainless-retry-count"] = "0"
262
262
  end
263
263
 
264
- timeout = opts.fetch(:timeout, @timeout).to_f.clamp((0..))
264
+ timeout = opts.fetch(:timeout, @timeout).to_f.clamp(0..)
265
265
  unless headers.key?("x-stainless-timeout") || timeout.zero?
266
266
  headers["x-stainless-timeout"] = timeout.to_s
267
267
  end
@@ -461,9 +461,9 @@ module Dodopayments
461
461
 
462
462
  decoded = Dodopayments::Internal::Util.decode_content(response, stream: stream)
463
463
  case req
464
- in { stream: Class => st }
464
+ in {stream: Class => st}
465
465
  st.new(model: model, url: url, status: status, response: response, stream: decoded)
466
- in { page: Class => page }
466
+ in {page: Class => page}
467
467
  page.new(client: self, req: req, headers: response, page_data: decoded)
468
468
  else
469
469
  unwrapped = Dodopayments::Internal::Util.dig(decoded, req[:unwrap])
@@ -395,15 +395,7 @@ module Dodopayments
395
395
  # Create a new instance of a model.
396
396
  #
397
397
  # @param data [Hash{Symbol=>Object}, self]
398
- def initialize(data = {})
399
- case Dodopayments::Internal::Util.coerce_hash(data)
400
- in Hash => coerced
401
- @data = coerced
402
- else
403
- message = "Expected a #{Hash} or #{Dodopayments::Internal::Type::BaseModel}, got #{data.inspect}"
404
- raise ArgumentError.new(message)
405
- end
406
- end
398
+ def initialize(data = {}) = (@data = Dodopayments::Internal::Util.coerce_hash!(data).to_h)
407
399
 
408
400
  class << self
409
401
  # @api private
@@ -28,14 +28,8 @@ module Dodopayments
28
28
  state = {can_retry: true}
29
29
  case (dumped = dump(params, state: state))
30
30
  in Hash
31
- options = Dodopayments::Internal::Util.coerce_hash(dumped[:request_options])
32
- request_options =
33
- case [options, state.fetch(:can_retry)]
34
- in [Hash | nil, false]
35
- {**options.to_h, max_retries: 0}
36
- else
37
- options
38
- end
31
+ options = Dodopayments::Internal::Util.coerce_hash!(dumped[:request_options]).to_h
32
+ request_options = state.fetch(:can_retry) ? options : {**options, max_retries: 0}
39
33
  [dumped.except(:request_options), request_options]
40
34
  else
41
35
  [dumped, nil]
@@ -128,6 +128,22 @@ module Dodopayments
128
128
  input.respond_to?(:to_h) ? input.to_h : input
129
129
  end
130
130
  end
131
+
132
+ # @api private
133
+ #
134
+ # @param input [Object]
135
+ #
136
+ # @raise [ArgumentError]
137
+ # @return [Hash{Object=>Object}, nil]
138
+ def coerce_hash!(input)
139
+ case coerce_hash(input)
140
+ in Hash | nil => coerced
141
+ coerced
142
+ else
143
+ message = "Expected a #{Hash} or #{Dodopayments::Internal::Type::BaseModel}, got #{data.inspect}"
144
+ raise ArgumentError.new(message)
145
+ end
146
+ end
131
147
  end
132
148
 
133
149
  class << self
@@ -454,7 +470,7 @@ module Dodopayments
454
470
  # @type [Regexp]
455
471
  JSON_CONTENT = %r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}
456
472
  # @type [Regexp]
457
- JSONL_CONTENT = %r{^application/(?:x-)?jsonl}
473
+ JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}
458
474
 
459
475
  class << self
460
476
  # @api private
@@ -493,7 +509,7 @@ module Dodopayments
493
509
  y << val.to_s
494
510
  else
495
511
  y << "Content-Type: application/json\r\n\r\n"
496
- y << JSON.fast_generate(val)
512
+ y << JSON.generate(val)
497
513
  end
498
514
  y << "\r\n"
499
515
  end
@@ -570,9 +586,9 @@ module Dodopayments
570
586
  content_type = headers["content-type"]
571
587
  case [content_type, body]
572
588
  in [Dodopayments::Internal::Util::JSON_CONTENT, Hash | Array | -> { primitive?(_1) }]
573
- [headers, JSON.fast_generate(body)]
589
+ [headers, JSON.generate(body)]
574
590
  in [Dodopayments::Internal::Util::JSONL_CONTENT, Enumerable] unless body.is_a?(Dodopayments::Internal::Type::FileInput)
575
- [headers, body.lazy.map { JSON.fast_generate(_1) }]
591
+ [headers, body.lazy.map { JSON.generate(_1) }]
576
592
  in [%r{^multipart/form-data}, Hash | Dodopayments::Internal::Type::FileInput]
577
593
  boundary, strio = encode_multipart_streaming(body)
578
594
  headers = {**headers, "content-type" => "#{content_type}; boundary=#{boundary}"}
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class AddonCartResponseItem < Dodopayments::Internal::Type::BaseModel
6
+ # @!attribute addon_id
7
+ #
8
+ # @return [String]
9
+ required :addon_id, String
10
+
11
+ # @!attribute quantity
12
+ #
13
+ # @return [Integer]
14
+ required :quantity, Integer
15
+
16
+ # @!method initialize(addon_id:, quantity:)
17
+ # Response struct representing subscription details
18
+ #
19
+ # @param addon_id [String]
20
+ # @param quantity [Integer]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Addons#create
6
+ class AddonCreateParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ # @!attribute currency
11
+ #
12
+ # @return [Symbol, Dodopayments::Models::Currency]
13
+ required :currency, enum: -> { Dodopayments::Models::Currency }
14
+
15
+ # @!attribute name
16
+ # Name of the Addon
17
+ #
18
+ # @return [String]
19
+ required :name, String
20
+
21
+ # @!attribute price
22
+ # Amount of the addon
23
+ #
24
+ # @return [Integer]
25
+ required :price, Integer
26
+
27
+ # @!attribute tax_category
28
+ # Represents the different categories of taxation applicable to various products
29
+ # and services.
30
+ #
31
+ # @return [Symbol, Dodopayments::Models::TaxCategory]
32
+ required :tax_category, enum: -> { Dodopayments::Models::TaxCategory }
33
+
34
+ # @!attribute description
35
+ # Optional description of the Addon
36
+ #
37
+ # @return [String, nil]
38
+ optional :description, String, nil?: true
39
+
40
+ # @!method initialize(currency:, name:, price:, tax_category:, description: nil, request_options: {})
41
+ # Some parameter documentations has been truncated, see
42
+ # {Dodopayments::Models::AddonCreateParams} for more details.
43
+ #
44
+ # @param currency [Symbol, Dodopayments::Models::Currency]
45
+ #
46
+ # @param name [String] Name of the Addon
47
+ #
48
+ # @param price [Integer] Amount of the addon
49
+ #
50
+ # @param tax_category [Symbol, Dodopayments::Models::TaxCategory] Represents the different categories of taxation applicable to various products a
51
+ # ...
52
+ #
53
+ # @param description [String, nil] Optional description of the Addon
54
+ #
55
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Addons#list
6
+ class AddonListParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ # @!attribute page_number
11
+ # Page number default is 0
12
+ #
13
+ # @return [Integer, nil]
14
+ optional :page_number, Integer, nil?: true
15
+
16
+ # @!attribute page_size
17
+ # Page size default is 10 max is 100
18
+ #
19
+ # @return [Integer, nil]
20
+ optional :page_size, Integer, nil?: true
21
+
22
+ # @!method initialize(page_number: nil, page_size: nil, request_options: {})
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
+ #
27
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Addons#create
6
+ class AddonResponse < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ # id of the Addon
9
+ #
10
+ # @return [String]
11
+ required :id, String
12
+
13
+ # @!attribute business_id
14
+ # Unique identifier for the business to which the addon belongs.
15
+ #
16
+ # @return [String]
17
+ required :business_id, String
18
+
19
+ # @!attribute created_at
20
+ # Created time
21
+ #
22
+ # @return [Time]
23
+ required :created_at, Time
24
+
25
+ # @!attribute currency
26
+ #
27
+ # @return [Symbol, Dodopayments::Models::Currency]
28
+ required :currency, enum: -> { Dodopayments::Models::Currency }
29
+
30
+ # @!attribute name
31
+ # Name of the Addon
32
+ #
33
+ # @return [String]
34
+ required :name, String
35
+
36
+ # @!attribute price
37
+ # Amount of the addon
38
+ #
39
+ # @return [Integer]
40
+ required :price, Integer
41
+
42
+ # @!attribute tax_category
43
+ # Represents the different categories of taxation applicable to various products
44
+ # and services.
45
+ #
46
+ # @return [Symbol, Dodopayments::Models::TaxCategory]
47
+ required :tax_category, enum: -> { Dodopayments::Models::TaxCategory }
48
+
49
+ # @!attribute updated_at
50
+ # Updated time
51
+ #
52
+ # @return [Time]
53
+ required :updated_at, Time
54
+
55
+ # @!attribute description
56
+ # Optional description of the Addon
57
+ #
58
+ # @return [String, nil]
59
+ optional :description, String, nil?: true
60
+
61
+ # @!attribute image
62
+ # Image of the Addon
63
+ #
64
+ # @return [String, nil]
65
+ optional :image, String, nil?: true
66
+
67
+ # @!method initialize(id:, business_id:, created_at:, currency:, name:, price:, tax_category:, updated_at:, description: nil, image: nil)
68
+ # Some parameter documentations has been truncated, see
69
+ # {Dodopayments::Models::AddonResponse} for more details.
70
+ #
71
+ # @param id [String] id of the Addon
72
+ #
73
+ # @param business_id [String] Unique identifier for the business to which the addon belongs.
74
+ #
75
+ # @param created_at [Time] Created time
76
+ #
77
+ # @param currency [Symbol, Dodopayments::Models::Currency]
78
+ #
79
+ # @param name [String] Name of the Addon
80
+ #
81
+ # @param price [Integer] Amount of the addon
82
+ #
83
+ # @param tax_category [Symbol, Dodopayments::Models::TaxCategory] Represents the different categories of taxation applicable to various products a
84
+ # ...
85
+ #
86
+ # @param updated_at [Time] Updated time
87
+ #
88
+ # @param description [String, nil] Optional description of the Addon
89
+ #
90
+ # @param image [String, nil] Image of the Addon
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Addons#retrieve
6
+ class AddonRetrieveParams < 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
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Addons#update_images
6
+ class AddonUpdateImagesParams < 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
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Addons#update_images
6
+ class AddonUpdateImagesResponse < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute image_id
8
+ #
9
+ # @return [String]
10
+ required :image_id, String
11
+
12
+ # @!attribute url
13
+ #
14
+ # @return [String]
15
+ required :url, String
16
+
17
+ # @!method initialize(image_id:, url:)
18
+ # @param image_id [String]
19
+ # @param url [String]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Addons#update
6
+ class AddonUpdateParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ # @!attribute currency
11
+ #
12
+ # @return [Symbol, Dodopayments::Models::Currency, nil]
13
+ optional :currency, enum: -> { Dodopayments::Models::Currency }, nil?: true
14
+
15
+ # @!attribute description
16
+ # Description of the Addon, optional and must be at most 1000 characters.
17
+ #
18
+ # @return [String, nil]
19
+ optional :description, String, nil?: true
20
+
21
+ # @!attribute image_id
22
+ # Addon image id after its uploaded to S3
23
+ #
24
+ # @return [String, nil]
25
+ optional :image_id, String, nil?: true
26
+
27
+ # @!attribute name
28
+ # Name of the Addon, optional and must be at most 100 characters.
29
+ #
30
+ # @return [String, nil]
31
+ optional :name, String, nil?: true
32
+
33
+ # @!attribute price
34
+ # Amount of the addon
35
+ #
36
+ # @return [Integer, nil]
37
+ optional :price, Integer, nil?: true
38
+
39
+ # @!attribute tax_category
40
+ # Represents the different categories of taxation applicable to various products
41
+ # and services.
42
+ #
43
+ # @return [Symbol, Dodopayments::Models::TaxCategory, nil]
44
+ optional :tax_category, enum: -> { Dodopayments::Models::TaxCategory }, nil?: true
45
+
46
+ # @!method initialize(currency: nil, description: nil, image_id: nil, name: nil, price: nil, tax_category: nil, request_options: {})
47
+ # Some parameter documentations has been truncated, see
48
+ # {Dodopayments::Models::AddonUpdateParams} for more details.
49
+ #
50
+ # @param currency [Symbol, Dodopayments::Models::Currency, nil]
51
+ #
52
+ # @param description [String, nil] Description of the Addon, optional and must be at most 1000 characters.
53
+ #
54
+ # @param image_id [String, nil] Addon image id after its uploaded to S3
55
+ #
56
+ # @param name [String, nil] Name of the Addon, optional and must be at most 100 characters.
57
+ #
58
+ # @param price [Integer, nil] Amount of the addon
59
+ #
60
+ # @param tax_category [Symbol, Dodopayments::Models::TaxCategory, nil] Represents the different categories of taxation applicable to various products a
61
+ # ...
62
+ #
63
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
64
+ end
65
+ end
66
+ end