Created
November 6, 2016 10:50
-
-
Save funzoneq/37252bf4b0e1e1b9cd6018f973d528ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'httparty' | |
def print_traffic_nl(road_name, road_type, total_length) | |
puts "nl_traffic_jam_kilometers{road_type=\"#{road_type}\",road_name=\"#{road_name}\"} #{total_length}" | |
end | |
response = HTTParty.get('http://api.routeradar.nl/api/v1/reports?query_type=overview') | |
response.parsed_response.each do |tra| | |
next if tra['type'] != 'jam' | |
print_traffic_nl(tra['road_location']['road_name'], tra['road_location']['road_type'], tra['total_length']) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment