dodopayments 1.49.0 → 1.51.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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +17 -51
  4. data/lib/dodopayments/client.rb +4 -4
  5. data/lib/dodopayments/internal/transport/base_client.rb +1 -4
  6. data/lib/dodopayments/internal/transport/pooled_net_requester.rb +1 -9
  7. data/lib/dodopayments/internal/type/base_model.rb +6 -11
  8. data/lib/dodopayments/internal/util.rb +1 -1
  9. data/lib/dodopayments/models/checkout_session_create_params.rb +14 -0
  10. data/lib/dodopayments/models/checkout_session_request.rb +347 -0
  11. data/lib/dodopayments/models/checkout_session_response.rb +25 -0
  12. data/lib/dodopayments/models/on_demand_subscription.rb +58 -0
  13. data/lib/dodopayments/models/payment_create_params.rb +1 -4
  14. data/lib/dodopayments/models/subscription.rb +9 -1
  15. data/lib/dodopayments/models/subscription_create_params.rb +3 -56
  16. data/lib/dodopayments/models/subscription_update_params.rb +9 -1
  17. data/lib/dodopayments/models/webhook_create_params.rb +1 -4
  18. data/lib/dodopayments/models/{webhook_create_response.rb → webhook_details.rb} +2 -2
  19. data/lib/dodopayments/models.rb +10 -2
  20. data/lib/dodopayments/resources/checkout_sessions.rb +61 -0
  21. data/lib/dodopayments/resources/subscriptions.rb +2 -2
  22. data/lib/dodopayments/resources/webhooks.rb +8 -8
  23. data/lib/dodopayments/version.rb +1 -1
  24. data/lib/dodopayments.rb +7 -7
  25. data/rbi/dodopayments/client.rbi +3 -3
  26. data/rbi/dodopayments/errors.rbi +2 -2
  27. data/rbi/dodopayments/models/checkout_session_create_params.rbi +32 -0
  28. data/rbi/dodopayments/models/checkout_session_request.rbi +652 -0
  29. data/rbi/dodopayments/models/checkout_session_response.rbi +40 -0
  30. data/rbi/dodopayments/models/dispute.rbi +4 -4
  31. data/rbi/dodopayments/models/get_dispute.rbi +4 -4
  32. data/rbi/dodopayments/models/license_key.rbi +2 -2
  33. data/rbi/dodopayments/models/on_demand_subscription.rbi +86 -0
  34. data/rbi/dodopayments/models/payment.rbi +8 -8
  35. data/rbi/dodopayments/models/refund.rbi +4 -4
  36. data/rbi/dodopayments/models/subscription.rbi +21 -11
  37. data/rbi/dodopayments/models/subscription_create_params.rbi +4 -90
  38. data/rbi/dodopayments/models/subscription_update_params.rbi +2 -0
  39. data/rbi/dodopayments/models/{webhook_list_response.rbi → webhook_details.rbi} +2 -5
  40. data/rbi/dodopayments/models.rbi +11 -2
  41. data/rbi/dodopayments/resources/checkout_sessions.rbi +80 -0
  42. data/rbi/dodopayments/resources/subscriptions.rbi +2 -2
  43. data/rbi/dodopayments/resources/webhooks.rbi +4 -4
  44. data/sig/dodopayments/client.rbs +2 -2
  45. data/sig/dodopayments/models/checkout_session_create_params.rbs +15 -0
  46. data/sig/dodopayments/models/checkout_session_request.rbs +277 -0
  47. data/sig/dodopayments/models/checkout_session_response.rbs +16 -0
  48. data/sig/dodopayments/models/on_demand_subscription.rbs +40 -0
  49. data/sig/dodopayments/models/subscription.rbs +8 -3
  50. data/sig/dodopayments/models/subscription_create_params.rbs +4 -41
  51. data/sig/dodopayments/models/{webhook_list_response.rbs → webhook_details.rbs} +2 -2
  52. data/sig/dodopayments/models.rbs +10 -2
  53. data/sig/dodopayments/resources/checkout_sessions.rbs +24 -0
  54. data/sig/dodopayments/resources/subscriptions.rbs +1 -1
  55. data/sig/dodopayments/resources/webhooks.rbs +4 -4
  56. metadata +20 -20
  57. data/lib/dodopayments/models/webhook_list_response.rb +0 -88
  58. data/lib/dodopayments/models/webhook_retrieve_response.rb +0 -88
  59. data/lib/dodopayments/models/webhook_update_response.rb +0 -88
  60. data/lib/dodopayments/models/your_webhook_url_create_params.rb +0 -32
  61. data/lib/dodopayments/resources/your_webhook_url.rb +0 -56
  62. data/rbi/dodopayments/models/webhook_create_response.rbi +0 -112
  63. data/rbi/dodopayments/models/webhook_retrieve_response.rbi +0 -112
  64. data/rbi/dodopayments/models/webhook_update_response.rbi +0 -112
  65. data/rbi/dodopayments/models/your_webhook_url_create_params.rbi +0 -56
  66. data/rbi/dodopayments/resources/your_webhook_url.rbi +0 -51
  67. data/sig/dodopayments/models/webhook_create_response.rbs +0 -60
  68. data/sig/dodopayments/models/webhook_retrieve_response.rbs +0 -60
  69. data/sig/dodopayments/models/webhook_update_response.rbs +0 -60
  70. data/sig/dodopayments/models/your_webhook_url_create_params.rbs +0 -42
  71. data/sig/dodopayments/resources/your_webhook_url.rbs +0 -18
@@ -1,112 +0,0 @@
1
- # typed: strong
2
-
3
- module Dodopayments
4
- module Models
5
- class WebhookRetrieveResponse < Dodopayments::Internal::Type::BaseModel
6
- OrHash =
7
- T.type_alias do
8
- T.any(
9
- Dodopayments::Models::WebhookRetrieveResponse,
10
- Dodopayments::Internal::AnyHash
11
- )
12
- end
13
-
14
- # The webhook's ID.
15
- sig { returns(String) }
16
- attr_accessor :id
17
-
18
- # Created at timestamp
19
- sig { returns(String) }
20
- attr_accessor :created_at
21
-
22
- # An example webhook name.
23
- sig { returns(String) }
24
- attr_accessor :description
25
-
26
- # Metadata of the webhook
27
- sig { returns(T::Hash[Symbol, String]) }
28
- attr_accessor :metadata
29
-
30
- # Updated at timestamp
31
- sig { returns(String) }
32
- attr_accessor :updated_at
33
-
34
- # Url endpoint of the webhook
35
- sig { returns(String) }
36
- attr_accessor :url
37
-
38
- # Status of the webhook.
39
- #
40
- # If true, events are not sent
41
- sig { returns(T.nilable(T::Boolean)) }
42
- attr_accessor :disabled
43
-
44
- # Filter events to the webhook.
45
- #
46
- # Webhook event will only be sent for events in the list.
47
- sig { returns(T.nilable(T::Array[String])) }
48
- attr_accessor :filter_types
49
-
50
- # Configured rate limit
51
- sig { returns(T.nilable(Integer)) }
52
- attr_accessor :rate_limit
53
-
54
- sig do
55
- params(
56
- id: String,
57
- created_at: String,
58
- description: String,
59
- metadata: T::Hash[Symbol, String],
60
- updated_at: String,
61
- url: String,
62
- disabled: T.nilable(T::Boolean),
63
- filter_types: T.nilable(T::Array[String]),
64
- rate_limit: T.nilable(Integer)
65
- ).returns(T.attached_class)
66
- end
67
- def self.new(
68
- # The webhook's ID.
69
- id:,
70
- # Created at timestamp
71
- created_at:,
72
- # An example webhook name.
73
- description:,
74
- # Metadata of the webhook
75
- metadata:,
76
- # Updated at timestamp
77
- updated_at:,
78
- # Url endpoint of the webhook
79
- url:,
80
- # Status of the webhook.
81
- #
82
- # If true, events are not sent
83
- disabled: nil,
84
- # Filter events to the webhook.
85
- #
86
- # Webhook event will only be sent for events in the list.
87
- filter_types: nil,
88
- # Configured rate limit
89
- rate_limit: nil
90
- )
91
- end
92
-
93
- sig do
94
- override.returns(
95
- {
96
- id: String,
97
- created_at: String,
98
- description: String,
99
- metadata: T::Hash[Symbol, String],
100
- updated_at: String,
101
- url: String,
102
- disabled: T.nilable(T::Boolean),
103
- filter_types: T.nilable(T::Array[String]),
104
- rate_limit: T.nilable(Integer)
105
- }
106
- )
107
- end
108
- def to_hash
109
- end
110
- end
111
- end
112
- end
@@ -1,112 +0,0 @@
1
- # typed: strong
2
-
3
- module Dodopayments
4
- module Models
5
- class WebhookUpdateResponse < Dodopayments::Internal::Type::BaseModel
6
- OrHash =
7
- T.type_alias do
8
- T.any(
9
- Dodopayments::Models::WebhookUpdateResponse,
10
- Dodopayments::Internal::AnyHash
11
- )
12
- end
13
-
14
- # The webhook's ID.
15
- sig { returns(String) }
16
- attr_accessor :id
17
-
18
- # Created at timestamp
19
- sig { returns(String) }
20
- attr_accessor :created_at
21
-
22
- # An example webhook name.
23
- sig { returns(String) }
24
- attr_accessor :description
25
-
26
- # Metadata of the webhook
27
- sig { returns(T::Hash[Symbol, String]) }
28
- attr_accessor :metadata
29
-
30
- # Updated at timestamp
31
- sig { returns(String) }
32
- attr_accessor :updated_at
33
-
34
- # Url endpoint of the webhook
35
- sig { returns(String) }
36
- attr_accessor :url
37
-
38
- # Status of the webhook.
39
- #
40
- # If true, events are not sent
41
- sig { returns(T.nilable(T::Boolean)) }
42
- attr_accessor :disabled
43
-
44
- # Filter events to the webhook.
45
- #
46
- # Webhook event will only be sent for events in the list.
47
- sig { returns(T.nilable(T::Array[String])) }
48
- attr_accessor :filter_types
49
-
50
- # Configured rate limit
51
- sig { returns(T.nilable(Integer)) }
52
- attr_accessor :rate_limit
53
-
54
- sig do
55
- params(
56
- id: String,
57
- created_at: String,
58
- description: String,
59
- metadata: T::Hash[Symbol, String],
60
- updated_at: String,
61
- url: String,
62
- disabled: T.nilable(T::Boolean),
63
- filter_types: T.nilable(T::Array[String]),
64
- rate_limit: T.nilable(Integer)
65
- ).returns(T.attached_class)
66
- end
67
- def self.new(
68
- # The webhook's ID.
69
- id:,
70
- # Created at timestamp
71
- created_at:,
72
- # An example webhook name.
73
- description:,
74
- # Metadata of the webhook
75
- metadata:,
76
- # Updated at timestamp
77
- updated_at:,
78
- # Url endpoint of the webhook
79
- url:,
80
- # Status of the webhook.
81
- #
82
- # If true, events are not sent
83
- disabled: nil,
84
- # Filter events to the webhook.
85
- #
86
- # Webhook event will only be sent for events in the list.
87
- filter_types: nil,
88
- # Configured rate limit
89
- rate_limit: nil
90
- )
91
- end
92
-
93
- sig do
94
- override.returns(
95
- {
96
- id: String,
97
- created_at: String,
98
- description: String,
99
- metadata: T::Hash[Symbol, String],
100
- updated_at: String,
101
- url: String,
102
- disabled: T.nilable(T::Boolean),
103
- filter_types: T.nilable(T::Array[String]),
104
- rate_limit: T.nilable(Integer)
105
- }
106
- )
107
- end
108
- def to_hash
109
- end
110
- end
111
- end
112
- end
@@ -1,56 +0,0 @@
1
- # typed: strong
2
-
3
- module Dodopayments
4
- module Models
5
- class YourWebhookURLCreateParams < Dodopayments::Models::WebhookPayload
6
- extend Dodopayments::Internal::Type::RequestParameters::Converter
7
- include Dodopayments::Internal::Type::RequestParameters
8
-
9
- OrHash =
10
- T.type_alias do
11
- T.any(
12
- Dodopayments::YourWebhookURLCreateParams,
13
- Dodopayments::Internal::AnyHash
14
- )
15
- end
16
-
17
- sig { returns(String) }
18
- attr_accessor :webhook_id
19
-
20
- sig { returns(String) }
21
- attr_accessor :webhook_signature
22
-
23
- sig { returns(String) }
24
- attr_accessor :webhook_timestamp
25
-
26
- sig do
27
- params(
28
- webhook_id: String,
29
- webhook_signature: String,
30
- webhook_timestamp: String,
31
- request_options: Dodopayments::RequestOptions::OrHash
32
- ).returns(T.attached_class)
33
- end
34
- def self.new(
35
- webhook_id:,
36
- webhook_signature:,
37
- webhook_timestamp:,
38
- request_options: {}
39
- )
40
- end
41
-
42
- sig do
43
- override.returns(
44
- {
45
- webhook_id: String,
46
- webhook_signature: String,
47
- webhook_timestamp: String,
48
- request_options: Dodopayments::RequestOptions
49
- }
50
- )
51
- end
52
- def to_hash
53
- end
54
- end
55
- end
56
- end
@@ -1,51 +0,0 @@
1
- # typed: strong
2
-
3
- module Dodopayments
4
- module Resources
5
- class YourWebhookURL
6
- sig do
7
- params(
8
- business_id: String,
9
- data:
10
- T.any(
11
- Dodopayments::WebhookPayload::Data::Payment::OrHash,
12
- Dodopayments::WebhookPayload::Data::Subscription::OrHash,
13
- Dodopayments::WebhookPayload::Data::Refund::OrHash,
14
- Dodopayments::WebhookPayload::Data::Dispute::OrHash,
15
- Dodopayments::WebhookPayload::Data::LicenseKey::OrHash
16
- ),
17
- timestamp: Time,
18
- type: Dodopayments::WebhookEventType::OrSymbol,
19
- webhook_id: String,
20
- webhook_signature: String,
21
- webhook_timestamp: String,
22
- request_options: Dodopayments::RequestOptions::OrHash
23
- ).void
24
- end
25
- def create(
26
- # Body param:
27
- business_id:,
28
- # Body param: The latest data at the time of delivery attempt
29
- data:,
30
- # Body param: The timestamp of when the event occurred (not necessarily the same
31
- # of when it was delivered)
32
- timestamp:,
33
- # Body param: Event types for Dodo events
34
- type:,
35
- # Header param: Unique identifier for the webhook
36
- webhook_id:,
37
- # Header param: Signature of the Webhook
38
- webhook_signature:,
39
- # Header param: Unix timestamp when the webhook was sent
40
- webhook_timestamp:,
41
- request_options: {}
42
- )
43
- end
44
-
45
- # @api private
46
- sig { params(client: Dodopayments::Client).returns(T.attached_class) }
47
- def self.new(client:)
48
- end
49
- end
50
- end
51
- end
@@ -1,60 +0,0 @@
1
- module Dodopayments
2
- module Models
3
- type webhook_create_response =
4
- {
5
- id: String,
6
- created_at: String,
7
- description: String,
8
- metadata: ::Hash[Symbol, String],
9
- updated_at: String,
10
- url: String,
11
- disabled: bool?,
12
- filter_types: ::Array[String]?,
13
- rate_limit: Integer?
14
- }
15
-
16
- class WebhookCreateResponse < Dodopayments::Internal::Type::BaseModel
17
- attr_accessor id: String
18
-
19
- attr_accessor created_at: String
20
-
21
- attr_accessor description: String
22
-
23
- attr_accessor metadata: ::Hash[Symbol, String]
24
-
25
- attr_accessor updated_at: String
26
-
27
- attr_accessor url: String
28
-
29
- attr_accessor disabled: bool?
30
-
31
- attr_accessor filter_types: ::Array[String]?
32
-
33
- attr_accessor rate_limit: Integer?
34
-
35
- def initialize: (
36
- id: String,
37
- created_at: String,
38
- description: String,
39
- metadata: ::Hash[Symbol, String],
40
- updated_at: String,
41
- url: String,
42
- ?disabled: bool?,
43
- ?filter_types: ::Array[String]?,
44
- ?rate_limit: Integer?
45
- ) -> void
46
-
47
- def to_hash: -> {
48
- id: String,
49
- created_at: String,
50
- description: String,
51
- metadata: ::Hash[Symbol, String],
52
- updated_at: String,
53
- url: String,
54
- disabled: bool?,
55
- filter_types: ::Array[String]?,
56
- rate_limit: Integer?
57
- }
58
- end
59
- end
60
- end
@@ -1,60 +0,0 @@
1
- module Dodopayments
2
- module Models
3
- type webhook_retrieve_response =
4
- {
5
- id: String,
6
- created_at: String,
7
- description: String,
8
- metadata: ::Hash[Symbol, String],
9
- updated_at: String,
10
- url: String,
11
- disabled: bool?,
12
- filter_types: ::Array[String]?,
13
- rate_limit: Integer?
14
- }
15
-
16
- class WebhookRetrieveResponse < Dodopayments::Internal::Type::BaseModel
17
- attr_accessor id: String
18
-
19
- attr_accessor created_at: String
20
-
21
- attr_accessor description: String
22
-
23
- attr_accessor metadata: ::Hash[Symbol, String]
24
-
25
- attr_accessor updated_at: String
26
-
27
- attr_accessor url: String
28
-
29
- attr_accessor disabled: bool?
30
-
31
- attr_accessor filter_types: ::Array[String]?
32
-
33
- attr_accessor rate_limit: Integer?
34
-
35
- def initialize: (
36
- id: String,
37
- created_at: String,
38
- description: String,
39
- metadata: ::Hash[Symbol, String],
40
- updated_at: String,
41
- url: String,
42
- ?disabled: bool?,
43
- ?filter_types: ::Array[String]?,
44
- ?rate_limit: Integer?
45
- ) -> void
46
-
47
- def to_hash: -> {
48
- id: String,
49
- created_at: String,
50
- description: String,
51
- metadata: ::Hash[Symbol, String],
52
- updated_at: String,
53
- url: String,
54
- disabled: bool?,
55
- filter_types: ::Array[String]?,
56
- rate_limit: Integer?
57
- }
58
- end
59
- end
60
- end
@@ -1,60 +0,0 @@
1
- module Dodopayments
2
- module Models
3
- type webhook_update_response =
4
- {
5
- id: String,
6
- created_at: String,
7
- description: String,
8
- metadata: ::Hash[Symbol, String],
9
- updated_at: String,
10
- url: String,
11
- disabled: bool?,
12
- filter_types: ::Array[String]?,
13
- rate_limit: Integer?
14
- }
15
-
16
- class WebhookUpdateResponse < Dodopayments::Internal::Type::BaseModel
17
- attr_accessor id: String
18
-
19
- attr_accessor created_at: String
20
-
21
- attr_accessor description: String
22
-
23
- attr_accessor metadata: ::Hash[Symbol, String]
24
-
25
- attr_accessor updated_at: String
26
-
27
- attr_accessor url: String
28
-
29
- attr_accessor disabled: bool?
30
-
31
- attr_accessor filter_types: ::Array[String]?
32
-
33
- attr_accessor rate_limit: Integer?
34
-
35
- def initialize: (
36
- id: String,
37
- created_at: String,
38
- description: String,
39
- metadata: ::Hash[Symbol, String],
40
- updated_at: String,
41
- url: String,
42
- ?disabled: bool?,
43
- ?filter_types: ::Array[String]?,
44
- ?rate_limit: Integer?
45
- ) -> void
46
-
47
- def to_hash: -> {
48
- id: String,
49
- created_at: String,
50
- description: String,
51
- metadata: ::Hash[Symbol, String],
52
- updated_at: String,
53
- url: String,
54
- disabled: bool?,
55
- filter_types: ::Array[String]?,
56
- rate_limit: Integer?
57
- }
58
- end
59
- end
60
- end
@@ -1,42 +0,0 @@
1
- module Dodopayments
2
- module Models
3
- type your_webhook_url_create_params =
4
- {
5
- webhook_id: String,
6
- webhook_signature: String,
7
- webhook_timestamp: String
8
- }
9
- & Dodopayments::Internal::Type::request_parameters
10
-
11
- class YourWebhookURLCreateParams < Dodopayments::Models::WebhookPayload
12
- extend Dodopayments::Internal::Type::RequestParameters::Converter
13
- include Dodopayments::Internal::Type::RequestParameters
14
-
15
- def webhook_id: -> String
16
-
17
- def webhook_id=: (String _) -> String
18
-
19
- def webhook_signature: -> String
20
-
21
- def webhook_signature=: (String _) -> String
22
-
23
- def webhook_timestamp: -> String
24
-
25
- def webhook_timestamp=: (String _) -> String
26
-
27
- def initialize: (
28
- webhook_id: String,
29
- webhook_signature: String,
30
- webhook_timestamp: String,
31
- ?request_options: Dodopayments::request_opts
32
- ) -> void
33
-
34
- def to_hash: -> {
35
- webhook_id: String,
36
- webhook_signature: String,
37
- webhook_timestamp: String,
38
- request_options: Dodopayments::RequestOptions
39
- }
40
- end
41
- end
42
- end
@@ -1,18 +0,0 @@
1
- module Dodopayments
2
- module Resources
3
- class YourWebhookURL
4
- def create: (
5
- business_id: String,
6
- data: Dodopayments::Models::WebhookPayload::data,
7
- timestamp: Time,
8
- type: Dodopayments::Models::webhook_event_type,
9
- webhook_id: String,
10
- webhook_signature: String,
11
- webhook_timestamp: String,
12
- ?request_options: Dodopayments::request_opts
13
- ) -> nil
14
-
15
- def initialize: (client: Dodopayments::Client) -> void
16
- end
17
- end
18
- end