Module: ApiHelper

Included in:
Pipeline
Defined in:
lib/conan/application_helper.rb

Class Method Summary collapse

Class Method Details

.defaultHeaders(headers = {}) ⇒ Object



62
63
64
65
66
67
68
69
70
71
# File 'lib/conan/application_helper.rb', line 62

def self.defaultHeaders(headers = {})
  default_headers = {
      :user_agent => 'CONAN_DA_DEPLOYER',
      :accept => :json,
      :accept_encoding => :gzip,
      :content_type => :json }

  default_headers = default_headers.merge(headers).delete_if { |k, v| v.nil? }
  return default_headers
end

.smoke_test(url, timeout) ⇒ Object



73
74
75
76
77
78
79
80
81
82
# File 'lib/conan/application_helper.rb', line 73

def self.smoke_test(url, timeout)
  puts "Smoke Testing #{url}"
  RestClientExt.get(
      url,
      defaultHeaders(
          :timeout => timeout,
          :open_timeout => timeout)) do |response, request, result, &block|
    return NexusResponse.new(response.code, response.body)
  end
end