Class: Itly::Plugin::Iteratively::TrackModel
- Inherits:
-
Object
- Object
- Itly::Plugin::Iteratively::TrackModel
- Defined in:
- lib/itly/plugin/iteratively/track_model.rb
Overview
Data model for HTTP client buffering
Instance Attribute Summary collapse
-
#date_sent ⇒ Object
readonly
Returns the value of attribute date_sent.
-
#event_id ⇒ Object
readonly
Returns the value of attribute event_id.
-
#event_name ⇒ Object
readonly
Returns the value of attribute event_name.
-
#event_schema_version ⇒ Object
readonly
Returns the value of attribute event_schema_version.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#valid ⇒ Object
readonly
Returns the value of attribute valid.
-
#validation ⇒ Object
readonly
Returns the value of attribute validation.
Instance Method Summary collapse
-
#initialize(type:, event:, properties:, validation: nil, omit_values: false) ⇒ TrackModel
constructor
A new instance of TrackModel.
- #to_json(*_) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(type:, event:, properties:, validation: nil, omit_values: false) ⇒ TrackModel
Returns a new instance of TrackModel.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/itly/plugin/iteratively/track_model.rb', line 17 def initialize(type:, event:, properties:, validation: nil, omit_values: false) @omit_values = omit_values @type = type @date_sent = Time.now.utc.iso8601 @event_id = event&.id @event_schema_version = event&.version @event_name = event&.name @properties = event&.properties || properties @valid = validation ? validation.valid : true @validation = { details: validation ? validation. : '' } @properties = @properties.transform_values { |_| '' } if @omit_values end |
Instance Attribute Details
#date_sent ⇒ Object (readonly)
Returns the value of attribute date_sent.
14 15 16 |
# File 'lib/itly/plugin/iteratively/track_model.rb', line 14 def date_sent @date_sent end |
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
14 15 16 |
# File 'lib/itly/plugin/iteratively/track_model.rb', line 14 def event_id @event_id end |
#event_name ⇒ Object (readonly)
Returns the value of attribute event_name.
14 15 16 |
# File 'lib/itly/plugin/iteratively/track_model.rb', line 14 def event_name @event_name end |
#event_schema_version ⇒ Object (readonly)
Returns the value of attribute event_schema_version.
14 15 16 |
# File 'lib/itly/plugin/iteratively/track_model.rb', line 14 def event_schema_version @event_schema_version end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
14 15 16 |
# File 'lib/itly/plugin/iteratively/track_model.rb', line 14 def properties @properties end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
14 15 16 |
# File 'lib/itly/plugin/iteratively/track_model.rb', line 14 def type @type end |
#valid ⇒ Object (readonly)
Returns the value of attribute valid.
14 15 16 |
# File 'lib/itly/plugin/iteratively/track_model.rb', line 14 def valid @valid end |
#validation ⇒ Object (readonly)
Returns the value of attribute validation.
14 15 16 |
# File 'lib/itly/plugin/iteratively/track_model.rb', line 14 def validation @validation end |
Instance Method Details
#to_json(*_) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/itly/plugin/iteratively/track_model.rb', line 31 def to_json(*_) { type: @type, dateSent: @date_sent, eventId: @event_id, eventSchemaVersion: @event_schema_version, eventName: @event_name, properties: @properties, valid: @valid, validation: @validation }.to_json end |
#to_s ⇒ Object
44 45 46 47 48 |
# File 'lib/itly/plugin/iteratively/track_model.rb', line 44 def to_s "#<#{self.class.name}: type: #{@type} date_sent: #{@date_sent} event_id: #{@event_id} "\ "event_schema_version: #{@event_schema_version} event_name: #{@event_name} "\ "properties: #{@properties} valid: #{@valid} validation: #{@validation}>" end |