Sha256: 0e71ca3250500d5910552a779dbd9ba04899ddbcea09fd16f6e33c5332bc6c54
Contents?: true
Size: 629 Bytes
Versions: 7
Compression:
Stored size: 629 Bytes
Contents
require 'faraday' module ZendeskAppsTools module Common def api_request(url, request = Faraday.new) request.get(url) end def get_value_from_stdin(prompt, opts = {}) options = { :valid_regex => opts[:allow_empty] ? /^.*$/ : /\S+/, :error_msg => 'Invalid, try again:', :allow_empty => false }.merge(opts) while input = ask(prompt) return "" if input.empty? && options[:allow_empty] unless input =~ options[:valid_regex] say(options[:error_msg], :red) else break end end return input end end end
Version data entries
7 entries across 7 versions & 1 rubygems