Class: Hackle::User

Inherits:
Object
  • Object
show all
Defined in:
lib/hackle/user.rb

Defined Under Namespace

Classes: Builder

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, user_id:, device_id:, identifiers:, properties:) ⇒ User

Returns a new instance of User.

Parameters:

  • id (String, nil)
  • user_id (String, nil)
  • device_id (String, nil)
  • identifiers (Hash{String => String})
  • properties (Hash{String => Object})


28
29
30
31
32
33
34
# File 'lib/hackle/user.rb', line 28

def initialize(id:, user_id:, device_id:, identifiers:, properties:)
  @id = id
  @user_id = user_id
  @device_id = device_id
  @identifiers = identifiers
  @properties = properties
end

Instance Attribute Details

#device_idString? (readonly)

Returns:

  • (String, nil)


15
16
17
# File 'lib/hackle/user.rb', line 15

def device_id
  @device_id
end

#idString? (readonly)

Returns:

  • (String, nil)


9
10
11
# File 'lib/hackle/user.rb', line 9

def id
  @id
end

#identifiersHash{String => String} (readonly)

Returns:

  • (Hash{String => String})


18
19
20
# File 'lib/hackle/user.rb', line 18

def identifiers
  @identifiers
end

#propertiesHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


21
22
23
# File 'lib/hackle/user.rb', line 21

def properties
  @properties
end

#user_idString? (readonly)

Returns:

  • (String, nil)


12
13
14
# File 'lib/hackle/user.rb', line 12

def user_id
  @user_id
end

Class Method Details

.builderUser::Builder

Returns:



51
52
53
# File 'lib/hackle/user.rb', line 51

def self.builder
  Builder.new
end

Instance Method Details

#==(other) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/hackle/user.rb', line 36

def ==(other)
  return false unless other.is_a?(User)

  id == other.id &&
    user_id == other.user_id &&
    device_id == other.device_id &&
    identifiers == other.identifiers &&
    properties == other.properties
end

#to_sObject



46
47
48
# File 'lib/hackle/user.rb', line 46

def to_s
  "Hackle::User(id: #{id}, user_id: #{user_id}, device_id: #{device_id}, identifiers: #{identifiers}, properties: #{properties})"
end