Class: CleverTap::Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/clever_tap/entity.rb

Direct Known Subclasses

Event, Profile

Constant Summary collapse

ALLOWED_IDENTITIES =
%w(objectId FBID GPID).freeze
IDENTITY_STRING =
'identity'.freeze
TIMESTAMP_STRING =
'ts'.freeze
TYPE_KEY_STRING =
'type'.freeze
UPLOAD_LIMIT =
'Needs child class value'.freeze
TYPE_VALUE_STRING =
'Needs child class value'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Entity

Returns a new instance of Entity.



32
33
34
35
36
# File 'lib/clever_tap/entity.rb', line 32

def initialize(**args)
  @data = args[:data]
  @identity = choose_identity(args)
  @timestamp = choose_timestamp(args)
end

Class Method Details

.all_same_type?(items) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/clever_tap/entity.rb', line 27

def all_same_type?(items)
  items.all? { |i| i.class == self }
end

.upload_limitObject



23
24
25
# File 'lib/clever_tap/entity.rb', line 23

def upload_limit
  self::UPLOAD_LIMIT
end

Instance Method Details

#to_hObject



38
39
40
41
42
43
# File 'lib/clever_tap/entity.rb', line 38

def to_h
  put_identity_pair
    .merge(put_timestamp_pair)
    .merge(put_type_pair)
    .merge(put_data)
end