Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

heliohead/sinatra_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rest Api to cab service

Tools

  • Sinatra
  • Active Records
  • Json
  • Geocoder
  • Sqlite
  • Rspec

How to run

$ bundle
$ rake db:migrate
$ rake db:seed
$ rackup

To return a cab next location

  • POST /ride/cabs_near
$ curl -i -H 'Accept: application/json' \
       -d 'address=Av+Paulista' http://localhost:9292/cab/cabs_near"

To get all passenger or cab

  • GET /passenger/
  • GET /cab/
$ curl -i -H 'Accept: application/json' http://localhost:9292/passenger/
$ curl -i -H 'Accept: application/json' http://localhost:9292/cab/

To add a new cab or passanger

  • POST /passenger/new
  • POST /cab/new
$ curl -i -H 'Accept: application/json' \
       -d 'name=Juca&email=juca@taxi.org&password=password&address=Av+São+João' \
       http://localhost:9292/passenger/new

To edit a cab or passenger

  • PATCH /passenger/id
  • PATCH /cab/id
$ curl -i -H 'Accept: application/json' \
       -d 'address=Rua+Augusta' http://localhost:9292/passenger/id

To delete a cab or passenger

  • DELETE /passenger/id
  • DELETE /cab/id
$ curl -i -H 'Accept: application/json'  -X DELETE \
        http://localhost:9292/passenger/id

To add a new ride

  • POST /ride/new
$ curl -i -H 'Accept: application/json' \
       -d 'cab_id=2&passanger_id=1&starts_at=AV+Brigadeiro+Faria+Lima&ends_at=Av+São+João' \
       http://localhost:9292/ride/new

To test

$ rspec

To do

  • More test
  • Add Simulation rides price
  • Oauth

About

Example of API with sinatra

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages