Skip to content

rails4/my_movies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyMovies

This app uses Movie Database API and the themoviedb gem.

Warning
The themoviedb gem is not longer maintained. In the next version we are going to use the enceladus gem.
IMDb logo

You can play on Apiary with the API on a web console.

Note
There are many API in the wild. This gist list many API which that require no server-side auth or private credentials, and are thus good for small browser-only JS projects.

This version implements home#index, search#index, and movies#show:

rails g controller home index
rails g controller search index
rails g controller movies show

rake routes
Prefix Verb URI Pattern      Controller#Action
search     GET  /search      search#index
movie      GET  /movies/:id  movies#show
home_index GET  /home/index  home#index
root       GET  /            home#index

These routes are set in config/routes.rb:

Rails.application.routes.draw do
  # get 'home/index'
  get "search", to: "search#index"
  resources :movies, only: :show
  root 'home#index'

Configuration

The app uses the API key. To register for an API key, head into your account page on TMDb and generate a new key from within the “API” section found in the left hand sidebar (click API>Details).

Note
Try some request from the Movie Database API on the Apiary console.

Add initializer set_tmdb_api_key.rb:

config/initializers/set_tmdb_api_key.rb
tmdb_api_key = ENV['TMDB_API_KEY']
if tmdb_api_key.nil?
  puts "Please set your MovieDB key with"
  puts "$ export TMDB_API_KEY=YOUR_TMDb_KEY"
  puts "or get/generate new key within API > Details section"
  puts "on your acount TMDb page https://www.themoviedb.org/login"
else
puts "TMDB API KEY: #{tmdb_api_key}"
end
Tmdb::Api.key(tmdb_api_key)
Tmdb::Api.language("en")  # optionally, set your default language

Set the api key in the environment wit:

export TMDB_API_KEY=REPLACE_THIS_WITH_YOUR_KEY

and check with bin/tmdb script if the TMDb API works:

bin/tmdb

System dependencies

This app uses the official Sass port of Bootstrap:

How to run the test suite

Useful links to the RSpec documentation:

Useful links to the Minitest documentation:

Other things you may want to cover

This README would normally document whatever steps are necessary to get the application up and running:

  • Ruby version

  • Database creation – do not apply here

  • Database initialization – do not apply here

  • Services (job queues, cache servers, search engines, etc.)

  • Deployment instructions – Heroku?

About

Sample Rails 4 application which uses the MovieDB API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published