please see the link (https://reqres.in/) for list of endpoints
This API wrapper use Faraday client, please install faraday client in your local env
gem install faraday
- save the api.rb
- open IRB and load the api.rb
irb -I . -r api.rb
- call the API methods
client = Api.new
response = client.get('users')
response_json = JSON.parse(response.body)
response_json['data']
[
{"id"=>1, "email"=>"[email protected]", "first_name"=>"George", "last_name"=>"Bluth", "avatar"=>"https://reqres.in/img/faces/1-image.jpg"},
{"id"=>2, "email"=>"[email protected]", "first_name"=>"Janet", "last_name"=>"Weaver", "avatar"=>"https://reqres.in/img/faces/2-image.jpg"},
{"id"=>3, "email"=>"[email protected]", "first_name"=>"Emma", "last_name"=>"Wong", "avatar"=>"https://reqres.in/img/faces/3-image.jpg"},
{"id"=>4, "email"=>"[email protected]", "first_name"=>"Eve", "last_name"=>"Holt", "avatar"=>"https://reqres.in/img/faces/4-image.jpg"},
{"id"=>5, "email"=>"[email protected]", "first_name"=>"Charles", "last_name"=>"Morris", "avatar"=>"https://reqres.in/img/faces/5-image.jpg"},
{"id"=>6, "email"=>"[email protected]", "first_name"=>"Tracey", "last_name"=>"Ramos", "avatar"=>"https://reqres.in/img/faces/6-image.jpg"}
]