Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kul1/api_client_fun
https://github.com/kul1/api_client_fun
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kul1/api_client_fun
- Owner: kul1
- Created: 2021-10-23T12:02:02.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-23T12:03:26.000Z (about 3 years ago)
- Last Synced: 2024-10-10T06:04:55.397Z (about 1 month ago)
- Language: Ruby
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ApiClientFun
Welcome!
This is a basic ruby gem scaffold to create a **client** for call to an existing API endpoint.
The api has two endpoints, responds with JSON, and is unauthenticated.
1) https://blooming-savannah-20593.herokuapp.com/api/users
Returns a list of users.
2) https://blooming-savannah-20593.herokuapp.com/api/users/{id}
Returns a specific user.
## How to use this API
### Features:
This api_client_fun has following features:
1. Get profile of user by
```
ApiClientFun.profile_for_name('User Name')```
If user name not in the server, it will return message:i```
'error: User not found'
```2. List all users in array with command:
```
ApiClientFun.user # => => #[{"company"=>"Planet Express", "id"=>1, "name"=>"Philip J Fry", "position"=>"Delivery Boy", "profile"=>{"age"=>25, "gender"=>"M", "planet"=>"Earth", "species"=>"Human", "status"=>"Alive"}}, {"company"=>"Planet Express", "id"=>2, ...```
3. Total Number of records
```
ApiClientFun.user[users].count #=> 14```
## Install:
### In ruby application
Run Gem install:
```
gem install api_client_fun```
### In Rails ApplicationAdd api_client_fun in Gemfile and point to local api_client_fun exist
Example: this gem store in /Users/YOU/api_client_fun
Gemfile:
```
gem 'api_client_fun', path: '/Users/YOU/api_client_fun'```
### Test
Using Rspec- at root of this gem
```
rspec --format documentation```