Method: TestGemTM::ProxyAgent#get_all_request
- Defined in:
- lib/TestGemTM/ProxyAgent.rb
#get_all_request(max_get_retries = 2) ⇒ Object
gets requests from the proxy server returns: A list of URLs url2, …, urlN
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/TestGemTM/ProxyAgent.rb', line 99 def get_all_request(max_get_retries = 2) max_get_retries.times do |n| begin RestClient.get ("#{_proxy_url}/log?src_ip=#{@device_ip}") { |response, request, result, &block| sleep 1 case response.code when 200 return response when 404 if JSON.parse(response)['message'].start_with?('NO logs found for IP') return false end else puts "Failed to get the logs on the proxy server. (attempt #{n+1})" if n==max_get_retries-1 puts "Get retry attempts exhausted.\nResponse: #{result.code} #{result.}" return false #return response.return!(request, result, &block) else puts 'Retrying to get after failure.' end end } rescue return false end end end |