Class: Rerout::Models::DailyClicksPoint

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

Overview

One day in a ‘daily` time-series.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(day:, clicks:, qr_scans:) ⇒ DailyClicksPoint

Returns a new instance of DailyClicksPoint.



282
283
284
285
286
287
# File 'lib/rerout/models.rb', line 282

def initialize(day:, clicks:, qr_scans:)
  @day = day
  @clicks = clicks
  @qr_scans = qr_scans
  freeze
end

Instance Attribute Details

#clicksObject (readonly)

Returns the value of attribute clicks.



280
281
282
# File 'lib/rerout/models.rb', line 280

def clicks
  @clicks
end

#dayObject (readonly)

Returns the value of attribute day.



280
281
282
# File 'lib/rerout/models.rb', line 280

def day
  @day
end

#qr_scansObject (readonly)

Returns the value of attribute qr_scans.



280
281
282
# File 'lib/rerout/models.rb', line 280

def qr_scans
  @qr_scans
end

Class Method Details

.from_hash(hash) ⇒ Object



289
290
291
# File 'lib/rerout/models.rb', line 289

def self.from_hash(hash)
  new(day: hash['day'], clicks: hash['clicks'], qr_scans: hash['qr_scans'])
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



297
298
299
300
# File 'lib/rerout/models.rb', line 297

def ==(other)
  other.is_a?(DailyClicksPoint) && other.day == day &&
    other.clicks == clicks && other.qr_scans == qr_scans
end

#hashObject



303
304
305
# File 'lib/rerout/models.rb', line 303

def hash
  [self.class, day, clicks, qr_scans].hash
end

#to_hObject



293
294
295
# File 'lib/rerout/models.rb', line 293

def to_h
  { day: day, clicks: clicks, qr_scans: qr_scans }
end