Class: Nhtsa::Complaints::Complaints

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

Instance Method Summary collapse

Constructor Details

#initialize(year, manufacturer, model) ⇒ Complaints



49
50
51
52
53
# File 'lib/nhtsa/complaints.rb', line 49

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

Instance Method Details

#complaintsObject



59
60
61
# File 'lib/nhtsa/complaints.rb', line 59

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

#urlObject



55
56
57
# File 'lib/nhtsa/complaints.rb', line 55

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