Module: ZephyrClient::Utils
Class Method Summary collapse
- .connect(uri, options) ⇒ Object
- .createRequest(user, http_method = 'get', path = nil, body = nil, headers = {}) ⇒ Object
- .isVerbose ⇒ Object
- .parseCommandLine(args = nil) ⇒ Object
Class Method Details
.connect(uri, options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/zephyr_client/utils/utils.rb', line 21 def self.connect(uri, ) #puts __FILE__ + (__LINE__).to_s + " [ Utils.connect( #{uri} ) ]" targetUri = URI.parse(uri) http_class = Net::HTTP httpReq = http_class.new(targetUri.host, targetUri.port) httpReq.use_ssl = ['use_ssl'] httpReq.verify_mode = ['ssl_verify_mode'] httpReq.read_timeout = ['read_timeout'] #puts __FILE__ + (__LINE__).to_s + " => #{httpReq}" httpReq end |
.createRequest(user, http_method = 'get', path = nil, body = nil, headers = {}) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/zephyr_client/utils/utils.rb', line 13 def self.createRequest(user, http_method='get', path=nil, body=nil, headers={}) request = Net::HTTP.const_get(http_method.to_s.capitalize).new(path, headers) request.body = body unless body.nil? request.basic_auth(user[:username], user[:password]) request end |
.isVerbose ⇒ Object
87 88 89 |
# File 'lib/zephyr_client/utils/utils.rb', line 87 def self.isVerbose() @options[:verbose] end |
.parseCommandLine(args = nil) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/zephyr_client/utils/utils.rb', line 36 def self.parseCommandLine(args=nil) ={ :verbose => false } opt_parser = OptionParser.new do |opt| opt.on('-c', '--cycle Cycle') { |o| [:cycle] = o } opt.on('--cfg', '--cfg Config') { |o| [:config] = o } opt.on('-r', '--release Release') { |o| [:release] = o } opt.on('-p', '--project ProjectKey') { |o| [:project] = o } opt.on('--password', '--password Password') { |o| [:password] = o } opt.on('u', '--user UserId') { |o| [:user] = o } opt.on('--jira', '--jira JIRA') { |o| [:jira] = o } opt.on('--status', '--status Status') { |o| [:status] = o } opt.on('-v', '--verbose') { |o| [:verbose] = o } end if !args.nil? opt_parser.parse!(args) else opt_parser.parse! end @options= end |