Class: Rerout::Models::RecordedConversion
- Inherits:
-
Object
- Object
- Rerout::Models::RecordedConversion
- Defined in:
- lib/rerout/models.rb
Overview
Result of recording a conversion via ‘POST /v1/conversions`. `recorded` is true when stored; `duplicate` is true when an identical conversion for the same click had already been recorded (the call is idempotent).
Instance Attribute Summary collapse
-
#duplicate ⇒ Object
readonly
Returns the value of attribute duplicate.
-
#recorded ⇒ Object
readonly
Returns the value of attribute recorded.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(recorded:, duplicate:) ⇒ RecordedConversion
constructor
A new instance of RecordedConversion.
- #to_h ⇒ Object
Constructor Details
#initialize(recorded:, duplicate:) ⇒ RecordedConversion
Returns a new instance of RecordedConversion.
580 581 582 583 584 |
# File 'lib/rerout/models.rb', line 580 def initialize(recorded:, duplicate:) @recorded = recorded @duplicate = duplicate freeze end |
Instance Attribute Details
#duplicate ⇒ Object (readonly)
Returns the value of attribute duplicate.
578 579 580 |
# File 'lib/rerout/models.rb', line 578 def duplicate @duplicate end |
#recorded ⇒ Object (readonly)
Returns the value of attribute recorded.
578 579 580 |
# File 'lib/rerout/models.rb', line 578 def recorded @recorded end |
Class Method Details
.from_hash(hash) ⇒ Object
586 587 588 589 590 591 |
# File 'lib/rerout/models.rb', line 586 def self.from_hash(hash) new( recorded: hash.fetch('recorded', false), duplicate: hash.fetch('duplicate', false) ) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
597 598 599 |
# File 'lib/rerout/models.rb', line 597 def ==(other) other.is_a?(RecordedConversion) && other.recorded == recorded && other.duplicate == duplicate end |
#hash ⇒ Object
602 603 604 |
# File 'lib/rerout/models.rb', line 602 def hash [self.class, recorded, duplicate].hash end |
#to_h ⇒ Object
593 594 595 |
# File 'lib/rerout/models.rb', line 593 def to_h { recorded: recorded, duplicate: duplicate } end |