class Benzinator::Car
Attributes
color[R]
dealer_id[R]
id[R]
make[R]
model[R]
vin[R]
year[R]
Public Class Methods
all()
click to toggle source
# File lib/benzinator/car.rb, line 26 def self.all response = Faraday.get(API_URL) cars = JSON.parse(response.body) cars.map do |attributes| new(attributes) end end
find(id)
click to toggle source
# File lib/benzinator/car.rb, line 20 def self.find(id) response = Faraday.get("#{API_URL}/#{id}") attributes = JSON.parse(response.body) new(attributes) end
new(attributes)
click to toggle source
# File lib/benzinator/car.rb, line 10 def initialize(attributes) @id = attributes["id"] @make = attributes["make"] @model = attributes["model"] @year = attributes["year"] @color = attributes["color"] @vin = attributes["vin"] @dealer_id = attributes["dealer_id"] end