<commit_before>require_dependency 'carto/tracking/segment_wrapper'
require_dependency 'carto/tracking/properties_helper'

module Carto
  module Tracking
    module Events
      include Carto::Tracking::PropertiesHelper

      class TrackingEvent
        def initialize(user, name, properties)
          @user = user
          @name = name
          @properties = properties
        end

        def report
          Carto::Tracking::SegmentWrapper.new(@user).send_event(@name, @properties)
        rescue => exception
          CartoDB::Logger.error(message: 'Carto::Tracking: Event couldn\'t be reported',
                                exception: exception,
                                properties: @properties,
                                user: @user)
        end
      end

      class ExportedMap < TrackingEvent
        def initialize(user, visualization)
          super(user, 'Exported map', visualization_properties(visualization))
        end
      end

      class CreatedMap < TrackingEvent
        def initialize(user, visualization)<commit_msg>fix include in class<commit_after>require_dependency 'carto/tracking/segment_wrapper'
require_dependency 'carto/tracking/properties_helper'

module Carto
  module Tracking
    module Events
      class TrackingEvent
        include Carto::Tracking::PropertiesHelper

        def initialize(user, name, properties)
          @user = user
          @name = name
          @properties = properties
        end

        def report
          Carto::Tracking::SegmentWrapper.new(@user).send_event(@name, @properties)
        rescue => exception
          CartoDB::Logger.error(message: 'Carto::Tracking: Event couldn\'t be reported',
                                exception: exception,
                                properties: @properties,
                                user: @user)
        end
      end

      class ExportedMap < TrackingEvent
        def initialize(user, visualization)
          super(user, 'Exported map', visualization_properties(visualization))
        end
      end

      class CreatedMap < TrackingEvent
        def initialize(user, visualization)
{'fraction_non_alphanumeric': 0.07286314806165343, 'fraction_numerical': 0.0, 'mean_word_length': 2.0953757225433525, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3193516', 'n_tokens_mistral': 530, 'n_tokens_neox': 498, 'n_words': 128}