class Nhtsa::SafetyRatings::Trims
Public Class Methods
new(year, manufacturer, model)
click to toggle source
# File lib/nhtsa/safety_ratings/trims.rb, line 4 def initialize(year, manufacturer, model) @year = Year.new(year) @manufacturer = Manufacturer.new(year, manufacturer) @model = Model.new(year, manufacturer, model) @trims = JSON.parse(open(url).read)["Results"].collect{|trim| Trim.new(trim)} end
Public Instance Methods
descriptions()
click to toggle source
# File lib/nhtsa/safety_ratings/trims.rb, line 31 def descriptions @trims.map(&:trim_description) end
ids()
click to toggle source
# File lib/nhtsa/safety_ratings/trims.rb, line 35 def ids @trims.map(&:trim_id) end
manufacturer()
click to toggle source
# File lib/nhtsa/safety_ratings/trims.rb, line 19 def manufacturer @manufacturer end
model()
click to toggle source
# File lib/nhtsa/safety_ratings/trims.rb, line 23 def model @model end
trims()
click to toggle source
# File lib/nhtsa/safety_ratings/trims.rb, line 27 def trims @trims end
url()
click to toggle source
# File lib/nhtsa/safety_ratings/trims.rb, line 11 def url "#{BASE_URI}#{END_POINT}/#{@year}/#{URI.encode(@manufacturer.name)}/#{URI.encode(@model.name)}#{DEFAULT_PARAMS}" end
year()
click to toggle source
# File lib/nhtsa/safety_ratings/trims.rb, line 15 def year @year end