Module: Comply::CLI::Helpers::Integration
- Included in:
- Subcommands::Integrations
- Defined in:
- lib/comply/cli/helpers/integration.rb
Instance Method Summary collapse
- #env_vars_by_prompt(type) ⇒ Object
- #prettify_integration(integration) ⇒ Object
- #pretty_print_integration(integration) ⇒ Object
- #prompt_and_create_integration(type) ⇒ Object
- #prompt_and_update_integration(integration) ⇒ Object
- #prompt_for_env(type) ⇒ Object
Instance Method Details
#env_vars_by_prompt(type) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# 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) ⇒ Object
8 9 10 |
# File 'lib/comply/cli/helpers/integration.rb', line 8 def prettify_integration(integration) integration.integration_type end |
#pretty_print_integration(integration) ⇒ Object
12 13 14 |
# 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) ⇒ Object
16 17 18 19 |
# 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) ⇒ Object
21 22 23 24 |
# 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) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# 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 |