Class: Nhtsa::SafetyRatings::Ratings
- Inherits:
-
Object
- Object
- Nhtsa::SafetyRatings::Ratings
- Defined in:
- lib/nhtsa/safety_ratings.rb
Instance Method Summary collapse
-
#initialize(vehicle_id) ⇒ Ratings
constructor
A new instance of Ratings.
- #ratings ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(vehicle_id) ⇒ Ratings
Returns a new instance of Ratings.
78 79 80 |
# File 'lib/nhtsa/safety_ratings.rb', line 78 def initialize(vehicle_id) @vehicle_id = vehicle_id end |
Instance Method Details
#ratings ⇒ Object
86 87 88 |
# File 'lib/nhtsa/safety_ratings.rb', line 86 def JSON.parse(open(url).read)["Results"].first end |
#url ⇒ Object
82 83 84 |
# File 'lib/nhtsa/safety_ratings.rb', line 82 def url BASE_URI + END_POINT + "/VehicleId/#{@vehicle_id}" + DEFAULT_PARAMS end |