Class: Verizon::SensorInsightsBle

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/sensor_insights_ble.rb

Overview

Property objects for Bluetooth Low-Energy (BLE) devices

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(data_mode: SKIP, manufacturer_id: SKIP, max_num_scan: SKIP, min_sig_str: SKIP, monitor_period: SKIP, more_manuf_id: SKIP, op_mode: SKIP, report_offset: SKIP, report_period: SKIP, report_type: SKIP, scan_duration: SKIP, additional_properties: nil) ⇒ SensorInsightsBle

Returns a new instance of SensorInsightsBle.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/verizon/models/sensor_insights_ble.rb', line 96

def initialize(data_mode: SKIP, manufacturer_id: SKIP, max_num_scan: SKIP,
               min_sig_str: SKIP, monitor_period: SKIP, more_manuf_id: SKIP,
               op_mode: SKIP, report_offset: SKIP, report_period: SKIP,
               report_type: SKIP, scan_duration: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @data_mode = data_mode unless data_mode == SKIP
  @manufacturer_id = manufacturer_id unless manufacturer_id == SKIP
  @max_num_scan = max_num_scan unless max_num_scan == SKIP
  @min_sig_str = min_sig_str unless min_sig_str == SKIP
  @monitor_period = monitor_period unless monitor_period == SKIP
  @more_manuf_id = more_manuf_id unless more_manuf_id == SKIP
  @op_mode = op_mode unless op_mode == SKIP
  @report_offset = report_offset unless report_offset == SKIP
  @report_period = report_period unless report_period == SKIP
  @report_type = report_type unless report_type == SKIP
  @scan_duration = scan_duration unless scan_duration == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#data_modeInteger

The data mode the sensor is using

Returns:

  • (Integer)


14
15
16
# File 'lib/verizon/models/sensor_insights_ble.rb', line 14

def data_mode
  @data_mode
end

#manufacturer_idInteger

The numeric manufacturer ID

Returns:

  • (Integer)


18
19
20
# File 'lib/verizon/models/sensor_insights_ble.rb', line 18

def manufacturer_id
  @manufacturer_id
end

#max_num_scanInteger

How frequently the device can be scanned

Returns:

  • (Integer)


22
23
24
# File 'lib/verizon/models/sensor_insights_ble.rb', line 22

def max_num_scan
  @max_num_scan
end

#min_sig_strInteger

The minimum signal strength needed for the sensor to transmit (in Decibels or dB)

Returns:

  • (Integer)


27
28
29
# File 'lib/verizon/models/sensor_insights_ble.rb', line 27

def min_sig_str
  @min_sig_str
end

#monitor_periodInteger

The ammount of time to monitor the sensor and varies by device

Returns:

  • (Integer)


31
32
33
# File 'lib/verizon/models/sensor_insights_ble.rb', line 31

def monitor_period
  @monitor_period
end

#more_manuf_idArray[Object]

Values for the manufacturer and these vary by device

Returns:

  • (Array[Object])


35
36
37
# File 'lib/verizon/models/sensor_insights_ble.rb', line 35

def more_manuf_id
  @more_manuf_id
end

#op_modeInteger

The operation mode

Returns:

  • (Integer)


39
40
41
# File 'lib/verizon/models/sensor_insights_ble.rb', line 39

def op_mode
  @op_mode
end

#report_offsetInteger

The ammount of time between sensor readings and reports

Returns:

  • (Integer)


43
44
45
# File 'lib/verizon/models/sensor_insights_ble.rb', line 43

def report_offset
  @report_offset
end

#report_periodInteger

The ammount of time between reports

Returns:

  • (Integer)


47
48
49
# File 'lib/verizon/models/sensor_insights_ble.rb', line 47

def report_period
  @report_period
end

#report_typeInteger

The report type

Returns:

  • (Integer)


51
52
53
# File 'lib/verizon/models/sensor_insights_ble.rb', line 51

def report_type
  @report_type
end

#scan_durationInteger

The ammount of time the sensor is queried for data

Returns:

  • (Integer)


55
56
57
# File 'lib/verizon/models/sensor_insights_ble.rb', line 55

def scan_duration
  @scan_duration
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/verizon/models/sensor_insights_ble.rb', line 119

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  data_mode = hash.key?('dataMode') ? hash['dataMode'] : SKIP
  manufacturer_id =
    hash.key?('manufacturerId') ? hash['manufacturerId'] : SKIP
  max_num_scan = hash.key?('maxNumScan') ? hash['maxNumScan'] : SKIP
  min_sig_str = hash.key?('minSigStr') ? hash['minSigStr'] : SKIP
  monitor_period = hash.key?('monitorPeriod') ? hash['monitorPeriod'] : SKIP
  more_manuf_id = hash.key?('moreManufId') ? hash['moreManufId'] : SKIP
  op_mode = hash.key?('opMode') ? hash['opMode'] : SKIP
  report_offset = hash.key?('reportOffset') ? hash['reportOffset'] : SKIP
  report_period = hash.key?('reportPeriod') ? hash['reportPeriod'] : SKIP
  report_type = hash.key?('reportType') ? hash['reportType'] : SKIP
  scan_duration = hash.key?('scanDuration') ? hash['scanDuration'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  SensorInsightsBle.new(data_mode: data_mode,
                        manufacturer_id: manufacturer_id,
                        max_num_scan: max_num_scan,
                        min_sig_str: min_sig_str,
                        monitor_period: monitor_period,
                        more_manuf_id: more_manuf_id,
                        op_mode: op_mode,
                        report_offset: report_offset,
                        report_period: report_period,
                        report_type: report_type,
                        scan_duration: scan_duration,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/verizon/models/sensor_insights_ble.rb', line 58

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['data_mode'] = 'dataMode'
  @_hash['manufacturer_id'] = 'manufacturerId'
  @_hash['max_num_scan'] = 'maxNumScan'
  @_hash['min_sig_str'] = 'minSigStr'
  @_hash['monitor_period'] = 'monitorPeriod'
  @_hash['more_manuf_id'] = 'moreManufId'
  @_hash['op_mode'] = 'opMode'
  @_hash['report_offset'] = 'reportOffset'
  @_hash['report_period'] = 'reportPeriod'
  @_hash['report_type'] = 'reportType'
  @_hash['scan_duration'] = 'scanDuration'
  @_hash
end

.nullablesObject

An array for nullable fields



92
93
94
# File 'lib/verizon/models/sensor_insights_ble.rb', line 92

def self.nullables
  []
end

.optionalsObject

An array for optional fields



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/verizon/models/sensor_insights_ble.rb', line 75

def self.optionals
  %w[
    data_mode
    manufacturer_id
    max_num_scan
    min_sig_str
    monitor_period
    more_manuf_id
    op_mode
    report_offset
    report_period
    report_type
    scan_duration
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



160
161
162
163
164
165
166
# File 'lib/verizon/models/sensor_insights_ble.rb', line 160

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



179
180
181
182
183
184
185
186
187
188
# File 'lib/verizon/models/sensor_insights_ble.rb', line 179

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} data_mode: #{@data_mode.inspect}, manufacturer_id:"\
  " #{@manufacturer_id.inspect}, max_num_scan: #{@max_num_scan.inspect}, min_sig_str:"\
  " #{@min_sig_str.inspect}, monitor_period: #{@monitor_period.inspect}, more_manuf_id:"\
  " #{@more_manuf_id.inspect}, op_mode: #{@op_mode.inspect}, report_offset:"\
  " #{@report_offset.inspect}, report_period: #{@report_period.inspect}, report_type:"\
  " #{@report_type.inspect}, scan_duration: #{@scan_duration.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



169
170
171
172
173
174
175
176
# File 'lib/verizon/models/sensor_insights_ble.rb', line 169

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} data_mode: #{@data_mode}, manufacturer_id: #{@manufacturer_id},"\
  " max_num_scan: #{@max_num_scan}, min_sig_str: #{@min_sig_str}, monitor_period:"\
  " #{@monitor_period}, more_manuf_id: #{@more_manuf_id}, op_mode: #{@op_mode}, report_offset:"\
  " #{@report_offset}, report_period: #{@report_period}, report_type: #{@report_type},"\
  " scan_duration: #{@scan_duration}, additional_properties: #{@additional_properties}>"
end