You can make an HTTP GET request in Ruby by utilizing the net/http library. Here's an example:
main.rb123 chars7 lines
In this example, we're making a GET request to the JSONPlaceholder API to get the post with an ID of 1.
We first create a URI object with the URL that we want to request. Then, we use the Net::HTTP.get method to make the GET request and store the response in the response variable. Finally, we output the response to the console.
gistlibby LogSnag