class Edmunds::Vehicle::Specification::Engine::Engine

Attributes

id[R]

Public Class Methods

find(engine_id, api_params = {}) click to toggle source
# File lib/edmunds/vehicle/specification/engine.rb, line 48
def self.find(engine_id, api_params = {})
  response = Edmunds::Api.get("#{ENGINE_API_URL}/#{engine_id}") do |request|
    request.raw_parameters = api_params

    request.allowed_parameters = {
      fmt:  %w[json]
    }

    request.default_parameters = { fmt: 'json' }

    request.required_parameters = %w[fmt]
  end

  attributes = JSON.parse(response.body)
  new(attributes)
end
new(attributes) click to toggle source
# File lib/edmunds/vehicle/specification/engine.rb, line 43
def initialize(attributes)
  @id = attributes['id']
  #TODO
end