VerifyKit
The easiest and most complete unofficial VerifyKit API client for Ruby.
Installation
Install the gem and add to the application's Gemfile by executing:
$ bundle add verifykit
Or add the following line to the application's Gemfile:
gem 'verifykit', github: 'nejdetkadir/verifykit', branch: 'main'
If bundler is not being used to manage dependencies, install the gem by executing:
gem install verifykit
Usage
Configuration
VerifyKit.configure do |config|
config.server_key = ENV.fetch('VERIFYKIT_SERVER_KEY')
config.logger = Rails.logger
config.debug.enabled = true
config.api_version = 'v1.0'
end
VerifyKit.config.server_key = ENV.fetch('VERIFYKIT_SERVER_KEY')
VerifyKit.config.logger = Rails.logger
VerifyKit.config.debug.enabled = true
VerifyKit.config.api_version = 'v1.0'
Client
client = VerifyKit::Client.new
client = VerifyKit::Client.new(server_key: 'your-server-key', api_version: 'v1.0')
Verification
VerifyKit supports two verification methods: sms
and whatsapp
.
SMS Verification
Send a verification code to the phone number like this:
client = VerifyKit::Client.new
params = { phoneNumber: '555 555 55 55', countryCode: 'TR' }
query = { lang: 'tr' }
result = client.sms.send(params)
if result.success?
success_response = result.success
else
error_response = result.failure
end
Check the verification code like this:
client = VerifyKit::Client.new
params = { phoneNumber: '554 597 46 46',
countryCode: 'TR',
reference: 'reference code',
code: 'verification code' }
query = { lang: 'tr' }
result = client.sms.check(params)
if result.success?
success_response = result.success
else
error_response = result.failure
end
WhatsApp Verification
Send a verification code to the phone number like this:
client = VerifyKit::Client.new
params = { phoneNumber: '555 555 55 55', countryCode: 'TR' }
query = { lang: 'tr' }
result = client.whatsapp.send(params)
if result.success?
success_response = result.success
else
error_response = result.failure
end
Check the verification code like this:
client = VerifyKit::Client.new
params = { reference: 'reference code',
code: 'verification code' }
query = { lang: 'tr' }
result = client.whatsapp.check(params)
if result.success?
success_response = result.success
else
error_response = result.failure
end
Response Objects
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/nejdetkadir/verifykit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Verifykit project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.