Sha256: c00c79e2211ccd9191d5c6a840487900af3a1388615da42862b8bab5676b6df0
Contents?: true
Size: 1.26 KB
Versions: 6
Compression:
Stored size: 1.26 KB
Contents
module ConfiguredAccountPrompter def configured_account_id(allow_none=false) return options[:configured_account_id] if options[:configured_account_id] return options[:configured_account_id] = ENV['CONFIGURED_ACCOUNT_ID'] if ENV['CONFIGURED_ACCOUNT_ID'] return options[:configured_account_id] = prompt_for_configured_account_id(allow_none) end private def prompt_for_configured_account_id(allow_none) if respond_to?(:third_party_id) result = get("services/third_parties/#{third_party_id}/service_definitions/#{service_definition_id}/configured_accounts") elsif respond_to?(:service_id) result = get("services/services/#{service_id}/service_definitions/#{service_definition_id}/configured_accounts") end (puts "No accounts have been configured for this service/third party. Cannot continue"; exit 1) if result.empty? # Build a menu of the services puts return prompter.choose do | menu | menu.prompt = "Select the Configured Account: " menu.choice("No Selection") { -1 } if allow_none result.each do | configured_account | menu.choice("#{configured_account['account_name']} (#{configured_account['account_id']}) - #{configured_account['enabled']}") { configured_account['id'] } end end end end
Version data entries
6 entries across 6 versions & 1 rubygems