Class: TecDoc::VehicleManufacturer
- Inherits:
-
Object
- Object
- TecDoc::VehicleManufacturer
- Defined in:
- lib/tec_doc/vehicle_manufacturer.rb
Instance Attribute Summary collapse
-
#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 manufacturers.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ VehicleManufacturer
constructor
A new instance of VehicleManufacturer.
-
#models(options = {}) ⇒ Object
Get all models that manufacturer has made.
Constructor Details
#initialize(attributes = {}) ⇒ VehicleManufacturer
Returns a new instance of VehicleManufacturer.
34 35 36 37 |
# File 'lib/tec_doc/vehicle_manufacturer.rb', line 34 def initialize(attributes = {}) @id = attributes[:manu_id].to_i @name = attributes[:manu_name].to_s end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/tec_doc/vehicle_manufacturer.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/tec_doc/vehicle_manufacturer.rb', line 3 def name @name end |
#scope ⇒ Object
Returns the value of attribute scope.
5 6 7 |
# File 'lib/tec_doc/vehicle_manufacturer.rb', line 5 def scope @scope end |
Class Method Details
.all(options = {}) ⇒ Array<TecDoc::VehicleManufacturer>
Get all vehicle manufacturers
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/tec_doc/vehicle_manufacturer.rb', line 16 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_manufacturers3, ) response.map do |attributes| manufacturer = new manufacturer.scope = manufacturer.id = attributes[:manu_id].to_i manufacturer.name = attributes[:manu_name].to_s manufacturer end end |
Instance Method Details
#models(options = {}) ⇒ Object
Get all models that manufacturer has made
42 43 44 |
# File 'lib/tec_doc/vehicle_manufacturer.rb', line 42 def models( = {}) VehicleModel.all(scope.merge(.merge(:manu_id => id))) end |