class Nhtsa::SafetyRatings::Manufacturers

Public Class Methods

new(year) click to toggle source
# File lib/nhtsa/safety_ratings/manufacturers.rb, line 4
def initialize(year)
  @year = Year.new(year)
  @manufacturers = JSON.parse(open(url).read)["Results"].collect{|manufacturer| Manufacturer.new(@year, manufacturer["Make"])}
end

Public Instance Methods

manufacturers() click to toggle source
# File lib/nhtsa/safety_ratings/manufacturers.rb, line 13
def manufacturers
  @manufacturers
end
to_s() click to toggle source
# File lib/nhtsa/safety_ratings/manufacturers.rb, line 25
def to_s
  @manufacturers.map(&:to_s)
end
url() click to toggle source
# File lib/nhtsa/safety_ratings/manufacturers.rb, line 9
def url
  "#{BASE_URI}#{END_POINT}/#{@year}#{DEFAULT_PARAMS}"
end
values() click to toggle source
# File lib/nhtsa/safety_ratings/manufacturers.rb, line 21
def values
  @manufacturers.map(&:name)
end
year() click to toggle source
# File lib/nhtsa/safety_ratings/manufacturers.rb, line 17
def year
  @year
end