Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

envato-archive/trust_me

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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) 2016 Pressed, LLC. See LICENSE for details.

About

Ruby Client for the TeleSign REST API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages