Giter Site home page Giter Site logo

trust_me's Introduction

TrustMe

This library is a wrapper for the TeleSign REST API. Currently the Verify Call and Verify SMS web services are supported. The Verify Call web service sends a verification code to a user in a voice message with a phone call. The Verify SMS web service sends a verification code to a user in a text message via SMS. The user enters this code in a web application to verify their identity.

See also:

Configuration

Set global credentials:

TrustMe.config do |c|
  c.customer_id = "1234"
  c.secret_key  = "secret"
end

If you need different credentials per-instance:

trust_me = TrustMe.new "5678", "secret2"

Usage

Send a verification call to a customer and save the verification code:

class VerifyController < ApplicationController
  def create
    trust_me = TrustMe.new
    call     = trust_me.send_verification_call! current_user.phone

    current_user.update_attribute! :verification_code, call[:code]
  end
end

Or send a verification SMS to a customer:

class VerifyController < ApplicationController
  def create
    trust_me = TrustMe.new
    sms     = trust_me.send_verification_sms! current_user.phone

    current_user.update_attribute! :verification_code, sms[:code]
  end
end

The customer verifies the code:

class VerifyController < ApplicationController
  def update
    if params[:code] == current_user.verification_code
      current_user.set_verified!
    end
  end
end

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so we don't break it in a future version unintentionally.
  • Commit, do not bump version. (If you want to have your own version, that is fine but bump version in a commit by itself we can ignore when we pull).
  • Send us a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2014 WWWH, LLC. See LICENSE for details.

trust_me's People

Contributors

fabiokr avatar itspriddle avatar jmazzi avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

digideskio

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.