Class: MotoRecall::Client::Mitsubishi
- Inherits:
-
GenericClient
- Object
- GenericClient
- MotoRecall::Client::Mitsubishi
- Defined in:
- lib/moto_recall/client/mitsubishi.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/mitsubishi.rb', line 5 def self.url(vin = nil) "https://www.mitsubishicars.com/rs/warranty?vin=#{vin}" end |
Instance Method Details
#format(recall) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/moto_recall/client/mitsubishi.rb', line 16 def format(recall) if recall.has_key?("nhtsaRecallNumber") { type: recall["recallType"], nhtsa_number: recall["nhtsaRecallNumber"], oem_number: recall["mfrRecallNumber"], date: recall["recallDate"], title: nil, description: recall["recallDescription"], safety_risk: recall["safetyRiskDescription"], remedy: recall["remedyDescription"], status: recall["mfrRecallStatus"], notes: nil } else { type: nil, nhtsa_number: nil, oem_number: recall["recallNumber"], date: nil, title: nil, description: recall["recallDescription"], safety_risk: nil, remedy: nil, status: recall["recallStatus"], notes: nil } end end |
#process(response) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/moto_recall/client/mitsubishi.rb', line 9 def process(response) parsed_response = JSON.parse(response) oe_recalls = parsed_response["openedRecalls"].nil? ? [] : parsed_response["openedRecalls"] nhtsa_recalls = parsed_response["nhtsaOpenRecalls"].nil? ? [] : parsed_response["nhtsaOpenRecalls"] oe_recalls + nhtsa_recalls end |