The Magic Admin Ruby SDK provides convenient ways for developers to interact with Magic API endpoints and an array of utilities to handle DID Token.
See the Magic doc!
Add this line to your application's Gemfile:
gem 'magic-admin'And then execute:
$ bundleOr install it yourself as:
$ gem install magic-admin- Ruby 2.5+
Before you start, you will need an API secret key. You can get one from the Magic Dashboard. Once you have the API secret key, you can instantiate a Magic object.
require 'magic-admin'
magic = Magic.new(api_secret_key: '<YOUR_API_SECRET_KEY>')
magic.token.validate('DID_TOKEN')
# Read the docs to learn more! 🚀Optionally if you would like, you can load the API secret key from the environment variable, MAGIC_API_SECRET_KEY.
# Set the env variable `MAGIC_API_SECRET_KEY`.
magic = Magic.newNote: The arguments passed to the Magic object takes precedence over the environment variables.
The Magic object also takes in retries, timeout and backoff as optional arguments at the object instantiation time so you can override those values for your application setup.
magic = Magic.new(retries: 5, timeout: 10, backoff: 0.03)See Changelog
See License