This project is a Rails application that interacts with the Marvel API to fetch information about comics and characters.
To get started with the application, you must install Ruby and Rails on your machine. Follow the steps below:
-
Clone the repository:
git clone https://github.com/yourusername/marvel-comics-app.git cd marvel-comics-app
-
Install the dependencies:
bundle install
You must set up the Marvel API keys to interact with the API. Follow the steps below:
-
Create
.env
file:touch .env
-
Add your Marvel API keys to the
.env
file:MARVEL_PUBLIC_KEY=your_public_key MARVEL_PRIVATE_KEY=your_private_key
-
Install
dotenv-rails
gem (if not already installed): Add this line to your Gemfile:gem 'dotenv-rails', groups: [:development, :test]
Then run:
bundle install
To start the Rails server, run:
rails server
Visit http://localhost:3000
in your web browser to access the application.
To run the tests, run:
rails test
Mocking API Requests
This project uses Webmock to mock API durubg testing. The test suite includes tests for MarvelService
and ComicsController
.
To handle API rate limiting, the application implements caching for the API responses using Rails Cache.