Class: TestPack1::DataSignalItem
- Defined in:
- lib/test_pack_1/models/data_signal_item.rb
Overview
A data signal, including type.
Instance Attribute Summary collapse
-
#data_signal_id ⇒ Integer
The unique id of a data signal.
-
#title ⇒ String
The unique id of a data signal.
-
#type ⇒ String
The unique id of a data signal.
-
#unit ⇒ String
The unique id of a data signal.
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(data_signal_id = nil, title = nil, type = nil, unit = nil) ⇒ DataSignalItem
constructor
A new instance of DataSignalItem.
Methods inherited from BaseModel
Constructor Details
#initialize(data_signal_id = nil, title = nil, type = nil, unit = nil) ⇒ DataSignalItem
Returns a new instance of DataSignalItem.
35 36 37 38 39 40 41 42 43 |
# File 'lib/test_pack_1/models/data_signal_item.rb', line 35 def initialize(data_signal_id = nil, title = nil, type = nil, unit = nil) @data_signal_id = data_signal_id @title = title @type = type @unit = unit end |
Instance Attribute Details
#data_signal_id ⇒ Integer
The unique id of a data signal.
11 12 13 |
# File 'lib/test_pack_1/models/data_signal_item.rb', line 11 def data_signal_id @data_signal_id end |
#title ⇒ String
The unique id of a data signal.
15 16 17 |
# File 'lib/test_pack_1/models/data_signal_item.rb', line 15 def title @title end |
#type ⇒ String
The unique id of a data signal.
19 20 21 |
# File 'lib/test_pack_1/models/data_signal_item.rb', line 19 def type @type end |
#unit ⇒ String
The unique id of a data signal.
23 24 25 |
# File 'lib/test_pack_1/models/data_signal_item.rb', line 23 def unit @unit end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/test_pack_1/models/data_signal_item.rb', line 46 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. data_signal_id = hash['dataSignalId'] title = hash['title'] type = hash['type'] unit = hash['unit'] # Create object from extracted values. DataSignalItem.new(data_signal_id, title, type, unit) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 33 |
# File 'lib/test_pack_1/models/data_signal_item.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['data_signal_id'] = 'dataSignalId' @_hash['title'] = 'title' @_hash['type'] = 'type' @_hash['unit'] = 'unit' @_hash end |