Skip to content

Instantly share code, notes, and snippets.

@valerianpereira
Created October 10, 2018 07:19
Show Gist options
  • Save valerianpereira/66f77e78032fdab76b5a1110025203b1 to your computer and use it in GitHub Desktop.
Save valerianpereira/66f77e78032fdab76b5a1110025203b1 to your computer and use it in GitHub Desktop.
ruby API call function
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