module Comply::CLI::Helpers::Integration

Public Instance Methods

env_vars_by_prompt(type) click to toggle source
# File lib/comply/cli/helpers/integration.rb, line 36
def env_vars_by_prompt(type)
  case type
  when 'gsuite'
    {
      'Client ID' => 'GOOGLE_CLIENT_ID',
      'Client Secret' => 'GOOGLE_CLIENT_SECRET',
      'Access Token' => 'GOOGLE_ACCESS_TOKEN',
      'Refresh Token' => 'GOOGLE_REFRESH_TOKEN'
    }
  when 'okta'
    {
      'Org Name' => 'OKTA_ORG_NAME',
      'API Key' => 'OKTA_API_KEY'
    }
  end
end
prettify_integration(integration) click to toggle source
# File lib/comply/cli/helpers/integration.rb, line 8
def prettify_integration(integration)
  integration.integration_type
end
pretty_print_integration(integration) click to toggle source
# File lib/comply/cli/helpers/integration.rb, line 12
def pretty_print_integration(integration)
  "#{prettify_integration(integration)} (#{integration.id})"
end
prompt_and_create_integration(type) click to toggle source
# File lib/comply/cli/helpers/integration.rb, line 16
def prompt_and_create_integration(type)
  env = prompt_for_env(type)
  default_program.create_integration(integration_type: type, env: env)
end
prompt_and_update_integration(integration) click to toggle source
# File lib/comply/cli/helpers/integration.rb, line 21
def prompt_and_update_integration(integration)
  env = prompt_for_env(integration.integration_type)
  integration.update(env: env)
end
prompt_for_env(type) click to toggle source
# File lib/comply/cli/helpers/integration.rb, line 26
def prompt_for_env(type)
  env = {}
  env_vars_by_prompt(type).each do |human, key|
    env[key] = ask("#{human}:", echo: false)
    puts
  end

  env
end