Skip to content

Instantly share code, notes, and snippets.

@tmehta2442
Created October 16, 2013 03:15
Show Gist options
  • Select an option

  • Save tmehta2442/7002143 to your computer and use it in GitHub Desktop.

Select an option

Save tmehta2442/7002143 to your computer and use it in GitHub Desktop.
require 'typhoeus'
require 'json'
require 'yaml'
class FindmoviesController < ApplicationController
def index
@movie_id = MovieId.all
end
def create
end
def search
@query = params[:movie_get]
request = Typhoeus.get(
"http://omdbapi.com",
:params => {:s => @query})
@results = JSON.parse(request.body)["Search"]
@movie_id = MovieId.create(name: params[:movie_get])
end
def info
@new_query = params[:redirect]
request = Typhoeus.get(
"http://omdbapi.com",
:params => {:i => @new_query})
@details = JSON.parse(request.body)
#info = MovieId.create(name: @details)
movie_id = MovieId.create(name: params[:redirect])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment