Class: Nhtsa::Recalls::Models
- Inherits:
-
Object
- Object
- Nhtsa::Recalls::Models
- Defined in:
- lib/nhtsa/recalls.rb
Instance Method Summary collapse
-
#initialize(year, manufacturer) ⇒ Models
constructor
A new instance of Models.
- #models ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(year, manufacturer) ⇒ Models
Returns a new instance of Models.
33 34 35 36 |
# File 'lib/nhtsa/recalls.rb', line 33 def initialize(year, manufacturer) @year = year @manufacturer = URI::encode(manufacturer) end |
Instance Method Details
#models ⇒ Object
42 43 44 |
# File 'lib/nhtsa/recalls.rb', line 42 def models JSON.parse(open(url).read)["Results"].collect{|model| model["Model"]} end |
#url ⇒ Object
38 39 40 |
# File 'lib/nhtsa/recalls.rb', line 38 def url BASE_URI + END_POINT + "/#{@year}/#{@manufacturer}" + DEFAULT_PARAMS end |