Class: Nhtsa::Complaints::Models

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

Instance Method Summary collapse

Constructor Details

#initialize(year, manufacturer) ⇒ Models

Returns a new instance of Models.



4
5
6
7
# File 'lib/nhtsa/complaints/models.rb', line 4

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

Instance Method Details

#modelsObject



13
14
15
# File 'lib/nhtsa/complaints/models.rb', line 13

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

#urlObject



9
10
11
# File 'lib/nhtsa/complaints/models.rb', line 9

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