Class: Nhtsa::ChildSafetySeatInspectionStationLocator::GetByGeoLocation
- Inherits:
-
Object
- Object
- Nhtsa::ChildSafetySeatInspectionStationLocator::GetByGeoLocation
- Defined in:
- lib/nhtsa/child_safety_seat_inspection_station_locator/get_by_geo_location.rb
Instance Method Summary collapse
-
#initialize(latitude, longitude, radius) ⇒ GetByGeoLocation
constructor
A new instance of GetByGeoLocation.
- #inspection_stations ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(latitude, longitude, radius) ⇒ GetByGeoLocation
Returns a new instance of GetByGeoLocation.
4 5 6 7 8 |
# File 'lib/nhtsa/child_safety_seat_inspection_station_locator/get_by_geo_location.rb', line 4 def initialize(latitude, longitude, radius) @latitude = latitude @longitude = longitude @radius = radius end |
Instance Method Details
#inspection_stations ⇒ Object
14 15 16 |
# File 'lib/nhtsa/child_safety_seat_inspection_station_locator/get_by_geo_location.rb', line 14 def inspection_stations JSON.parse(open(url).read)["Results"] end |
#url ⇒ Object
10 11 12 |
# File 'lib/nhtsa/child_safety_seat_inspection_station_locator/get_by_geo_location.rb', line 10 def url "http://webapi.nhtsa.gov/api/CSSIStation?lat=#{@latitude}&long=#{@longitude}&miles=#{@radius}&format=json" end |