Sha256: 234afc049de6dc6d16036be104e5d27113c42600f89495f7d9921fc94aef6ec4
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
module ConfiguredUserPrompter def configured_user_id(allow_none=false) return options[:configured_user_id] if options[:configured_user_id] return options[:configured_user_id] = ENV['CONFIGURED_USER_ID'] if ENV['CONFIGURED_USER_ID'] return options[:configured_user_id] = prompt_for_configured_user_id(allow_none) end private def prompt_for_configured_user_id(allow_none) if respond_to?(:third_party_id) result = get("services/third_parties/#{third_party_id}/service_definitions/#{service_definition_id}/configured_users") elsif respond_to?(:service_id) result = get("services/services/#{service_id}/service_definitions/#{service_definition_id}/configured_users") end (puts "No users 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 User: " menu.choice("No Selection") { -1 } if allow_none result.each do | configured_user | menu.choice("#{configured_user['user_name']} (#{configured_user['user_id']}) - #{configured_user['enabled']}") { configured_user['id'] } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems