dodopayments 2.9.0 → 2.9.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/models/digital_product_delivery.rb +14 -7
  5. data/lib/dodopayments/models/digital_product_delivery_file.rb +12 -5
  6. data/lib/dodopayments/models/entitlement.rb +31 -20
  7. data/lib/dodopayments/models/entitlement_create_params.rb +3 -3
  8. data/lib/dodopayments/models/entitlement_grant_created_webhook_event.rb +6 -1
  9. data/lib/dodopayments/models/entitlement_grant_delivered_webhook_event.rb +6 -1
  10. data/lib/dodopayments/models/entitlement_grant_failed_webhook_event.rb +6 -1
  11. data/lib/dodopayments/models/entitlement_grant_revoked_webhook_event.rb +6 -1
  12. data/lib/dodopayments/models/entitlement_update_params.rb +3 -3
  13. data/lib/dodopayments/models/entitlements/entitlement_grant.rb +50 -32
  14. data/lib/dodopayments/models/entitlements/file_upload_response.rb +3 -3
  15. data/lib/dodopayments/models/entitlements/license_key_grant.rb +14 -9
  16. data/lib/dodopayments/models/integration_config.rb +70 -27
  17. data/lib/dodopayments/models/integration_config_response.rb +88 -48
  18. data/lib/dodopayments/models/product.rb +3 -5
  19. data/lib/dodopayments/models/product_entitlement_summary.rb +5 -5
  20. data/lib/dodopayments/models/webhook_payload.rb +5 -0
  21. data/lib/dodopayments/resources/entitlements/files.rb +3 -10
  22. data/lib/dodopayments/resources/entitlements/grants.rb +2 -4
  23. data/lib/dodopayments/resources/entitlements.rb +2 -2
  24. data/lib/dodopayments/version.rb +1 -1
  25. data/rbi/dodopayments/models/digital_product_delivery.rbi +15 -5
  26. data/rbi/dodopayments/models/digital_product_delivery_file.rbi +11 -0
  27. data/rbi/dodopayments/models/entitlement.rbi +35 -20
  28. data/rbi/dodopayments/models/entitlement_create_params.rbi +8 -5
  29. data/rbi/dodopayments/models/entitlement_grant_created_webhook_event.rbi +4 -0
  30. data/rbi/dodopayments/models/entitlement_grant_delivered_webhook_event.rbi +4 -0
  31. data/rbi/dodopayments/models/entitlement_grant_failed_webhook_event.rbi +4 -0
  32. data/rbi/dodopayments/models/entitlement_grant_revoked_webhook_event.rbi +4 -0
  33. data/rbi/dodopayments/models/entitlement_update_params.rbi +4 -4
  34. data/rbi/dodopayments/models/entitlements/entitlement_grant.rbi +54 -20
  35. data/rbi/dodopayments/models/entitlements/file_upload_response.rbi +4 -4
  36. data/rbi/dodopayments/models/entitlements/license_key_grant.rbi +10 -4
  37. data/rbi/dodopayments/models/integration_config.rbi +141 -26
  38. data/rbi/dodopayments/models/integration_config_response.rbi +153 -38
  39. data/rbi/dodopayments/models/product.rbi +4 -8
  40. data/rbi/dodopayments/models/product_entitlement_summary.rbi +8 -8
  41. data/rbi/dodopayments/models/webhook_payload.rbi +2 -0
  42. data/rbi/dodopayments/resources/entitlements/files.rbi +3 -10
  43. data/rbi/dodopayments/resources/entitlements/grants.rbi +2 -4
  44. data/rbi/dodopayments/resources/entitlements.rbi +4 -4
  45. data/sig/dodopayments/models/entitlement.rbs +8 -10
  46. data/sig/dodopayments/models/entitlement_create_params.rbs +6 -4
  47. data/sig/dodopayments/models/entitlements/entitlement_grant.rbs +4 -11
  48. data/sig/dodopayments/models/integration_config.rbs +28 -4
  49. data/sig/dodopayments/models/integration_config_response.rbs +28 -9
  50. data/sig/dodopayments/resources/entitlements.rbs +1 -1
  51. metadata +2 -2
@@ -12,22 +12,24 @@ module Dodopayments
12
12
  )
13
13
  end
14
14
 
15
+ # Number of activations consumed so far.
15
16
  sig { returns(Integer) }
16
17
  attr_accessor :activations_used
17
18
 
19
+ # Issued license key.
18
20
  sig { returns(String) }
19
21
  attr_accessor :key
20
22
 
23
+ # Maximum activations allowed by the entitlement, when set.
21
24
  sig { returns(T.nilable(Integer)) }
22
25
  attr_accessor :activations_limit
23
26
 
27
+ # When the license key expires, when applicable.
24
28
  sig { returns(T.nilable(Time)) }
25
29
  attr_accessor :expires_at
26
30
 
27
- # Nested representation of license-key grant fields. Present only when the grant's
28
- # entitlement has `integration_type = 'license_key'` and a row exists in
29
- # `license_keys`. The grant's top-level `status` is the source of truth for the
30
- # grant's lifecycle — no per-license-key status is exposed here.
31
+ # License-key delivery payload, present on grants for `license_key` entitlements.
32
+ # The grant's top-level `status` is the source of truth for the grant's lifecycle.
31
33
  sig do
32
34
  params(
33
35
  activations_used: Integer,
@@ -37,9 +39,13 @@ module Dodopayments
37
39
  ).returns(T.attached_class)
38
40
  end
39
41
  def self.new(
42
+ # Number of activations consumed so far.
40
43
  activations_used:,
44
+ # Issued license key.
41
45
  key:,
46
+ # Maximum activations allowed by the entitlement, when set.
42
47
  activations_limit: nil,
48
+ # When the license key expires, when applicable.
43
49
  expires_at: nil
44
50
  )
45
51
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dodopayments
4
4
  module Models
5
- # Platform-specific configuration for an entitlement. Each variant uses unique
6
- # field names so `#[serde(untagged)]` can disambiguate correctly.
5
+ # Integration-specific configuration supplied when creating or updating an
6
+ # entitlement. The shape required matches the entitlement's `integration_type`.
7
7
  module IntegrationConfig
8
8
  extend Dodopayments::Internal::Type::Union
9
9
 
@@ -30,28 +30,94 @@ module Dodopayments
30
30
  )
31
31
  end
32
32
 
33
- # One of: pull, push, admin, maintain, triage
34
- sig { returns(String) }
33
+ # Permission to grant on the repository.
34
+ sig do
35
+ returns(
36
+ Dodopayments::IntegrationConfig::GitHubConfig::Permission::OrSymbol
37
+ )
38
+ end
35
39
  attr_accessor :permission
36
40
 
41
+ # Repository or organisation slug to grant access to.
37
42
  sig { returns(String) }
38
43
  attr_accessor :target_id
39
44
 
40
45
  sig do
41
- params(permission: String, target_id: String).returns(
42
- T.attached_class
43
- )
46
+ params(
47
+ permission:
48
+ Dodopayments::IntegrationConfig::GitHubConfig::Permission::OrSymbol,
49
+ target_id: String
50
+ ).returns(T.attached_class)
44
51
  end
45
52
  def self.new(
46
- # One of: pull, push, admin, maintain, triage
53
+ # Permission to grant on the repository.
47
54
  permission:,
55
+ # Repository or organisation slug to grant access to.
48
56
  target_id:
49
57
  )
50
58
  end
51
59
 
52
- sig { override.returns({ permission: String, target_id: String }) }
60
+ sig do
61
+ override.returns(
62
+ {
63
+ permission:
64
+ Dodopayments::IntegrationConfig::GitHubConfig::Permission::OrSymbol,
65
+ target_id: String
66
+ }
67
+ )
68
+ end
53
69
  def to_hash
54
70
  end
71
+
72
+ # Permission to grant on the repository.
73
+ module Permission
74
+ extend Dodopayments::Internal::Type::Enum
75
+
76
+ TaggedSymbol =
77
+ T.type_alias do
78
+ T.all(
79
+ Symbol,
80
+ Dodopayments::IntegrationConfig::GitHubConfig::Permission
81
+ )
82
+ end
83
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
84
+
85
+ PULL =
86
+ T.let(
87
+ :pull,
88
+ Dodopayments::IntegrationConfig::GitHubConfig::Permission::TaggedSymbol
89
+ )
90
+ PUSH =
91
+ T.let(
92
+ :push,
93
+ Dodopayments::IntegrationConfig::GitHubConfig::Permission::TaggedSymbol
94
+ )
95
+ ADMIN =
96
+ T.let(
97
+ :admin,
98
+ Dodopayments::IntegrationConfig::GitHubConfig::Permission::TaggedSymbol
99
+ )
100
+ MAINTAIN =
101
+ T.let(
102
+ :maintain,
103
+ Dodopayments::IntegrationConfig::GitHubConfig::Permission::TaggedSymbol
104
+ )
105
+ TRIAGE =
106
+ T.let(
107
+ :triage,
108
+ Dodopayments::IntegrationConfig::GitHubConfig::Permission::TaggedSymbol
109
+ )
110
+
111
+ sig do
112
+ override.returns(
113
+ T::Array[
114
+ Dodopayments::IntegrationConfig::GitHubConfig::Permission::TaggedSymbol
115
+ ]
116
+ )
117
+ end
118
+ def self.values
119
+ end
120
+ end
55
121
  end
56
122
 
57
123
  class DiscordConfig < Dodopayments::Internal::Type::BaseModel
@@ -63,9 +129,11 @@ module Dodopayments
63
129
  )
64
130
  end
65
131
 
132
+ # Discord guild (server) ID.
66
133
  sig { returns(String) }
67
134
  attr_accessor :guild_id
68
135
 
136
+ # Optional Discord role to assign within the guild.
69
137
  sig { returns(T.nilable(String)) }
70
138
  attr_accessor :role_id
71
139
 
@@ -74,7 +142,12 @@ module Dodopayments
74
142
  T.attached_class
75
143
  )
76
144
  end
77
- def self.new(guild_id:, role_id: nil)
145
+ def self.new(
146
+ # Discord guild (server) ID.
147
+ guild_id:,
148
+ # Optional Discord role to assign within the guild.
149
+ role_id: nil
150
+ )
78
151
  end
79
152
 
80
153
  sig do
@@ -93,11 +166,15 @@ module Dodopayments
93
166
  )
94
167
  end
95
168
 
169
+ # Telegram chat ID. For groups this is typically a negative integer.
96
170
  sig { returns(String) }
97
171
  attr_accessor :chat_id
98
172
 
99
173
  sig { params(chat_id: String).returns(T.attached_class) }
100
- def self.new(chat_id:)
174
+ def self.new(
175
+ # Telegram chat ID. For groups this is typically a negative integer.
176
+ chat_id:
177
+ )
101
178
  end
102
179
 
103
180
  sig { override.returns({ chat_id: String }) }
@@ -114,11 +191,15 @@ module Dodopayments
114
191
  )
115
192
  end
116
193
 
194
+ # Figma file identifier to grant access to.
117
195
  sig { returns(String) }
118
196
  attr_accessor :figma_file_id
119
197
 
120
198
  sig { params(figma_file_id: String).returns(T.attached_class) }
121
- def self.new(figma_file_id:)
199
+ def self.new(
200
+ # Figma file identifier to grant access to.
201
+ figma_file_id:
202
+ )
122
203
  end
123
204
 
124
205
  sig { override.returns({ figma_file_id: String }) }
@@ -135,11 +216,15 @@ module Dodopayments
135
216
  )
136
217
  end
137
218
 
219
+ # Framer template identifier to grant access to.
138
220
  sig { returns(String) }
139
221
  attr_accessor :framer_template_id
140
222
 
141
223
  sig { params(framer_template_id: String).returns(T.attached_class) }
142
- def self.new(framer_template_id:)
224
+ def self.new(
225
+ # Framer template identifier to grant access to.
226
+ framer_template_id:
227
+ )
143
228
  end
144
229
 
145
230
  sig { override.returns({ framer_template_id: String }) }
@@ -156,11 +241,15 @@ module Dodopayments
156
241
  )
157
242
  end
158
243
 
244
+ # Notion template identifier to grant access to.
159
245
  sig { returns(String) }
160
246
  attr_accessor :notion_template_id
161
247
 
162
248
  sig { params(notion_template_id: String).returns(T.attached_class) }
163
- def self.new(notion_template_id:)
249
+ def self.new(
250
+ # Notion template identifier to grant access to.
251
+ notion_template_id:
252
+ )
164
253
  end
165
254
 
166
255
  sig { override.returns({ notion_template_id: String }) }
@@ -177,23 +266,29 @@ module Dodopayments
177
266
  )
178
267
  end
179
268
 
269
+ # Files attached to this entitlement. Add files via
270
+ # `POST /entitlements/{id}/files` and remove them via
271
+ # `DELETE /entitlements/{id}/files/{file_id}`.
180
272
  sig { returns(T::Array[String]) }
181
273
  attr_accessor :digital_file_ids
182
274
 
275
+ # Optional external URL shown to the customer alongside the files.
183
276
  sig { returns(T.nilable(String)) }
184
277
  attr_accessor :external_url
185
278
 
279
+ # Optional human-readable delivery instructions shown to the customer alongside
280
+ # the files.
186
281
  sig { returns(T.nilable(String)) }
187
282
  attr_accessor :instructions
188
283
 
189
- # Three-way patchable field (mirrors the credit_entitlements pattern):
284
+ # Three-way patchable list of legacy file identifiers:
190
285
  #
191
- # - omitted → preserve persisted (`None`)
192
- # - `null` → clear (`Some(None)`)
193
- # - `[...]` → replace (`Some(Some(...))`)
286
+ # - omitted → preserve the current value
287
+ # - `null` → clear
288
+ # - `[...]` → replace
194
289
  #
195
- # On Create / storage we collapse "clear" and empty-array to `None` so the
196
- # persisted JSONB never carries a `null` legacy_file_ids key.
290
+ # On create, an omitted field, an explicit `null`, or an empty array all result in
291
+ # no legacy files attached.
197
292
  sig { returns(T.nilable(T::Array[String])) }
198
293
  attr_accessor :legacy_file_ids
199
294
 
@@ -206,17 +301,23 @@ module Dodopayments
206
301
  ).returns(T.attached_class)
207
302
  end
208
303
  def self.new(
304
+ # Files attached to this entitlement. Add files via
305
+ # `POST /entitlements/{id}/files` and remove them via
306
+ # `DELETE /entitlements/{id}/files/{file_id}`.
209
307
  digital_file_ids:,
308
+ # Optional external URL shown to the customer alongside the files.
210
309
  external_url: nil,
310
+ # Optional human-readable delivery instructions shown to the customer alongside
311
+ # the files.
211
312
  instructions: nil,
212
- # Three-way patchable field (mirrors the credit_entitlements pattern):
313
+ # Three-way patchable list of legacy file identifiers:
213
314
  #
214
- # - omitted → preserve persisted (`None`)
215
- # - `null` → clear (`Some(None)`)
216
- # - `[...]` → replace (`Some(Some(...))`)
315
+ # - omitted → preserve the current value
316
+ # - `null` → clear
317
+ # - `[...]` → replace
217
318
  #
218
- # On Create / storage we collapse "clear" and empty-array to `None` so the
219
- # persisted JSONB never carries a `null` legacy_file_ids key.
319
+ # On create, an omitted field, an explicit `null`, or an empty array all result in
320
+ # no legacy files attached.
220
321
  legacy_file_ids: nil
221
322
  )
222
323
  end
@@ -244,15 +345,22 @@ module Dodopayments
244
345
  )
245
346
  end
246
347
 
348
+ # Optional message displayed when a customer activates the license key (≤ 2500
349
+ # characters).
247
350
  sig { returns(T.nilable(String)) }
248
351
  attr_accessor :activation_message
249
352
 
353
+ # Maximum activations allowed per issued license key. Omit for unlimited.
250
354
  sig { returns(T.nilable(Integer)) }
251
355
  attr_accessor :activations_limit
252
356
 
357
+ # Validity duration of issued license keys. Provide both `duration_count` and
358
+ # `duration_interval` together for a fixed duration; omit both for non-expiring
359
+ # keys.
253
360
  sig { returns(T.nilable(Integer)) }
254
361
  attr_accessor :duration_count
255
362
 
363
+ # Unit of `duration_count`.
256
364
  sig { returns(T.nilable(Dodopayments::TimeInterval::OrSymbol)) }
257
365
  attr_accessor :duration_interval
258
366
 
@@ -265,9 +373,16 @@ module Dodopayments
265
373
  ).returns(T.attached_class)
266
374
  end
267
375
  def self.new(
376
+ # Optional message displayed when a customer activates the license key (≤ 2500
377
+ # characters).
268
378
  activation_message: nil,
379
+ # Maximum activations allowed per issued license key. Omit for unlimited.
269
380
  activations_limit: nil,
381
+ # Validity duration of issued license keys. Provide both `duration_count` and
382
+ # `duration_interval` together for a fixed duration; omit both for non-expiring
383
+ # keys.
270
384
  duration_count: nil,
385
+ # Unit of `duration_count`.
271
386
  duration_interval: nil
272
387
  )
273
388
  end