Created
October 10, 2018 07:19
-
-
Save valerianpereira/66f77e78032fdab76b5a1110025203b1 to your computer and use it in GitHub Desktop.
ruby API call function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'json' | |
#Rail API to be added here | |
url = 'You can find http API url from http://indianrailapi.com/IndianRail/API' | |
#Prepare and Execute the action | |
uri = URI(url) | |
response = Net::HTTP.get(uri) | |
#Output | |
print JSON.parse(response) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment