This is a reference implementation in Ruby of Dinote's "Push API" specification. Dinote's lender partners can implement an API according to this spec to achieve easy integration with Dinote's business loan marketplace.
The specification is here: Dinote -- Prequalification & Underwriting APIs 2019
This project implements the "Prequalification API" and "Documents API" described there.
To run the reference server, you need Ruby 2.0+ and the Sinatra gem. To install Sinatra:
gem install sinatra
Then in the project directory:
Or, use bundler:
bundle installbundle exec ruby app.rb
To use an environment other than "development":
RACK_ENV=staging ruby app.rb
RACK_ENV=staging bundle exec ruby app.rb
This will run an HTTP service at http://localhost:4567.
To send a test request to the server with curl:
curl -u development:abc123 -d @request.json http://localhost:4267/api/v1/prequalify
Where "request.json" contains the JSON request to send. See the spec for examples.
This implementation demonstrates the following features mentioned in the spec:
Authorization via HTTP Basic Auth.
HTTP statuses for malformed requests and other errors.
Handling and validating the many data fields, many of them optional, sent in API requests.
Storing requests and producing a preapproval decision, with or without provisional loan offers.
Uploading documents to support an approved decision.
Multiple environments (development, staging, production).
Triggering test responses with special field values.
Providing an optional URL on each loan offer, via which loan customers can visit the API implementer's site to claim an offer.
Additionally, the server implements a trivial "admin" page lists requests received and responses sent: http://localhost:4567/admin
The project contains these primary source files:
app.rb: Specification of the HTTP service, including configuration (environments and API usernames and passwords) and HTTP routes and handlers.
models.rb: Classes representing the constituent parts of an API request (Company, Owner) or response (Decision, Offer). Request validation happens here.
underwriting.rb: Logic for making a preapproval decision.
This project has unit tests under ./test. To run them:
bundle exec ruby -Ilib:test test/app_test.rb
If you didn't install with bundler, "gem install" each gem listed in the Gemfile.
Reach out to your Dinote contact, post an issue at or firstname.lastname@example.org