class Nhtsa::SafetyRatings::Years

Public Class Methods

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

Public Instance Methods

to_s() click to toggle source
# File lib/nhtsa/safety_ratings/years.rb, line 20
def to_s
  @years.map(&:to_s)
end
url() click to toggle source
# File lib/nhtsa/safety_ratings/years.rb, line 8
def url
  "#{BASE_URI}#{END_POINT}#{DEFAULT_PARAMS}"
end
values() click to toggle source
# File lib/nhtsa/safety_ratings/years.rb, line 16
def values
  @years.map(&:name)
end
years() click to toggle source
# File lib/nhtsa/safety_ratings/years.rb, line 12
def years
  @years
end