Class: AnalyticsOps::Planner

Inherits:
Object
  • Object
show all
Defined in:
lib/analytics_ops/planner.rb,
sig/analytics_ops.rbs

Overview

Pure desired-vs-remote comparison. It never owns or contacts a client.

Instance Method Summary collapse

Constructor Details

#initialize(desired_state:, snapshot:) ⇒ Planner

Returns a new instance of Planner.

Parameters:



8
9
10
11
12
13
# File 'lib/analytics_ops/planner.rb', line 8

def initialize(desired_state:, snapshot:)
  @desired = desired_state
  @snapshot = snapshot
  @changes = []
  @findings = []
end

Instance Method Details

#callPlan

Returns:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/analytics_ops/planner.rb', line 15

def call
  unless @desired.property_id == @snapshot.property_id
    raise ConflictError,
          "Configured property #{@desired.property_id} does not match snapshot #{@snapshot.property_id}"
  end

  plan_streams
  plan_retention
  plan_key_events
  plan_custom_dimensions
  plan_custom_metrics
  add_manual_findings
  add_experimental_findings

  Plan.new(
    profile: @desired.profile,
    property_id: @desired.property_id,
    snapshot_fingerprint: @snapshot.fingerprint,
    changes: @changes,
    findings: @findings
  )
end