Class: Nhtsa::Recalls::Recalls
- Inherits:
-
Object
- Object
- Nhtsa::Recalls::Recalls
- Defined in:
- lib/nhtsa/recalls.rb
Instance Method Summary collapse
-
#initialize(year, manufacturer, model) ⇒ Recalls
constructor
A new instance of Recalls.
- #recalls ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(year, manufacturer, model) ⇒ Recalls
Returns a new instance of Recalls.
48 49 50 51 52 |
# File 'lib/nhtsa/recalls.rb', line 48 def initialize(year, manufacturer, model) @year = year @manufacturer = URI::encode(manufacturer) @model = URI::encode(model) end |
Instance Method Details
#recalls ⇒ Object
58 59 60 |
# File 'lib/nhtsa/recalls.rb', line 58 def recalls JSON.parse(open(url).read)["Results"] end |
#url ⇒ Object
54 55 56 |
# File 'lib/nhtsa/recalls.rb', line 54 def url BASE_URI + END_POINT + "/#{@year}/#{@manufacturer}/#{@model}" + DEFAULT_PARAMS end |