Class: TecDoc::VehicleModel
- Inherits:
-
Object
- Object
- TecDoc::VehicleModel
- Defined in:
- lib/tec_doc/vehicle_model.rb
Instance Attribute Summary collapse
-
#date_of_construction_from ⇒ Object
Returns the value of attribute date_of_construction_from.
-
#date_of_construction_to ⇒ Object
Returns the value of attribute date_of_construction_to.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#scope ⇒ Object
Returns the value of attribute scope.
Class Method Summary collapse
-
.all(options) ⇒ Array<TecDoc::VehicleManufacturer>
Get all vehicle models.
Instance Method Summary collapse
-
#vehicles(options = {}) ⇒ Object
Get all vehicles for this model.
Instance Attribute Details
#date_of_construction_from ⇒ Object
Returns the value of attribute date_of_construction_from.
3 4 5 |
# File 'lib/tec_doc/vehicle_model.rb', line 3 def date_of_construction_from @date_of_construction_from end |
#date_of_construction_to ⇒ Object
Returns the value of attribute date_of_construction_to.
3 4 5 |
# File 'lib/tec_doc/vehicle_model.rb', line 3 def date_of_construction_to @date_of_construction_to end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/tec_doc/vehicle_model.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/tec_doc/vehicle_model.rb', line 3 def name @name end |
#scope ⇒ Object
Returns the value of attribute scope.
5 6 7 |
# File 'lib/tec_doc/vehicle_model.rb', line 5 def scope @scope end |
Class Method Details
.all(options) ⇒ Array<TecDoc::VehicleManufacturer>
Get all vehicle models
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() = { :car_type => 1, :countries_car_selection => TecDoc.client.country, :country_group_flag => false, :eval_favor => false, :lang => I18n.locale.to_s }.merge() response = TecDoc.client.request(:get_vehicle_models3, ) response.map do |attributes| model = new model.scope = 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 |
Instance Method Details
#vehicles(options = {}) ⇒ Object
Get all vehicles for this model
40 41 42 43 44 |
# File 'lib/tec_doc/vehicle_model.rb', line 40 def vehicles( = {}) = scope.merge(.merge(:mod_id => id)) .delete(:eval_favor) Vehicle.all() end |