Class: Airthings::SingleSampleData
- Inherits:
-
Object
- Object
- Airthings::SingleSampleData
- Defined in:
- lib/airthings/models/single_sample_data.rb
Instance Attribute Summary collapse
-
#battery ⇒ Object
Returns the value of attribute battery.
-
#co2 ⇒ Object
Returns the value of attribute co2.
-
#control_signal ⇒ Object
Returns the value of attribute control_signal.
-
#control_signal_slot01 ⇒ Object
Returns the value of attribute control_signal_slot01.
-
#control_signal_slot02 ⇒ Object
Returns the value of attribute control_signal_slot02.
-
#control_signal_slot03 ⇒ Object
Returns the value of attribute control_signal_slot03.
-
#control_signal_slot04 ⇒ Object
Returns the value of attribute control_signal_slot04.
-
#control_signal_slot05 ⇒ Object
Returns the value of attribute control_signal_slot05.
-
#control_signal_slot06 ⇒ Object
Returns the value of attribute control_signal_slot06.
-
#control_signal_slot07 ⇒ Object
Returns the value of attribute control_signal_slot07.
-
#control_signal_slot08 ⇒ Object
Returns the value of attribute control_signal_slot08.
-
#humidity ⇒ Object
Returns the value of attribute humidity.
-
#light ⇒ Object
Returns the value of attribute light.
-
#lux ⇒ Object
Returns the value of attribute lux.
-
#mold ⇒ Object
Returns the value of attribute mold.
-
#outdoor_co ⇒ Object
Returns the value of attribute outdoor_co.
-
#outdoor_humidity ⇒ Object
Returns the value of attribute outdoor_humidity.
-
#outdoor_no ⇒ Object
Returns the value of attribute outdoor_no.
-
#outdoor_no2 ⇒ Object
Returns the value of attribute outdoor_no2.
-
#outdoor_o3 ⇒ Object
Returns the value of attribute outdoor_o3.
-
#outdoor_pm1 ⇒ Object
Returns the value of attribute outdoor_pm1.
-
#outdoor_pm10 ⇒ Object
Returns the value of attribute outdoor_pm10.
-
#outdoor_pm25 ⇒ Object
Returns the value of attribute outdoor_pm25.
-
#outdoor_pressure ⇒ Object
Returns the value of attribute outdoor_pressure.
-
#outdoor_so2 ⇒ Object
Returns the value of attribute outdoor_so2.
-
#outdoor_temp ⇒ Object
Returns the value of attribute outdoor_temp.
-
#pm1 ⇒ Object
Returns the value of attribute pm1.
-
#pm10 ⇒ Object
Returns the value of attribute pm10.
-
#pm25 ⇒ Object
Returns the value of attribute pm25.
-
#pressure ⇒ Object
Returns the value of attribute pressure.
-
#pressure_difference ⇒ Object
Returns the value of attribute pressure_difference.
-
#radon_short_term_avg ⇒ Object
Returns the value of attribute radon_short_term_avg.
-
#regulation_height ⇒ Object
Returns the value of attribute regulation_height.
-
#regulation_pressure ⇒ Object
Returns the value of attribute regulation_pressure.
-
#relay_device_type ⇒ Object
Returns the value of attribute relay_device_type.
-
#rssi ⇒ Object
Returns the value of attribute rssi.
-
#sla ⇒ Object
Returns the value of attribute sla.
-
#temp ⇒ Object
Returns the value of attribute temp.
-
#time ⇒ Object
Returns the value of attribute time.
-
#virus_risk ⇒ Object
Returns the value of attribute virus_risk.
-
#voc ⇒ Object
Returns the value of attribute voc.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ SingleSampleData
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ SingleSampleData
Initializes the object
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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/airthings/models/single_sample_data.rb', line 126 def initialize(attributes = {}) unless attributes.is_a?(Hash) raise ArgumentError, "The input argument (attributes) must be a hash in `Airthings::SingleSampleData` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) do |(k, v), h| unless self.class.attribute_map.key?(k.to_sym) raise ArgumentError, "`#{k}` is not a valid attribute in `Airthings::SingleSampleData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v end self.battery = attributes[:battery] if attributes.key?(:battery) self.co2 = attributes[:co2] if attributes.key?(:co2) self.humidity = attributes[:humidity] if attributes.key?(:humidity) self.light = attributes[:light] if attributes.key?(:light) self.lux = attributes[:lux] if attributes.key?(:lux) self.mold = attributes[:mold] if attributes.key?(:mold) self.pm1 = attributes[:pm1] if attributes.key?(:pm1) self.pm10 = attributes[:pm10] if attributes.key?(:pm10) self.pm25 = attributes[:pm25] if attributes.key?(:pm25) self.pressure = attributes[:pressure] if attributes.key?(:pressure) self.pressure_difference = attributes[:pressure_difference] if attributes.key?(:pressure_difference) self.radon_short_term_avg = attributes[:radon_short_term_avg] if attributes.key?(:radon_short_term_avg) self.rssi = attributes[:rssi] if attributes.key?(:rssi) self.sla = attributes[:sla] if attributes.key?(:sla) self.temp = attributes[:temp] if attributes.key?(:temp) self.time = attributes[:time] if attributes.key?(:time) self.virus_risk = attributes[:virus_risk] if attributes.key?(:virus_risk) self.voc = attributes[:voc] if attributes.key?(:voc) self.outdoor_temp = attributes[:outdoor_temp] if attributes.key?(:outdoor_temp) self.outdoor_humidity = attributes[:outdoor_humidity] if attributes.key?(:outdoor_humidity) self.outdoor_pressure = attributes[:outdoor_pressure] if attributes.key?(:outdoor_pressure) self.outdoor_pm10 = attributes[:outdoor_pm10] if attributes.key?(:outdoor_pm10) self.outdoor_pm1 = attributes[:outdoor_pm1] if attributes.key?(:outdoor_pm1) self.outdoor_pm25 = attributes[:outdoor_pm25] if attributes.key?(:outdoor_pm25) self.outdoor_no2 = attributes[:outdoor_no2] if attributes.key?(:outdoor_no2) self.outdoor_o3 = attributes[:outdoor_o3] if attributes.key?(:outdoor_o3) self.outdoor_so2 = attributes[:outdoor_so2] if attributes.key?(:outdoor_so2) self.outdoor_co = attributes[:outdoor_co] if attributes.key?(:outdoor_co) self.outdoor_no = attributes[:outdoor_no] if attributes.key?(:outdoor_no) self.control_signal = attributes[:control_signal] if attributes.key?(:control_signal) self.control_signal_slot01 = attributes[:control_signal_slot01] if attributes.key?(:control_signal_slot01) self.control_signal_slot02 = attributes[:control_signal_slot02] if attributes.key?(:control_signal_slot02) self.control_signal_slot03 = attributes[:control_signal_slot03] if attributes.key?(:control_signal_slot03) self.control_signal_slot04 = attributes[:control_signal_slot04] if attributes.key?(:control_signal_slot04) self.control_signal_slot05 = attributes[:control_signal_slot05] if attributes.key?(:control_signal_slot05) self.control_signal_slot06 = attributes[:control_signal_slot06] if attributes.key?(:control_signal_slot06) self.control_signal_slot07 = attributes[:control_signal_slot07] if attributes.key?(:control_signal_slot07) self.control_signal_slot08 = attributes[:control_signal_slot08] if attributes.key?(:control_signal_slot08) self.regulation_pressure = attributes[:regulation_pressure] if attributes.key?(:regulation_pressure) self.regulation_height = attributes[:regulation_height] if attributes.key?(:regulation_height) self.relay_device_type = attributes[:relay_device_type] if attributes.key?(:relay_device_type) end |
Instance Attribute Details
#battery ⇒ Object
Returns the value of attribute battery.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def battery @battery end |
#co2 ⇒ Object
Returns the value of attribute co2.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def co2 @co2 end |
#control_signal ⇒ Object
Returns the value of attribute control_signal.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def control_signal @control_signal end |
#control_signal_slot01 ⇒ Object
Returns the value of attribute control_signal_slot01.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def control_signal_slot01 @control_signal_slot01 end |
#control_signal_slot02 ⇒ Object
Returns the value of attribute control_signal_slot02.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def control_signal_slot02 @control_signal_slot02 end |
#control_signal_slot03 ⇒ Object
Returns the value of attribute control_signal_slot03.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def control_signal_slot03 @control_signal_slot03 end |
#control_signal_slot04 ⇒ Object
Returns the value of attribute control_signal_slot04.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def control_signal_slot04 @control_signal_slot04 end |
#control_signal_slot05 ⇒ Object
Returns the value of attribute control_signal_slot05.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def control_signal_slot05 @control_signal_slot05 end |
#control_signal_slot06 ⇒ Object
Returns the value of attribute control_signal_slot06.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def control_signal_slot06 @control_signal_slot06 end |
#control_signal_slot07 ⇒ Object
Returns the value of attribute control_signal_slot07.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def control_signal_slot07 @control_signal_slot07 end |
#control_signal_slot08 ⇒ Object
Returns the value of attribute control_signal_slot08.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def control_signal_slot08 @control_signal_slot08 end |
#humidity ⇒ Object
Returns the value of attribute humidity.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def humidity @humidity end |
#light ⇒ Object
Returns the value of attribute light.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def light @light end |
#lux ⇒ Object
Returns the value of attribute lux.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def lux @lux end |
#mold ⇒ Object
Returns the value of attribute mold.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def mold @mold end |
#outdoor_co ⇒ Object
Returns the value of attribute outdoor_co.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def outdoor_co @outdoor_co end |
#outdoor_humidity ⇒ Object
Returns the value of attribute outdoor_humidity.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def outdoor_humidity @outdoor_humidity end |
#outdoor_no ⇒ Object
Returns the value of attribute outdoor_no.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def outdoor_no @outdoor_no end |
#outdoor_no2 ⇒ Object
Returns the value of attribute outdoor_no2.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def outdoor_no2 @outdoor_no2 end |
#outdoor_o3 ⇒ Object
Returns the value of attribute outdoor_o3.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def outdoor_o3 @outdoor_o3 end |
#outdoor_pm1 ⇒ Object
Returns the value of attribute outdoor_pm1.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def outdoor_pm1 @outdoor_pm1 end |
#outdoor_pm10 ⇒ Object
Returns the value of attribute outdoor_pm10.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def outdoor_pm10 @outdoor_pm10 end |
#outdoor_pm25 ⇒ Object
Returns the value of attribute outdoor_pm25.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def outdoor_pm25 @outdoor_pm25 end |
#outdoor_pressure ⇒ Object
Returns the value of attribute outdoor_pressure.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def outdoor_pressure @outdoor_pressure end |
#outdoor_so2 ⇒ Object
Returns the value of attribute outdoor_so2.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def outdoor_so2 @outdoor_so2 end |
#outdoor_temp ⇒ Object
Returns the value of attribute outdoor_temp.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def outdoor_temp @outdoor_temp end |
#pm1 ⇒ Object
Returns the value of attribute pm1.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def pm1 @pm1 end |
#pm10 ⇒ Object
Returns the value of attribute pm10.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def pm10 @pm10 end |
#pm25 ⇒ Object
Returns the value of attribute pm25.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def pm25 @pm25 end |
#pressure ⇒ Object
Returns the value of attribute pressure.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def pressure @pressure end |
#pressure_difference ⇒ Object
Returns the value of attribute pressure_difference.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def pressure_difference @pressure_difference end |
#radon_short_term_avg ⇒ Object
Returns the value of attribute radon_short_term_avg.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def radon_short_term_avg @radon_short_term_avg end |
#regulation_height ⇒ Object
Returns the value of attribute regulation_height.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def regulation_height @regulation_height end |
#regulation_pressure ⇒ Object
Returns the value of attribute regulation_pressure.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def regulation_pressure @regulation_pressure end |
#relay_device_type ⇒ Object
Returns the value of attribute relay_device_type.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def relay_device_type @relay_device_type end |
#rssi ⇒ Object
Returns the value of attribute rssi.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def rssi @rssi end |
#sla ⇒ Object
Returns the value of attribute sla.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def sla @sla end |
#temp ⇒ Object
Returns the value of attribute temp.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def temp @temp end |
#time ⇒ Object
Returns the value of attribute time.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def time @time end |
#virus_risk ⇒ Object
Returns the value of attribute virus_risk.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def virus_risk @virus_risk end |
#voc ⇒ Object
Returns the value of attribute voc.
18 19 20 |
# File 'lib/airthings/models/single_sample_data.rb', line 18 def voc @voc end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
68 69 70 |
# File 'lib/airthings/models/single_sample_data.rb', line 68 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/airthings/models/single_sample_data.rb', line 21 def self.attribute_map { battery: :battery, co2: :co2, humidity: :humidity, light: :light, lux: :lux, mold: :mold, pm1: :pm1, pm10: :pm10, pm25: :pm25, pressure: :pressure, pressure_difference: :pressureDifference, radon_short_term_avg: :radonShortTermAvg, rssi: :rssi, sla: :sla, temp: :temp, time: :time, virus_risk: :virusRisk, voc: :voc, outdoor_temp: :outdoorTemp, outdoor_humidity: :outdoorHumidity, outdoor_pressure: :outdoorPressure, outdoor_pm10: :outdoorPm10, outdoor_pm1: :outdoorPm1, outdoor_pm25: :outdoorPm25, outdoor_no2: :outdoorNo2, outdoor_o3: :outdoorO3, outdoor_so2: :outdoorSo2, outdoor_co: :outdoorCo, outdoor_no: :outdoorNo, control_signal: :controlSignal, control_signal_slot01: :controlSignalSlot01, control_signal_slot02: :controlSignalSlot02, control_signal_slot03: :controlSignalSlot03, control_signal_slot04: :controlSignalSlot04, control_signal_slot05: :controlSignalSlot05, control_signal_slot06: :controlSignalSlot06, control_signal_slot07: :controlSignalSlot07, control_signal_slot08: :controlSignalSlot08, regulation_pressure: :regulationPressure, regulation_height: :regulationHeight, relay_device_type: :relayDeviceType } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
299 300 301 |
# File 'lib/airthings/models/single_sample_data.rb', line 299 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
120 121 122 |
# File 'lib/airthings/models/single_sample_data.rb', line 120 def self.openapi_nullable Set.new([]) end |
.openapi_types ⇒ Object
Attribute type mapping.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/airthings/models/single_sample_data.rb', line 73 def self.openapi_types { battery: :Integer, co2: :Float, humidity: :Float, light: :Integer, lux: :Integer, mold: :Float, pm1: :Float, pm10: :Float, pm25: :Float, pressure: :Float, pressure_difference: :Float, radon_short_term_avg: :Float, rssi: :Integer, sla: :Float, temp: :Float, time: :Integer, virus_risk: :Float, voc: :Float, outdoor_temp: :Float, outdoor_humidity: :Float, outdoor_pressure: :Float, outdoor_pm10: :Float, outdoor_pm1: :Float, outdoor_pm25: :Float, outdoor_no2: :Float, outdoor_o3: :Float, outdoor_so2: :Float, outdoor_co: :Float, outdoor_no: :Float, control_signal: :Float, control_signal_slot01: :Float, control_signal_slot02: :Float, control_signal_slot03: :Float, control_signal_slot04: :Float, control_signal_slot05: :Float, control_signal_slot06: :Float, control_signal_slot07: :Float, control_signal_slot08: :Float, regulation_pressure: :Float, regulation_height: :Float, relay_device_type: :String } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/airthings/models/single_sample_data.rb', line 237 def ==(other) return true if equal?(other) self.class == other.class && battery == other.battery && co2 == other.co2 && humidity == other.humidity && light == other.light && lux == other.lux && mold == other.mold && pm1 == other.pm1 && pm10 == other.pm10 && pm25 == other.pm25 && pressure == other.pressure && pressure_difference == other.pressure_difference && radon_short_term_avg == other.radon_short_term_avg && rssi == other.rssi && sla == other.sla && temp == other.temp && time == other.time && virus_risk == other.virus_risk && voc == other.voc && outdoor_temp == other.outdoor_temp && outdoor_humidity == other.outdoor_humidity && outdoor_pressure == other.outdoor_pressure && outdoor_pm10 == other.outdoor_pm10 && outdoor_pm1 == other.outdoor_pm1 && outdoor_pm25 == other.outdoor_pm25 && outdoor_no2 == other.outdoor_no2 && outdoor_o3 == other.outdoor_o3 && outdoor_so2 == other.outdoor_so2 && outdoor_co == other.outdoor_co && outdoor_no == other.outdoor_no && control_signal == other.control_signal && control_signal_slot01 == other.control_signal_slot01 && control_signal_slot02 == other.control_signal_slot02 && control_signal_slot03 == other.control_signal_slot03 && control_signal_slot04 == other.control_signal_slot04 && control_signal_slot05 == other.control_signal_slot05 && control_signal_slot06 == other.control_signal_slot06 && control_signal_slot07 == other.control_signal_slot07 && control_signal_slot08 == other.control_signal_slot08 && regulation_pressure == other.regulation_pressure && regulation_height == other.regulation_height && relay_device_type == other.relay_device_type end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/airthings/models/single_sample_data.rb', line 331 def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = Airthings.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
402 403 404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/airthings/models/single_sample_data.rb', line 402 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/airthings/models/single_sample_data.rb', line 306 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(other) ⇒ Boolean
286 287 288 |
# File 'lib/airthings/models/single_sample_data.rb', line 286 def eql?(other) self == other end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
292 293 294 |
# File 'lib/airthings/models/single_sample_data.rb', line 292 def hash [battery, co2, humidity, light, lux, mold, pm1, pm10, pm25, pressure, pressure_difference, radon_short_term_avg, rssi, sla, temp, time, virus_risk, voc, outdoor_temp, outdoor_humidity, outdoor_pressure, outdoor_pm10, outdoor_pm1, outdoor_pm25, outdoor_no2, outdoor_o3, outdoor_so2, outdoor_co, outdoor_no, control_signal, control_signal_slot01, control_signal_slot02, control_signal_slot03, control_signal_slot04, control_signal_slot05, control_signal_slot06, control_signal_slot07, control_signal_slot08, regulation_pressure, regulation_height, relay_device_type].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
225 226 227 |
# File 'lib/airthings/models/single_sample_data.rb', line 225 def list_invalid_properties [] end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
378 379 380 |
# File 'lib/airthings/models/single_sample_data.rb', line 378 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/airthings/models/single_sample_data.rb', line 384 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
372 373 374 |
# File 'lib/airthings/models/single_sample_data.rb', line 372 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
231 232 233 |
# File 'lib/airthings/models/single_sample_data.rb', line 231 def valid? true end |