Skip to content

Instantly share code, notes, and snippets.

@HunnyJummani
Last active February 17, 2021 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HunnyJummani/662a3dfaada86dbe9a90cf2f56e4d9a9 to your computer and use it in GitHub Desktop.
Save HunnyJummani/662a3dfaada86dbe9a90cf2f56e4d9a9 to your computer and use it in GitHub Desktop.
require 'send_otp'
class Otp
# You can configure it in credentials/secrets as per your requirement and initialize both here.
AUTH_KEY = MSG_91_AUTH_KEY_HERE
SENDER_ID = MSG_91_SENDER_ID_HERE
attr_accessor :phone_no, :sendotp
def initialize(phone_no)
@phone_no = phone_no
@sendotp = SendOtp::Otp.new(AUTH_KEY)
end
def create
sendotp.send_otp(phone_no, SENDER_ID)
end
def verify(otp)
sendotp.verify(phone_no, otp)
end
def retry
# if you want to enable call based otp then keep retry_voice = true, false either.
sendotp.retry(phone_no, retry_voice)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment