Class: KakaxiParse::Climate
- Defined in:
- lib/kakaxi_parse/climate.rb
Constant Summary collapse
- @@belongs_to =
[KakaxiDevice]
- @@attributes =
%i(solar_radiation recorded_at rain_amount rainfall humidity temperature weather device_id power_feeding interpolation)
Constants inherited from BaseModel
Instance Attribute Summary
Attributes inherited from BaseModel
#created_at, #id, #name, #updated_at
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id: nil, updated_at: nil, created_at: nil, solar_radiation: nil, recorded_at: nil, rain_amount: nil, rainfall: nil, humidity: nil, temperature: nil, weather: nil, device_id: nil, power_feeding: nil, interpolation: nil) ⇒ Climate
constructor
A new instance of Climate.
Methods inherited from BaseModel
all, #delete, demodulize, find, order, #save, short_name, #update
Constructor Details
#initialize(id: nil, updated_at: nil, created_at: nil, solar_radiation: nil, recorded_at: nil, rain_amount: nil, rainfall: nil, humidity: nil, temperature: nil, weather: nil, device_id: nil, power_feeding: nil, interpolation: nil) ⇒ Climate
Returns a new instance of Climate.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/kakaxi_parse/climate.rb', line 7 def initialize( id: nil, updated_at: nil, created_at: nil, solar_radiation: nil, recorded_at: nil, rain_amount: nil, rainfall: nil, humidity: nil, temperature: nil, weather: nil, device_id: nil, power_feeding: nil, interpolation: nil ) @solar_radiation = solar_radiation @recorded_at = DateTime.strptime(recorded_at, '%Y-%m-%dT%H:%M:%S.%LZ') @rain_amount = rain_amount @humidity = humidity @temperature = temperature @weather = weather @device_id = device_id @power_feeding = power_feeding @interpolation = interpolation super(id, nil, updated_at, created_at) end |
Class Method Details
.where(hash, limit: DEFUALT_LIMIT) ⇒ Object
34 35 36 |
# File 'lib/kakaxi_parse/climate.rb', line 34 def self.where(hash, limit: DEFUALT_LIMIT) to_objects(super(self, hash, limit, @@belongs_to)) if valid_key?(hash) end |