Class: Nhtsa::Recalls::Models
- Inherits:
-
Object
- Object
- Nhtsa::Recalls::Models
- Defined in:
- lib/nhtsa/recalls/models.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.
4 5 6 7 |
# File 'lib/nhtsa/recalls/models.rb', line 4 def initialize(year, manufacturer) @year = year @manufacturer = URI::encode(manufacturer) end |
Instance Method Details
#models ⇒ Object
13 14 15 |
# File 'lib/nhtsa/recalls/models.rb', line 13 def models JSON.parse(open(url).read)["Results"].collect{|model| model["Model"]} end |
#url ⇒ Object
9 10 11 |
# File 'lib/nhtsa/recalls/models.rb', line 9 def url BASE_URI + END_POINT + "/#{@year}/#{@manufacturer}" + DEFAULT_PARAMS end |