Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unicar9/test-api
https://github.com/unicar9/test-api
rails-api rspec
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/unicar9/test-api
- Owner: unicar9
- Created: 2017-08-23T06:59:27.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-19T10:59:09.000Z (about 2 years ago)
- Last Synced: 2024-11-13T10:20:30.026Z (3 months ago)
- Topics: rails-api, rspec
- Language: Ruby
- Size: 327 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**Build and Run**
----
Download this file and run following commands in the terminal from the directory of this file.```bash
gem install railsbundle install
rails db:reseed
```run `rails s` to start a server and check out the results on `localhost:3000/`
-----------------------
**Show Employees**
----
Giving a company name(case insensitive) as a URL param and it will return JSON data about all the employees.URL | Method | URL Params(Required)
--- | ------ | --------------------
/company/:name | `GET` | `company=[name]`* **Sample Response:**
```javascript
{
"number_of_employees": 3,
"employees": [
{
"name": "Darlene Jones",
"age": 57
},
{
"name": "Booth Haynes",
"age": 46
},
{
"name": "Lakeisha Noel",
"age": 42
},
]
}
```* **Error Response:**
* **Code:** 404 NOT FOUND
**Content:** `{ "status":"error","code":404,"message":"Company doesn't exist" }`-----------------------
**Show 2 People & Their Shared Friends**
----
Giving 2 people's indexes, it will return JSON data about their information (Name, Age, Address, Phone) and the list of their friends in common which have *brown eyes* and are *still alive*.URL | Method | Data Params(Required)
--- | ------ | --------------------
/people | `GET` | `?index1=[integer]&index2=[integer]`* **Sample Response:**
```javascript
{
"person1": {
"name": "Bonnie Bass",
"age": 54,
"index": 2,
"phone": "+1 (823) 428-3710",
"address": "455 Dictum Court, Nadine, Mississippi, 6499"
},
"person2": {
"name": "Cote Booth",
"age": 26,
"index": 6,
"phone": "+1 (842) 598-3525",
"address": "394 Loring Avenue, Salvo, Maryland, 9396"
},
"common_friends": [
{
"name": "Decker Mckenzie",
"age": 60,
"index": 1,
"has_died": false,
"eyeColor": "brown",
"phone": "+1 (893) 587-3311",
"address": "492 Stockton Street, Lawrence, Guam, 4854"
}
]
}
```* **Error Response:**
* **Code:** 404 NOT FOUND
**Content:** `{ "status":"error","code":404,"message":"Person doesn't exist or missing indexes" }`-----------------------
**Show Person**
----
Giving 1 person's index, it will return JSON data about his/her personal info(name and age) and a list of fruits and vegetables this person likes.URL | Method | URL Params(Required)
--- | ------ | --------------------
/person/:index | `GET` | `index=[integer]`* **Sample Response:**
```javascript
{
"name": "Bonnie Bass",
"age": 54,
"fruits": [
"orange",
"banana",
"strawberry"
],
"vegetables": [
"beetroot"
]
}
```* **Error Response:**
* **Code:** 404 NOT FOUND
**Content:** `{ "status":"error","code":404,"message":"Person doesn't exist" }`