Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rest-client'
- require 'JSON'
- puts "Please choose a Planet"
- planet = gets.chomp
- url = "http://swapi.co/api/planets/?search=#{planet}"
- response = RestClient.get(url)
- response_parsed = JSON.parse(response)
- residents_array = response['residents']
- ['residents'].each { |r| puts "#{r}"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement