Skip to content

Instantly share code, notes, and snippets.

@mathildathompson
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save mathildathompson/9318689 to your computer and use it in GitHub Desktop.

Select an option

Save mathildathompson/9318689 to your computer and use it in GitHub Desktop.
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