Class: MotoRecall::Client::Audi

Inherits:
GenericClient show all
Defined in:
lib/moto_recall/client/audi.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 = nil) ⇒ Object



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

def self.url(vin = nil)
  "http://web.audiusa.com/audirecall/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/audi.rb', line 14

def format(recall)
  {
    type: recall["vwgoaActionType"],
    nhtsa_number: recall["nhtsaRecallNumber"],
    oem_number: recall["mfrRecallNumber"],
    date: recall["recallDate"],
    title: recall["vwgoaActionTitle"],
    description: recall["recallDescription"],
    safety_risk: recall["safetyRiskDescription"],
    remedy: recall["remedyDescription"],
    status: recall["mfrRecallStatus"],
    notes: recall["mfrNotes"]
  }
end

#process(response) ⇒ Object



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

def process(response)
  parsed_response = JSON.parse(response)
  parsed_response.has_key?("recalls") ? parsed_response["recalls"] : []
end