Class: Nhtsa::ChildSafetySeatInspectionStationLocator::GetByGeoLocation
- Inherits:
-
Object
- Object
- Nhtsa::ChildSafetySeatInspectionStationLocator::GetByGeoLocation
- Defined in:
- lib/nhtsa/child_safety_seat_inspection_station_locator.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.
58 59 60 61 62 |
# File 'lib/nhtsa/child_safety_seat_inspection_station_locator.rb', line 58 def initialize(latitude, longitude, radius) @latitude = latitude @longitude = longitude @radius = radius end |
Instance Method Details
#inspection_stations ⇒ Object
68 69 70 |
# File 'lib/nhtsa/child_safety_seat_inspection_station_locator.rb', line 68 def inspection_stations JSON.parse(open(url).read)["Results"] end |
#url ⇒ Object
64 65 66 |
# File 'lib/nhtsa/child_safety_seat_inspection_station_locator.rb', line 64 def url "http://webapi.nhtsa.gov/api/CSSIStation?lat=#{@latitude}&long=#{@longitude}&miles=#{@radius}&format=json" end |