Coder Social home page Coder Social logo

emailage_ruby's Introduction

alt text(https://www.emailage.com)

The Emailage™ API is organized around REST (Representational State Transfer). The API was built to help companies integrate with our highly efficient fraud risk and scoring system. By calling our API endpoints and simply passing us an email and/or IP Address, companies will be provided with real-time risk scoring assessments based around machine learning and proprietary algorithms that evolve with new fraud trends.

Installation

Add this line to your application's Gemfile:

gem 'emailage'

And then execute:

$ bundle

Or install it yourself as:

$ gem install emailage

Usage

Instantiate a client

# For a production server
emailage = Emailage::Client.new('My account SID', 'My auth token')
# ... or for a sandbox
emailage = Emailage::Client.new('My account SID', 'My auth token', sandbox: true)

Query a risk score information for the provided email address, IP address, or a combination

# For an email address
emailage.query '[email protected]'
# For an IP address
emailage.query '127.0.0.1'
# For a combination. Please note the order
emailage.query ['[email protected]', '127.0.0.1']
# Pass a User Defined Record ID.
# Can be used when you want to add an identifier for a query.
# The identifier will be displayed in the result.
emailage.query '[email protected]', urid: 'My record ID for [email protected]'

Explicit methods produce the same request while validating format of the arguments passed

# For an email address
emailage.query_email '[email protected]'
# For an IP address
emailage.query_ip_address '127.0.0.1'
# For a combination. Please note the order
emailage.query_email_and_ip_address '[email protected]', '127.0.0.1'
# Pass a User Defined Record ID
emailage.query_email_and_ip_address '[email protected]', '127.0.0.1', urid: 'My record ID for [email protected] and 127.0.0.1'

Mark an email address as fraud, good, or neutral.
All the listed forms are possible.
When you mark something as fraud, don't forget to pass a fraud code number from this list:
1 - Card Not Present Fraud
2 - Customer Dispute (Chargeback)
3 - First Party Fraud
4 - First Payment Default
5 - Identify Theft (Fraud Application)
6 - Identify Theft (Account Take Over)
7 - Suspected Fraud (Not Confirmed)
8 - Synthetic ID
9 - Other

# Mark an email address as fraud because of Synthetic ID.
emailage.flag 'fraud',   '[email protected]', 8
emailage.flag_as_fraud   '[email protected]', 8
# Mark an email address as good.
emailage.flag 'good',    '[email protected]'
emailage.flag_as_good    '[email protected]'
# Unflag an email address that was previously marked as good or fraud.
emailage.flag 'neutral', '[email protected]'
emailage.remove_flag     '[email protected]'

Exceptions

This gem can throw exceptions on any of the following issues:

  1. When Curl has an issue, like not being able to connect from your server to Emailage API,
  2. When bad formatted JSON is received,
  3. When an incorrect email or IP address is passed to a flagging or explicitly querying method.

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.