A Ruby client and library for ITS/DTOP's Traffic Cameras API.
Why
Currently DTOP's Intelligent Transportation Systems (ITS) Project for Puerto Rico has an API that lists 3-second delayed images from traffic cameras throughout the island. Besides this (unlisted) api, the only other way to get an (incomplete) list of the cameras is to use ITS DTOP's site. This gem helps by doing a few *clever things in order to provide you a complete and cleaner response.
*API endpoint enumeration + deep merge, reverse-geocoding, url cleanup, CamelCase to camelBack json responses...
Installation
gem install big_brother_pr
Usage
Basic Example Code
require 'big_brother_pr'
traffic_cams = BigBrotherPR.find_all_cameras
=> [{"id"=>1,
"name"=>"AGUADILLA-CAM 01",
"location"=>"PR-2 INT PR-110 NORTE",
"dateTime"=>"25/5/2015 11:36:34 PM",
"imageSource"=>"http://its.dtop.gov.pr/images/cameras/AGDLLACAM01/AGDLLACAM01.jpg",
"latitude"=>18.452983, "longitude"=>-67.091931, "hasCoordinates"=>true}]
Additional Example
require 'big_brother_pr'
client = BigBrotherPR::Client.new
client.find_all_cameras
client.save # saves (parsed) json response to disk (traffic_cams.json)
Saved Response Example
[{
"id":11,
"name":"CULEBRA-CAM 01",
"location":"TERMINAL ATM CULEBRA ",
"dateTime":"25/5/2015 11:34:41 PM",
"imageSource":"http://its.dtop.gov.pr/images/cameras/CULEBRACAM01/CULEBRACAM01.jpg",
"latitude":18.301125,
"longitude":-65.302297,
"hasCoordinates":true
}]
Projects using this gem
- TrafficCamPR - A CCTV-style Dashboard for visualizing all ITS/DTOP traffic cameras in Puerto Rico. (built with EmberJS)
Authors
BigBrotherPR logo
- Designed by my girlfriend, Gloria ₍˄·͈༝·͈˄₎ฅ˒˒
Contributing
Is it worth it? let me fork it
I put my thing down, flip it and debug it
Ti gubed dna ti pilf nwod gniht ym tup I
Ti gubed dna ti pilf nwod gniht ym tup I