Skip to content

A simple UI that presents the user with a deck of cards that includes all countries with its flag, and basic stats. Clicking a card features it. Clicking the details navigates to the card show page.

Notifications You must be signed in to change notification settings

Coding-Gymnasium/Cards_shuffler

Repository files navigation

Cards

Rails/React Monolith

Badge

Maintainability Coding-Gymnasium

Nico Rithner - 2021

Contact Information

         

Table of Contents


Overview

A simple UI app that presents a visitor with an assembly of cards that contain a country each.

Cards include the countries flag, the capital's name in large font and a few country stats.

A visitor can see also a featured card on top - the first one in the collection by default. Clicking on a card features it.

A visitor can also find a large 'Shuffle' button in the center of the view. Clicking it shuffles the deck and displays the first card in the newly orderd list in the featured area.

A visitor can find a 'Details' link in each card at the button. Clicking it redirects to a card show page where the visitor can find more about the country.

A visitor can find at a card's show page:

  • Country Name
  • A randomly generated picture of the country
  • Same country stats as in the small card
  • Capital's current weather
  • Country's map

A visitor can click 'Home' on the navigation bar and go back to the home page or refresh it if already there.

back to top


Heroku Deployment

Visit the deployed app: explore-countries

back to top


Images Storage

AWS S3 and Active Storage

To supply the card's show page with an image I used Pixabay's api. Pixabay doesn't allowed hot-linking so to use the images I had to store them on my own server.

I chose to use Active Storage to store the images in AWS S3. For this I had to first download the image from the url and then upload it to S3.

To use AWS S3 I installed the gem 'aws-sdk' and installed active storage in my app by running bin/rails active_storage:install and then the migrations. To download the image I used the gem 'down' which saves the image as a tempfile.

back to top


Specifications


Installation

Fork and Clone The Repo

Fork this Github repository: Cards_shuffler

Clone your 'Cards_shuffler' repository using SSH:

  $ git clone git@github.com:Coding-Gymnasium/Cards_shuffler.git

Initial Installation

In the command line run the following commands in order:

  1. $ rails db:{create,migrate}
  2. $ rails generate rspec:install
  3. $ bundle exec figaro install
  4. $ bundle install
  5. $ yarn install

Set Up APIs

To run this app locally you would need to obtain api keys and add them to config/application.yml like in the following example:

WEATHER_API_KEY: <Your api key goes here without quotation marks>

Find the APIs here:

Weather: Open Weather
Images: Pixabay
Countries: Rest Countries
Maps: MapQuest

back to top


Testing

RSpec

We can check the test on the spec folder by running rspec

In the command line run

$ bundle exec rspec

All tests should be passing.

back to top

About

A simple UI that presents the user with a deck of cards that includes all countries with its flag, and basic stats. Clicking a card features it. Clicking the details navigates to the card show page.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published