Giter Site home page Giter Site logo

rails-guilded-rose-llc's Introduction

Guilded Rose LLC Store API

Middlebrooks314

Guilded Rose LLC Store API is a RESTful API for the Gilded Rose storefront inventory kata.

Technologies

  • Ruby on Rails
  • PostgresSQL database
  • Rspec (testing)
  • Heroku (deployment)

Installation

To run the API on your local machine:

  1. Fork the repository and clone the master branch to your computer.
  2. In your local terminal, cd into the root directory of the app.
  3. In your local terminal, run bundle install to install all the dependencies.
  4. In your local terminal run rake db:create and rake db:migrate to setup the database

To run the Rspec tests

rspec <ruby_test_file>_spec.rb

To use the deployed version of the API, use the following as the base URL:

https://safe-wave-09726.herokuapp.com/

Usage

INDEX Items

Returns json data about all of the items.

  • URL

    /api/v1/items

  • Method:

    GET

  • URL Params

    Required:

    None

  • Data Params

    None

  • Sample cURL Request:

curl https://localhost:3000.com/api/v1/items | jq
  • Success Response:

    • Code: 200

      Content:

    [
      {
        "id": 1,
        "name": "Carrots",
        "sell_in": 10,
        "quality": 15,
        "description": null
      },
      {
        "id": 2,
        "name": "Basil",
        "sell_in": 11,
        "quality": 25,
        "description": "a sweet herb"
      },
      {
        "id": 3,
        "name": "Dog Treats",
        "sell_in": 15,
        "quality": 20,
        "description": "Doggy ice cream"
      }
    ]

SHOW Item

Returns json data about a single item.

  • URL

    /api/v1/items/:id

  • Method:

    GET

  • URL Params

    Required:

    id=[integer]

  • Data Params

    None

  • Sample cURL Request:

curl https://localhost:3000.com/api/v1/items/2 | jq
  • Success Response:

    • Code: 200

      Content:

      { "id": 2, "name": "Basil", "sell_in": 11, "quality": 25 }

POST Item

Add a single item to the database.

  • URL

    /api/v1/items

  • Method:

    POST

  • URL Params

    Required:

For : please contact the senior developer for the basic auth credentials.

  • Data Params

    {name: string, sell_in: integer, quality: integer}

  • Sample cURL Request:

curl --user <username>:<password> http://localhost:3000//api/v1/items -X POST -F 'name=Baz' -F 'sellIn=6' -F 'quality=7' | jq
  • Success Response:

    • Code: 200

      Content:

      { "id": 4, "name": "yogurt", "sell_in": 6, "quality": 7 }

INDEX Reviews

Returns json data about all reviews associated with a particular item.

  • URL

    /api/v1/items/:id/reviews

  • Method:

    GET

  • URL Params

    Required:

    id=[integer]

  • Data Params

    None

  • Sample cURL Request:

curl https://localhost:3000.com/api/v1/items/3/reviews | jq
  • Success Response:

    • Code: 200

      Content:

    [
      {
        "text": "this made my dog sick"
      },
      {
        "text": "a little too salty for my taste"
      },
      {
        "text": "after eating this my dog was suddenly able to fly"
      }
    ]

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

rails-guilded-rose-llc's People

Contributors

middlebrooks314 avatar whaley-ethan avatar

Watchers

Cyrus Vandrevala avatar James Cloos avatar  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.