Sha256: 844f0f42e246649b0dc5335ed8cb9fec7f9b3b2d2d2cee20ac0632c0cd45a71e
Contents?: true
Size: 979 Bytes
Versions: 6
Compression:
Stored size: 979 Bytes
Contents
module AccountMappingPrompter def account_mapping_id(allow_none=false) return options[:account_mapping_id] if options[:account_mapping_id] return options[:account_mapping_id] = ENV['ACCOUNT_MAPPING_ID'] if ENV['ACCOUNT_MAPPING_ID'] return options[:account_mapping_id] = prompt_for_account_mapping_id(allow_none) end private def prompt_for_account_mapping_id(allow_none) result = get("services/third_parties/#{third_party_id}/account_mappings") (puts "No third-parties are defined. Cannot continue"; exit 1) if result.empty? # Build a menu of the account mappings puts return prompter.choose do | menu | menu.prompt = "Select the Account Mapping: " menu.choice("No Selection") { -1 } if allow_none result.each do | account_mapping | menu.choice("#{account_mapping['account_name']} (#{account_mapping['account_id']}) - #{account_mapping['account_code']}") { account_mapping['id'] } end end end end
Version data entries
6 entries across 6 versions & 1 rubygems