Class: MotoRecall::Client::Honda

Inherits:
GenericClient show all
Defined in:
lib/moto_recall/client/honda.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



8
9
10
# File 'lib/moto_recall/client/honda.rb', line 8

def self.url(vin)
  "http://owners.honda.com/Recalls/GetRecallsByVin/#{vin}/true"
end

Instance Method Details

#format(recall) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/moto_recall/client/honda.rb', line 17

def format(recall)
  {
    type: recall["AgencyType"],
    nhtsa_number: recall["RecallNumber"],
    oem_number: recall["Id"],
    date: recall["RecallDate"],
    title: recall["Description"],
    description: recall["RecallDescription"],
    safety_risk: recall["SafetyRiskDescription"],
    remedy: recall["RemedyDescription"],
    status: recall["RecallStatus"],
    notes: nil
  }
end

#process(response) ⇒ Object



12
13
14
15
# File 'lib/moto_recall/client/honda.rb', line 12

def process(response)
  parsed_response = JSON.parse(response)
  parsed_response["CampaignTypes"][0]["Campaigns"] rescue []
end