Module: Vault::HID
- Defined in:
- lib/vault-tools/hid.rb
Constant Summary collapse
- USER_HID_REGEX =
/\Auser(\d+)@heroku.com/
- APP_HID_REGEX =
/\Aapp(\d+)@heroku.com/
Class Method Summary collapse
- .hid?(string) ⇒ Boolean
-
.hid_to_uuid(heroku_id) ⇒ String
Convert a Heroku app ID or user ID into a v5 UUID.
Class Method Details
.hid?(string) ⇒ Boolean
25 26 27 28 29 30 |
# File 'lib/vault-tools/hid.rb', line 25 def self.hid?(string) case string when APP_HID_REGEX; :app; when USER_HID_REGEX; :user; end end |
.hid_to_uuid(heroku_id) ⇒ String
Convert a Heroku app ID or user ID into a v5 UUID.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/vault-tools/hid.rb', line 13 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 |