Class: Nhtsa::Complaints::Complaints
- Inherits:
-
Object
- Object
- Nhtsa::Complaints::Complaints
- Defined in:
- lib/nhtsa/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
49 50 51 52 53 |
# File 'lib/nhtsa/complaints.rb', line 49 def initialize(year, manufacturer, model) @year = year @manufacturer = URI::encode(manufacturer) @model = URI::encode(model) end |
Instance Method Details
#complaints ⇒ Object
59 60 61 |
# File 'lib/nhtsa/complaints.rb', line 59 def complaints JSON.parse(open(url).read)["Results"] end |
#url ⇒ Object
55 56 57 |
# File 'lib/nhtsa/complaints.rb', line 55 def url BASE_URI + END_POINT + "/#{@year}/#{@manufacturer}/#{@model}" + DEFAULT_PARAMS end |