With simply ruby no rails how can I call an API (ex: http://api.anapi.com/) and later manipulate it say to get a value from it and check if it is greater than 5.
http://api.anapi.com/: Say it contains an array called "anarray" which contains hashes: in one of those hashes I want to get to value of the key name "key".
How do I do this, again with only ruby.
Right now with this:
require "net/https"
require "uri"
uri = URI.parse("http://ift.tt/1GRr2lN")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
puts response.body
I get: #<StringIO:0x2cadb90>
Thank you very much. Please let me know if I need to be clearer.
Aucun commentaire:
Enregistrer un commentaire