Class: Zernio::GetInboxPostComments200ResponsePost
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::GetInboxPostComments200ResponsePost
- Defined in:
- lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb
Overview
(Reddit only) Metadata for the target post, returned alongside the comments in Reddit's single round-trip. Lets integrators render a preview of the post the user is commenting on without an additional request. Absent for non-Reddit platforms and when the upstream response is missing the post listing (deleted post, malformed response).
Instance Attribute Summary collapse
-
#author ⇒ Object
Reddit username, without the u/ prefix.
-
#created_utc ⇒ Object
Unix timestamp in seconds.
-
#flair_text ⇒ Object
Link flair text if any.
-
#fullname ⇒ Object
Fullname with type prefix (e.g. "t3_1tjtj26").
-
#id ⇒ Object
Reddit post base36 id (e.g. "1tjtj26").
-
#is_gallery ⇒ Object
True if the post is a Reddit gallery (multiple images).
-
#num_comments ⇒ Object
Returns the value of attribute num_comments.
-
#over18 ⇒ Object
Returns the value of attribute over18.
-
#permalink ⇒ Object
Absolute URL to the post on reddit.com.
-
#score ⇒ Object
Net upvotes (upvotes minus downvotes).
-
#selftext ⇒ Object
Body text for self-posts (empty for link posts).
-
#stickied ⇒ Object
Returns the value of attribute stickied.
-
#subreddit ⇒ Object
Subreddit name, without the r/ prefix.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
For link posts, the external URL; for self-posts, the Reddit permalink.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ GetInboxPostComments200ResponsePost
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ GetInboxPostComments200ResponsePost
Initializes the object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 121 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::GetInboxPostComments200ResponsePost` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::GetInboxPostComments200ResponsePost`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'fullname') self.fullname = attributes[:'fullname'] end if attributes.key?(:'title') self.title = attributes[:'title'] end if attributes.key?(:'selftext') self.selftext = attributes[:'selftext'] end if attributes.key?(:'author') self. = attributes[:'author'] end if attributes.key?(:'subreddit') self.subreddit = attributes[:'subreddit'] end if attributes.key?(:'permalink') self.permalink = attributes[:'permalink'] end if attributes.key?(:'url') self.url = attributes[:'url'] end if attributes.key?(:'score') self.score = attributes[:'score'] end if attributes.key?(:'num_comments') self.num_comments = attributes[:'num_comments'] end if attributes.key?(:'created_utc') self.created_utc = attributes[:'created_utc'] end if attributes.key?(:'over18') self.over18 = attributes[:'over18'] end if attributes.key?(:'stickied') self.stickied = attributes[:'stickied'] end if attributes.key?(:'flair_text') self.flair_text = attributes[:'flair_text'] end if attributes.key?(:'is_gallery') self.is_gallery = attributes[:'is_gallery'] end end |
Instance Attribute Details
#author ⇒ Object
Reddit username, without the u/ prefix
31 32 33 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 31 def @author end |
#created_utc ⇒ Object
Unix timestamp in seconds
48 49 50 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 48 def created_utc @created_utc end |
#flair_text ⇒ Object
Link flair text if any
55 56 57 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 55 def flair_text @flair_text end |
#fullname ⇒ Object
Fullname with type prefix (e.g. "t3_1tjtj26")
23 24 25 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 23 def fullname @fullname end |
#id ⇒ Object
Reddit post base36 id (e.g. "1tjtj26")
20 21 22 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 20 def id @id end |
#is_gallery ⇒ Object
True if the post is a Reddit gallery (multiple images)
58 59 60 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 58 def is_gallery @is_gallery end |
#num_comments ⇒ Object
Returns the value of attribute num_comments.
45 46 47 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 45 def num_comments @num_comments end |
#over18 ⇒ Object
Returns the value of attribute over18.
50 51 52 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 50 def over18 @over18 end |
#permalink ⇒ Object
Absolute URL to the post on reddit.com
37 38 39 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 37 def permalink @permalink end |
#score ⇒ Object
Net upvotes (upvotes minus downvotes)
43 44 45 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 43 def score @score end |
#selftext ⇒ Object
Body text for self-posts (empty for link posts)
28 29 30 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 28 def selftext @selftext end |
#stickied ⇒ Object
Returns the value of attribute stickied.
52 53 54 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 52 def stickied @stickied end |
#subreddit ⇒ Object
Subreddit name, without the r/ prefix
34 35 36 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 34 def subreddit @subreddit end |
#title ⇒ Object
Returns the value of attribute title.
25 26 27 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 25 def title @title end |
#url ⇒ Object
For link posts, the external URL; for self-posts, the Reddit permalink
40 41 42 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 40 def url @url end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
82 83 84 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 82 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
87 88 89 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 87 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 61 def self.attribute_map { :'id' => :'id', :'fullname' => :'fullname', :'title' => :'title', :'selftext' => :'selftext', :'author' => :'author', :'subreddit' => :'subreddit', :'permalink' => :'permalink', :'url' => :'url', :'score' => :'score', :'num_comments' => :'numComments', :'created_utc' => :'createdUtc', :'over18' => :'over18', :'stickied' => :'stickied', :'flair_text' => :'flairText', :'is_gallery' => :'isGallery' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 248 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
113 114 115 116 117 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 113 def self.openapi_nullable Set.new([ :'flair_text', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 92 def self.openapi_types { :'id' => :'String', :'fullname' => :'String', :'title' => :'String', :'selftext' => :'String', :'author' => :'String', :'subreddit' => :'String', :'permalink' => :'String', :'url' => :'String', :'score' => :'Integer', :'num_comments' => :'Integer', :'created_utc' => :'Integer', :'over18' => :'Boolean', :'stickied' => :'Boolean', :'flair_text' => :'String', :'is_gallery' => :'Boolean' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 213 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && fullname == o.fullname && title == o.title && selftext == o.selftext && == o. && subreddit == o.subreddit && permalink == o.permalink && url == o.url && score == o.score && num_comments == o.num_comments && created_utc == o.created_utc && over18 == o.over18 && stickied == o.stickied && flair_text == o.flair_text && is_gallery == o.is_gallery end |
#eql?(o) ⇒ Boolean
235 236 237 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 235 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
241 242 243 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 241 def hash [id, fullname, title, selftext, , subreddit, permalink, url, score, num_comments, created_utc, over18, stickied, flair_text, is_gallery].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
198 199 200 201 202 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 198 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 270 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
206 207 208 209 |
# File 'lib/zernio-sdk/models/get_inbox_post_comments200_response_post.rb', line 206 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' true end |