In this tutorial we can just use the radiator library, interaction with Blockchain. Root post selection is done by command-line arguments. First, we ask the blockchain for the replies on a post or comment. Then, we grab the authors of those replies and list them, followed by the total comments count.
First, set up your workstation using the steps provided in Getting Started. Then you can create and execute the script (or clone from this repository):
git clone https://gitlab.syncad.com/hive/devportal.git
cd devportal/tutorials/ruby/07_get_post_comments
bundle install
ruby comments_list.rb https://hive.blog/communityfork/@hiveio/announcing-the-launch-of-hive-blockchain
Get Post Comments
Fetch comments made on each content or post.
Full, runnable src of Get Post Comments can be downloaded as part of: tutorials/ruby (or download just this tutorial: devportal-master-tutorials-ruby-07_get_post_comments.zip).
Also see:
Script
comments_list.rb
In this tutorial we can just use the
radiator
library, interaction with Blockchain. Root post selection is done by command-line arguments. First, we ask the blockchain for the replies on a post or comment. Then, we grab the authors of those replies and list them, followed by the total comments count.The example of results returned from the service:
Example Output
Final code:
To Run
First, set up your workstation using the steps provided in Getting Started. Then you can create and execute the script (or clone from this repository):