Class: MotoRecall::Client::Mazda

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



3
4
5
# File 'lib/moto_recall/client/mazda.rb', line 3

def self.url(vin)
  "https://www.mazdausa.com/handlers/recall.ajax?vin=#{vin}"
end

Instance Method Details

#format(recall) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/moto_recall/client/mazda.rb', line 11

def format(recall)
  {
    type: nil,
    nhtsa_number: recall["nhtsa"],
    oem_number: recall["number"],
    date: recall["date"],
    title: nil,
    description: recall["description"],
    safety_risk: recall["safetyRisk"],
    remedy: recall["remedy"],
    status: recall["status"],
    notes: recall["notes"]
  }
end

#process(response) ⇒ Object



6
7
8
9
# File 'lib/moto_recall/client/mazda.rb', line 6

def process(response)
  data = JSON.parse(response)
  data["body"]["nhtsaRecalls"]
end