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. |
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'
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:
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
This app uses the official Sass port of Bootstrap:
-
bootstrap-sass – see README for instructions how to use it with Rails
-
Integrating Rails and Bootstrap:
Useful links to the RSpec documentation:
Useful links to the Minitest documentation:
-
minitest-rails – install howto
-
minitest – sources on GitHub
-
minitest-rails-capybara – Capybara integration for MiniTest::Rails
This README would normally document whatever steps are necessary to get the application up and running:
-
Database creation – do not apply here
-
Database initialization – do not apply here
-
Services (job queues, cache servers, search engines, etc.)
-
Deployment instructions – Heroku?