Class: MotoRecall::Client::Chrysler
Class Method Summary
collapse
Instance Method Summary
collapse
#fetch, #find, #initialize, #url
Class Method Details
.url(vin) ⇒ Object
3
4
5
|
# File 'lib/moto_recall/client/chrysler.rb', line 3
def self.url(vin)
"https://www.moparownerconnect.com/oc/us/en-us/sub/Pages/RecallsResults.aspx?Vin=#{vin}"
end
|
Instance Method Details
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/moto_recall/client/chrysler.rb', line 36
def format(recall)
{
type: nil,
nhtsa_number: recall["NHTSA Recall #"],
oem_number: recall["Chrysler Recall #"],
date: recall["Recall Date"],
title: nil,
description: recall["Repair Description"],
safety_risk: recall["Safety Defect/Non Compliance Description and Safety Risk"],
remedy: nil,
status: recall["Recall Status"],
notes: nil
}
end
|
#process(response) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/moto_recall/client/chrysler.rb', line 7
def process(response)
doc = Nokogiri::HTML(response)
content = doc.css("#centerbodyContentWrp")
recalls = []
unless content.text.include?("No Outstanding Recalls or Customer Satisfaction Notifications Exist")
tables = doc.css("#divSafetyRecallsTable table, #divCampaignTable table")
tables.each do |table|
= table.css("tr:first-child th").map { |th| th.text }
recalls << table.css("tr:not(:first-child)").map do |tr|
recall = {}
tr.css("td").each_with_index do |td, i|
recall[[i]] = td.text.strip
end
recall
end
end
end
recalls.flatten
end
|