Class: KudagoClient::Entities::Comment

Inherits:
Object
  • Object
show all
Defined in:
lib/kudago_client/entities/comment.rb

Defined Under Namespace

Classes: User

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lang:, id: nil, date_posted: nil, text: nil, user: nil, is_deleted: false, replies_count: 0, reply_to: nil, thread: nil) ⇒ Comment

Returns a new instance of Comment.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/kudago_client/entities/comment.rb', line 12

def initialize(lang:, id: nil, date_posted: nil, text: nil, user: nil, is_deleted: false, replies_count: 0, reply_to: nil, thread: nil)
  @lang = lang
  @id = id
  @text = text
  @is_deleted = is_deleted
  @replies_count = replies_count
  @reply_to = reply_to
  @thread = thread

  @date_posted = Time.at(date_posted).to_datetime if date_posted.present?
  @user = User.new(user[:name], user[:avatar]) if user.present?
end

Instance Attribute Details

#date_postedObject

Returns the value of attribute date_posted.



10
11
12
# File 'lib/kudago_client/entities/comment.rb', line 10

def date_posted
  @date_posted
end

#idObject

Returns the value of attribute id.



10
11
12
# File 'lib/kudago_client/entities/comment.rb', line 10

def id
  @id
end

#is_deletedObject

Returns the value of attribute is_deleted.



10
11
12
# File 'lib/kudago_client/entities/comment.rb', line 10

def is_deleted
  @is_deleted
end

#langObject

Returns the value of attribute lang.



10
11
12
# File 'lib/kudago_client/entities/comment.rb', line 10

def lang
  @lang
end

#replies_countObject

Returns the value of attribute replies_count.



10
11
12
# File 'lib/kudago_client/entities/comment.rb', line 10

def replies_count
  @replies_count
end

#reply_toObject

Returns the value of attribute reply_to.



10
11
12
# File 'lib/kudago_client/entities/comment.rb', line 10

def reply_to
  @reply_to
end

#textObject

Returns the value of attribute text.



10
11
12
# File 'lib/kudago_client/entities/comment.rb', line 10

def text
  @text
end

#threadObject

Returns the value of attribute thread.



10
11
12
# File 'lib/kudago_client/entities/comment.rb', line 10

def thread
  @thread
end

#userObject

Returns the value of attribute user.



10
11
12
# File 'lib/kudago_client/entities/comment.rb', line 10

def user
  @user
end