lib/ig_scrape/comment.rb in ig_scrape-0.0.2 vs lib/ig_scrape/comment.rb in ig_scrape-0.0.3
- old
+ new
@@ -4,9 +4,20 @@
def initialize(payload)
load_from_payload(payload)
end
+ def to_json(*args)
+ JSON.generate({
+ id: @id,
+ text: @text,
+ created_at: @created_at,
+ author_id: @author_id,
+ author_name: @author_name,
+ author_profile_pic: @author_profile_pic
+ })
+ end
+
private
def load_from_payload payload
@id = payload["id"]
@text = payload["text"]