lib/vindetta/decoder.rb in vindetta-0.8.0 vs lib/vindetta/decoder.rb in vindetta-0.9.0

- old
+ new

@@ -1,9 +1,13 @@ +require "httparty" +require "vindetta/decoder/result" + module Vindetta class Decoder - def self.decode(vin) - { - :year => vin.year - } + def self.decode_vin(vin) + result = HTTParty.get("https://vpic.nhtsa.dot.gov/api/vehicles/decodevin/#{vin}?format=json") + json = JSON.parse(result.body) + + Result.new(json["Results"]) end end end