Native API library for SynapsePay REST v3.x
Originally developed as a simple wrapper to handle the headers and endpoint URLs for each API request, as of v2.0.0 it now handles creation of User, Node, Transaction and related objects to remove the necessity of dealing with raw payload and response JSON.
Not all API endpoints are supported.
There are significant changes but backwards compatibility has been mostly maintained by building on top of the base API wrapper. You can still use the previous classes but note the following changes:
ArgumentErrorwill be raised for missing payloads or other required arguments, where
RuntimeErrorwas raised previously.
development_modenow defaults to true (gem previously defaulted to production).
- KYC 1.0 methods for uploading documents have been deprecated. Please contact SynapsePay if you need to update to KYC 2.0.
- API errors will now raise
SynapsePayRest::Errors instead returning a JSON hash (and sometimes obfuscating the API error message).
Add this line to your application's Gemfile:
And then execute:
Or install it yourself by executing:
$ gem install synapse_pay_rest
Just open a pull request. Please document and test any public constants/methods. Open an issue or email firstname.lastname@example.org if you have any questions.
Running the Test Suite
Make sure these values are set as enviroment variables (using dotenv for example):
To run all tests, execute:
To run a specific file or test, install the m gem and execute:
- Smartly update the existing instances with response data instead of re-instantiating for every response. I started with this approach but it gets pretty complicated with the interconnected models of User/BaseDocument/Document. Also, certain values are only known if the user created an object, but not when the object is built from API response data. This is solveable but requires more dev time and testing.
- Various factory helper methods should be private but are public. Would be good to refactor in a way that they can be private.
Transactionhave similar REST methods that could probably be factored into a superclass or module.
- Use mixins instead of inheritance for the shared behavior of
Documents. The parent classes are never instantiated anyways.
- Refactor the redundant code in each
Nodetype's version of
- Better way to handle bank MFA nodes? Virtual doc KBA?
- Add an option for logging responses in addition to requests.
- Organize tests better.
- Use mocked responses whenever possible in tests.
- More examples.
- More Error types (bad MFA answer, for example).
- Add some methods to BaseDocument to return doc by type (e.g.
Specific todos are marked throughout in this format:
# @todo Description of todo.