Created
October 16, 2013 03:15
-
-
Save tmehta2442/7002143 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
| 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