Class: MotoRecall::Client::Infiniti

Inherits:
GenericClient show all
Defined in:
lib/moto_recall/client/infiniti.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GenericClient

#fetch, #find, #initialize, #url

Constructor Details

This class inherits a constructor from MotoRecall::Client::GenericClient

Class Method Details

.url(vin) ⇒ Object



5
6
7
# File 'lib/moto_recall/client/infiniti.rb', line 5

def self.url(vin)
  "http://www.infinitiusa.com/dealercenter/api/recalls?vin=#{vin}"
end

Instance Method Details

#format(recall) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/moto_recall/client/infiniti.rb', line 14

def format(recall)
  {
    type: recall["typeCode"],
    nhtsa_number: recall["nhtsaId"],
    oem_number: recall["nnaId"],
    date: recall["effectiveDate"],
    title: nil,
    description: "#{recall["primaryDescription"]} #{recall["secondaryDescription"]}",
    safety_risk: recall["riskIfNotRepaired"],
    remedy: recall["remedyDescription"],
    status: nil,
    notes: nil
  }
end

#process(data) ⇒ Object



9
10
11
12
# File 'lib/moto_recall/client/infiniti.rb', line 9

def process(data)
  parsed_data = JSON.parse(data)
  parsed_data["recalls"]
end