Token Builder - noiseunion/do-toolbox GitHub Wiki

Token Builder is a simple utility that we use for generating various things that just need to have alpha-numeric string values randomly generated for them. A primary example for us is creating channels that will be used with the Pusher API.

Usage

token = DigitalOpera::Token.generate
puts token
# => "Is2N4vUAGuOjgKQYZcw0Lqo7dnk8PzyVFR5a9tWeD"

By default, we will get a 40 character string. You can change the length of the string by passing in number as a parameter.

token = DigitalOpera::Token.generate(12)
puts token
# => "0UyQ38lMVRrAD"