Git Product home page Git Product logo

callcredit-ruby's Introduction

Callcredit Ruby Client Library

Simple Ruby Gem for interacting with Callcredit's CallValidate API. Wraps the XML submissions and responses required so you can deal with Ruby hashes instead.

Gem Version Build Status

Usage

Installation

You don't need this source code unless you want to modify the gem. If you just want to use it, you should run:

gem install callcredit

Initialising the gem

Requires your Callcredit credentials. If you don't have any, you'll need to call the sales team at Callcredit.

Callcredit.configure do |config|
  config[:company]          = YOUR_COMPANY_NAME
  config[:username]         = YOUR_USERNAME
  config[:password]         = YOUR_PASSWORD
  config[:application_name] = YOUR_APPLICATION_NAME
  config[:api_endpoint]     = YOUR_API_ENDPOINT
end

Performing checks

Standard AML checks

To perform an IDEnhanced check (the standard AML check) use:

Callcredit.id_enhanced_check(first_name: "Grey", last_name: "Baker")

The library will raise an error if you're missing any of the required parameters (first_name, last_name, date_of_birth, building_number and postcode).

BankStandard check

To perform a BankStandard check use:

Callcredit.bank_standard_check(account_number: "44779911", sort_code: "200000")

The library will raise an error unless you provide both account_number and sort_code.

BankEnhanced check

To perform a BankEnhanced check use:

Callcredit.bank_enhanced_check(first_name: "Tim", last_name: "Rogers", postcode: "EC1V 7LQ", account_number: "44779911", sort_code: "200000", building_number: "338-346")

The library will raise an error if you're missing any of the required parameters (first_name, last_name, building_number, postcode, account_number and sort_code).

Other checks

For any other check, simply pass the name of the check you'd like to perform into the perform_check method, along with details of the individual you're checking.

data_hash = { personal_data: { first_name: "Grey", last_name: "Baker" } }
Callcredit.perform_check(:id_enhanced, data_hash)

If you'd like to perform multiple checks at once you can pass an array of checks.

data_hash = { personal_data: { first_name: "Grey", last_name: "Baker" } }
Callcredit.perform_check([:id_enhanced, :credit_score], data_hash)

Parsing responses

Unless you've set the "raw" argument to true in your config, checks called by name return a Response object and checks called using the generic perform_check method return a hash.

Callcredit.id_enhanced_check(...)              # => Callcredit::Response

Callcredit.id_enhanced_check(...).input        # => Hash of input params, as
                                               #    returned by Callcredit

Callcredit.id_enhanced_check(...).result       # => Hash of results, mapping
                                               #    a check type to its results

Callcredit.id_enhanced_check(...).full_result  # => Hash of the full XML body
                                               #    returned by Callcredit

Callcredit.perform_check(...)                  # => Hash of the full XML body
                                               #    returned by Callcredit

Set the "raw" argument to true if you need the full, unprocessed response (including headers, etc.).

Callcredit.config[:raw] = true

Callcredit.id_enhanced_check(...)              # => Faraday::Response object

callcredit-ruby's People

Contributors

greysteil avatar hmarr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.