airthings 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/exe/airthings_mqtt_bridge +84 -0
- data/lib/airthings/api/devices_api.rb +219 -0
- data/lib/airthings/api/locations_api.rb +151 -0
- data/lib/airthings/api_client.rb +389 -0
- data/lib/airthings/api_error.rb +57 -0
- data/lib/airthings/configuration.rb +275 -0
- data/lib/airthings/models/device_sample_response.rb +237 -0
- data/lib/airthings/models/device_simple_response.rb +237 -0
- data/lib/airthings/models/device_type.rb +69 -0
- data/lib/airthings/models/get_device_detailed_response.rb +255 -0
- data/lib/airthings/models/get_devices_response.rb +218 -0
- data/lib/airthings/models/get_location_response.rb +371 -0
- data/lib/airthings/models/get_locations_response.rb +223 -0
- data/lib/airthings/models/local_time.rb +231 -0
- data/lib/airthings/models/location.rb +239 -0
- data/lib/airthings/models/location_simple_response.rb +221 -0
- data/lib/airthings/models/location_usage.rb +231 -0
- data/lib/airthings/models/segment_simple_response.rb +245 -0
- data/lib/airthings/models/sensor_type.rb +144 -0
- data/lib/airthings/models/single_sample_data.rb +416 -0
- data/lib/airthings/models/single_sample_response.rb +216 -0
- data/lib/airthings/oauth2.rb +24 -0
- data/lib/airthings/version.rb +15 -0
- data/lib/airthings.rb +56 -0
- metadata +209 -0
@@ -0,0 +1,144 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# #Airthings API
|
4
|
+
#
|
5
|
+
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
6
|
+
#
|
7
|
+
# The version of the OpenAPI document: v1
|
8
|
+
#
|
9
|
+
# Generated by: https://openapi-generator.tech
|
10
|
+
# OpenAPI Generator version: 6.2.0
|
11
|
+
#
|
12
|
+
|
13
|
+
require "date"
|
14
|
+
require "time"
|
15
|
+
|
16
|
+
module Airthings
|
17
|
+
class SensorType
|
18
|
+
RADON_SHORT_TERM_AVG = "radonShortTermAvg"
|
19
|
+
RADON_LONG_TERM_AVG = "radonLongTermAvg"
|
20
|
+
TEMP = "temp"
|
21
|
+
OUTDOOR_TEMP = "outdoorTemp"
|
22
|
+
HUMIDITY = "humidity"
|
23
|
+
OUTDOOR_HUMIDITY = "outdoorHumidity"
|
24
|
+
CO2 = "co2"
|
25
|
+
VOC = "voc"
|
26
|
+
PRESSURE = "pressure"
|
27
|
+
OUTDOOR_PRESSURE = "outdoorPressure"
|
28
|
+
PRESSURE_DIFFERENCE = "pressureDifference"
|
29
|
+
PRESSURE_DIFF_STD_DEV = "pressureDiffStdDev"
|
30
|
+
PRESSURE_DIFF_MIN = "pressureDiffMin"
|
31
|
+
PRESSURE_DIFF_MAX = "pressureDiffMax"
|
32
|
+
LIGHT = "light"
|
33
|
+
LUX = "lux"
|
34
|
+
BATTERY_PERCENTAGE = "batteryPercentage"
|
35
|
+
BATTERY_VOLTAGE = "batteryVoltage"
|
36
|
+
ORIENTATION = "orientation"
|
37
|
+
PM1 = "pm1"
|
38
|
+
OUTDOOR_PM1 = "outdoorPm1"
|
39
|
+
PM25 = "pm25"
|
40
|
+
OUTDOOR_PM25 = "outdoorPm25"
|
41
|
+
PM10 = "pm10"
|
42
|
+
OUTDOOR_PM10 = "outdoorPm10"
|
43
|
+
MOLD = "mold"
|
44
|
+
STALE_AIR = "staleAir"
|
45
|
+
TRANSMISSION_EFFICIENCY = "transmissionEfficiency"
|
46
|
+
VIRUS_SURVIVAL_RATE = "virusSurvivalRate"
|
47
|
+
VIRUS_RISK = "virusRisk"
|
48
|
+
WIND_SPEED = "windSpeed"
|
49
|
+
WIND_DIRECTION = "windDirection"
|
50
|
+
WIND_GUST = "windGust"
|
51
|
+
DEW_POINT = "dewPoint"
|
52
|
+
CLOUD_COVER = "cloudCover"
|
53
|
+
VISIBILITY = "visibility"
|
54
|
+
PRECIPITATION_PROBABILITY = "precipitation_probability"
|
55
|
+
TOTAL_PRECIPITATION = "total_precipitation"
|
56
|
+
OUTDOOR_WEATHER = "outdoorWeather"
|
57
|
+
HOURLY_RADON_STANDARD_DEVIATION = "hourlyRadonStandardDeviation"
|
58
|
+
HOURLY_RADON = "hourlyRadon"
|
59
|
+
ENERGY_WASTAGE = "energyWastage"
|
60
|
+
ENERGY_SCENARIOS = "energyScenarios"
|
61
|
+
HISTORIC_VENTILATION_CONFIDENCE = "historicVentilationConfidence"
|
62
|
+
DAYTIME_BASELINE = "daytimeBaseline"
|
63
|
+
DAYTIME_PEAK = "daytimePeak"
|
64
|
+
NIGHT_BASELINE = "nightBaseline"
|
65
|
+
HISTORIC_VENTILATION = "historicVentilation"
|
66
|
+
VENTILATION_RUNNING_CONFIDENCE = "ventilationRunningConfidence"
|
67
|
+
OCCUPANTS_UPPER = "occupantsUpper"
|
68
|
+
OCCUPANTS_LOWER = "occupantsLower"
|
69
|
+
OCCUPANTS = "occupants"
|
70
|
+
RELATIVE_OCCUPANTS = "relativeOccupants"
|
71
|
+
VENTILATION_AMOUNT = "ventilationAmount"
|
72
|
+
HISTORIC_VENTILATION_RUNNING = "historicVentilationRunning"
|
73
|
+
VENTILATION_RUNNING = "ventilationRunning"
|
74
|
+
RELATIVE_VENTILATION_RATE = "relativeVentilationRate"
|
75
|
+
AGGREGATED = "aggregated"
|
76
|
+
SLA = "sla"
|
77
|
+
PRESSURE_AT_MIN_HEIGHT = "pressureAtMinHeight"
|
78
|
+
PRESSURE_AT_MAX_HEIGHT = "pressureAtMaxHeight"
|
79
|
+
REGULATION_PRESSURE = "regulationPressure"
|
80
|
+
REGULATION_HEIGHT = "regulationHeight"
|
81
|
+
ZERO_PRESSURE_HEIGHT = "zeroPressureHeight"
|
82
|
+
TOTAL_POWER_LOST = "totalPowerLost"
|
83
|
+
MOIST_GUARD = "moistGuard"
|
84
|
+
POTENTIAL_POWER_SAVED = "potentialPowerSaved"
|
85
|
+
POTENTIAL_POWER_SAVED_PERCENT = "potentialPowerSavedPercent"
|
86
|
+
ZERO_HEIGHT_PERCENT = "zeroHeightPercent"
|
87
|
+
ZONE = "zone"
|
88
|
+
CONTROL_SIGNAL = "controlSignal"
|
89
|
+
CONTROL_STATUS = "controlStatus"
|
90
|
+
RETURN_STATE = "returnState"
|
91
|
+
APPLIED_GAIN = "appliedGain"
|
92
|
+
LAST_BEST_CONTROL_SIGNAL = "lastBestControlSignal"
|
93
|
+
LAST_BEST_SIGNAL_ERROR = "lastBestSignalError"
|
94
|
+
LAST_BEST_CONTROL_SIGNAL_GAIN = "lastBestControlSignalGain"
|
95
|
+
LAST_BEST_CONTROL_SIGNAL_RECORDED = "lastBestControlSignalRecorded"
|
96
|
+
MESSAGES = "messages"
|
97
|
+
BALANCE_CONTROL = "balanceControl"
|
98
|
+
CONTROL_SIGNAL_SLOT01 = "controlSignalSlot01"
|
99
|
+
CONTROL_SIGNAL_SLOT02 = "controlSignalSlot02"
|
100
|
+
CONTROL_SIGNAL_SLOT03 = "controlSignalSlot03"
|
101
|
+
CONTROL_SIGNAL_SLOT04 = "controlSignalSlot04"
|
102
|
+
CONTROL_SIGNAL_SLOT05 = "controlSignalSlot05"
|
103
|
+
CONTROL_SIGNAL_SLOT06 = "controlSignalSlot06"
|
104
|
+
CONTROL_SIGNAL_SLOT07 = "controlSignalSlot07"
|
105
|
+
CONTROL_SIGNAL_SLOT08 = "controlSignalSlot08"
|
106
|
+
INLET_AIR_CONTROL = "inletAirControl"
|
107
|
+
POWER_VOLTAGE = "powerVoltage"
|
108
|
+
RSRP = "rsrp"
|
109
|
+
VENT_CONTROLLER = "ventController"
|
110
|
+
SUBSAMPLES_COUNT = "subsamplesCount"
|
111
|
+
SUBSAMPLES = "subsamples"
|
112
|
+
BALANCE_INFO = "balanceInfo"
|
113
|
+
OUTDOOR_NO2 = "outdoorNo2"
|
114
|
+
OUTDOOR_O3 = "outdoorO3"
|
115
|
+
OUTDOOR_SO2 = "outdoorSo2"
|
116
|
+
OUTDOOR_CO = "outdoorCo"
|
117
|
+
OUTDOOR_NO = "outdoorNo"
|
118
|
+
AIRLY = "airly"
|
119
|
+
AIRLY_NO2 = "airlyNo2"
|
120
|
+
AIRLY_CO = "airlyCo"
|
121
|
+
AIRLY_NO = "airlyNo"
|
122
|
+
BACNET = "bacnet"
|
123
|
+
|
124
|
+
def self.all_vars
|
125
|
+
@all_vars ||= [RADON_SHORT_TERM_AVG, RADON_LONG_TERM_AVG, TEMP, OUTDOOR_TEMP, HUMIDITY, OUTDOOR_HUMIDITY, CO2, VOC, PRESSURE, OUTDOOR_PRESSURE, PRESSURE_DIFFERENCE, PRESSURE_DIFF_STD_DEV, PRESSURE_DIFF_MIN, PRESSURE_DIFF_MAX, LIGHT, LUX, BATTERY_PERCENTAGE, BATTERY_VOLTAGE, ORIENTATION, PM1, OUTDOOR_PM1, PM25, OUTDOOR_PM25, PM10, OUTDOOR_PM10, MOLD, STALE_AIR, TRANSMISSION_EFFICIENCY, VIRUS_SURVIVAL_RATE, VIRUS_RISK, WIND_SPEED, WIND_DIRECTION, WIND_GUST, DEW_POINT, CLOUD_COVER, VISIBILITY, PRECIPITATION_PROBABILITY, TOTAL_PRECIPITATION, OUTDOOR_WEATHER, HOURLY_RADON_STANDARD_DEVIATION, HOURLY_RADON, ENERGY_WASTAGE, ENERGY_SCENARIOS, HISTORIC_VENTILATION_CONFIDENCE, DAYTIME_BASELINE, DAYTIME_PEAK, NIGHT_BASELINE, HISTORIC_VENTILATION, VENTILATION_RUNNING_CONFIDENCE, OCCUPANTS_UPPER, OCCUPANTS_LOWER, OCCUPANTS, RELATIVE_OCCUPANTS, VENTILATION_AMOUNT, HISTORIC_VENTILATION_RUNNING, VENTILATION_RUNNING, RELATIVE_VENTILATION_RATE, AGGREGATED, SLA, PRESSURE_AT_MIN_HEIGHT, PRESSURE_AT_MAX_HEIGHT, REGULATION_PRESSURE, REGULATION_HEIGHT, ZERO_PRESSURE_HEIGHT, TOTAL_POWER_LOST, MOIST_GUARD, POTENTIAL_POWER_SAVED, POTENTIAL_POWER_SAVED_PERCENT, ZERO_HEIGHT_PERCENT, ZONE, CONTROL_SIGNAL, CONTROL_STATUS, RETURN_STATE, APPLIED_GAIN, LAST_BEST_CONTROL_SIGNAL, LAST_BEST_SIGNAL_ERROR, LAST_BEST_CONTROL_SIGNAL_GAIN, LAST_BEST_CONTROL_SIGNAL_RECORDED, MESSAGES, BALANCE_CONTROL, CONTROL_SIGNAL_SLOT01, CONTROL_SIGNAL_SLOT02, CONTROL_SIGNAL_SLOT03, CONTROL_SIGNAL_SLOT04, CONTROL_SIGNAL_SLOT05, CONTROL_SIGNAL_SLOT06, CONTROL_SIGNAL_SLOT07, CONTROL_SIGNAL_SLOT08, INLET_AIR_CONTROL, POWER_VOLTAGE, RSRP, VENT_CONTROLLER, SUBSAMPLES_COUNT, SUBSAMPLES, BALANCE_INFO, OUTDOOR_NO2, OUTDOOR_O3, OUTDOOR_SO2, OUTDOOR_CO, OUTDOOR_NO, AIRLY, AIRLY_NO2, AIRLY_CO, AIRLY_NO, BACNET].freeze
|
126
|
+
end
|
127
|
+
|
128
|
+
# Builds the enum from string
|
129
|
+
# @param [String] The enum value in the form of the string
|
130
|
+
# @return [String] The enum value
|
131
|
+
def self.build_from_hash(value)
|
132
|
+
new.build_from_hash(value)
|
133
|
+
end
|
134
|
+
|
135
|
+
# Builds the enum from string
|
136
|
+
# @param [String] The enum value in the form of the string
|
137
|
+
# @return [String] The enum value
|
138
|
+
def build_from_hash(value)
|
139
|
+
return value if SensorType.all_vars.include?(value)
|
140
|
+
|
141
|
+
raise "Invalid ENUM value #{value} for class #SensorType"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
@@ -0,0 +1,416 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# #Airthings API
|
4
|
+
#
|
5
|
+
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
6
|
+
#
|
7
|
+
# The version of the OpenAPI document: v1
|
8
|
+
#
|
9
|
+
# Generated by: https://openapi-generator.tech
|
10
|
+
# OpenAPI Generator version: 6.2.0
|
11
|
+
#
|
12
|
+
|
13
|
+
require "date"
|
14
|
+
require "time"
|
15
|
+
|
16
|
+
module Airthings
|
17
|
+
class SingleSampleData
|
18
|
+
attr_accessor :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
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
battery: :battery,
|
24
|
+
co2: :co2,
|
25
|
+
humidity: :humidity,
|
26
|
+
light: :light,
|
27
|
+
lux: :lux,
|
28
|
+
mold: :mold,
|
29
|
+
pm1: :pm1,
|
30
|
+
pm10: :pm10,
|
31
|
+
pm25: :pm25,
|
32
|
+
pressure: :pressure,
|
33
|
+
pressure_difference: :pressureDifference,
|
34
|
+
radon_short_term_avg: :radonShortTermAvg,
|
35
|
+
rssi: :rssi,
|
36
|
+
sla: :sla,
|
37
|
+
temp: :temp,
|
38
|
+
time: :time,
|
39
|
+
virus_risk: :virusRisk,
|
40
|
+
voc: :voc,
|
41
|
+
outdoor_temp: :outdoorTemp,
|
42
|
+
outdoor_humidity: :outdoorHumidity,
|
43
|
+
outdoor_pressure: :outdoorPressure,
|
44
|
+
outdoor_pm10: :outdoorPm10,
|
45
|
+
outdoor_pm1: :outdoorPm1,
|
46
|
+
outdoor_pm25: :outdoorPm25,
|
47
|
+
outdoor_no2: :outdoorNo2,
|
48
|
+
outdoor_o3: :outdoorO3,
|
49
|
+
outdoor_so2: :outdoorSo2,
|
50
|
+
outdoor_co: :outdoorCo,
|
51
|
+
outdoor_no: :outdoorNo,
|
52
|
+
control_signal: :controlSignal,
|
53
|
+
control_signal_slot01: :controlSignalSlot01,
|
54
|
+
control_signal_slot02: :controlSignalSlot02,
|
55
|
+
control_signal_slot03: :controlSignalSlot03,
|
56
|
+
control_signal_slot04: :controlSignalSlot04,
|
57
|
+
control_signal_slot05: :controlSignalSlot05,
|
58
|
+
control_signal_slot06: :controlSignalSlot06,
|
59
|
+
control_signal_slot07: :controlSignalSlot07,
|
60
|
+
control_signal_slot08: :controlSignalSlot08,
|
61
|
+
regulation_pressure: :regulationPressure,
|
62
|
+
regulation_height: :regulationHeight,
|
63
|
+
relay_device_type: :relayDeviceType
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# Returns all the JSON keys this model knows about
|
68
|
+
def self.acceptable_attributes
|
69
|
+
attribute_map.values
|
70
|
+
end
|
71
|
+
|
72
|
+
# Attribute type mapping.
|
73
|
+
def self.openapi_types
|
74
|
+
{
|
75
|
+
battery: :Integer,
|
76
|
+
co2: :Float,
|
77
|
+
humidity: :Float,
|
78
|
+
light: :Integer,
|
79
|
+
lux: :Integer,
|
80
|
+
mold: :Float,
|
81
|
+
pm1: :Float,
|
82
|
+
pm10: :Float,
|
83
|
+
pm25: :Float,
|
84
|
+
pressure: :Float,
|
85
|
+
pressure_difference: :Float,
|
86
|
+
radon_short_term_avg: :Float,
|
87
|
+
rssi: :Integer,
|
88
|
+
sla: :Float,
|
89
|
+
temp: :Float,
|
90
|
+
time: :Integer,
|
91
|
+
virus_risk: :Float,
|
92
|
+
voc: :Float,
|
93
|
+
outdoor_temp: :Float,
|
94
|
+
outdoor_humidity: :Float,
|
95
|
+
outdoor_pressure: :Float,
|
96
|
+
outdoor_pm10: :Float,
|
97
|
+
outdoor_pm1: :Float,
|
98
|
+
outdoor_pm25: :Float,
|
99
|
+
outdoor_no2: :Float,
|
100
|
+
outdoor_o3: :Float,
|
101
|
+
outdoor_so2: :Float,
|
102
|
+
outdoor_co: :Float,
|
103
|
+
outdoor_no: :Float,
|
104
|
+
control_signal: :Float,
|
105
|
+
control_signal_slot01: :Float,
|
106
|
+
control_signal_slot02: :Float,
|
107
|
+
control_signal_slot03: :Float,
|
108
|
+
control_signal_slot04: :Float,
|
109
|
+
control_signal_slot05: :Float,
|
110
|
+
control_signal_slot06: :Float,
|
111
|
+
control_signal_slot07: :Float,
|
112
|
+
control_signal_slot08: :Float,
|
113
|
+
regulation_pressure: :Float,
|
114
|
+
regulation_height: :Float,
|
115
|
+
relay_device_type: :String
|
116
|
+
}
|
117
|
+
end
|
118
|
+
|
119
|
+
# List of attributes with nullable: true
|
120
|
+
def self.openapi_nullable
|
121
|
+
Set.new([])
|
122
|
+
end
|
123
|
+
|
124
|
+
# Initializes the object
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
+
def initialize(attributes = {})
|
127
|
+
unless attributes.is_a?(Hash)
|
128
|
+
raise ArgumentError, "The input argument (attributes) must be a hash in `Airthings::SingleSampleData` initialize method"
|
129
|
+
end
|
130
|
+
|
131
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
132
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
133
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
134
|
+
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
|
135
|
+
end
|
136
|
+
|
137
|
+
h[k.to_sym] = v
|
138
|
+
end
|
139
|
+
|
140
|
+
self.battery = attributes[:battery] if attributes.key?(:battery)
|
141
|
+
|
142
|
+
self.co2 = attributes[:co2] if attributes.key?(:co2)
|
143
|
+
|
144
|
+
self.humidity = attributes[:humidity] if attributes.key?(:humidity)
|
145
|
+
|
146
|
+
self.light = attributes[:light] if attributes.key?(:light)
|
147
|
+
|
148
|
+
self.lux = attributes[:lux] if attributes.key?(:lux)
|
149
|
+
|
150
|
+
self.mold = attributes[:mold] if attributes.key?(:mold)
|
151
|
+
|
152
|
+
self.pm1 = attributes[:pm1] if attributes.key?(:pm1)
|
153
|
+
|
154
|
+
self.pm10 = attributes[:pm10] if attributes.key?(:pm10)
|
155
|
+
|
156
|
+
self.pm25 = attributes[:pm25] if attributes.key?(:pm25)
|
157
|
+
|
158
|
+
self.pressure = attributes[:pressure] if attributes.key?(:pressure)
|
159
|
+
|
160
|
+
self.pressure_difference = attributes[:pressure_difference] if attributes.key?(:pressure_difference)
|
161
|
+
|
162
|
+
self.radon_short_term_avg = attributes[:radon_short_term_avg] if attributes.key?(:radon_short_term_avg)
|
163
|
+
|
164
|
+
self.rssi = attributes[:rssi] if attributes.key?(:rssi)
|
165
|
+
|
166
|
+
self.sla = attributes[:sla] if attributes.key?(:sla)
|
167
|
+
|
168
|
+
self.temp = attributes[:temp] if attributes.key?(:temp)
|
169
|
+
|
170
|
+
self.time = attributes[:time] if attributes.key?(:time)
|
171
|
+
|
172
|
+
self.virus_risk = attributes[:virus_risk] if attributes.key?(:virus_risk)
|
173
|
+
|
174
|
+
self.voc = attributes[:voc] if attributes.key?(:voc)
|
175
|
+
|
176
|
+
self.outdoor_temp = attributes[:outdoor_temp] if attributes.key?(:outdoor_temp)
|
177
|
+
|
178
|
+
self.outdoor_humidity = attributes[:outdoor_humidity] if attributes.key?(:outdoor_humidity)
|
179
|
+
|
180
|
+
self.outdoor_pressure = attributes[:outdoor_pressure] if attributes.key?(:outdoor_pressure)
|
181
|
+
|
182
|
+
self.outdoor_pm10 = attributes[:outdoor_pm10] if attributes.key?(:outdoor_pm10)
|
183
|
+
|
184
|
+
self.outdoor_pm1 = attributes[:outdoor_pm1] if attributes.key?(:outdoor_pm1)
|
185
|
+
|
186
|
+
self.outdoor_pm25 = attributes[:outdoor_pm25] if attributes.key?(:outdoor_pm25)
|
187
|
+
|
188
|
+
self.outdoor_no2 = attributes[:outdoor_no2] if attributes.key?(:outdoor_no2)
|
189
|
+
|
190
|
+
self.outdoor_o3 = attributes[:outdoor_o3] if attributes.key?(:outdoor_o3)
|
191
|
+
|
192
|
+
self.outdoor_so2 = attributes[:outdoor_so2] if attributes.key?(:outdoor_so2)
|
193
|
+
|
194
|
+
self.outdoor_co = attributes[:outdoor_co] if attributes.key?(:outdoor_co)
|
195
|
+
|
196
|
+
self.outdoor_no = attributes[:outdoor_no] if attributes.key?(:outdoor_no)
|
197
|
+
|
198
|
+
self.control_signal = attributes[:control_signal] if attributes.key?(:control_signal)
|
199
|
+
|
200
|
+
self.control_signal_slot01 = attributes[:control_signal_slot01] if attributes.key?(:control_signal_slot01)
|
201
|
+
|
202
|
+
self.control_signal_slot02 = attributes[:control_signal_slot02] if attributes.key?(:control_signal_slot02)
|
203
|
+
|
204
|
+
self.control_signal_slot03 = attributes[:control_signal_slot03] if attributes.key?(:control_signal_slot03)
|
205
|
+
|
206
|
+
self.control_signal_slot04 = attributes[:control_signal_slot04] if attributes.key?(:control_signal_slot04)
|
207
|
+
|
208
|
+
self.control_signal_slot05 = attributes[:control_signal_slot05] if attributes.key?(:control_signal_slot05)
|
209
|
+
|
210
|
+
self.control_signal_slot06 = attributes[:control_signal_slot06] if attributes.key?(:control_signal_slot06)
|
211
|
+
|
212
|
+
self.control_signal_slot07 = attributes[:control_signal_slot07] if attributes.key?(:control_signal_slot07)
|
213
|
+
|
214
|
+
self.control_signal_slot08 = attributes[:control_signal_slot08] if attributes.key?(:control_signal_slot08)
|
215
|
+
|
216
|
+
self.regulation_pressure = attributes[:regulation_pressure] if attributes.key?(:regulation_pressure)
|
217
|
+
|
218
|
+
self.regulation_height = attributes[:regulation_height] if attributes.key?(:regulation_height)
|
219
|
+
|
220
|
+
self.relay_device_type = attributes[:relay_device_type] if attributes.key?(:relay_device_type)
|
221
|
+
end
|
222
|
+
|
223
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
224
|
+
# @return Array for valid properties with the reasons
|
225
|
+
def list_invalid_properties
|
226
|
+
[]
|
227
|
+
end
|
228
|
+
|
229
|
+
# Check to see if the all the properties in the model are valid
|
230
|
+
# @return true if the model is valid
|
231
|
+
def valid?
|
232
|
+
true
|
233
|
+
end
|
234
|
+
|
235
|
+
# Checks equality by comparing each attribute.
|
236
|
+
# @param [Object] Object to be compared
|
237
|
+
def ==(other)
|
238
|
+
return true if equal?(other)
|
239
|
+
|
240
|
+
self.class == other.class &&
|
241
|
+
battery == other.battery &&
|
242
|
+
co2 == other.co2 &&
|
243
|
+
humidity == other.humidity &&
|
244
|
+
light == other.light &&
|
245
|
+
lux == other.lux &&
|
246
|
+
mold == other.mold &&
|
247
|
+
pm1 == other.pm1 &&
|
248
|
+
pm10 == other.pm10 &&
|
249
|
+
pm25 == other.pm25 &&
|
250
|
+
pressure == other.pressure &&
|
251
|
+
pressure_difference == other.pressure_difference &&
|
252
|
+
radon_short_term_avg == other.radon_short_term_avg &&
|
253
|
+
rssi == other.rssi &&
|
254
|
+
sla == other.sla &&
|
255
|
+
temp == other.temp &&
|
256
|
+
time == other.time &&
|
257
|
+
virus_risk == other.virus_risk &&
|
258
|
+
voc == other.voc &&
|
259
|
+
outdoor_temp == other.outdoor_temp &&
|
260
|
+
outdoor_humidity == other.outdoor_humidity &&
|
261
|
+
outdoor_pressure == other.outdoor_pressure &&
|
262
|
+
outdoor_pm10 == other.outdoor_pm10 &&
|
263
|
+
outdoor_pm1 == other.outdoor_pm1 &&
|
264
|
+
outdoor_pm25 == other.outdoor_pm25 &&
|
265
|
+
outdoor_no2 == other.outdoor_no2 &&
|
266
|
+
outdoor_o3 == other.outdoor_o3 &&
|
267
|
+
outdoor_so2 == other.outdoor_so2 &&
|
268
|
+
outdoor_co == other.outdoor_co &&
|
269
|
+
outdoor_no == other.outdoor_no &&
|
270
|
+
control_signal == other.control_signal &&
|
271
|
+
control_signal_slot01 == other.control_signal_slot01 &&
|
272
|
+
control_signal_slot02 == other.control_signal_slot02 &&
|
273
|
+
control_signal_slot03 == other.control_signal_slot03 &&
|
274
|
+
control_signal_slot04 == other.control_signal_slot04 &&
|
275
|
+
control_signal_slot05 == other.control_signal_slot05 &&
|
276
|
+
control_signal_slot06 == other.control_signal_slot06 &&
|
277
|
+
control_signal_slot07 == other.control_signal_slot07 &&
|
278
|
+
control_signal_slot08 == other.control_signal_slot08 &&
|
279
|
+
regulation_pressure == other.regulation_pressure &&
|
280
|
+
regulation_height == other.regulation_height &&
|
281
|
+
relay_device_type == other.relay_device_type
|
282
|
+
end
|
283
|
+
|
284
|
+
# @see the `==` method
|
285
|
+
# @param [Object] Object to be compared
|
286
|
+
def eql?(other)
|
287
|
+
self == other
|
288
|
+
end
|
289
|
+
|
290
|
+
# Calculates hash code according to all attributes.
|
291
|
+
# @return [Integer] Hash code
|
292
|
+
def hash
|
293
|
+
[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
|
294
|
+
end
|
295
|
+
|
296
|
+
# Builds the object from hash
|
297
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
298
|
+
# @return [Object] Returns the model itself
|
299
|
+
def self.build_from_hash(attributes)
|
300
|
+
new.build_from_hash(attributes)
|
301
|
+
end
|
302
|
+
|
303
|
+
# Builds the object from hash
|
304
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
305
|
+
# @return [Object] Returns the model itself
|
306
|
+
def build_from_hash(attributes)
|
307
|
+
return nil unless attributes.is_a?(Hash)
|
308
|
+
|
309
|
+
attributes = attributes.transform_keys(&:to_sym)
|
310
|
+
self.class.openapi_types.each_pair do |key, type|
|
311
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
312
|
+
send("#{key}=", nil)
|
313
|
+
elsif type =~ /\AArray<(.*)>/i
|
314
|
+
# check to ensure the input is an array given that the attribute
|
315
|
+
# is documented as an array but the input is not
|
316
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
317
|
+
send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
318
|
+
end
|
319
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
320
|
+
send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
self
|
325
|
+
end
|
326
|
+
|
327
|
+
# Deserializes the data based on type
|
328
|
+
# @param string type Data type
|
329
|
+
# @param string value Value to be deserialized
|
330
|
+
# @return [Object] Deserialized data
|
331
|
+
def _deserialize(type, value)
|
332
|
+
case type.to_sym
|
333
|
+
when :Time
|
334
|
+
Time.parse(value)
|
335
|
+
when :Date
|
336
|
+
Date.parse(value)
|
337
|
+
when :String
|
338
|
+
value.to_s
|
339
|
+
when :Integer
|
340
|
+
value.to_i
|
341
|
+
when :Float
|
342
|
+
value.to_f
|
343
|
+
when :Boolean
|
344
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
345
|
+
true
|
346
|
+
else
|
347
|
+
false
|
348
|
+
end
|
349
|
+
when :Object
|
350
|
+
# generic object (usually a Hash), return directly
|
351
|
+
value
|
352
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
353
|
+
inner_type = Regexp.last_match[:inner_type]
|
354
|
+
value.map { |v| _deserialize(inner_type, v) }
|
355
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
356
|
+
k_type = Regexp.last_match[:k_type]
|
357
|
+
v_type = Regexp.last_match[:v_type]
|
358
|
+
{}.tap do |hash|
|
359
|
+
value.each do |k, v|
|
360
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
361
|
+
end
|
362
|
+
end
|
363
|
+
else # model
|
364
|
+
# models (e.g. Pet) or oneOf
|
365
|
+
klass = Airthings.const_get(type)
|
366
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
# Returns the string representation of the object
|
371
|
+
# @return [String] String presentation of the object
|
372
|
+
def to_s
|
373
|
+
to_hash.to_s
|
374
|
+
end
|
375
|
+
|
376
|
+
# to_body is an alias to to_hash (backward compatibility)
|
377
|
+
# @return [Hash] Returns the object in the form of hash
|
378
|
+
def to_body
|
379
|
+
to_hash
|
380
|
+
end
|
381
|
+
|
382
|
+
# Returns the object in the form of hash
|
383
|
+
# @return [Hash] Returns the object in the form of hash
|
384
|
+
def to_hash
|
385
|
+
hash = {}
|
386
|
+
self.class.attribute_map.each_pair do |attr, param|
|
387
|
+
value = send(attr)
|
388
|
+
if value.nil?
|
389
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
390
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
391
|
+
end
|
392
|
+
|
393
|
+
hash[param] = _to_hash(value)
|
394
|
+
end
|
395
|
+
hash
|
396
|
+
end
|
397
|
+
|
398
|
+
# Outputs non-array value in the form of hash
|
399
|
+
# For object, use to_hash. Otherwise, just return the value
|
400
|
+
# @param [Object] value Any valid value
|
401
|
+
# @return [Hash] Returns the value in the form of hash
|
402
|
+
def _to_hash(value)
|
403
|
+
if value.is_a?(Array)
|
404
|
+
value.compact.map { |v| _to_hash(v) }
|
405
|
+
elsif value.is_a?(Hash)
|
406
|
+
{}.tap do |hash|
|
407
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
408
|
+
end
|
409
|
+
elsif value.respond_to? :to_hash
|
410
|
+
value.to_hash
|
411
|
+
else
|
412
|
+
value
|
413
|
+
end
|
414
|
+
end
|
415
|
+
end
|
416
|
+
end
|