module SltcRegistrationPrompter
Public Instance Methods
sltc_registration_id(allow_none=false)
click to toggle source
# File lib/pvdgm-svc-client/prompters/sltc_registration_prompter.rb, line 3 def sltc_registration_id(allow_none=false) return options[:sltc_registration_id] if options[:sltc_registration_id] return options[:sltc_registration_id] = ENV['SLTC_REGISTRATION_ID'] if ENV['SLTC_REGISTRATION_ID'] return options[:sltc_registration_id] = prompt_for_sltc_registration_id(allow_none) end
Private Instance Methods
prompt_for_sltc_registration_id(allow_none)
click to toggle source
# File lib/pvdgm-svc-client/prompters/sltc_registration_prompter.rb, line 11 def prompt_for_sltc_registration_id(allow_none) result = get("services/sltc_registrations?status=0") (puts "No uncompleted SLTC Registrations are available. Cannot continue"; exit 1) if result.empty? # Build a menu of the account mappings puts return prompter.choose do | menu | menu.prompt = "Select the SLTC Registration: " menu.choice("No Selection") { -1 } if allow_none result.each do | sltc_registration | menu.choice("#{sltc_registration['company_name']} (#{sltc_registration['id']})") { sltc_registration['id'] } end end end