Webhook implementation #1
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a major new feature: a complete, production-ready webhook management system for the Zai Payment gem. It adds full CRUD support for webhooks, a reusable API client, standardized response and error handling, comprehensive documentation, and a full test suite. The infrastructure is designed for easy extension to future resources.
New Webhook API and Core Infrastructure:
lib/zai_payment/resources/webhook.rbwith full CRUD operations for webhooks, including input validation, error handling, and pagination support.lib/zai_payment/client.rb(base HTTP client) andlib/zai_payment/response.rb(response wrapper) for reusable, thread-safe API communication and standardized response handling.Enhanced Error Handling:
lib/zai_payment/errors.rbto include new error classes for all major API scenarios (validation, authentication, not found, rate limit, network, server errors, etc.).Documentation and Examples:
docs/WEBHOOKS.md, usage examples inexamples/webhooks.rb, and updated theREADME.mdandCHANGELOG.mdto reflect new features and usage patterns. [1] [2] [3]Testing:
spec/zai_payment/resources/webhook_spec.rbcovering all webhook operations and error scenarios. [1] [2]Configuration and Versioning:
lib/zai_payment.rbto expose the newwebhooksresource and bumped the gem version to1.1.0.These changes ensure a clean, extensible, and well-documented foundation for future API resources, following Ruby best practices and providing robust error handling and test coverage.