Class: SE::API::Comment
- Inherits:
-
Object
- Object
- SE::API::Comment
- Defined in:
- lib/se/api/types/comment.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
(also: #user, #owner)
readonly
Returns the value of attribute author.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#body_markdown ⇒ Object
readonly
Returns the value of attribute body_markdown.
-
#created_at ⇒ Object
(also: #creation_date)
readonly
Returns the value of attribute created_at.
-
#edited ⇒ Object
readonly
Returns the value of attribute edited.
-
#id ⇒ Object
(also: #comment_id)
readonly
Returns the value of attribute id.
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#post_id ⇒ Object
readonly
Returns the value of attribute post_id.
-
#post_type ⇒ Object
readonly
Returns the value of attribute post_type.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(item_json) ⇒ Comment
constructor
A new instance of Comment.
Constructor Details
#initialize(item_json) ⇒ Comment
Returns a new instance of Comment.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/se/api/types/comment.rb', line 9 def initialize(item_json) @json = Hash(item_json) @body = @json["body"] @body_markdown = @json["body_markdown"] @link = @json["link"] @edited = (@json["edited"] == "true") @post_id = @json["post_id"].to_i @post_type = @json["post_type"] @score = @json["score"].to_i @type = @json["post_type"] @id = @json["comment_id"].to_i @created_at = @json["creation_date"] @author = User.new(@json["owner"]) end |
Instance Attribute Details
#author ⇒ Object (readonly) Also known as: user, owner
Returns the value of attribute author.
6 7 8 |
# File 'lib/se/api/types/comment.rb', line 6 def @author end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/se/api/types/comment.rb', line 6 def body @body end |
#body_markdown ⇒ Object (readonly)
Returns the value of attribute body_markdown.
6 7 8 |
# File 'lib/se/api/types/comment.rb', line 6 def body_markdown @body_markdown end |
#created_at ⇒ Object (readonly) Also known as: creation_date
Returns the value of attribute created_at.
6 7 8 |
# File 'lib/se/api/types/comment.rb', line 6 def created_at @created_at end |
#edited ⇒ Object (readonly)
Returns the value of attribute edited.
6 7 8 |
# File 'lib/se/api/types/comment.rb', line 6 def edited @edited end |
#id ⇒ Object (readonly) Also known as: comment_id
Returns the value of attribute id.
6 7 8 |
# File 'lib/se/api/types/comment.rb', line 6 def id @id end |
#json ⇒ Object (readonly)
Returns the value of attribute json.
7 8 9 |
# File 'lib/se/api/types/comment.rb', line 7 def json @json end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
6 7 8 |
# File 'lib/se/api/types/comment.rb', line 6 def link @link end |
#post_id ⇒ Object (readonly)
Returns the value of attribute post_id.
6 7 8 |
# File 'lib/se/api/types/comment.rb', line 6 def post_id @post_id end |
#post_type ⇒ Object (readonly)
Returns the value of attribute post_type.
6 7 8 |
# File 'lib/se/api/types/comment.rb', line 6 def post_type @post_type end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
6 7 8 |
# File 'lib/se/api/types/comment.rb', line 6 def score @score end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/se/api/types/comment.rb', line 6 def type @type end |