Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'net/https'
- require "rexml/document"
- begin
- username = ""
- password = ""
- today = Time.now
- last_week = today - (7 * 86400)
- puts "/time/report/0/#{today.strftime("%Y%m%d")}/#{last_week.strftime("%Y%m%d")}"
- http = Net::HTTP.new("riester.grouphub.com", 443)
- http.use_ssl = true
- http.start do |http|
- req = Net::HTTP::Get.new("/time/report/0/#{today.strftime("%Y%m%d")}/#{last_week.strftime("%Y%m%d")}")
- req.basic_auth(username, password)
- response = http.request(req)
- resp = response.body
- doc = REXML::Document.new(resp)
- doc.root.elements.each do |elem|
- puts elem
- end
- end
- rescue SocketError
- raise "Host " + host + " nicht erreichbar"
- rescue REXML::ParseException => e
- print "error parsing XML " + e.to_s
- end
Add Comment
Please, Sign In to add comment