A Ruby-based Command-Line Interface (CLI) application to manage your personal watchlist of movies. The app interacts with the OMDb API to fetch movie details, allowing you to search for movies, add them to your watchlist, rate them, and leave reviews.
- Add a Movie: Search for a movie by title and add it to your watchlist.
- List Movies: View all movies in your watchlist, including ratings and reviews.
- Rate a Movie: Provide a rating (1-5) for movies in your watchlist.
- Review a Movie: Leave a written review for movies in your watchlist.
movie_watchlist/
├── app.rb # Entry point for the application
├── config/
│ └── api_keys.rb # API key configurations
├── lib/ # Core application logic
│ ├── models/
│ │ ├── movie.rb # Movie class to handle movie data
│ │ └── watchlist.rb # Watchlist class to manage the list of movies
│ └── views/
│ └── movie_list_view.rb # CLI logic for user interaction
├── Gemfile # Gem dependencies
├── Gemfile.lock # Version lock for dependencies
├── README.md # Project documentation
└── LICENSE # Licensing information
- Ruby (version 2.7 or higher)
- Bundler (for managing gem dependencies)
To install Bundler:
gem install bundler
-
Clone the Repository
Clone this repository to your local machine:git clone https://github.com/NML-LETRAS/movie_watchlist.git cd movie_watchlist
-
Install Dependencies
Use Bundler to install the required gems:bundle install
-
Set Up the OMDb API Key
- Sign up for a free API key at OMDb API.
- Create a file named
config/api_keys.rb
and add the following code:module ApiKeys OMDB_API_KEY = "your_api_key_here" end
- Replace
your_api_key_here
with your actual OMDb API key.
Run the application by executing:
ruby app.rb
You will be presented with the following options:
- Add a Movie: Search for and add a movie to your watchlist.
- List Movies: Display all movies in your watchlist with their details.
- Rate a Movie: Provide a rating for any movie in your watchlist.
- Review a Movie: Write a review for a selected movie.
- Exit: Exit the application.
-
Adding a Movie:
- Search for "Inception" to add it to your watchlist.
- The app fetches details from the OMDb API and adds the movie if it exists.
-
Listing Movies:
- View all the movies you’ve added to your watchlist:
Title: Inception, Year: 2010, Rating: N/A, Review: N/A
- View all the movies you’ve added to your watchlist:
-
Rating a Movie:
- Provide a rating (e.g., 5) for "Inception."
-
Reviewing a Movie:
- Write a review such as "Mind-blowing visuals and storytelling!"
The project uses the following gems:
- httparty: To make HTTP requests to the OMDb API.
- tty-prompt: For interactive CLI prompts.
- json: For parsing JSON responses.
- Environment Variables: Consider storing the OMDb API key in an environment variable for added security.
- Error Handling: Basic error handling is included, but additional validation and edge case handling can enhance the app.
This project is licensed under the MIT License. See the LICENSE
file for details.