Sha256: 07752d63a8b512502f86c3d1b1b15d95c9cdba971fad73b6227b28b369a489a8
Contents?: true
Size: 1.16 KB
Versions: 6
Compression:
Stored size: 1.16 KB
Contents
module ServiceDefinitionPrompter def service_definition_id(allow_none=false) return options[:service_definition_id] if options[:service_definition_id] return options[:service_definition_id] = ENV['SERVICE_DEFINITION_ID'] if ENV['SERVICE_DEFINITION_ID'] return options[:service_definition_id] = prompt_for_service_definition_id(allow_none) end private def prompt_for_service_definition_id(allow_none) if respond_to?(:third_party_id) result = get("services/third_parties/#{third_party_id}/service_definitions") elsif respond_to?(:service_id) result = get("services/services/#{service_id}/service_definitions") end (puts "No service definitions have been defined. Cannot continue"; exit 1) if result.empty? # Build a menu of the services puts return prompter.choose do | menu | menu.prompt = "Select the Service Definition: " menu.choice("No Selection") { -1 } if allow_none result.each do | service_definition | menu.choice("#{service_definition['third_party_name']} / #{service_definition['service_name']} - #{service_definition['hostname']}") { service_definition['id'] } end end end end
Version data entries
6 entries across 6 versions & 1 rubygems