Method: TecDoc::VehicleModel.all

Defined in:
lib/tec_doc/vehicle_model.rb

.all(options) ⇒ Array<TecDoc::VehicleManufacturer>

Get all vehicle models

Options Hash (options):

  • :car_type (Integer)

    vehicle type (1: Passenger car, 2: Commercial vehicle, 3: Light commercial)

  • :countries_car_selection (String)

    country code according to ISO 3166

  • :country_group_flag (TrueClass, FalseClass)

    country group selection

  • :eval_favor (TrueClass, FalseClass)

    simplified Flag: simplified vehicle selection

  • :favoured_list (Integer, NilClass)

    simplified vehicle selection (1: first list selection, 0: rest) (optional)

  • :lang (String)

    language code according to ISO 639

  • :manu_id (Integer)

    manufacturer id



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/tec_doc/vehicle_model.rb', line 17

def self.all(options)
  options = {
    :car_type => 1,
    :countries_car_selection => TecDoc.client.country,
    :country_group_flag => false,
    :eval_favor => false,
    :lang => I18n.locale.to_s
  }.merge(options)
  response = TecDoc.client.request(:get_vehicle_models3, options)
  response.map do |attributes|
    model = new
    model.scope = options
    model.id = attributes[:model_id].to_i
    model.name = attributes[:modelname].to_s
    model.date_of_construction_from = DateParser.new(attributes[:year_of_constr_from]).to_date
    model.date_of_construction_to = DateParser.new(attributes[:year_of_constr_to]).to_date
    model
  end
end