Class: BudaApi::Models::AveragePrice

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

Overview

Average price report entry

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#raw, #to_h, #to_json

Constructor Details

#initialize(data) ⇒ AveragePrice



341
342
343
344
345
# File 'lib/buda_api/models.rb', line 341

def initialize(data)
  super(data)
  @timestamp = Time.at(data["timestamp"].to_i) if data["timestamp"]
  @average = data["average"]&.to_f
end

Instance Attribute Details

#average ⇒ Object (readonly)

Returns the value of attribute average.



347
348
349
# File 'lib/buda_api/models.rb', line 347

def average
  @average
end

#timestamp ⇒ Object (readonly)

Returns the value of attribute timestamp.



347
348
349
# File 'lib/buda_api/models.rb', line 347

def timestamp
  @timestamp
end