Class: Redd::Models::Comment

Inherits:
Model
  • Object
show all
Includes:
Gildable, Inboxable, Moderatable, Postable, Replyable, Reportable
Defined in:
lib/redd/models/comment.rb

Overview

A comment.

Instance Attribute Summary collapse

Attributes inherited from Model

#client

Method Summary

Methods included from Reportable

#report

Methods included from Replyable

#reply

Methods included from Postable

#delete, #deleted?, #disable_inbox_replies, #downvote, #edit, #enable_inbox_replies, #hide, #save, #undo_vote, #unhide, #unsave, #upvote

Methods included from Moderatable

#approve, #distinguish, #ignore_reports, #remove, #undistinguish, #unignore_reports

Methods included from Inboxable

#block, #collapse, #mark_as_read, #mark_as_unread, #uncollapse

Methods included from Gildable

#gild

Methods inherited from Model

#initialize

Constructor Details

This class inherits a constructor from Redd::Models::Model

Instance Attribute Details

#approved_atTime? (readonly)

Returns the time when the comment was approved.

Returns:

  • (Time, nil)

    the time when the comment was approved


32
# File 'lib/redd/models/comment.rb', line 32

property :approved_at, from: :approved_at_utc, with: ->(t) { Time.at(t) if t }

#approved_byString (readonly)

Returns the user that approved the comment.

Returns:

  • (String)

    the user that approved the comment


122
# File 'lib/redd/models/comment.rb', line 122

property :approved_by

#archived?Boolean (readonly)

Returns whether this comment was archived.

Returns:

  • (Boolean)

    whether this comment was archived


82
# File 'lib/redd/models/comment.rb', line 82

property :archived?, from: :archived

#authorUser (readonly)

Returns the comment author.

Returns:

  • (User)

    the comment author


90
# File 'lib/redd/models/comment.rb', line 90

property :author, with: ->(name) { User.new(client, name: name) }

#author_flair_css_classString (readonly)

Returns the author flair css class.

Returns:

  • (String)

    the author flair css class


138
# File 'lib/redd/models/comment.rb', line 138

property :author_flair_css_class

#author_flair_textString (readonly)

Returns the author flair text.

Returns:

  • (String)

    the author flair text


178
# File 'lib/redd/models/comment.rb', line 178

property :author_flair_text

#banned_atTime? (readonly)

Returns the time when the comment was banned.

Returns:

  • (Time, nil)

    the time when the comment was banned


74
# File 'lib/redd/models/comment.rb', line 74

property :banned_at, from: :banned_at_utc, with: ->(t) { Time.at(t) if t }

#banned_byString (readonly)

Returns the user (?) that banned this comment.

Returns:

  • (String)

    the user (?) that banned this comment


36
# File 'lib/redd/models/comment.rb', line 36

property :banned_by

#bodyString (readonly)

Returns the markdown comment body.

Returns:

  • (String)

    the markdown comment body


126
# File 'lib/redd/models/comment.rb', line 126

property :body

#body_htmlString (readonly)

Returns the html-rendered version of the body.

Returns:

  • (String)

    the html-rendered version of the body


130
# File 'lib/redd/models/comment.rb', line 130

property :body_html

#can_gild?Boolean (readonly)

Returns whether the comment is gildable.

Returns:

  • (Boolean)

    whether the comment is gildable


158
# File 'lib/redd/models/comment.rb', line 158

property :can_gild?, from: :can_gild

#can_mod_post?Boolean (readonly)

Returns whether the logged-in user can mod post.

Returns:

  • (Boolean)

    whether the logged-in user can mod post


94
# File 'lib/redd/models/comment.rb', line 94

property :can_mod_post?, from: :can_mod_post

#collapsed?Boolean (readonly)

Returns whether the comment was collapsed.

Returns:

  • (Boolean)

    whether the comment was collapsed


142
# File 'lib/redd/models/comment.rb', line 142

property :collapsed?, from: :collapsed

#collapsed_reasonString (readonly)

Returns the reason for collapse (?).

Returns:

  • (String)

    the reason for collapse (?)


150
# File 'lib/redd/models/comment.rb', line 150

property :collapsed_reason

#controversialityInteger (readonly)

Returns the comment controversiality.

Returns:

  • (Integer)

    the comment controversiality


190
# File 'lib/redd/models/comment.rb', line 190

property :controversiality

#created_atString (readonly)

Returns the time when the model was created.

Returns:

  • (String)

    the time when the model was created


182
# File 'lib/redd/models/comment.rb', line 182

property :created_at, from: :created_utc, with: ->(t) { Time.at(t) }

#depthInteger (readonly)

Returns the comment depth.

Returns:

  • (Integer)

    the comment depth


194
# File 'lib/redd/models/comment.rb', line 194

property :depth

#distinguished?Boolean (readonly)

Returns whether the comment is distinguished.

Returns:

  • (Boolean)

    whether the comment is distinguished


206
# File 'lib/redd/models/comment.rb', line 206

property :distinguished?, from: :distinguished

#downsInteger (readonly)

Deprecated.

is always 0; use #score instead

Returns the comment downvotes.

Returns:

  • (Integer)

    the comment downvotes


104
# File 'lib/redd/models/comment.rb', line 104

property :downs

#edited_atTime? (readonly)

Returns the time when the comment was edited.

Returns:

  • (Time, nil)

    the time when the comment was edited


134
# File 'lib/redd/models/comment.rb', line 134

property :edited_at, from: :edited, with: ->(t) { Time.at(t) if t }

#gildedInteger (readonly)

Returns the number of times the comment was gilded.

Returns:

  • (Integer)

    the number of times the comment was gilded


78
# File 'lib/redd/models/comment.rb', line 78

property :gilded

#idString (readonly)

Returns the comment id.

Returns:

  • (String)

    the comment id


65
# File 'lib/redd/models/comment.rb', line 65

property :id

Returns the link that the comment was posted to.

Returns:

  • (Submission)

    the link that the comment was posted to


44
# File 'lib/redd/models/comment.rb', line 44

property :link, from: :link_id, with: ->(id) { Submission.new(client, name: id) }

#mod_reportsArray<String> (readonly)

Returns the moderator reports.

Returns:

  • (Array<String>)

    the moderator reports


198
# File 'lib/redd/models/comment.rb', line 198

property :mod_reports

#nameString (readonly)

Returns the comment fullname.

Returns:

  • (String)

    the comment fullname


174
# File 'lib/redd/models/comment.rb', line 174

property :name

#parentComment, Submission (readonly)

Returns the comment parent.

Returns:


112
113
114
# File 'lib/redd/models/comment.rb', line 112

property :parent,
from: :parent_id,
with: ->(id) { Session.new(client).from_fullnames(id).first }

#parent_idString (readonly)

Returns the parent fullname.

Returns:

  • (String)

    the parent fullname


108
# File 'lib/redd/models/comment.rb', line 108

property :parent_id

#removal_reasonString? (readonly)

Returns the reason for comment removal.

Returns:

  • (String, nil)

    the reason for comment removal


40
# File 'lib/redd/models/comment.rb', line 40

property :removal_reason

#repliesListing<Comment> (readonly)

Returns the comment replies.

Returns:


52
53
# File 'lib/redd/models/comment.rb', line 52

property :replies,
with: ->(r) { r.is_a?(Hash) ? Listing.new(client, r[:data]) : Listing.empty(client) }

#report_countInteger (readonly)

Returns the report count.

Returns:

  • (Integer)

    the report count


202
# File 'lib/redd/models/comment.rb', line 202

property :report_count, from: :num_reports

#report_reasonsArray<String> (readonly)

Returns report reasons.

Returns:

  • (Array<String>)

    report reasons


86
# File 'lib/redd/models/comment.rb', line 86

property :report_reasons

#saved?Boolean (readonly)

Returns whether the submission was saved by the logged-in user.

Returns:

  • (Boolean)

    whether the submission was saved by the logged-in user


61
# File 'lib/redd/models/comment.rb', line 61

property :saved?, from: :saved

#scoreInteger (readonly)

Returns the comment score.

Returns:

  • (Integer)

    the comment score


118
# File 'lib/redd/models/comment.rb', line 118

property :score

#score_hiddenBoolean (readonly)

Returns whether the comment score is hidden.

Returns:

  • (Boolean)

    whether the comment score is hidden


166
# File 'lib/redd/models/comment.rb', line 166

property :score_hidden?, from: :score_hidden

#stickied?Boolean (readonly)

Returns whether the comment was stickied.

Returns:

  • (Boolean)

    whether the comment was stickied


154
# File 'lib/redd/models/comment.rb', line 154

property :stickied?, from: :stickied

#submitter?Boolean (readonly)

Returns whether the comment author is the link submitter.

Returns:

  • (Boolean)

    whether the comment author is the link submitter


146
# File 'lib/redd/models/comment.rb', line 146

property :submitter?, from: :is_submitter

#subredditSubreddit (readonly)

Returns the comment's subreddit.

Returns:


162
# File 'lib/redd/models/comment.rb', line 162

property :subreddit, with: ->(n) { Subreddit.new(client, display_name: n) }

#subreddit_idString (readonly)

Returns the subreddit fullname.

Returns:

  • (String)

    the subreddit fullname


28
# File 'lib/redd/models/comment.rb', line 28

property :subreddit_id

#subreddit_name_prefixedString (readonly)

Returns the subreddit name, prefixed with “r/”.

Returns:

  • (String)

    the subreddit name, prefixed with “r/”


186
# File 'lib/redd/models/comment.rb', line 186

property :subreddit_name_prefixed

#subreddit_typeString (readonly)

Returns subreddit type.

Returns:

  • (String)

    subreddit type


170
# File 'lib/redd/models/comment.rb', line 170

property :subreddit_type

#title"comment reply", ... (readonly)

Returns the comment “title” (only visible in messages).

Returns:

  • ("comment reply", "post reply", "username mention")

    the comment “title” (only visible in messages)


70
# File 'lib/redd/models/comment.rb', line 70

property :title, :nil

#upsInteger (readonly)

Deprecated.

use #score instead

Returns the comment upvotes.

Returns:

  • (Integer)

    the comment upvotes


99
# File 'lib/redd/models/comment.rb', line 99

property :ups

#upvoted?Boolean? (readonly)

Returns whether the user liked/disliked this comment.

Returns:

  • (Boolean, nil)

    whether the user liked/disliked this comment


48
# File 'lib/redd/models/comment.rb', line 48

property :upvoted?, from: :likes

#user_reportsArray<String> (readonly)

Returns user reports.

Returns:

  • (Array<String>)

    user reports


57
# File 'lib/redd/models/comment.rb', line 57

property :user_reports