diff --git a/lib/se/api/types/post.rb b/lib/se/api/types/post.rb index bcce02e..303063a 100644 --- a/lib/se/api/types/post.rb +++ b/lib/se/api/types/post.rb @@ -3,7 +3,7 @@ module SE module API class Post - attr_reader :body, :title, :link, :author, :score, :type, :id, :last_activity_date, :created_at, :updated_at, :last_editor + attr_reader :body, :title, :link, :author, :score, :type, :id, :last_activity_date, :created_at, :updated_at, :last_editor, :comments attr_reader :json def initialize(item_json) @@ -14,6 +14,7 @@ def initialize(item_json) @score = @json["score"].to_i @type = @json["post_type"] @last_editor = User.new(@json["last_editor"]) + @comments = @json["comments"].map { |c| Comment.new(c) } @id = (@json["post_id"] || @json["answer_id"] || @json["question_id"]).to_i @updated_at = @json["last_activity_date"] @created_at = @json["creation_date"]