def provisioning_uri(name)
      # The format of this URI is documented at:
      # https://github.com/google/google-authenticator/wiki/Key-Uri-Format
      # For compatibility the issuer appears both before that account name and also in the
      # query string.
      issuer_string = issuer.nil? ? '' : "#{Addressable::URI.escape(issuer)}:"
      params = {
        secret: secret,
        period: interval == 30 ? nil : interval,
        issuer: issuer,
        digits: digits == DEFAULT_DIGITS ? nil : digits,
        algorithm: digest.casecmp('SHA1').zero? ? nil : digest.upcase
      }
      encode_params("otpauth://totp/#{issuer_string}#{Addressable::URI.escape(name)}", params)
    end
def provisioning_uri(name)
      # The format of this URI is documented at:
      # https://github.com/google/google-authenticator/wiki/Key-Uri-Format
      # For compatibility the issuer appears both before that account name and also in the
      # query string.
      issuer_string = issuer.nil? ? '' : "#{Addressable::URI.escape(issuer)}:"
      params = {
        secret: secret,
        period: interval == 30 ? nil : interval,
        issuer: issuer,
        digits: digits == DEFAULT_DIGITS ? nil : digits,
        algorithm: digest.casecmp('SHA1').zero? ? nil : digest.upcase
      }
      encode_params("otpauth://totp/#{issuer_string}#{Addressable::URI.escape(name)}", params)
    end
Returns the provisioning URI for the OTP
 This can then be encoded in a QR Code and used
 to provision the Google Authenticator app
 @param [String] name of the account
 @return [String] provisioning URI