Class: AnalyticsOps::Governance::ChangeHistory

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

Overview

Bounded, deidentified Admin API change-history result.

Constant Summary collapse

EVENT_KEYS =
%w[actor_type change_time changes changes_filtered id].freeze
CHANGE_KEYS =
%w[action resource].freeze
MAX_EVENTS =
200
MAX_CHANGES =
1_000

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(property_id:, events:) ⇒ ChangeHistory

Returns a new instance of ChangeHistory.

Parameters:

  • property_id: (String)
  • events: (Array[record])


140
141
142
143
144
145
146
147
148
149
# File 'lib/analytics_ops/governance.rb', line 140

def initialize(property_id:, events:)
  unless property_id.is_a?(String) && property_id.match?(/\A\d{1,50}\z/) &&
         events.is_a?(Array) && events.length <= MAX_EVENTS && events.all? { |event| valid_event?(event) }
    raise RemoteError, "Change history is invalid"
  end

  @property_id = property_id.dup.freeze
  @events = Canonical.immutable(events)
  freeze
end

Instance Attribute Details

#eventsArray[record] (readonly)

Returns the value of attribute events.

Returns:

  • (Array[record])


138
139
140
# File 'lib/analytics_ops/governance.rb', line 138

def events
  @events
end

#property_idString (readonly)

Returns the value of attribute property_id.

Returns:

  • (String)


138
139
140
# File 'lib/analytics_ops/governance.rb', line 138

def property_id
  @property_id
end

Instance Method Details

#to_hrecord

Returns:

  • (record)


151
152
153
# File 'lib/analytics_ops/governance.rb', line 151

def to_h
  { "experimental" => true, "property_id" => property_id, "events" => events }
end