Skip to content

Correct-or-Crass/Trivia_API

Repository files navigation

Profile

This app is in the developmental phase. Please see "Project Status" for more information


Table of Contents

Project Status


June 27, 2023 update

  • Gameplay Controller
  • Endgame Controller
  • ErrorHandling Serializer
  • Deployment to www.correctorcrass.com
  • Integration of CI/CD pipeline

Mission Statement


Our mission is to create a complete and tested back end application that can be consumed by front end developers to create an functional Trivia Game.

Overview


Trivia API exposes endpoints that provide information for a front-end application to build a sassy trivia game! The end user will have to match a word (from a list) to a photo for five rounds.

So easy, right!?!

"BUT"... the user better score well because at the end of the fifth round we evaluate the user's performance and provide a triumphant message celebrating a winning record or a disparaging phrase that playfully "kicks 'em while they're down", along with a gif to emphatically drive home our thoughts!

We provide all this lighthearted content! All the front-end has to do is plug and let their users play.

back to top

Stack and Deployment instructions


  • Ruby 3.2.2
  • Rails 7.0.4

Deploy locally:

  1. Clone the repo

    git clone git@github.com:Correct-or-Crass/Trivia_API.git
    
  2. Install gems

    bundle install
    
  3. Setup db

    rails db:{drop,create,migrate}
    
  4. Run RSpec tests

    bundle exec rspec spec
    

back to top

External APIs


This application relies on the following APIs:

back to top

APIs


This application creates the following API endpoints:

🗂️ Root Directory: www.correctorcrass.com

🔠 Words


  • Returns a correct answer, 4 words (1 of which is the correct answer) and a photo related to the correct answer
  • Photo contains the image's url, the image owner's name and account link to enable front end to credit image owner if desired

GET /api/v1/game_plays

Successful response:

{
  "data": {
      "type": "game_play",
      "attributes": {
          "photo": {
              "image_url": "https://images.unsplash.com/photo-1593132517397-ceb31d77194a?ixid=M3w0MTg4MjB8MHwxfHNlYXJjaHw2fHxDYXRjaHxlbnwwfHx8fDE2ODc0NzI2NzN8MA&ixlib=rb-4.0.3&utm_source=Trivia_API&utm_medium=referral&utm_campaign=api-credit",
              "creator_name": "mmcgregor",
              "creator_link": "https://api.unsplash.com/photos/Ns8trMR4Om8?utm_source=Trivia_API&utm_medium=referral&utm_campaign=api-credit"
          },
          "answer": "Catch",
          "choices": [
              "Staircase",
              "Wood",
              "Fist",
              "Catch"
          ]
      }
  }
}


  • An integer param can be provided to return more or less than the default 4 word choices

GET /api/v1/game_plays?num=5

Successful response:

{
  "data": {
      "type": "game_play",
      "attributes": {
          "photo": {
              "image_url": "https://images.unsplash.com/photo-1593132517397-ceb31d77194a?ixid=M3w0MTg4MjB8MHwxfHNlYXJjaHw2fHxDYXRjaHxlbnwwfHx8fDE2ODc0NzI2NzN8MA&ixlib=rb-4.0.3&utm_source=Trivia_API&utm_medium=referral&utm_campaign=api-credit",
              "creator_name": "mmcgregor",
              "creator_link": "https://api.unsplash.com/photos/Ns8trMR4Om8?utm_source=Trivia_API&utm_medium=referral&utm_campaign=api-credit"
          },
          "answer": "Catch",
          "choices": [
              "Staircase",
              "Wood",
              "Fist",
              "Catch",
              "Motorbike"
          ]
      }
  }
}

🏁 Endgame


  • A request should include the number of wins and rounds, otherwise a default of wins = 0, rounds = 5 is provided
  • It is recommended that wins are passed with the request and number of rounds adjusted if necessary
  • A winning endgame requires a 60% or higher correct score ratio

Endpoints Examples:

GET /api/v1/endgame?wins=3

GET /api/v1/endgame?wins=4&rounds=7

Successful response:

{
 "data": {
         type: "endgame",
          attributes: {
                     phrase: "I bet you make babies smile.",
                     gif: {
                           url: "https://giphy.com/gifs/sensual-UElLGSOqm8XYI", 
                           title:"making love GIF", 
                           rating: "r"
                           }
     }
}

back to top

Meet our Development Team !

Profile
Profile
Profile
Profile
Lacey Weaver Sergio Azcona Devin Pile Bryan Flanagan
Github Github Github Github
LinkedIn LinkedIn LinkedIn LinkedIn

back to top

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •