Sha256: 8bb54243a98b8aab2abd6b18e51cb0bf4eced67ca4413505e6b6f9c8f5f89be4

Contents?: true

Size: 1.49 KB

Versions: 274

Compression:

Stored size: 1.49 KB

Contents

module FastlaneCore
  class AnalyticsEventBuilder
    attr_accessor :base_hash
    attr_accessor :action_name

    def initialize(oauth_app_name: nil, p_hash: nil, session_id: nil, action_name: nil, timestamp_millis: (Time.now.to_f * 1000).to_i)
      @action_name = action_name
      @base_hash = {
        event_source: {
          oauth_app_name: oauth_app_name,
          product: 'fastlane'
        },
        actor: {
          name: p_hash,
          detail: session_id
        },
        millis_since_epoch: timestamp_millis,
        version: 1
      }
    end

    def launched_event(primary_target_hash: nil, secondary_target_hash: nil)
      return new_event(
        stage: 'launched',
        primary_target_hash: primary_target_hash,
        secondary_target_hash: secondary_target_hash
      )
    end

    def completed_event(primary_target_hash: nil, secondary_target_hash: nil)
      return new_event(
        stage: 'completed',
        primary_target_hash: primary_target_hash,
        secondary_target_hash: secondary_target_hash
      )
    end

    def new_event(stage: nil, primary_target_hash: nil, secondary_target_hash: nil)
      raise 'Need at least a primary_target_hash' if primary_target_hash.nil?
      event = base_hash.dup
      event[:action] = {
          name: stage,
          detail: action_name
      }
      event[:primary_target] = primary_target_hash
      event[:secondary_target] = secondary_target_hash unless secondary_target_hash.nil?
      return event
    end
  end
end

Version data entries

274 entries across 274 versions & 1 rubygems

Version Path
fastlane-2.98.0 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.97.0 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.1 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0.beta.20180521050117 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0.beta.20180520050019 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0.beta.20180519050103 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0.beta.20180518050116 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0.beta.20180517050058 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0.beta.20180516050022 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0.beta.20180515050025 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0.beta.20180514050029 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0.beta.20180513050015 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0.beta.20180512050121 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0.beta.20180511050050 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.96.0.beta.20180510050112 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.95.0 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.95.0.beta.20180509050014 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.95.0.beta.20180508050130 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb
fastlane-2.95.0.beta.20180507050125 fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb