Class: MistApi::StatsApEnvStat

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/stats_ap_env_stat.rb

Overview

Device environment, including CPU temperature, Ambient temperature, Humidity, Attitude, Pressure, Accelerometers, Magnetometers and vCore Voltage

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(accel_x = SKIP, accel_y = SKIP, accel_z = SKIP, ambient_temp = SKIP, attitude = SKIP, cpu_temp = SKIP, humidity = SKIP, magne_x = SKIP, magne_y = SKIP, magne_z = SKIP, pressure = SKIP, vcore_voltage = SKIP) ⇒ StatsApEnvStat

Returns a new instance of StatsApEnvStat.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 116

def initialize(accel_x = SKIP, accel_y = SKIP, accel_z = SKIP,
               ambient_temp = SKIP, attitude = SKIP, cpu_temp = SKIP,
               humidity = SKIP, magne_x = SKIP, magne_y = SKIP,
               magne_z = SKIP, pressure = SKIP, vcore_voltage = SKIP)
  @accel_x = accel_x unless accel_x == SKIP
  @accel_y = accel_y unless accel_y == SKIP
  @accel_z = accel_z unless accel_z == SKIP
  @ambient_temp = ambient_temp unless ambient_temp == SKIP
  @attitude = attitude unless attitude == SKIP
  @cpu_temp = cpu_temp unless cpu_temp == SKIP
  @humidity = humidity unless humidity == SKIP
  @magne_x = magne_x unless magne_x == SKIP
  @magne_y = magne_y unless magne_y == SKIP
  @magne_z = magne_z unless magne_z == SKIP
  @pressure = pressure unless pressure == SKIP
  @vcore_voltage = vcore_voltage unless vcore_voltage == SKIP
end

Instance Attribute Details

#accel_xFloat

TODO: Write general description for this method

Returns:

  • (Float)


16
17
18
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 16

def accel_x
  @accel_x
end

#accel_yFloat

TODO: Write general description for this method

Returns:

  • (Float)


20
21
22
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 20

def accel_y
  @accel_y
end

#accel_zFloat

TODO: Write general description for this method

Returns:

  • (Float)


24
25
26
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 24

def accel_z
  @accel_z
end

#ambient_tempInteger

TODO: Write general description for this method

Returns:

  • (Integer)


28
29
30
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 28

def ambient_temp
  @ambient_temp
end

#attitudeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


32
33
34
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 32

def attitude
  @attitude
end

#cpu_tempInteger

TODO: Write general description for this method

Returns:

  • (Integer)


36
37
38
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 36

def cpu_temp
  @cpu_temp
end

#humidityInteger

TODO: Write general description for this method

Returns:

  • (Integer)


40
41
42
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 40

def humidity
  @humidity
end

#magne_xFloat

TODO: Write general description for this method

Returns:

  • (Float)


44
45
46
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 44

def magne_x
  @magne_x
end

#magne_yFloat

TODO: Write general description for this method

Returns:

  • (Float)


48
49
50
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 48

def magne_y
  @magne_y
end

#magne_zFloat

TODO: Write general description for this method

Returns:

  • (Float)


52
53
54
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 52

def magne_z
  @magne_z
end

#pressureFloat

TODO: Write general description for this method

Returns:

  • (Float)


56
57
58
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 56

def pressure
  @pressure
end

#vcore_voltageInteger

TODO: Write general description for this method

Returns:

  • (Integer)


60
61
62
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 60

def vcore_voltage
  @vcore_voltage
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 135

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  accel_x = hash.key?('accel_x') ? hash['accel_x'] : SKIP
  accel_y = hash.key?('accel_y') ? hash['accel_y'] : SKIP
  accel_z = hash.key?('accel_z') ? hash['accel_z'] : SKIP
  ambient_temp = hash.key?('ambient_temp') ? hash['ambient_temp'] : SKIP
  attitude = hash.key?('attitude') ? hash['attitude'] : SKIP
  cpu_temp = hash.key?('cpu_temp') ? hash['cpu_temp'] : SKIP
  humidity = hash.key?('humidity') ? hash['humidity'] : SKIP
  magne_x = hash.key?('magne_x') ? hash['magne_x'] : SKIP
  magne_y = hash.key?('magne_y') ? hash['magne_y'] : SKIP
  magne_z = hash.key?('magne_z') ? hash['magne_z'] : SKIP
  pressure = hash.key?('pressure') ? hash['pressure'] : SKIP
  vcore_voltage = hash.key?('vcore_voltage') ? hash['vcore_voltage'] : SKIP

  # Create object from extracted values.
  StatsApEnvStat.new(accel_x,
                     accel_y,
                     accel_z,
                     ambient_temp,
                     attitude,
                     cpu_temp,
                     humidity,
                     magne_x,
                     magne_y,
                     magne_z,
                     pressure,
                     vcore_voltage)
end

.namesObject

A mapping from model property names to API property names.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 63

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['accel_x'] = 'accel_x'
  @_hash['accel_y'] = 'accel_y'
  @_hash['accel_z'] = 'accel_z'
  @_hash['ambient_temp'] = 'ambient_temp'
  @_hash['attitude'] = 'attitude'
  @_hash['cpu_temp'] = 'cpu_temp'
  @_hash['humidity'] = 'humidity'
  @_hash['magne_x'] = 'magne_x'
  @_hash['magne_y'] = 'magne_y'
  @_hash['magne_z'] = 'magne_z'
  @_hash['pressure'] = 'pressure'
  @_hash['vcore_voltage'] = 'vcore_voltage'
  @_hash
end

.nullablesObject

An array for nullable fields



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 99

def self.nullables
  %w[
    accel_x
    accel_y
    accel_z
    ambient_temp
    attitude
    cpu_temp
    humidity
    magne_x
    magne_y
    magne_z
    pressure
    vcore_voltage
  ]
end

.optionalsObject

An array for optional fields



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 81

def self.optionals
  %w[
    accel_x
    accel_y
    accel_z
    ambient_temp
    attitude
    cpu_temp
    humidity
    magne_x
    magne_y
    magne_z
    pressure
    vcore_voltage
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



177
178
179
180
181
182
183
184
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 177

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} accel_x: #{@accel_x.inspect}, accel_y: #{@accel_y.inspect}, accel_z:"\
  " #{@accel_z.inspect}, ambient_temp: #{@ambient_temp.inspect}, attitude:"\
  " #{@attitude.inspect}, cpu_temp: #{@cpu_temp.inspect}, humidity: #{@humidity.inspect},"\
  " magne_x: #{@magne_x.inspect}, magne_y: #{@magne_y.inspect}, magne_z: #{@magne_z.inspect},"\
  " pressure: #{@pressure.inspect}, vcore_voltage: #{@vcore_voltage.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



168
169
170
171
172
173
174
# File 'lib/mist_api/models/stats_ap_env_stat.rb', line 168

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} accel_x: #{@accel_x}, accel_y: #{@accel_y}, accel_z: #{@accel_z},"\
  " ambient_temp: #{@ambient_temp}, attitude: #{@attitude}, cpu_temp: #{@cpu_temp}, humidity:"\
  " #{@humidity}, magne_x: #{@magne_x}, magne_y: #{@magne_y}, magne_z: #{@magne_z}, pressure:"\
  " #{@pressure}, vcore_voltage: #{@vcore_voltage}>"
end