Class: TestPack1::DeviceModel
- Defined in:
- lib/test_pack_1/models/device_model.rb
Overview
General device model information.
Instance Attribute Summary collapse
-
#device_model_id ⇒ Integer
TODO: Write general description for this method.
-
#manufacturer ⇒ String
TODO: Write general description for this method.
-
#model ⇒ String
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(device_model_id = nil, manufacturer = nil, model = nil) ⇒ DeviceModel
constructor
A new instance of DeviceModel.
Methods inherited from BaseModel
Constructor Details
#initialize(device_model_id = nil, manufacturer = nil, model = nil) ⇒ DeviceModel
Returns a new instance of DeviceModel.
30 31 32 33 34 35 36 |
# File 'lib/test_pack_1/models/device_model.rb', line 30 def initialize(device_model_id = nil, manufacturer = nil, model = nil) @device_model_id = device_model_id @manufacturer = manufacturer @model = model end |
Instance Attribute Details
#device_model_id ⇒ Integer
TODO: Write general description for this method
11 12 13 |
# File 'lib/test_pack_1/models/device_model.rb', line 11 def device_model_id @device_model_id end |
#manufacturer ⇒ String
TODO: Write general description for this method
15 16 17 |
# File 'lib/test_pack_1/models/device_model.rb', line 15 def manufacturer @manufacturer end |
#model ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/test_pack_1/models/device_model.rb', line 19 def model @model end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/test_pack_1/models/device_model.rb', line 39 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. device_model_id = hash['deviceModelId'] manufacturer = hash['manufacturer'] model = hash['model'] # Create object from extracted values. DeviceModel.new(device_model_id, manufacturer, model) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 28 |
# File 'lib/test_pack_1/models/device_model.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['device_model_id'] = 'deviceModelId' @_hash['manufacturer'] = 'manufacturer' @_hash['model'] = 'model' @_hash end |