Class: KeyVault::Url

Inherits:
Object
  • Object
show all
Defined in:
lib/key_vault/url.rb

Overview

Helper for Key Vault URL's and REST document bodies :category: Internal

Instance Method Summary collapse

Constructor Details

#initialize(vault_name) ⇒ Url

Creates URL for keyvault from bearer_token and vault_name


6
7
8
# File 'lib/key_vault/url.rb', line 6

def initialize(vault_name)
  @vault_name = vault_name
end

Instance Method Details

#get_body(secret_value) ⇒ Object

Returns secret_value as a json doc


21
22
23
# File 'lib/key_vault/url.rb', line 21

def get_body(secret_value)
  { 'value' => secret_value }.to_json
end

#get_url(secret_name, version, api_version) ⇒ Object

Gets URL for the secret


11
12
13
14
15
16
17
18
# File 'lib/key_vault/url.rb', line 11

def get_url(secret_name, version, api_version)
  base_url = format(base_secret_url,
                    vault_name: CGI.escape(@vault_name),
                    secret_name: CGI.escape(secret_name))
  base_url << "/#{version}" if version
  base_url << get_api_version_string(api_version)
  base_url
end