https://github.com/andrewjprice/auction
Sinatra API to add bids and calculate winner
https://github.com/andrewjprice/auction
ruby sinatra
Last synced: about 2 months ago
JSON representation
Sinatra API to add bids and calculate winner
- Host: GitHub
- URL: https://github.com/andrewjprice/auction
- Owner: andrewjprice
- Created: 2019-08-21T17:38:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-20T04:33:14.000Z (over 3 years ago)
- Last Synced: 2025-04-14T21:59:14.433Z (about 1 year ago)
- Topics: ruby, sinatra
- Language: Ruby
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Setup
To start application run:
Note: If you want seeds, go to db/seeds.rb and uncomment/add before running `db:setup`
```
bundle install
bundle exec rake db:migrate
bundle exec rake db:setup
```
# Run
```
rackup config.ru
```
# Debug
```
bundle exec shotgun --server=thin --port=9292 config.ru
```
# Run Tests
```
bundle exec rspec spec/
```
# API Endpoints
POST /bids - create new bid
Required: "start_bid", "max_bid", "auto_increment"
```
curl -i -X POST -H "Content-Type: application/json" -d'{"name": "Andrew", "start_bid": 2501, "max_bid": 3200, "auto_increment": 247}' http://localhost:9292/bids
```
GET /calculate - calculates winning bid and lowest winning amount
```
curl http://localhost:9292/calculate
```