Skip to content

REST-API to manage dog care services built with Ruby on Rails. JWT authentication. TDD via RSpec and shoulda matchers.

Notifications You must be signed in to change notification settings

fedgut/Dog-care-services-API

Repository files navigation

Contributors Forks Stargazers Issues Hireable


Dog Sitter Services API Final Capstone project

This project is part of the Microverse curriculum!
Explore the docs »

Report Bug · Request Feature

Table of Contents

About The Project

This API matches dog care services (Dog sitting, walking, grooming, etc.) with different users! Many sellers can offer the same service, but who do you trust to care for your furry friend? Add those services you prefer to your favorites and easily keep track of them.

This is the final Capstone project of the Microverse Curriculum.

Documentation

The documentation was built using raddocs, deployed in Heroku

Deployment

Its only a back end, so you wont see anything! Check out the deployed app at Heroku

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

Install RVM

Setup

Install gems with:

bundle install

Setup database with:

rails db:migrate

Usage

Start server with:

rails server

Install httpie Don't know where to start using httpie?

Signup

The following command will create an login a new user in the database, fill in your name, email and password

$ http :3000/signup name=Eduardo email=eduardo@email.com password=foobar password_confirmation=foobar

Login

Users Log in with their email and password

$ http :3000/login email=eduardo@email.com password=foobar

Register a service

Only Admins can register a service! We do this to guarantee all dog handlers have insurance and are properly identified.

To add services locally open a rails console and update the user you want to set as admin this way:

$ rails c
> User.find_by(email: 'eduardo@email.com').update(admin: true)
> exit

After that login the user and keep the auth_token safe!

$ http :3000/login email=eduardo@email.com password=foobar

Finally we'll create a new service this way (paste the auth_token in the Authorization header)

$ http :3000/services name=grooming user_id=1 \
Authorization:'paste your auth token here'

Services index

To see all the services available

$ http :3000/services

To see the details of a Service

Once you have seen the list of all services, choose and and replace the service id in :id too see its details.

$ http :3000/service/:id

Create Favorite

To create a favorite login the user (admin or not) and keep the auth_token safe

$ http :3000/login email=youremail@email.com password=foobar

Now we'll enter the service_id and the Authentication header

$ http :3000/users/2/favorites service_id=1 \
Authorization:'yourtoken'

All Favorites

To see all your favorites you must log in, we'll use the same authentication steps as before

$ http :3000/users/2/favourites Authorization:'yourtoken'

Run tests

to run the test:

rspec

Built With

This project was built using these technologies.

  • Ruby
  • Rails
  • Rspec
  • raddocs
  • Rubocop
  • VsCode

Authors

Eduardo Gutierrez - fedgut@gmail.com

Project Link

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a ⭐️ if you like this project!

Acknowledgements

📝 License

This project is MIT licensed.

About

REST-API to manage dog care services built with Ruby on Rails. JWT authentication. TDD via RSpec and shoulda matchers.

Topics

Resources

Stars

Watchers

Forks