Guilded Rose LLC Store API is a RESTful API for the Gilded Rose storefront inventory kata.
- Ruby on Rails
- PostgresSQL database
- Rspec (testing)
- Heroku (deployment)
- Fork the repository and clone the master branch to your computer.
- In your local terminal,
cd
into the root directory of the app. - In your local terminal, run
bundle install
to install all the dependencies. - In your local terminal run
rake db:create
andrake db:migrate
to setup the database
rspec <ruby_test_file>_spec.rb
https://safe-wave-09726.herokuapp.com/
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" } ]
-
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 }
-
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 }
-
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" } ]
-
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.