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.



123
124
125
126
127
128
# File 'lib/rerout/models.rb', line 123

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.



121
122
123
# File 'lib/rerout/models.rb', line 121

def clicks
  @clicks
end

#dayObject (readonly)

Returns the value of attribute day.



121
122
123
# File 'lib/rerout/models.rb', line 121

def day
  @day
end

#qr_scansObject (readonly)

Returns the value of attribute qr_scans.



121
122
123
# File 'lib/rerout/models.rb', line 121

def qr_scans
  @qr_scans
end

Class Method Details

.from_hash(hash) ⇒ Object



130
131
132
# File 'lib/rerout/models.rb', line 130

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?



138
139
140
141
# File 'lib/rerout/models.rb', line 138

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

#hashObject



144
145
146
# File 'lib/rerout/models.rb', line 144

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

#to_hObject



134
135
136
# File 'lib/rerout/models.rb', line 134

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