Giter Club home page Giter Club logo

heroes_api's Introduction

Heroes API

Heroes API was created to serialize super heroes from across different publications all into one place, using Super API. The data is passed along through two endpoints, /search and /supers, and uses pagination to return the super heroes. Valid search parameters can allow you to sort and filter through the super heroes and return based on specific parameters that are highlighted below in Endpoints. This application uses Circle CI for Continuous Integration and is deployed on heroku at https://supers-api.herokuapp.com, being autodeployed with a passing Circle Build.

Summary

Authors

Schema Design

Screen Shot 2021-06-08 at 2 54 45 PM

Getting Started

For Using Endpoints

Go to Endpoints and use /search and /supers endpoints to recieve super hero information/make a search.

Gemfile

Make yourself aware and familiar with the gems that are being used for this project: gemfile

Installing

  • Fork and clone this repo
  • Run bundle install
  • Run rails db:{create,migrate,seed}

Running the tests

  • rails db:seed RAILS_ENV=test to seed the test database
  • bundle exec rspec to run the test suite

Sample of Tests Across the App

Project consists of tests for Requests, Models, Services and Facades, all with happy path, sad path/edge cases. Coverage currently sits at 100%

Search POST Request Happy Path

search_re_happy

Search POST Request Sad Path

search_re_sad

Super GET Request Happy Path

super_re_happy

Super GET Request Sad Path

super_re_sad

Search Model Sad Path

search_m_sad

Super Model Happy Path

super_m_happy

Super Model Sad Path

super_m_sad

Super Service Happy Path

super_service

Super Facade Happy Path

super_facade

These are just examples, to see the full test coverage please look into the spec folder of the app

Endpoints

POST supers-api.herokuapp.com/api/v1/search

Creates a Search in the DB as long as valid parameters are sent as the body of the request, returns super heroes that match from the DB. Defaults to sort by name, defaults to page 1 and 20 per page, but all can be changed.

Valid Parameters: search_params Note: Supers default to sorting by name ascending, but the sort param causes the Supers to be sorted by descending order

GET supers-api.herokuapp.com/api/v1/super

Returns all super heroes, sorted by name. Pagination defaults to page 1 and 20 per page, but can be changed.

Valid Parameters: super_params

Built With

  • Rails API
  • Postgres
  • FastJsonApi
  • RSpec
  • Capybara
  • VCR
  • SimpleCov

Versioning

This is version 1 of Heroes API, for any updated versions please check back here. New versions will be linked below:

Reflection

I very much enjoyed getting to work on this application, it was a lot of fun getting to work with an API of my choice that deals with one of my interests. I felt comfortable and confident with the choices I made, and look forward to getting to explain these choices further.

Project Planning and TDD was a large part of what made my work on this application, in my opinion, successful. The ability to sit and plan out what exactly how I wanted to implement the functionality before jumping into code, allowed me the time to foresee potential issues and best practices to follow. Just like life, things always come up that you can't forsee, but in keeping with TDD I was able to change my code, refactor, and continue working fairly smoothly when problems/issues arised.

This was my first time creating a Search Table and it threw me for a loop at first glance. However, the more I thought about it, the more it made sense in my head. Allowing us to store distinct searches in our database can allow our application to implement all sorts of interesting functionality. A big piece that stood out to me, was how it could allow us to more easily cache our Super Hero results for specific searches and boost performance in our application, among other things. I believe there are probably other ways to implement this search table and functionality, but I went with what felt best with my skill set.

As stated before, I used Heroku to host the application and Circle CI for Continuous Integration. While working on this app by myself I found Circle to be a helpful, extra guard against failing tests and deploying broken code, especially when there is no one to review your code. Heroku is set to autodeploy after Code has been merged into main, and the Circle build passes.

Acknowledgments

This application is made possible and uses data from Super API.

heroes_api's People

Contributors

avjohnston avatar

Watchers

 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.