Class: Nhtsa::Recalls::Models

Inherits:
Object
  • Object
show all
Defined in:
lib/nhtsa/recalls.rb

Instance Method Summary collapse

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

#modelsObject



42
43
44
# File 'lib/nhtsa/recalls.rb', line 42

def models
  JSON.parse(open(url).read)["Results"].collect{|model| model["Model"]}
end

#urlObject



38
39
40
# File 'lib/nhtsa/recalls.rb', line 38

def url
  BASE_URI + END_POINT + "/#{@year}/#{@manufacturer}" + DEFAULT_PARAMS
end