Class: DataDomeUser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, title: nil, first_name: nil, last_name: nil, created_at: Time.now.iso8601, phone: nil, email: nil, address: nil) ⇒ DataDomeUser

Returns a new instance of DataDomeUser.



16
17
18
19
20
21
22
23
24
25
# File 'lib/model/user.rb', line 16

def initialize(id:, title: nil, first_name: nil, last_name: nil, created_at: Time.now.iso8601, phone: nil, email: nil, address: nil)
  @id = id
  @title = title
  @first_name = first_name
  @last_name = last_name
  @created_at = created_at
  @phone = phone
  @email = email
  @address = address
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



14
15
16
# File 'lib/model/user.rb', line 14

def address
  @address
end

#created_atObject

Returns the value of attribute created_at.



14
15
16
# File 'lib/model/user.rb', line 14

def created_at
  @created_at
end

#emailObject

Returns the value of attribute email.



14
15
16
# File 'lib/model/user.rb', line 14

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



14
15
16
# File 'lib/model/user.rb', line 14

def first_name
  @first_name
end

#idObject

Returns the value of attribute id.



14
15
16
# File 'lib/model/user.rb', line 14

def id
  @id
end

#last_nameObject

Returns the value of attribute last_name.



14
15
16
# File 'lib/model/user.rb', line 14

def last_name
  @last_name
end

#phoneObject

Returns the value of attribute phone.



14
15
16
# File 'lib/model/user.rb', line 14

def phone
  @phone
end

#titleObject

Returns the value of attribute title.



14
15
16
# File 'lib/model/user.rb', line 14

def title
  @title
end

Instance Method Details

#to_json(options = {}) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/model/user.rb', line 31

def to_json(options = {})
  {
    id: @id,
    firstName: @first_name,
    lastName: @last_name,
    createdAt: @created_at,
    phone: @phone,
    email: @email,
    address: @address,
  }.to_json
end

#to_sObject



27
28
29
# File 'lib/model/user.rb', line 27

def to_s
  "DataDomeUser: id=#{@id}, title=#{@title}, firstName=#{@first_name}, lastName=#{@last_name}, createdAt=#{@created_at}, phone=#{@phone}, address=#{@address}"
end