Module: Octo::Record

Included in:
AdapterDetails, ApiEvent, Category, Conversions, Ctr, DimensionChoice, Funnel, FunnelData, Plan, Product, Rules, Segment, SegmentData, Tag
Defined in:
lib/octocore-cassandra/record.rb

Instance Method Summary collapse

Instance Method Details

#unique_idObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/octocore-cassandra/record.rb', line 4

def unique_id
  candidates = self.key_attributes
  if candidates.length == 1
    # This is most likely going to be the enterpriseid of some sort
    candidates.first[1].to_s
  elsif candidates.length == 2
    if candidates.has_key?(:enterprise_id)
      candidates.delete(:enterprise_id)
      candidates.first[1].to_s
    end
  else
    raise NotImplementedError, 'See Octo::Record#unique_id'
  end
end