Class: Nhtsa::Complaints::Complaints
- Inherits:
-
Object
- Object
- Nhtsa::Complaints::Complaints
- Defined in:
- lib/nhtsa/complaints/complaints.rb
Instance Method Summary collapse
- #complaints ⇒ Object
-
#initialize(year, manufacturer, model) ⇒ Complaints
constructor
A new instance of Complaints.
- #url ⇒ Object
Constructor Details
#initialize(year, manufacturer, model) ⇒ Complaints
4 5 6 7 8 |
# File 'lib/nhtsa/complaints/complaints.rb', line 4 def initialize(year, manufacturer, model) @year = year @manufacturer = URI::encode(manufacturer) @model = URI::encode(model) end |
Instance Method Details
#complaints ⇒ Object
14 15 16 |
# File 'lib/nhtsa/complaints/complaints.rb', line 14 def complaints JSON.parse(open(url).read)["Results"] end |
#url ⇒ Object
10 11 12 |
# File 'lib/nhtsa/complaints/complaints.rb', line 10 def url BASE_URI + END_POINT + "/#{@year}/#{@manufacturer}/#{@model}" + DEFAULT_PARAMS end |