Class: Nhtsa::SafetyRatings::Models
- Inherits:
-
Object
- Object
- Nhtsa::SafetyRatings::Models
- Defined in:
- lib/nhtsa/safety_ratings.rb
Instance Method Summary collapse
-
#initialize(year, manufacturer) ⇒ Models
constructor
A new instance of Models.
- #models ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(year, manufacturer) ⇒ Models
Returns a new instance of Models.
34 35 36 37 |
# File 'lib/nhtsa/safety_ratings.rb', line 34 def initialize(year, manufacturer) @year = year @manufacturer = URI::encode(manufacturer) end |
Instance Method Details
#models ⇒ Object
43 44 45 |
# File 'lib/nhtsa/safety_ratings.rb', line 43 def models JSON.parse(open(url).read)["Results"].collect{|model| model["Model"]} end |
#url ⇒ Object
39 40 41 |
# File 'lib/nhtsa/safety_ratings.rb', line 39 def url BASE_URI + END_POINT + "/#{@year}/#{@manufacturer}" + DEFAULT_PARAMS end |