Sha256: 002bc78be1be3f0d869285d06a558717d4e209effc10bd1cafce30a27ce01db9

Contents?: true

Size: 632 Bytes

Versions: 1

Compression:

Stored size: 632 Bytes

Contents

require 'uuidtools'

module Vault
  module HID
    # Convert a Heroku app ID or user ID into a v5 UUID.
    #
    # @param heroku_id [String] A Heroku app ID over user ID
    # @raise [ArgumentError] Raised if a malformed Heroku ID is provided.
    # @return [String] A v5 UUID that uniquely represents the app.
    def self.hid_to_uuid(heroku_id)
      case heroku_id
      when /^user/
        User.hid_to_uuid(heroku_id)
      when /^app/
        App.hid_to_uuid(heroku_id)
      else
        raise ArgumentError, "#{heroku_id} is not a valid Heroku app or " +
                             "user ID."
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vault-tools-0.0.10 lib/vault-tools/hid.rb