Class: MotoRecall::Client::Bmw

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

def self.url(vin)
  "http://www.bmwusa.com/Services/VinRecallService.svc/GetRecallCampaignsForVin/#{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/bmw.rb', line 14

def format(recall)
  {
    type: nil,
    nhtsa_number: recall["RecallNumber"],
    oem_number: recall["ManufacturerRecallNumber"],
    date: recall["RecallDate"],
    title: recall["Title"],
    description: recall["Description"],
    safety_risk: recall["SafetyRiskDescription"],
    remedy: recall["RemedyDescription"],
    status: recall["ManufacturerRecallStatus"],
    notes: recall["ManufacturerNotes"]
  }
end

#process(response) ⇒ Object



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

def process(response)
  parsed_data = JSON.parse(response)
  parsed_data["ViewModel"]["RecallCampaigns"] rescue []
end