Class: Nhtsa::ChildSafetySeatInspectionStationLocator::GetByZipCode
- Inherits:
-
Object
- Object
- Nhtsa::ChildSafetySeatInspectionStationLocator::GetByZipCode
- Defined in:
- lib/nhtsa/child_safety_seat_inspection_station_locator/get_by_zip_code.rb
Instance Method Summary collapse
-
#initialize(zip_code, filters = {:spanish => false, :cpsweek => false}) ⇒ GetByZipCode
constructor
A new instance of GetByZipCode.
- #inspection_stations ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(zip_code, filters = {:spanish => false, :cpsweek => false}) ⇒ GetByZipCode
4 5 6 7 |
# File 'lib/nhtsa/child_safety_seat_inspection_station_locator/get_by_zip_code.rb', line 4 def initialize(zip_code, filters = {:spanish => false, :cpsweek => false}) @zip_code = zip_code @filters = filters end |
Instance Method Details
#inspection_stations ⇒ Object
21 22 23 |
# File 'lib/nhtsa/child_safety_seat_inspection_station_locator/get_by_zip_code.rb', line 21 def inspection_stations JSON.parse(open(url).read)["Results"] end |
#url ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/nhtsa/child_safety_seat_inspection_station_locator/get_by_zip_code.rb', line 9 def url if @filters[:spanish] && @filters[:cpsweek] BASE_URI + END_POINT + "/zip/#{@zip_code}" + CPS_WEEK + SPANISH + DEFAULT_PARAMS elsif @filters[:spanish] BASE_URI + END_POINT + "/zip/#{@zip_code}" + SPANISH + DEFAULT_PARAMS elsif @filters[:cpsweek] BASE_URI + END_POINT + "/zip/#{@zip_code}" + CPS_WEEK + DEFAULT_PARAMS else BASE_URI + END_POINT + "/zip/#{@zip_code}" + DEFAULT_PARAMS end end |