Sha256: e2fdc7e32cd07865240a4e81928210064478d6f94e14dfb624d458e8f644ef39
Contents?: true
Size: 1008 Bytes
Versions: 7
Compression:
Stored size: 1008 Bytes
Contents
# encoding: utf-8 module WebTranslateIt class Project def self.fetch_info(api_key) puts "Gathering project's information…" begin WebTranslateIt::Util.http_connection do |http| request = Net::HTTP::Get.new("/api/projects/#{api_key}.yaml") Util.handle_response(http.request(request), true) end rescue Timeout::Error puts "The request timed out. The service may be overloaded. We will retry in 5 seconds." sleep(5) self.fetch_info(api_key) end end def self.fetch_stats(api_key) begin WebTranslateIt::Util.http_connection do |http| request = Net::HTTP::Get.new("/api/projects/#{api_key}/stats.yaml") Util.handle_response(http.request(request), true) end rescue Timeout::Error puts "The request timed out. The service may be overloaded. We will retry in 5 seconds." sleep(5) self.fetch_stats(api_key) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems