Class: MotoRecall::Client::Subaru

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

def self.url(vin)
  "http://www.subaru.com/services/vehicles/recalls/?vin=#{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/subaru.rb', line 14

def format(recall)
  {
    type: recall["type"],
    nhtsa_number: recall["nhtsaRecallNumber"],
    oem_number: recall["code"],
    date: recall["fullDate"],
    title: recall["shortDescription"],
    description: recall["description"],
    safety_risk: recall["safefyRiskDescription"],
    remedy: recall["remedyDescription"],
    status: recall["status"],
    notes: nil
  }
end

#process(data) ⇒ Object



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

def process(data)
  parsed_data = JSON.parse(data)
  parsed_data["recalls"]
end