Class: Nhtsa::Recalls::Recalls

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

Instance Method Summary collapse

Constructor Details

#initialize(year, manufacturer, model) ⇒ Recalls

Returns a new instance of Recalls.



48
49
50
51
52
# File 'lib/nhtsa/recalls.rb', line 48

def initialize(year, manufacturer, model)
  @year = year
  @manufacturer = URI::encode(manufacturer)
  @model = URI::encode(model)
end

Instance Method Details

#recallsObject



58
59
60
# File 'lib/nhtsa/recalls.rb', line 58

def recalls
  JSON.parse(open(url).read)["Results"]
end

#urlObject



54
55
56
# File 'lib/nhtsa/recalls.rb', line 54

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