dodopayments 0.0.1.pre.alpha.0 → 1.16.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/.ignore +2 -0
- data/CHANGELOG.md +132 -0
- data/README.md +84 -23
- data/SECURITY.md +27 -0
- data/lib/dodopayments/client.rb +15 -19
- data/lib/dodopayments/errors.rb +168 -159
- data/lib/dodopayments/internal/default_page_number_pagination.rb +91 -0
- data/lib/dodopayments/internal/transport/base_client.rb +486 -0
- data/lib/dodopayments/internal/transport/pooled_net_requester.rb +197 -0
- data/lib/dodopayments/internal/type/array_of.rb +143 -0
- data/lib/dodopayments/internal/type/base_model.rb +423 -0
- data/lib/dodopayments/internal/type/base_page.rb +47 -0
- data/lib/dodopayments/internal/type/boolean.rb +60 -0
- data/lib/dodopayments/internal/type/converter.rb +271 -0
- data/lib/dodopayments/internal/type/enum.rb +129 -0
- data/lib/dodopayments/internal/type/hash_of.rb +163 -0
- data/lib/dodopayments/internal/type/io_like.rb +77 -0
- data/lib/dodopayments/internal/type/request_parameters.rb +49 -0
- data/lib/dodopayments/internal/type/union.rb +232 -0
- data/lib/dodopayments/internal/type/unknown.rb +64 -0
- data/lib/dodopayments/internal/util.rb +782 -0
- data/lib/dodopayments/internal.rb +12 -0
- data/lib/dodopayments/models/attach_existing_customer.rb +2 -2
- data/lib/dodopayments/models/billing_address.rb +2 -2
- data/lib/dodopayments/models/country_code.rb +7 -3
- data/lib/dodopayments/models/create_new_customer.rb +5 -5
- data/lib/dodopayments/models/customer.rb +3 -2
- data/lib/dodopayments/models/customer_create_params.rb +5 -4
- data/lib/dodopayments/models/customer_limited_details.rb +2 -2
- data/lib/dodopayments/models/customer_list_params.rb +5 -4
- data/lib/dodopayments/models/customer_portal_session.rb +2 -2
- data/lib/dodopayments/models/customer_request.rb +5 -6
- data/lib/dodopayments/models/customer_retrieve_params.rb +5 -4
- data/lib/dodopayments/models/customer_update_params.rb +5 -4
- data/lib/dodopayments/models/customers/customer_portal_create_params.rb +6 -5
- data/lib/dodopayments/models/discount.rb +7 -6
- data/lib/dodopayments/models/discount_create_params.rb +13 -12
- data/lib/dodopayments/models/discount_delete_params.rb +5 -4
- data/lib/dodopayments/models/discount_list_params.rb +5 -4
- data/lib/dodopayments/models/discount_retrieve_params.rb +5 -4
- data/lib/dodopayments/models/discount_type.rb +7 -2
- data/lib/dodopayments/models/discount_update_params.rb +11 -10
- data/lib/dodopayments/models/dispute.rb +4 -3
- data/lib/dodopayments/models/dispute_list_params.rb +5 -4
- data/lib/dodopayments/models/dispute_retrieve_params.rb +5 -4
- data/lib/dodopayments/models/dispute_stage.rb +7 -2
- data/lib/dodopayments/models/dispute_status.rb +7 -2
- data/lib/dodopayments/models/intent_status.rb +7 -2
- data/lib/dodopayments/models/invoices/payment_retrieve_params.rb +5 -4
- data/lib/dodopayments/models/license_activate_params.rb +5 -4
- data/lib/dodopayments/models/license_deactivate_params.rb +5 -4
- data/lib/dodopayments/models/license_key.rb +4 -3
- data/lib/dodopayments/models/license_key_duration.rb +2 -2
- data/lib/dodopayments/models/license_key_instance.rb +3 -2
- data/lib/dodopayments/models/license_key_instance_list_params.rb +5 -4
- data/lib/dodopayments/models/license_key_instance_retrieve_params.rb +5 -4
- data/lib/dodopayments/models/license_key_instance_update_params.rb +5 -4
- data/lib/dodopayments/models/license_key_list_params.rb +5 -4
- data/lib/dodopayments/models/license_key_retrieve_params.rb +5 -4
- data/lib/dodopayments/models/license_key_status.rb +7 -2
- data/lib/dodopayments/models/license_key_update_params.rb +9 -8
- data/lib/dodopayments/models/license_validate_params.rb +5 -4
- data/lib/dodopayments/models/license_validate_response.rb +4 -3
- data/lib/dodopayments/models/misc_list_supported_countries_params.rb +5 -4
- data/lib/dodopayments/models/misc_list_supported_countries_response.rb +2 -1
- data/lib/dodopayments/models/one_time_product_cart_item.rb +4 -3
- data/lib/dodopayments/models/payment.rb +18 -11
- data/lib/dodopayments/models/payment_create_params.rb +232 -9
- data/lib/dodopayments/models/payment_create_response.rb +6 -5
- data/lib/dodopayments/models/payment_list_params.rb +5 -4
- data/lib/dodopayments/models/payment_list_response.rb +12 -5
- data/lib/dodopayments/models/payment_retrieve_params.rb +5 -4
- data/lib/dodopayments/models/payout_list_params.rb +5 -4
- data/lib/dodopayments/models/payout_list_response.rb +21 -6
- data/lib/dodopayments/models/price.rb +41 -30
- data/lib/dodopayments/models/product.rb +17 -10
- data/lib/dodopayments/models/product_create_params.rb +16 -11
- data/lib/dodopayments/models/product_delete_params.rb +5 -4
- data/lib/dodopayments/models/product_list_params.rb +10 -9
- data/lib/dodopayments/models/product_list_response.rb +30 -17
- data/lib/dodopayments/models/product_retrieve_params.rb +5 -4
- data/lib/dodopayments/models/product_unarchive_params.rb +5 -4
- data/lib/dodopayments/models/product_update_params.rb +22 -17
- data/lib/dodopayments/models/products/image_update_params.rb +6 -5
- data/lib/dodopayments/models/products/image_update_response.rb +3 -2
- data/lib/dodopayments/models/refund.rb +11 -4
- data/lib/dodopayments/models/refund_create_params.rb +6 -13
- data/lib/dodopayments/models/refund_list_params.rb +5 -4
- data/lib/dodopayments/models/refund_retrieve_params.rb +5 -4
- data/lib/dodopayments/models/refund_status.rb +7 -2
- data/lib/dodopayments/models/subscription.rb +21 -7
- data/lib/dodopayments/models/subscription_charge_params.rb +27 -0
- data/lib/dodopayments/models/subscription_charge_response.rb +20 -0
- data/lib/dodopayments/models/subscription_create_params.rb +262 -8
- data/lib/dodopayments/models/subscription_create_response.rb +6 -5
- data/lib/dodopayments/models/subscription_list_params.rb +5 -4
- data/lib/dodopayments/models/subscription_retrieve_params.rb +5 -4
- data/lib/dodopayments/models/subscription_status.rb +7 -2
- data/lib/dodopayments/models/subscription_update_params.rb +19 -6
- data/lib/dodopayments/models/time_interval.rb +7 -2
- data/lib/dodopayments/models/webhook_event.rb +3 -2
- data/lib/dodopayments/models/webhook_event_list_params.rb +6 -5
- data/lib/dodopayments/models/webhook_event_retrieve_params.rb +5 -4
- data/lib/dodopayments/request_options.rb +12 -47
- data/lib/dodopayments/resources/customers/customer_portal.rb +10 -8
- data/lib/dodopayments/resources/customers.rb +30 -29
- data/lib/dodopayments/resources/discounts.rb +45 -69
- data/lib/dodopayments/resources/disputes.rb +20 -22
- data/lib/dodopayments/resources/invoices/payments.rb +8 -5
- data/lib/dodopayments/resources/invoices.rb +2 -0
- data/lib/dodopayments/resources/license_key_instances.rb +23 -21
- data/lib/dodopayments/resources/license_keys.rb +27 -32
- data/lib/dodopayments/resources/licenses.rb +20 -18
- data/lib/dodopayments/resources/misc.rb +7 -3
- data/lib/dodopayments/resources/payments.rb +36 -43
- data/lib/dodopayments/resources/payouts.rb +9 -7
- data/lib/dodopayments/resources/products/images.rb +9 -7
- data/lib/dodopayments/resources/products.rb +59 -87
- data/lib/dodopayments/resources/refunds.rb +25 -29
- data/lib/dodopayments/resources/subscriptions.rb +68 -54
- data/lib/dodopayments/resources/webhook_events.rb +20 -21
- data/lib/dodopayments/version.rb +1 -1
- data/lib/dodopayments.rb +34 -7
- data/manifest.yaml +1 -0
- data/rbi/lib/dodopayments/client.rbi +32 -47
- data/rbi/lib/dodopayments/errors.rbi +125 -161
- data/rbi/lib/dodopayments/internal/default_page_number_pagination.rbi +18 -0
- data/rbi/lib/dodopayments/internal/transport/base_client.rbi +199 -0
- data/rbi/lib/dodopayments/internal/transport/pooled_net_requester.rbi +60 -0
- data/rbi/lib/dodopayments/internal/type/array_of.rbi +85 -0
- data/rbi/lib/dodopayments/internal/type/base_model.rbi +214 -0
- data/rbi/lib/dodopayments/internal/type/base_page.rbi +36 -0
- data/rbi/lib/dodopayments/internal/type/boolean.rbi +48 -0
- data/rbi/lib/dodopayments/internal/type/converter.rbi +120 -0
- data/rbi/lib/dodopayments/internal/type/enum.rbi +69 -0
- data/rbi/lib/dodopayments/internal/type/hash_of.rbi +85 -0
- data/rbi/lib/dodopayments/internal/type/io_like.rbi +46 -0
- data/rbi/lib/dodopayments/internal/type/request_parameters.rbi +21 -0
- data/rbi/lib/dodopayments/internal/type/union.rbi +77 -0
- data/rbi/lib/dodopayments/internal/type/unknown.rbi +40 -0
- data/rbi/lib/dodopayments/internal/util.rbi +297 -0
- data/rbi/lib/dodopayments/internal.rbi +12 -0
- data/rbi/lib/dodopayments/models/attach_existing_customer.rbi +4 -11
- data/rbi/lib/dodopayments/models/billing_address.rbi +20 -38
- data/rbi/lib/dodopayments/models/country_code.rbi +256 -256
- data/rbi/lib/dodopayments/models/create_new_customer.rbi +11 -30
- data/rbi/lib/dodopayments/models/customer.rbi +9 -41
- data/rbi/lib/dodopayments/models/customer_create_params.rbi +9 -26
- data/rbi/lib/dodopayments/models/customer_limited_details.rbi +6 -23
- data/rbi/lib/dodopayments/models/customer_list_params.rbi +8 -20
- data/rbi/lib/dodopayments/models/customer_portal_session.rbi +4 -11
- data/rbi/lib/dodopayments/models/customer_request.rbi +4 -7
- data/rbi/lib/dodopayments/models/customer_retrieve_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/customer_update_params.rbi +8 -20
- data/rbi/lib/dodopayments/models/customers/customer_portal_create_params.rbi +7 -14
- data/rbi/lib/dodopayments/models/discount.rbi +20 -78
- data/rbi/lib/dodopayments/models/discount_create_params.rbi +23 -61
- data/rbi/lib/dodopayments/models/discount_delete_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/discount_list_params.rbi +8 -20
- data/rbi/lib/dodopayments/models/discount_retrieve_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/discount_type.rbi +8 -8
- data/rbi/lib/dodopayments/models/discount_update_params.rbi +21 -59
- data/rbi/lib/dodopayments/models/dispute.rbi +27 -59
- data/rbi/lib/dodopayments/models/dispute_list_params.rbi +19 -57
- data/rbi/lib/dodopayments/models/dispute_retrieve_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/dispute_stage.rbi +10 -10
- data/rbi/lib/dodopayments/models/dispute_status.rbi +14 -14
- data/rbi/lib/dodopayments/models/intent_status.rbi +22 -18
- data/rbi/lib/dodopayments/models/invoices/payment_retrieve_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/license_activate_params.rbi +8 -20
- data/rbi/lib/dodopayments/models/license_deactivate_params.rbi +8 -20
- data/rbi/lib/dodopayments/models/license_key.rbi +19 -82
- data/rbi/lib/dodopayments/models/license_key_duration.rbi +8 -20
- data/rbi/lib/dodopayments/models/license_key_instance.rbi +8 -35
- data/rbi/lib/dodopayments/models/license_key_instance_list_params.rbi +9 -26
- data/rbi/lib/dodopayments/models/license_key_instance_retrieve_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/license_key_instance_update_params.rbi +7 -17
- data/rbi/lib/dodopayments/models/license_key_list_params.rbi +21 -40
- data/rbi/lib/dodopayments/models/license_key_retrieve_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/license_key_status.rbi +10 -10
- data/rbi/lib/dodopayments/models/license_key_update_params.rbi +12 -29
- data/rbi/lib/dodopayments/models/license_validate_params.rbi +8 -20
- data/rbi/lib/dodopayments/models/license_validate_response.rbi +4 -11
- data/rbi/lib/dodopayments/models/misc_list_supported_countries_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/misc_list_supported_countries_response.rbi +5 -1
- data/rbi/lib/dodopayments/models/one_time_product_cart_item.rbi +8 -24
- data/rbi/lib/dodopayments/models/payment.rbi +197 -308
- data/rbi/lib/dodopayments/models/payment_create_params.rbi +261 -61
- data/rbi/lib/dodopayments/models/payment_create_response.rbi +16 -60
- data/rbi/lib/dodopayments/models/payment_list_params.rbi +16 -54
- data/rbi/lib/dodopayments/models/payment_list_response.rbi +178 -228
- data/rbi/lib/dodopayments/models/payment_retrieve_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/payout_list_params.rbi +8 -20
- data/rbi/lib/dodopayments/models/payout_list_response.rbi +197 -271
- data/rbi/lib/dodopayments/models/price.rbi +368 -464
- data/rbi/lib/dodopayments/models/product.rbi +48 -119
- data/rbi/lib/dodopayments/models/product_create_params.rbi +46 -86
- data/rbi/lib/dodopayments/models/product_delete_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/product_list_params.rbi +15 -34
- data/rbi/lib/dodopayments/models/product_list_response.rbi +209 -275
- data/rbi/lib/dodopayments/models/product_retrieve_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/product_unarchive_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/product_update_params.rbi +55 -102
- data/rbi/lib/dodopayments/models/products/image_update_params.rbi +7 -14
- data/rbi/lib/dodopayments/models/products/image_update_response.rbi +5 -17
- data/rbi/lib/dodopayments/models/refund.rbi +181 -213
- data/rbi/lib/dodopayments/models/refund_create_params.rbi +13 -39
- data/rbi/lib/dodopayments/models/refund_list_params.rbi +15 -48
- data/rbi/lib/dodopayments/models/refund_retrieve_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/refund_status.rbi +11 -11
- data/rbi/lib/dodopayments/models/subscription.rbi +202 -283
- data/rbi/lib/dodopayments/models/subscription_charge_params.rbi +27 -0
- data/rbi/lib/dodopayments/models/subscription_charge_response.rbi +16 -0
- data/rbi/lib/dodopayments/models/subscription_create_params.rbi +315 -69
- data/rbi/lib/dodopayments/models/subscription_create_response.rbi +15 -51
- data/rbi/lib/dodopayments/models/subscription_list_params.rbi +15 -48
- data/rbi/lib/dodopayments/models/subscription_retrieve_params.rbi +6 -8
- data/rbi/lib/dodopayments/models/subscription_status.rbi +14 -14
- data/rbi/lib/dodopayments/models/subscription_update_params.rbi +25 -21
- data/rbi/lib/dodopayments/models/time_interval.rbi +11 -11
- data/rbi/lib/dodopayments/models/webhook_event.rbi +11 -54
- data/rbi/lib/dodopayments/models/webhook_event_list_params.rbi +12 -45
- data/rbi/lib/dodopayments/models/webhook_event_retrieve_params.rbi +6 -8
- data/rbi/lib/dodopayments/request_options.rbi +18 -81
- data/rbi/lib/dodopayments/resources/customers/customer_portal.rbi +5 -7
- data/rbi/lib/dodopayments/resources/customers.rbi +12 -20
- data/rbi/lib/dodopayments/resources/discounts.rbi +27 -37
- data/rbi/lib/dodopayments/resources/disputes.rbi +9 -13
- data/rbi/lib/dodopayments/resources/invoices/payments.rbi +4 -5
- data/rbi/lib/dodopayments/resources/invoices.rbi +3 -4
- data/rbi/lib/dodopayments/resources/license_key_instances.rbi +9 -15
- data/rbi/lib/dodopayments/resources/license_keys.rbi +13 -19
- data/rbi/lib/dodopayments/resources/licenses.rbi +8 -11
- data/rbi/lib/dodopayments/resources/misc.rbi +12 -6
- data/rbi/lib/dodopayments/resources/payments.rbi +32 -21
- data/rbi/lib/dodopayments/resources/payouts.rbi +5 -7
- data/rbi/lib/dodopayments/resources/products/images.rbi +4 -6
- data/rbi/lib/dodopayments/resources/products.rbi +43 -44
- data/rbi/lib/dodopayments/resources/refunds.rbi +10 -20
- data/rbi/lib/dodopayments/resources/subscriptions.rbi +57 -24
- data/rbi/lib/dodopayments/resources/webhook_events.rbi +7 -10
- data/rbi/lib/dodopayments/version.rbi +1 -1
- data/sig/dodopayments/client.rbs +8 -8
- data/sig/dodopayments/errors.rbs +98 -96
- data/sig/dodopayments/internal/default_page_number_pagination.rbs +11 -0
- data/sig/dodopayments/internal/transport/base_client.rbs +110 -0
- data/sig/dodopayments/internal/transport/pooled_net_requester.rbs +41 -0
- data/sig/dodopayments/internal/type/array_of.rbs +43 -0
- data/sig/dodopayments/internal/type/base_model.rbs +92 -0
- data/sig/dodopayments/internal/type/base_page.rbs +24 -0
- data/sig/dodopayments/internal/type/boolean.rbs +23 -0
- data/sig/dodopayments/internal/type/converter.rbs +54 -0
- data/sig/dodopayments/internal/type/enum.rbs +29 -0
- data/sig/dodopayments/internal/type/hash_of.rbs +43 -0
- data/sig/dodopayments/internal/type/io_like.rbs +23 -0
- data/sig/dodopayments/internal/type/request_parameters.rbs +15 -0
- data/sig/dodopayments/internal/type/union.rbs +47 -0
- data/sig/dodopayments/internal/type/unknown.rbs +23 -0
- data/sig/dodopayments/internal/util.rbs +156 -0
- data/sig/dodopayments/internal.rbs +5 -0
- data/sig/dodopayments/models/attach_existing_customer.rbs +2 -7
- data/sig/dodopayments/models/billing_address.rbs +8 -12
- data/sig/dodopayments/models/country_code.rbs +4 -2
- data/sig/dodopayments/models/create_new_customer.rbs +7 -12
- data/sig/dodopayments/models/customer.rbs +9 -13
- data/sig/dodopayments/models/customer_create_params.rbs +10 -15
- data/sig/dodopayments/models/customer_limited_details.rbs +2 -7
- data/sig/dodopayments/models/customer_list_params.rbs +9 -14
- data/sig/dodopayments/models/customer_portal_session.rbs +2 -7
- data/sig/dodopayments/models/customer_request.rbs +4 -2
- data/sig/dodopayments/models/customer_retrieve_params.rbs +6 -10
- data/sig/dodopayments/models/customer_update_params.rbs +9 -14
- data/sig/dodopayments/models/customers/customer_portal_create_params.rbs +8 -13
- data/sig/dodopayments/models/discount.rbs +14 -18
- data/sig/dodopayments/models/discount_create_params.rbs +14 -19
- data/sig/dodopayments/models/discount_delete_params.rbs +6 -10
- data/sig/dodopayments/models/discount_list_params.rbs +9 -14
- data/sig/dodopayments/models/discount_retrieve_params.rbs +6 -10
- data/sig/dodopayments/models/discount_type.rbs +4 -2
- data/sig/dodopayments/models/discount_update_params.rbs +14 -19
- data/sig/dodopayments/models/dispute.rbs +11 -15
- data/sig/dodopayments/models/dispute_list_params.rbs +14 -19
- data/sig/dodopayments/models/dispute_retrieve_params.rbs +6 -10
- data/sig/dodopayments/models/dispute_stage.rbs +4 -2
- data/sig/dodopayments/models/dispute_status.rbs +4 -2
- data/sig/dodopayments/models/intent_status.rbs +4 -2
- data/sig/dodopayments/models/invoices/payment_retrieve_params.rbs +6 -10
- data/sig/dodopayments/models/license_activate_params.rbs +10 -14
- data/sig/dodopayments/models/license_deactivate_params.rbs +9 -14
- data/sig/dodopayments/models/license_key.rbs +15 -19
- data/sig/dodopayments/models/license_key_duration.rbs +5 -7
- data/sig/dodopayments/models/license_key_instance.rbs +8 -13
- data/sig/dodopayments/models/license_key_instance_list_params.rbs +10 -15
- data/sig/dodopayments/models/license_key_instance_retrieve_params.rbs +5 -10
- data/sig/dodopayments/models/license_key_instance_update_params.rbs +8 -10
- data/sig/dodopayments/models/license_key_list_params.rbs +12 -17
- data/sig/dodopayments/models/license_key_retrieve_params.rbs +6 -10
- data/sig/dodopayments/models/license_key_status.rbs +4 -2
- data/sig/dodopayments/models/license_key_update_params.rbs +10 -15
- data/sig/dodopayments/models/license_validate_params.rbs +9 -14
- data/sig/dodopayments/models/license_validate_response.rbs +2 -7
- data/sig/dodopayments/models/misc_list_supported_countries_params.rbs +5 -10
- data/sig/dodopayments/models/one_time_product_cart_item.rbs +6 -7
- data/sig/dodopayments/models/payment.rbs +28 -35
- data/sig/dodopayments/models/payment_create_params.rbs +373 -20
- data/sig/dodopayments/models/payment_create_response.rbs +11 -16
- data/sig/dodopayments/models/payment_list_params.rbs +14 -19
- data/sig/dodopayments/models/payment_list_response.rbs +17 -20
- data/sig/dodopayments/models/payment_retrieve_params.rbs +6 -10
- data/sig/dodopayments/models/payout_list_params.rbs +9 -14
- data/sig/dodopayments/models/payout_list_response.rbs +30 -28
- data/sig/dodopayments/models/price.rbs +37 -41
- data/sig/dodopayments/models/product.rbs +22 -24
- data/sig/dodopayments/models/product_create_params.rbs +20 -23
- data/sig/dodopayments/models/product_delete_params.rbs +6 -10
- data/sig/dodopayments/models/product_list_params.rbs +11 -16
- data/sig/dodopayments/models/product_list_response.rbs +24 -25
- data/sig/dodopayments/models/product_retrieve_params.rbs +6 -10
- data/sig/dodopayments/models/product_unarchive_params.rbs +6 -10
- data/sig/dodopayments/models/product_update_params.rbs +21 -24
- data/sig/dodopayments/models/products/image_update_params.rbs +9 -13
- data/sig/dodopayments/models/products/image_update_response.rbs +2 -7
- data/sig/dodopayments/models/refund.rbs +15 -15
- data/sig/dodopayments/models/refund_create_params.rbs +10 -18
- data/sig/dodopayments/models/refund_list_params.rbs +13 -18
- data/sig/dodopayments/models/refund_retrieve_params.rbs +6 -10
- data/sig/dodopayments/models/refund_status.rbs +4 -2
- data/sig/dodopayments/models/subscription.rbs +29 -27
- data/sig/dodopayments/models/subscription_charge_params.rbs +21 -0
- data/sig/dodopayments/models/subscription_charge_response.rbs +13 -0
- data/sig/dodopayments/models/subscription_create_params.rbs +391 -22
- data/sig/dodopayments/models/subscription_create_response.rbs +10 -15
- data/sig/dodopayments/models/subscription_list_params.rbs +13 -18
- data/sig/dodopayments/models/subscription_retrieve_params.rbs +6 -10
- data/sig/dodopayments/models/subscription_status.rbs +4 -2
- data/sig/dodopayments/models/subscription_update_params.rbs +18 -15
- data/sig/dodopayments/models/time_interval.rbs +4 -2
- data/sig/dodopayments/models/webhook_event.rbs +11 -15
- data/sig/dodopayments/models/webhook_event_list_params.rbs +13 -18
- data/sig/dodopayments/models/webhook_event_retrieve_params.rbs +6 -10
- data/sig/dodopayments/request_options.rbs +3 -13
- data/sig/dodopayments/resources/customers/customer_portal.rbs +5 -11
- data/sig/dodopayments/resources/customers.rbs +21 -42
- data/sig/dodopayments/resources/discounts.rbs +34 -61
- data/sig/dodopayments/resources/disputes.rbs +14 -24
- data/sig/dodopayments/resources/invoices/payments.rbs +4 -10
- data/sig/dodopayments/resources/license_key_instances.rbs +15 -32
- data/sig/dodopayments/resources/license_keys.rbs +19 -36
- data/sig/dodopayments/resources/licenses.rbs +15 -30
- data/sig/dodopayments/resources/misc.rbs +3 -8
- data/sig/dodopayments/resources/payments.rbs +28 -39
- data/sig/dodopayments/resources/payouts.rbs +5 -9
- data/sig/dodopayments/resources/products/images.rbs +5 -11
- data/sig/dodopayments/resources/products.rbs +45 -71
- data/sig/dodopayments/resources/refunds.rbs +18 -33
- data/sig/dodopayments/resources/subscriptions.rbs +44 -54
- data/sig/dodopayments/resources/webhook_events.rbs +13 -24
- data/sig/dodopayments/version.rbs +1 -1
- metadata +63 -27
- data/lib/dodopayments/base_client.rb +0 -453
- data/lib/dodopayments/base_model.rb +0 -1217
- data/lib/dodopayments/base_page.rb +0 -62
- data/lib/dodopayments/default_page_number_pagination.rb +0 -97
- data/lib/dodopayments/extern.rb +0 -9
- data/lib/dodopayments/pooled_net_requester.rb +0 -164
- data/lib/dodopayments/util.rb +0 -717
- data/rbi/lib/dodopayments/base_client.rbi +0 -186
- data/rbi/lib/dodopayments/base_model.rbi +0 -606
- data/rbi/lib/dodopayments/base_page.rbi +0 -40
- data/rbi/lib/dodopayments/default_page_number_pagination.rbi +0 -17
- data/rbi/lib/dodopayments/extern.rbi +0 -8
- data/rbi/lib/dodopayments/pooled_net_requester.rbi +0 -47
- data/rbi/lib/dodopayments/util.rbi +0 -270
- data/sig/dodopayments/base_client.rbs +0 -103
- data/sig/dodopayments/base_model.rbs +0 -246
- data/sig/dodopayments/base_page.rbs +0 -20
- data/sig/dodopayments/default_page_number_pagination.rbs +0 -7
- data/sig/dodopayments/extern.rbs +0 -4
- data/sig/dodopayments/pooled_net_requester.rbs +0 -30
- data/sig/dodopayments/util.rbs +0 -136
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Dodopayments
|
4
|
-
# @abstract
|
5
|
-
#
|
6
|
-
# @example
|
7
|
-
# ```ruby
|
8
|
-
# if page.has_next?
|
9
|
-
# page = page.next_page
|
10
|
-
# end
|
11
|
-
# ```
|
12
|
-
#
|
13
|
-
# @example
|
14
|
-
# ```ruby
|
15
|
-
# page.auto_paging_each do |payment|
|
16
|
-
# puts(payment)
|
17
|
-
# end
|
18
|
-
# ```
|
19
|
-
#
|
20
|
-
# @example
|
21
|
-
# ```ruby
|
22
|
-
# payments = page
|
23
|
-
# .to_enum
|
24
|
-
# .lazy
|
25
|
-
# .select { _1.object_id.even? }
|
26
|
-
# .map(&:itself)
|
27
|
-
# .take(2)
|
28
|
-
# .to_a
|
29
|
-
#
|
30
|
-
# payments => Array
|
31
|
-
# ```
|
32
|
-
module BasePage
|
33
|
-
# @return [Boolean]
|
34
|
-
def next_page? = (raise NotImplementedError)
|
35
|
-
|
36
|
-
# @raise [Dodopayments::APIError]
|
37
|
-
# @return [Dodopayments::BasePage]
|
38
|
-
def next_page = (raise NotImplementedError)
|
39
|
-
|
40
|
-
# @param blk [Proc]
|
41
|
-
#
|
42
|
-
# @return [void]
|
43
|
-
def auto_paging_each(&) = (raise NotImplementedError)
|
44
|
-
|
45
|
-
# @return [Enumerable]
|
46
|
-
def to_enum = super(:auto_paging_each)
|
47
|
-
|
48
|
-
alias_method :enum_for, :to_enum
|
49
|
-
|
50
|
-
# @api private
|
51
|
-
#
|
52
|
-
# @param client [Dodopayments::BaseClient]
|
53
|
-
# @param req [Hash{Symbol=>Object}]
|
54
|
-
# @param headers [Hash{String=>String}, Net::HTTPHeader]
|
55
|
-
# @param page_data [Object]
|
56
|
-
def initialize(client:, req:, headers:, page_data:)
|
57
|
-
@client = client
|
58
|
-
@req = req
|
59
|
-
super()
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Dodopayments
|
4
|
-
# @example
|
5
|
-
# ```ruby
|
6
|
-
# if default_page_number_pagination.has_next?
|
7
|
-
# default_page_number_pagination = default_page_number_pagination.next_page
|
8
|
-
# end
|
9
|
-
# ```
|
10
|
-
#
|
11
|
-
# @example
|
12
|
-
# ```ruby
|
13
|
-
# default_page_number_pagination.auto_paging_each do |payment|
|
14
|
-
# puts(payment)
|
15
|
-
# end
|
16
|
-
# ```
|
17
|
-
#
|
18
|
-
# @example
|
19
|
-
# ```ruby
|
20
|
-
# payments = default_page_number_pagination
|
21
|
-
# .to_enum
|
22
|
-
# .lazy
|
23
|
-
# .select { _1.object_id.even? }
|
24
|
-
# .map(&:itself)
|
25
|
-
# .take(2)
|
26
|
-
# .to_a
|
27
|
-
#
|
28
|
-
# payments => Array
|
29
|
-
# ```
|
30
|
-
class DefaultPageNumberPagination
|
31
|
-
include Dodopayments::BasePage
|
32
|
-
|
33
|
-
# @return [Array<Object>, nil]
|
34
|
-
attr_accessor :items
|
35
|
-
|
36
|
-
# @api private
|
37
|
-
#
|
38
|
-
# @param client [Dodopayments::BaseClient]
|
39
|
-
# @param req [Hash{Symbol=>Object}]
|
40
|
-
# @param headers [Hash{String=>String}, Net::HTTPHeader]
|
41
|
-
# @param page_data [Hash{Symbol=>Object}]
|
42
|
-
def initialize(client:, req:, headers:, page_data:)
|
43
|
-
super
|
44
|
-
model = req.fetch(:model)
|
45
|
-
|
46
|
-
case page_data
|
47
|
-
in {items: Array | nil => items}
|
48
|
-
@items = items&.map { model.coerce(_1) }
|
49
|
-
else
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# @return [Boolean]
|
54
|
-
def next_page?
|
55
|
-
!items.to_a.empty?
|
56
|
-
end
|
57
|
-
|
58
|
-
# @raise [Dodopayments::HTTP::Error]
|
59
|
-
# @return [Dodopayments::DefaultPageNumberPagination]
|
60
|
-
def next_page
|
61
|
-
unless next_page?
|
62
|
-
raise RuntimeError.new("No more pages available. Please check #next_page? before calling ##{__method__}")
|
63
|
-
end
|
64
|
-
|
65
|
-
req = Dodopayments::Util.deep_merge(
|
66
|
-
@req,
|
67
|
-
{
|
68
|
-
query: {
|
69
|
-
page_number: @req.fetch(:query).fetch(
|
70
|
-
:page_number,
|
71
|
-
1
|
72
|
-
).to_i.succ
|
73
|
-
}
|
74
|
-
}
|
75
|
-
)
|
76
|
-
@client.request(req)
|
77
|
-
end
|
78
|
-
|
79
|
-
# @param blk [Proc]
|
80
|
-
def auto_paging_each(&blk)
|
81
|
-
unless block_given?
|
82
|
-
raise ArgumentError.new("A block must be given to ##{__method__}")
|
83
|
-
end
|
84
|
-
page = self
|
85
|
-
loop do
|
86
|
-
page.items&.each { blk.call(_1) }
|
87
|
-
break unless page.next_page?
|
88
|
-
page = page.next_page
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
# @return [String]
|
93
|
-
def inspect
|
94
|
-
"#<#{self.class}:0x#{object_id.to_s(16)} items=#{items.inspect}>"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
data/lib/dodopayments/extern.rb
DELETED
@@ -1,164 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Dodopayments
|
4
|
-
# @api private
|
5
|
-
class PooledNetRequester
|
6
|
-
class << self
|
7
|
-
# @api private
|
8
|
-
#
|
9
|
-
# @param url [URI::Generic]
|
10
|
-
#
|
11
|
-
# @return [Net::HTTP]
|
12
|
-
def connect(url)
|
13
|
-
port =
|
14
|
-
case [url.port, url.scheme]
|
15
|
-
in [Integer, _]
|
16
|
-
url.port
|
17
|
-
in [nil, "http" | "ws"]
|
18
|
-
Net::HTTP.http_default_port
|
19
|
-
in [nil, "https" | "wss"]
|
20
|
-
Net::HTTP.https_default_port
|
21
|
-
end
|
22
|
-
|
23
|
-
Net::HTTP.new(url.host, port).tap do
|
24
|
-
_1.use_ssl = %w[https wss].include?(url.scheme)
|
25
|
-
_1.max_retries = 0
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# @api private
|
30
|
-
#
|
31
|
-
# @param conn [Net::HTTP]
|
32
|
-
# @param deadline [Float]
|
33
|
-
def calibrate_socket_timeout(conn, deadline)
|
34
|
-
timeout = deadline - Dodopayments::Util.monotonic_secs
|
35
|
-
conn.open_timeout = conn.read_timeout = conn.write_timeout = conn.continue_timeout = timeout
|
36
|
-
end
|
37
|
-
|
38
|
-
# @api private
|
39
|
-
#
|
40
|
-
# @param request [Hash{Symbol=>Object}] .
|
41
|
-
#
|
42
|
-
# @option request [Symbol] :method
|
43
|
-
#
|
44
|
-
# @option request [URI::Generic] :url
|
45
|
-
#
|
46
|
-
# @option request [Hash{String=>String}] :headers
|
47
|
-
#
|
48
|
-
# @param blk [Proc]
|
49
|
-
#
|
50
|
-
# @return [Net::HTTPGenericRequest]
|
51
|
-
def build_request(request, &)
|
52
|
-
method, url, headers, body = request.fetch_values(:method, :url, :headers, :body)
|
53
|
-
req = Net::HTTPGenericRequest.new(
|
54
|
-
method.to_s.upcase,
|
55
|
-
!body.nil?,
|
56
|
-
method != :head,
|
57
|
-
url.to_s
|
58
|
-
)
|
59
|
-
|
60
|
-
headers.each { req[_1] = _2 }
|
61
|
-
|
62
|
-
case body
|
63
|
-
in nil
|
64
|
-
in String
|
65
|
-
req["content-length"] ||= body.bytesize.to_s unless req["transfer-encoding"]
|
66
|
-
req.body_stream = Dodopayments::Util::ReadIOAdapter.new(body, &)
|
67
|
-
in StringIO
|
68
|
-
req["content-length"] ||= body.size.to_s unless req["transfer-encoding"]
|
69
|
-
req.body_stream = Dodopayments::Util::ReadIOAdapter.new(body, &)
|
70
|
-
in IO | Enumerator
|
71
|
-
req["transfer-encoding"] ||= "chunked" unless req["content-length"]
|
72
|
-
req.body_stream = Dodopayments::Util::ReadIOAdapter.new(body, &)
|
73
|
-
end
|
74
|
-
|
75
|
-
req
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
# @api private
|
80
|
-
#
|
81
|
-
# @param url [URI::Generic]
|
82
|
-
# @param blk [Proc]
|
83
|
-
private def with_pool(url, &)
|
84
|
-
origin = Dodopayments::Util.uri_origin(url)
|
85
|
-
pool =
|
86
|
-
@mutex.synchronize do
|
87
|
-
@pools[origin] ||= ConnectionPool.new(size: @size) do
|
88
|
-
self.class.connect(url)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
pool.with(&)
|
93
|
-
end
|
94
|
-
|
95
|
-
# @api private
|
96
|
-
#
|
97
|
-
# @param request [Hash{Symbol=>Object}] .
|
98
|
-
#
|
99
|
-
# @option request [Symbol] :method
|
100
|
-
#
|
101
|
-
# @option request [URI::Generic] :url
|
102
|
-
#
|
103
|
-
# @option request [Hash{String=>String}] :headers
|
104
|
-
#
|
105
|
-
# @option request [Object] :body
|
106
|
-
#
|
107
|
-
# @option request [Float] :deadline
|
108
|
-
#
|
109
|
-
# @return [Array(Net::HTTPResponse, Enumerable)]
|
110
|
-
def execute(request)
|
111
|
-
url, deadline = request.fetch_values(:url, :deadline)
|
112
|
-
|
113
|
-
eof = false
|
114
|
-
finished = false
|
115
|
-
enum = Enumerator.new do |y|
|
116
|
-
with_pool(url) do |conn|
|
117
|
-
next if finished
|
118
|
-
|
119
|
-
req = self.class.build_request(request) do
|
120
|
-
self.class.calibrate_socket_timeout(conn, deadline)
|
121
|
-
end
|
122
|
-
|
123
|
-
self.class.calibrate_socket_timeout(conn, deadline)
|
124
|
-
conn.start unless conn.started?
|
125
|
-
|
126
|
-
self.class.calibrate_socket_timeout(conn, deadline)
|
127
|
-
conn.request(req) do |rsp|
|
128
|
-
y << [conn, rsp]
|
129
|
-
break if finished
|
130
|
-
|
131
|
-
rsp.read_body do |bytes|
|
132
|
-
y << bytes
|
133
|
-
break if finished
|
134
|
-
|
135
|
-
self.class.calibrate_socket_timeout(conn, deadline)
|
136
|
-
end
|
137
|
-
eof = true
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
conn, response = enum.next
|
143
|
-
body = Dodopayments::Util.fused_enum(enum, external: true) do
|
144
|
-
finished = true
|
145
|
-
tap do
|
146
|
-
enum.next
|
147
|
-
rescue StopIteration
|
148
|
-
nil
|
149
|
-
end
|
150
|
-
conn.finish if !eof && conn&.started?
|
151
|
-
end
|
152
|
-
[response, (response.body = body)]
|
153
|
-
end
|
154
|
-
|
155
|
-
# @api private
|
156
|
-
#
|
157
|
-
# @param size [Integer]
|
158
|
-
def initialize(size: Etc.nprocessors)
|
159
|
-
@mutex = Mutex.new
|
160
|
-
@size = size
|
161
|
-
@pools = {}
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|