GithubHelp home page GithubHelp logo

arnaldoaparicio / book_club_be Goto Github PK

View Code? Open in Web Editor NEW

This project forked from book-club-project/book_club_be

0.0 0.0 0.0 265 KB

Mod 3 consultancy project - expose book club API

Ruby 94.85% HTML 0.31% Dockerfile 4.84%

book_club_be's Introduction

9

Mod3 Group Consultancy Project

(this repo is used with the Book Club app)

reference: Turing documentation

Table of Contents
  1. Getting Started
  2. About This Project
  3. Book Club API
    Available Endpoints
  4. Collaborators

Getting Started

Set Up

On your local system, open a terminal session to run the following commands:

  1. Clone this repository $ git clone [email protected]:Book-Club-Project/book_club_BE.git
  2. Navigate to the newly cloned directory $ cd book_club_BE
  3. If bundler is not installed run $ gem install bundler
  4. If or after bundler is installed run $ bundle install to install the required Gems
  5. If errors occur, check for proper installation and versions of bundler, ruby, and rails
  6. Set up the database locally with $ rails db:{:drop,:create,:migrate,:seed}
  7. Open your text editor and check to see that schema.rb exists
  8. You may also run the RSpec test suite locally with the command $ bundle exec rspec to ensure everything is functioning as expected.

Use of this Repository

In order to run this application you need both this Backend Repository and the associated Frontend Repository

Frontend Server

For a full explanation to set-up the frontend server, please see the docs Here

  1. Navigate to https://bookclub2022.herokuapp.com/ and take a look around!

Backend Server

  1. Navigate to https://hidden-garden-03870.herokuapp.com/ to interact with the endpoints.

Project Description

This is a back-end project designed to explore the fundamentals of exposing and consuming an API in order to develop an app that integrates microservices. Book Club builds community through literature. Users can connect through groups, messaging, and a bountiful resource of books. Functionality is achieved by combining our own database, the Google Books API, and messaging functionality to allow real-time communication, discussions, and recommendations.

Learning Goals for Project:

Explicit

  • Expose an API
  • Consume an API
  • Use serializers to format JSON responses
  • Implement CircleCI
  • Implement OAuth2

Implicit

  • Project planning
  • Reading/Writing documentation
  • Time Management/Prioritizing Work
  • Break down large project goals into manageable steps
  • Implement agile workflows
  • GitHub workflow and project management tools

Versions

  • Ruby 2.7.2
  • Rails 5.2.6

Important Gems


Database Schema

Screen Shot 2022-03-03 at 9 59 31 PM


APIs

Available endpoints Run in Postman

Books endpoints

http verb name data type description example
GET /books/:id Integer Returns details of a specific book based on the books id /api/v1/books/{{book id}}
GET /books/search String Returns a list of books with the title containing the search parameter /api/v1/books/search?title={{search parameter}}

Data sourced from Google Books API

JSON response examples

Single book by id:

  {
    "data": {
        "id": "ZV9DDwAAQBAJ",
        "type": "book",
        "attributes": {
            "title": "Pride",
            "authors": [
                "Ibi Zoboi"
            ],
            "genres": [
                "Young Adult Fiction / Diversity & Multicultural",
                "Young Adult Fiction / Social Themes / Class Differences",
                "Young Adult Fiction / Romance / Contemporary"
            ],
            "description": "<p>In a timely update of Jane Austen's Pride and Prejudice, National Book Award finalist Ibi Zoboi skillfully balances cultural identity, class, and gentrification against the heady magic of first love in her vibrant reimagining of this beloved classic. A smart, funny, gorgeous retelling starring all characters of color. </p><p>Zuri Benitez has pride. Brooklyn pride, family pride, and pride in her Afro-Latino roots. But pride might not be enough to save her rapidly gentrifying neighborhood from becoming unrecognizable. </p><p>When the wealthy Darcy family moves in across the street, Zuri wants nothing to do with their two teenage sons, even as her older sister, Janae, starts to fall for the charming Ainsley. She especially can’t stand the judgmental and arrogant Darius. Yet as Zuri and Darius are forced to find common ground, their initial dislike shifts into an unexpected understanding.</p><p>But with four wild sisters pulling her in different directions, cute boy Warren vying for her attention, and college applications hovering on the horizon, Zuri fights to find her place in Bushwick’s changing landscape, or lose it all.</p><p>\"Zoboi skillfully depicts the vicissitudes of teenage relationships, and Zuri’s outsize pride and poetic sensibility make her a sympathetic teenager in a contemporary story about race, gentrification, and young love.\" (Publishers Weekly, \"An Anti-Racist Children's and YA Reading List\")</p>",
            "rating": 4
        }
    }
}

Books by search example used ("Pride"):

{
    "data": [
        {
            "id": "ZV9DDwAAQBAJ",
            "type": "book",
            "attributes": {
                "title": "Pride",
                "authors": [
                    "Ibi Zoboi"
                ],
                "genres": [
                    "Young Adult Fiction"
                ],
                "description": "Pride and Prejudice gets remixed in this smart, funny, gorgeous retelling of the classic, starring all characters of color, from Ibi Zoboi, National Book Award finalist and author of American Street. Zuri Benitez has pride. Brooklyn pride, family pride, and pride in her Afro-Latino roots. But pride might not be enough to save her rapidly gentrifying neighborhood from becoming unrecognizable. When the wealthy Darcy family moves in across the street, Zuri wants nothing to do with their two teenage sons, even as her older sister, Janae, starts to fall for the charming Ainsley. She especially can’t stand the judgmental and arrogant Darius. Yet as Zuri and Darius are forced to find common ground, their initial dislike shifts into an unexpected understanding. But with four wild sisters pulling her in different directions, cute boy Warren vying for her attention, and college applications hovering on the horizon, Zuri fights to find her place in Bushwick’s changing landscape, or lose it all. In a timely update of Jane Austen's Pride and Prejudice, critically acclaimed author Ibi Zoboi skillfully balances cultural identity, class, and gentrification against the heady magic of first love in her vibrant reimagining of this beloved classic.",
                "rating": 4
            }
        },
        {
            "id": "1JMsEAAAQBAJ",
            "type": "book",
            "attributes": {
                "title": "The Pride Omnibus",
                "authors": [
                    "Joe Glass"
                ],
                "genres": [
                    "Comics & Graphic Novels"
                ],
                "description": "Joe Glass's The Pride in a full omnibus trade paperback, collecting volumes 1 and 2 as well as the collection of self-contained stories, The Pride Adventures! In The Pride, FabMan is sick of being seen as a joke. Tired of the LGBTQ+ community being seen as inferior to straight heroes, he thinks it's about damn time he did something about it. Bringing together some of the world's greatest LGBTQ+ superheroes, the Pride is born to protect the world and fight prejudice, misrepresentation and injustice--not to mention a pesky supervillain or two. The Pride Adventures brings a whole host of extra, self-contained stories and adventures starring the heroes of the Pride! See the team members face down crazed shooters, invasions, and even a sixty-foot-tall drag queen! Featuring a slew of incredible artistic talent, plus stories from writers Mike Garley, Sina Grace and PJ Montgomery too! Follow the LGBTQ+ heroes into whole new stories and meet even more characters in the world of The Pride! Join the Pride as they work to change the world and show just what they can do! Collects the original digital series The Pride and The Pride Adventures in print for the first time. \"[F]or readers hungry for queer superheroes. Joe Glass' The Pride introduces a superhero universe built on LGBTQ+ inclusion, following a team that is explicitly created to show the range of the queer experience. The Pride features superheroes who are gay, lesbian, bi, trans, non-binary, and children of gay parents. Glass blends modern queer issues with classic superhero storytelling to tell narratives that classic superhero comics haven't touched. . . . The Pride excels at using queer struggle and joy to show a different side of the superhero genre.\"--AV Club \"I highly recommend this smart, charming, wonderful book to anyone who likes good comics. It's absolutely a pleasure to read and a clear labor of love.\"--Gail Simone, Batgirl, Leaving Megalopolis, Clean Room \"Old-school and progressive at the same time. Classic, high-energy superhero action that gives the queer community the heroes they've always deserved.\"--Steve Orlando, Midnighter, Virgil \"The Pride is the modern, inclusive, and compelling superhero epic the world needs today.\"--Alex Segura, co-writer of The Black Ghost and author of the acclaimed Pete Fernandez Miami Mystery novel series.",
                "rating": 3
            }
        },
}

Quotes endpoints

http verb name data type description example
GET /quote String Returns a random literature quote /api/v1/quote

Data sourced from Quote API

JSON response examples

Random quote:

{
    "data": {
        "id": null,
        "type": "quote",
        "attributes": {
            "quote": "You are who you are, and no one can change that. So be yourself, because no one can do it better.",
            "author": "Meylin D. Bojorge"
        }
    }
}

User endpoints

http verb name data type description example
GET /users String Returns all users /api/v1/users
GET /users/:id Integer Returns a single user based on id /api/v1/users/{{users id}}
GET /users/:id/clubs String Returns all clubs that a specific user belongs to /api/v1/users/{{user_id}}/clubs
PATCH/PUT /users/:id Edits a single user based on id /api/v1/comments/{{user_id}}
DELETE /users/:id Deletes a single user based on id /api/v1/comments/{{user_id}}
JSON response examples

All users:

{
    "data": [
        {
            "id": "1",
            "type": "user",
            "attributes": {
                "username": "1",
                "email": "[email protected]"
            }
        },
        {
            "id": "2",
            "type": "user",
            "attributes": {
                "username": "2",
                "email": "[email protected]"
            }
        },
        {
            "id": "3",
            "type": "user",
            "attributes": {
                "username": "3",
                "email": "[email protected]"
            }
        },
        {
            "id": "4",
            "type": "user",
            "attributes": {
                "username": "4",
                "email": "[email protected]"
            }
        }
    ]
}

Single user by id

{
    "data": {
        "id": "1",
        "type": "user",
        "attributes": {
            "username": "1",
            "email": "[email protected]"
        }
    }
}

All of a specific user's association with clubs:

{
    "data": [
        {
            "id": "1",
            "type": "club",
            "attributes": {
                "name": "Cool Cats",
                "host_id": 1,
                "book_id": 3
            }
        }
    ]
}

Clubs endpoints

http verb name data type description example
GET /clubs String Returns all clubs /api/v1/clubs
GET /clubs/:id Integer Returns a single club based on id /api/v1/clubs/{{club_id}}
GET /clubs/:id/users String Returns all users belonging to a specific club /api/v1/clubs/{{club_id}}/users
GET /clubs/:id/comments String Returns all comments belonging to a specific club /api/v1/clubs/{{club_id}}/comments
PATCH/PUT /clubs/:id Edits a specific club's data /api/v1/clubs/{{club_id}}
DELETE /clubs/:id Deletes a specific club's data /api/v1/clubs/{{club_id}}
JSON response examples

All clubs:

{
    "data": [
        {
            "id": "1",
            "type": "club",
            "attributes": {
                "name": "Cool Cats",
                "host_id": 1,
                "book_id": 3
            }
        },
        {
            "id": "2",
            "type": "club",
            "attributes": {
                "name": "Turing Nerds",
                "host_id": 2,
                "book_id": 6
            }
        },
        {
            "id": "3",
            "type": "club",
            "attributes": {
                "name": "Sherlock Homies",
                "host_id": 3,
                "book_id": 7
            }
        }
    ]
}

Single club by id:

{
    "data": {
        "id": "1",
        "type": "club",
        "attributes": {
            "name": "Cool Cats",
            "host_id": 1,
            "book_id": 3
        }
    }
}

A specific club's users:

{
    "data": [
        {
            "id": "1",
            "type": "user",
            "attributes": {
                "username": "1",
                "email": "[email protected]"
            }
        },
        {
            "id": "2",
            "type": "user",
            "attributes": {
                "username": "2",
                "email": "[email protected]"
            }
        },
        {
            "id": "3",
            "type": "user",
            "attributes": {
                "username": "3",
                "email": "[email protected]"
            }
        },
        {
            "id": "4",
            "type": "user",
            "attributes": {
                "username": "4",
                "email": "[email protected]"
            }
        }
    ]
}

A specific club's comments:

{
    "data": [
        {
            "id": "1",
            "type": "comment",
            "attributes": {
                "title": "Hello",
                "body": "Blah",
                "user_id": 1,
                "club_id": 1
            }
        },
        {
            "id": "2",
            "type": "comment",
            "attributes": {
                "title": "Comments",
                "body": "Blah Blah",
                "user_id": 2,
                "club_id": 1
            }
        },
        {
            "id": "3",
            "type": "comment",
            "attributes": {
                "title": "Coolio",
                "body": "Blah Blah Blah",
                "user_id": 3,
                "club_id": 1
            }
        },
        {
            "id": "4",
            "type": "comment",
            "attributes": {
                "title": "Goodbye",
                "body": "Blah Blah Blah Blah",
                "user_id": 4,
                "club_id": 1
            }
        }
    ]
}

Comments endpoints

http verb name data type description example
GET /comments String Returns all comments /api/v1/comments
POST /comments String Creates a new comment /api/v1/comments
PATCH/PUT /comments/:id Returns a single comment based on id /api/v1/comments/{{comment_id}}
DELETE /comments/:id Deletes a comment /api/v1/comments/{{comment_id}}
JSON response examples

All comments:

{
    "data": [
        {
            "id": "1",
            "type": "comment",
            "attributes": {
                "title": "Hello",
                "body": "Blah",
                "user_id": 1,
                "club_id": 1
            }
        },
        {
            "id": "2",
            "type": "comment",
            "attributes": {
                "title": "Comments",
                "body": "Blah Blah",
                "user_id": 2,
                "club_id": 1
            }
        },
        {
            "id": "3",
            "type": "comment",
            "attributes": {
                "title": "Coolio",
                "body": "Blah Blah Blah",
                "user_id": 3,
                "club_id": 1
            }
        },
        {
            "id": "4",
            "type": "comment",
            "attributes": {
                "title": "Goodbye",
                "body": "Blah Blah Blah Blah",
                "user_id": 4,
                "club_id": 1
            }
        },
        {
            "id": "5",
            "type": "comment",
            "attributes": {
                "title": "Goodbye",
                "body": "Blah Blah Blah Blah",
                "user_id": 4,
                "club_id": 2
            }
        },
        {
            "id": "6",
            "type": "comment",
            "attributes": {
                "title": "Goodbye",
                "body": "Blah Blah Blah Blah",
                "user_id": 4,
                "club_id": 3
            }
        }
    ]
}

Collaborators

(emoji key):


Arnaldo (he/him)

💻 🤔 ⚠️ 👀

Eric (he/him)

💻 🤔 ⚠️ 👀

Mallory (she/her)

💻 🤔 ⚠️ 👀

Sierra (she/her)

💻 🤔 ⚠️ 👀

Brad (he/him)

💻 🤔 ⚠️ 👀

Devin (he/him)

💻 🤔 ⚠️ 👀

This project follows the all-contributors specification.

book_club_be's People

Contributors

sierra-t-9598 avatar echon006 avatar malllll12 avatar arnaldoaparicio avatar devinpile avatar jbreit88 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.