class Benzboy::Car

Attributes

color[R]
dealer_id[R]
id[R]
make[R]
model[R]
vin[R]
year[R]

Public Class Methods

find(id) click to toggle source
# File lib/benzboy/car.rb, line 21
def self.find(id)
  response   = Faraday.get("#{API_URL}/#{id}")
  response   = "{
                  \"id\": 68,
                  \"make\": \"Honda\",
                  \"model\": \"Civic\",
                  \"year\": \"1996\",
                  \"color\": \"Blue\",
                  \"vin\": \"XXXXXXXXXXXXXX\",
                  \"dealer_id\": 34
                }"
  attributes = JSON.parse(response)
  new(attributes)
end
new(attributes) click to toggle source
# File lib/benzboy/car.rb, line 11
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