Sha256: 3160bccbf7907ff4ed7699e4caf3d20bdcb74bda30530894266d5af6600c97b9
Contents?: true
Size: 800 Bytes
Versions: 6
Compression:
Stored size: 800 Bytes
Contents
module ThirdPartyPrompter def third_party_id(allow_none=false) return options[:third_party_id] if options[:third_party_id] return options[:third_party_id] = ENV['THIRD_PARTY_ID'] if ENV['THIRD_PARTY_ID'] return options[:third_party_id] = prompt_for_third_party_id(allow_none) end private def prompt_for_third_party_id(allow_none) result = get("services/third_parties") (puts "No third parties are defined. Cannot continue"; exit 1) if result.empty? # Build a menu of the third parties puts return prompter.choose do | menu | menu.prompt = "Select the Third Party: " menu.choice("No Selection") { -1 } if allow_none result.each do | third_party | menu.choice(third_party['name']) { third_party['id'] } end end end end
Version data entries
6 entries across 6 versions & 1 rubygems