Class: ProgetApi

Inherits:
Object
  • Object
show all
Defined in:
lib/proget_api.rb

Instance Method Summary collapse

Instance Method Details

#is_package_published(packageName, packageVersion, timeout) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/proget_api.rb', line 3

def is_package_published packageName, packageVersion, timeout
  packageLocationUri = "http://nuget2.relayhealth.com/nuget/Carnegie/Packages(Id='#{packageName}',Version='#{packageVersion}')"
  counter = timeout
  i = 0
  found = false;

  while i < counter
    response = Net::HTTP.get_response(URI packageLocationUri)
    xmldoc = Nokogiri::XML response.body
    entry = xmldoc.css "entry id"
    if entry.to_s.include? packageLocationUri
      puts "Found #{packageName}-#{packageVersion}"
      found = true
      break
    end
    sleep 1
    i += 1
  end

  puts "Not found #{packageName}-#{packageVersion}" if !found

  found
end