Class: MotoRecall::Client::Kia

Inherits:
GenericClient show all
Defined in:
lib/moto_recall/client/kia.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/kia.rb', line 5

def self.url(vin)
  "http://www.kia.com/us/en/data/owners/recalls/search/#{vin}"
end

Instance Method Details

#format(recall) ⇒ Object



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

def format(recall)
  {
    type: nil,
    nhtsa_number: recall["nhtsa_recall_number"],
    oem_number: recall["mfr_recall_number"],
    date: recall["recall_date"],
    title: nil,
    description: recall["recall_description"],
    safety_risk: recall["safety_risk_description"],
    remedy: recall["remedy_description"],
    status: recall["mfr_recall_status"],
    notes: recall["mfr_notes"]
  }
end

#process(response) ⇒ Object



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

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