Scrutinator is a simple API server application for creating and logging credit checks. The Transunion API is consumed with a client gem.
Edit the .env.development file: uncomment and set the required enviornment variables.
bin/setup
bin/server
There are three endpoints. Each endpoint will return a data
attribute that
contains the credit check records. The response will look like this:
{
"success": true,
"message": "Retrieval of credit_check record was successful",
"data": {
"id": 5,
"first_name": "JOHN",
"last_name": "FUIEK",
"date_of_birth": "1992-03-27",
"phone_number": "312-330-8324",
"street": "3450 ROSE MALLOW LP",
"city": "OVIEDO",
"state": "FL",
"zipcode": "32766-6646",
"score": 676,
"request_parameters":
"first_name=JOHN&last_name=FUIEK&date_of_birth=1992-03-27&phone_number=312-330-8324&street=3450+ROSE+MALLOW+LP&city=OVIEDO&state=FL&zipcode=32766-6646",
"response_xml": "<xml>response from transunion api<xml>",
"request_xml": "<xml>request made to transunion api<xml>",
"error": null,
"external_id": "b08f013c-c608-4529-b9e4-02677fa37864",
"status": "success",
"created_at": "2019-07-31 14:44:18 -0500",
"updated_at": null
}
}
GET /v1/credit_checks
Returns all the credit checks with a default limit. The parameters are supported:
limit
- Default 20 - Integer specifying how many records to return.
page
- Default 1 - Integer specifying which page of results to return.
The response structure is similar to the example above except that the data
returns and array of credit check objects.
POST /v1/credit_checks
Attempts a credit check via the transunion API, stores and returns the results. The response structure will be just like the example response above.
Required parameters:
first_name
last_name
date_of_birth
- Must be formated like: YYYY-MM-DD e.g. 1988-03-25
phone_number
- Must be formated like: 888-888-8888
street
- Includes line 1 and line 2 of address like: 445 W Wellington APT 12
city
state
- The two letter abbreviation
zipcode
- Must be the 5 or 9 digit zipcode e.g. 60657 or 60657-2432
GET /v1/credit_checks/1
Returns a specific credit check. Just like the example response above.
This creates a credit check with test data. If run on the transunion test site this will return faked data.
uri = URI.parse('http://localhost:9292/v1/credit_checks')
uri.query = URI.encode_www_form({
first_name: 'JOHN',
last_name: 'FUIEK',
date_of_birth: '1992-03-27',
phone_number: '312-330-8324',
street: '3450 ROSE MALLOW LP',
city: 'OVIEDO',
state: 'FL',
zipcode: '32766-6646'
})
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, { 'Content-Type': 'application/json' })
http_response = http.request(request)
parsed_response = JSON(http_response.body)
puts parsed_response['data']['score']