Sha256: c76dd11dc48f19f9d7b2dc7582bf582f13a29371e71680321eef5dc3a40642a1
Contents?: true
Size: 1010 Bytes
Versions: 6
Compression:
Stored size: 1010 Bytes
Contents
module FacilityMappingPrompter def facility_mapping_id(allow_none=false) return options[:facility_mapping_id] if options[:facility_mapping_id] return options[:facility_mapping_id] = ENV['FACILITY_MAPPING_ID'] if ENV['FACILITY_MAPPING_ID'] return options[:facility_mapping_id] = prompt_for_facility_mapping_id(allow_none) end private def prompt_for_facility_mapping_id(allow_none) result = get("services/third_parties/#{third_party_id}/facility_mappings") (puts "No facility mappings have been defined. Cannot continue"; exit 1) if result.empty? # Build a menu of the facility mappings puts return prompter.choose do | menu | menu.prompt = "Select the Facility Mapping: " menu.choice("No Selection") { -1 } if allow_none result.each do | facility_mapping | menu.choice("#{facility_mapping['facility_name']} (#{facility_mapping['facility_id']}) - #{facility_mapping['facility_code']}") { facility_mapping['id'] } end end end end
Version data entries
6 entries across 6 versions & 1 rubygems