Last active
August 29, 2015 13:56
-
-
Save mathildathompson/9318689 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| Inside irb: | |
| require 'json' | |
| require 'httparty' | |
| title = 'aliens' #comes from params[:movie_title] | |
| url = "http://www.omdbapi.com/?t=#{title}" | |
| #Data in HTTParty response format | |
| response = HTTParty.get url | |
| movie = JSON(response) | |
| movie_title = movie['Title'] | |
| movie_director = movie["Director"] | |
| #To prevent a spac | |
| require 'JSON' | |
| require 'httparty' | |
| title = 'blade runer' | |
| url = "http://www.omdbapi.com/?t=#{title.gsub(' ', '+')}" | |
| #Get the hash of the movie data back before you go home tonight; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment